master
xy 1 year ago
parent 507280b50d
commit c442fb2fdc

@ -22,15 +22,24 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
<template v-if="isHasAuth('search')">
<el-date-picker style="width: 100px;" v-model="select['filter[0][value]']" type="year" value-format="yyyy" size="small" placeholder="年份.." clearable></el-date-picker>
<el-select size="small" style="width: 100px;" clearable v-model="select['filter[1][value]']" placeholder="区域..">
<el-option
v-for="(group, groupId) in area"
:key="groupId"
:value="groupId"
:label="groupId"></el-option>
</el-select>
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
>
</template>
</template>
</vxe-toolbar>
</slot>
@ -93,6 +102,28 @@
:edit-render="{ name: 'input', attrs: { type: 'text' } }"
/>
<vxe-column
header-align="center"
field="is_open"
width="140"
align="center"
title="是否开启"
:cell-render="{
name: 'VxeSwitch',
props: {
'open-value': 1,
'close-value': 0,
'open-label': '是',
'close-label': '否'
},
events: {
change: ({ row }) => {
saveRow(row)
}
}
}"
/>
<vxe-column
align="center"
field="group"
@ -110,18 +141,6 @@
</el-select>
</template>
</vxe-column>
<!-- <vxe-column-->
<!-- align="center"-->
<!-- field="area_id"-->
<!-- width="180"-->
<!-- title="区域"-->
<!-- :edit-render="{-->
<!-- name: 'VxeSelect',-->
<!-- options: area,-->
<!-- props: { multiple: false },-->
<!-- optionProps: { value: 'id', label: 'name' },-->
<!-- }"-->
<!-- />-->
<vxe-column
align="center"
@ -343,28 +362,28 @@ export default {
page_size: 20,
keyword: "",
show_relation: ["image"],
"filter[0][key]": 'year',
"filter[0][op]": 'eq',
"filter[0][value]": '',
"filter[1][key]": 'group',
"filter[1][op]": 'eq',
"filter[1][value]": '',
},
total: 0,
allAlign: null,
tableData: [],
form: {
id: "",
name: "",
group: "",
area_id: "",
year: "",
title: "",
remark: "",
tip: "",
image_id: [],
need_sign: "",
is_open: 1
},
validRules: {
name: [
@ -583,6 +602,26 @@ export default {
}
},
async saveRow(row) {
try {
const errMap = await this.$refs["table"].validate();
if (errMap) {
throw new Error(errMap);
}
await this.$refs["table"].clearEdit();
let form = deepCopy(this.form);
for (const key in form) {
form[key] = row[key];
}
this.loading = true;
await save(form, false);
await this.getList();
this.loading = false;
} catch (err) {
this.loading = false;
}
},
async saveRowEvent(row) {
if (window.$_uploading) {
this.$message.warning("文件正在上传中");
@ -652,4 +691,7 @@ export default {
::v-deep .el-tag + .el-tag {
margin-left: 4px;
}
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
</style>

@ -87,6 +87,10 @@
></el-input>
</el-form-item>
<el-form-item label="是否开启" prop="is_open">
<el-switch v-model="form['is_open']" active-text="是" inactive-text="否" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
<el-form-item label="填报图" prop="image_id">
<el-upload
:action="action"
@ -183,17 +187,12 @@ export default {
name: "",
group: "",
area_id: "",
year: "",
title: "",
remark: "",
tip: "",
image_id: [],
is_open: 1,
need_sign: "",
},
rules: {
@ -272,19 +271,14 @@ export default {
reset() {
this.form = {
name: "",
area_id: "",
group: "",
year: "",
title: "",
remark: "",
tip: "",
image_id: [],
is_open: 1,
need_sign: "",
};
this.$refs["elForm"].resetFields();

@ -36,6 +36,10 @@
{{ form["title"] }}
</el-descriptions-item>
<el-descriptions-item label="是否开启">
{{ form['is_open'] ? '是' : '否' }}
</el-descriptions-item>
<el-descriptions-item label="备注" span="2">
<div v-html="form['remark']"></div>
</el-descriptions-item>
@ -44,13 +48,13 @@
<div v-html="form['tip']"></div>
</el-descriptions-item>
<el-form-item label="填报图" prop="image_id">
<el-descriptions-item label="填报图" prop="image_id">
<el-upload
:file-list="form['image_id']"
accept="application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
</el-upload>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="是否需要签名">
{{

@ -22,15 +22,24 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
<template v-if="isHasAuth('search')">
<el-cascader v-model="select['filter[0][value]']"
placeholder="归属表.."
size="small"
clearable
:options="groupAspiration"
:props="{
emitPath: false
}"></el-cascader>
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
>
</template>
</template>
</vxe-toolbar>
</slot>
@ -349,6 +358,9 @@ export default {
page_size: 20,
keyword: "",
show_relation: ["aspiration", "batchSubs"],
"filter[0][key]": 'aspiration_id',
"filter[0][op]": 'eq',
"filter[0][value]": ''
},
total: 0,
allAlign: null,
@ -375,6 +387,28 @@ export default {
};
},
computed: {
groupAspiration() {
const yearMap = {};
//
this.aspiration.forEach(item => {
if (!yearMap[item.year]) {
yearMap[item.year] = {
value: item.year,
label: `${item.year}`,
children: []
};
}
yearMap[item.year].children.push({
value: item.id,
label: item.name
//
});
});
//
return Object.values(yearMap);
},
isActiveStatus() {
return function (row) {
if (this.$refs["table"]) {
@ -619,6 +653,9 @@ export default {
</script>
<style scoped lang="scss">
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
::v-deep .el-card__header {
padding: 6px 20px;
}

@ -22,15 +22,45 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
<template v-if="isHasAuth('search')">
<el-cascader
v-model="select['filter[0][value]']"
placeholder="归属表.."
size="small"
clearable
:options="groupAspiration"
:props="{
emitPath: false,
lazy: true,
lazyLoad: (node, resolve) => {
const { level, value } = node;
if (level === 1) {
resolve(groupAspiration.find(i => i.value === value).children)
}
else if (level === 2) {
getBatches(value.split('-')[1]).then((res) => {
resolve(
res.map((i) => ({
...i,
value: i.id,
label: i.name,
leaf: true,
}))
);
});
}
},
}"
></el-cascader>
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
</template>
</template>
</vxe-toolbar>
</slot>
@ -87,7 +117,16 @@
<vxe-column title="归属表" min-width="160" header-align="center">
<template #default="{ row }">
<span>{{ row.batch ? (row.batch.aspiration ? row.batch.aspiration.name : '/') : '/' }} - {{ row.batch ? row.batch.name : '/' }}</span>
<span
>{{
row.batch
? row.batch.aspiration
? row.batch.aspiration.name
: "/"
: "/"
}}
- {{ row.batch ? row.batch.name : "/" }}</span
>
</template>
</vxe-column>
<vxe-column
@ -100,16 +139,37 @@
<vxe-column
align="center"
field="batch_id"
field="batch.name"
width="180"
title="归属批次"
:edit-render="{
name: 'VxeSelect',
options: batch,
props: { multiple: false },
optionProps: { value: 'id', label: 'name' },
}"
/>
:edit-render="{}"
>
<template #edit="{ row }">
<el-cascader
v-model="row['batch_id']"
size="small"
style="width: 100%"
:options="aspiration"
:props="{
value: 'id',
label: 'name',
lazy: true,
emitPath: false,
lazyLoad: (node, resolve) => {
const { level, value } = node;
getBatches(value).then((res) => {
resolve(
res.map((i) => ({
...i,
leaf: true,
}))
);
});
},
}"
></el-cascader>
</template>
</vxe-column>
<vxe-column
align="center"
@ -119,12 +179,21 @@
:edit-render="{}"
>
<template #default="{ row }">
{{ row.school ? row.school.map(i => i.name) : '' }}
{{ row.school ? row.school.map((i) => i.name) : "" }}
</template>
<template #edit="{ row }">
<el-input :value="row.school ? row.school.map(i => i.name).toString() : ''"
size="small" placeholder="点击选择学校"
@focus="selectedRow = row,$refs['SchoolPicker'].setDefaultValue(row.school || []), isShowSchoolPicker = true"></el-input>
<el-input
:value="
row.school ? row.school.map((i) => i.name).toString() : ''
"
size="small"
placeholder="点击选择学校"
@focus="
(selectedRow = row),
$refs['SchoolPicker'].setDefaultValue(row.school || []),
(isShowSchoolPicker = true)
"
></el-input>
</template>
</vxe-column>
@ -242,16 +311,18 @@
<AddBatchSub
ref="AddBatchSub"
:batch="batch"
:is-show.sync="isShowAdd"
@refresh="getList"
/>
<ShowBatchSub
ref="ShowBatchSub"
:batch="batch"
:is-show.sync="isShowDetail"
/>
<SchoolPicker ref="SchoolPicker" :is-show.sync="isShowSchoolPicker" @confirm="e => selectedRow.school = e" />
<SchoolPicker
ref="SchoolPicker"
:is-show.sync="isShowSchoolPicker"
@confirm="(e) => (selectedRow.school = e)"
/>
</div>
</template>
@ -265,12 +336,13 @@ import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/batch-sub/batch-sub";
import AddBatchSub from "./components/AddBatchSub.vue";
import ShowBatchSub from "./components/ShowBatchSub.vue";
import SchoolPicker from "./components/SchoolPicker.vue"
import SchoolPicker from "./components/SchoolPicker.vue";
import axios from "axios";
import { getToken } from "@/utils/auth";
import { index as batchIndex } from "@/api/batch/batch";
import { index as schoolIndex } from "@/api/school/school";
import { index as aspirationIndex } from "@/api/aspiration/aspiration";
export default {
name: "BatchSub",
@ -296,6 +368,9 @@ export default {
page_size: 20,
keyword: "",
show_relation: ["batch.aspiration"],
"filter[0][key]": 'batch_id',
"filter[0][op]": 'eq',
"filter[0][value]": ''
},
total: 0,
allAlign: null,
@ -307,7 +382,7 @@ export default {
sort: "",
show_school_obey: "",
show_specialty_obey: "",
school: []
school: [],
},
validRules: {
name: [
@ -325,11 +400,36 @@ export default {
],
},
batch: [],
// batch: [],
aspiration: [],
// school: [],
};
},
computed: {
groupAspiration() {
const yearMap = {};
//
this.aspiration.forEach((item) => {
if (!yearMap[item.year]) {
yearMap[item.year] = {
value: `0-${item.year}`,
label: `${item.year}`,
children: [],
};
}
yearMap[item.year].children.push({
value: `1-${item.id}`,
label: item.name,
leaf: false,
children: [],
//
});
});
//
return Object.values(yearMap);
},
isActiveStatus() {
return function (row) {
if (this.$refs["table"]) {
@ -344,7 +444,8 @@ export default {
},
},
created() {
this.getBatch();
this.getAspiration();
// this.getBatch();
// this.getSchool();
this.getList();
@ -415,6 +516,21 @@ export default {
default:
}
},
async getBatches(aspirationId) {
try {
const res = await batchIndex({
page: 1,
page_size: 999,
"filter[0][key]": "aspiration_id",
"filter[0][op]": "eq",
"filter[0][value]": aspirationId,
});
return res.data;
} catch (err) {
console.error(err);
return [];
}
},
async detail(row) {
await this.$refs["ShowBatchSub"].getDetail(row.id);
this.isShowDetail = true;
@ -434,6 +550,20 @@ export default {
// console.error(err);
// }
// },
async getAspiration() {
try {
const res = await aspirationIndex(
{
page: 1,
page_size: 999,
},
false
);
this.aspiration = res.data;
} catch (err) {
console.error(err);
}
},
async getBatch() {
try {
@ -499,8 +629,8 @@ export default {
},
async getList(isRefresh) {
if(isRefresh) {
this.select.page = 1
if (isRefresh) {
this.select.page = 1;
}
this.loading = true;
try {
@ -574,6 +704,9 @@ export default {
</script>
<style scoped lang="scss">
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
::v-deep .el-card__header {
padding: 6px 20px;
}

@ -24,10 +24,13 @@
<el-descriptions-item label="归属批次">
{{
batch.find((i) => i["id"] === form["batch_id"])
? batch.find((i) => i["id"] === form["batch_id"])["name"]
: ""
form.batch
? form.batch.aspiration
? form.batch.aspiration.name
: "/"
: "/"
}}
- {{ form.batch ? form.batch.name : "/" }}
</el-descriptions-item>
<el-descriptions-item label="排序">
@ -86,11 +89,6 @@ export default {
default: false,
required: true,
},
batch: {
type: Array,
default: () => [],
},
},
data() {
return {
@ -100,7 +98,7 @@ export default {
name: "",
batch_id: "",
batch: {},
sort: "",
show_school_obey: "",
@ -122,6 +120,7 @@ export default {
try {
const detail = await show({
id,
show_relation: ["batch.aspiration"],
});
for (let key in this.form) {
if (detail.hasOwnProperty(key)) {

@ -22,15 +22,58 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
<template v-if="isHasAuth('search')">
<el-cascader
v-model="select['filter[0][value]']"
placeholder="归属表.."
size="small"
clearable
:options="groupAspiration"
:props="{
emitPath: false,
lazy: true,
lazyLoad: (node, resolve) => {
const { level, value } = node;
if (level === 1) {
resolve(groupAspiration.find(i => i.value === value).children)
}
else if (level === 2) {
getBatches(value.split('-')[1]).then((res) => {
resolve(
res.map((i) => ({
...i,
value: `2-${i.id}`,
label: i.name,
leaf: false,
children: []
}))
);
});
}
else if (level === 3) {
getBatchSubs(value.split('-')[1]).then((res) => {
resolve(
res.map((i) => ({
...i,
value: i.id,
label: i.name,
leaf: true,
}))
);
});
}
},
}"
></el-cascader>
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
>
</template>
</template>
</vxe-toolbar>
</slot>
@ -268,6 +311,8 @@ import axios from "axios";
import { getToken } from "@/utils/auth";
import { index as batchSubIndex } from "@/api/batch-sub/batch-sub";
import {index as aspirationIndex} from "@/api/aspiration/aspiration";
import {index as batchIndex} from "@/api/batch/batch";
export default {
name: "BatchSubSchool",
@ -290,6 +335,9 @@ export default {
page_size: 20,
keyword: "",
show_relation: ["batchSub.batch.aspiration"],
"filter[0][key]": 'batch_sub_id',
"filter[0][op]": 'eq',
"filter[0][value]": ''
},
total: 0,
allAlign: null,
@ -319,9 +367,35 @@ export default {
},
batchSub: [],
aspiration: [],
};
},
computed: {
groupAspiration() {
const yearMap = {};
//
this.aspiration.forEach((item) => {
if (!yearMap[item.year]) {
yearMap[item.year] = {
value: `0-${item.year}`,
label: `${item.year}`,
children: [],
};
}
yearMap[item.year].children.push({
value: `1-${item.id}`,
label: item.name,
leaf: false,
children: [],
//
});
});
//
return Object.values(yearMap);
},
isActiveStatus() {
return function (row) {
if (this.$refs["table"]) {
@ -336,6 +410,7 @@ export default {
},
},
created() {
this.getAspiration();
// this.getBatchSub();
this.getList();
@ -411,6 +486,53 @@ export default {
this.isShowDetail = true;
},
async getBatches(aspirationId) {
try {
const res = await batchIndex({
page: 1,
page_size: 999,
"filter[0][key]": "aspiration_id",
"filter[0][op]": "eq",
"filter[0][value]": aspirationId,
});
return res.data;
} catch (err) {
console.error(err);
return [];
}
},
async getBatchSubs(batchId) {
try {
const res = await batchSubIndex({
page: 1,
page_size: 999,
"filter[0][key]": "batch_id",
"filter[0][op]": "eq",
"filter[0][value]": batchId,
});
return res.data;
} catch (err) {
console.error(err);
return [];
}
},
async getAspiration() {
try {
const res = await aspirationIndex(
{
page: 1,
page_size: 999,
},
false
);
this.aspiration = res.data;
} catch (err) {
console.error(err);
}
},
async getBatchSub() {
try {
const res = await batchSubIndex(
@ -567,6 +689,9 @@ export default {
</script>
<style scoped lang="scss">
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
::v-deep .el-card__header {
padding: 6px 20px;
}

@ -22,15 +22,22 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
<template v-if="isHasAuth('search')">
<el-input v-model="select['filter[0][value]']" size="small" style="width: 100px;" clearable placeholder="姓名.."></el-input>
<el-date-picker v-model="select['filter[1][value]']" size="small" style="width: 100px;" clearable placeholder="年份.." type="year" value-format="yyyy"></el-date-picker>
<el-select v-model="select['filter[2][value]']" style="width: 100px" size="small" placeholder="区域.." clearable>
<el-option v-for="i in area" :key="i.id" :value="i.id" :label="i.name"></el-option>
</el-select>
<el-input v-model="select['filter[3][value]']" size="small" style="width: 140px;" clearable placeholder="联系方式.."></el-input>
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
>
</template>
</template>
</vxe-toolbar>
</slot>
@ -354,6 +361,18 @@ export default {
page_size: 20,
keyword: "",
show_relation: [],
"filter[0][key]": 'name',
"filter[0][op]": 'like',
"filter[0][value]": '',
"filter[1][key]": 'year',
"filter[1][op]": 'eq',
"filter[1][value]": '',
"filter[2][key]": 'area_id',
"filter[2][op]": 'eq',
"filter[2][value]": '',
"filter[3][key]": 'mobile',
"filter[3][op]": 'like',
"filter[3][value]": '',
},
total: 0,
allAlign: null,
@ -644,6 +663,9 @@ export default {
</script>
<style scoped lang="scss">
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
::v-deep .el-card__header {
padding: 6px 20px;
}

@ -22,15 +22,17 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
<template v-if="isHasAuth('search')">
<el-input v-model="select['filter[0][value]']" clearable style="width: 100px;" size="small" placeholder="姓名.."></el-input>
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
>
</template>
</template>
</vxe-toolbar>
</slot>
@ -407,6 +409,9 @@ export default {
page_size: 20,
keyword: "",
show_relation: [],
"filter[0][key]": 'name',
"filter[0][op]": 'like',
"filter[0][value]": ''
},
total: 0,
allAlign: null,
@ -659,6 +664,9 @@ export default {
</script>
<style scoped lang="scss">
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
::v-deep .el-card__header {
padding: 6px 20px;
}

@ -22,15 +22,44 @@
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
<template v-if="isHasAuth('search')">
<el-select
style="width: 120px"
clearable
v-model="select['filter[0][value]']"
placeholder="用户.."
filterable
size="small"
>
<el-option
v-for="item in user"
:key="item.id"
:label="item.nickname || item.mobile"
:value="item.id"
></el-option>
</el-select>
<el-date-picker
:value="select['filter[1][value]'] ? select['filter[1][value]'].split(',') : []"
size="small"
type="daterange"
style="width: 240px"
clearable
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
@input="e => {
select['filter[1][value]'] = e ? e.toString() : ''
}"
></el-date-picker>
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList(true)"
>搜索</el-button
>
</template>
</template>
</vxe-toolbar>
</slot>
@ -245,6 +274,12 @@ export default {
page_size: 20,
keyword: "",
show_relation: [],
"filter[0][key]": "user_id",
"filter[0][op]": "eq",
"filter[0][value]": "",
"filter[1][key]": "time",
"filter[1][op]": "range",
"filter[1][value]": "",
},
total: 0,
allAlign: null,
@ -417,8 +452,8 @@ export default {
},
async getList(isRefresh) {
if(isRefresh) {
this.select.page = 1
if (isRefresh) {
this.select.page = 1;
}
this.loading = true;
try {
@ -492,6 +527,9 @@ export default {
</script>
<style scoped lang="scss">
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
::v-deep .el-card__header {
padding: 6px 20px;
}

Loading…
Cancel
Save