|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
|