|
@@ -9,6 +9,18 @@
|
|
|
<template v-if="item.model === 'nation'">
|
|
|
<el-option v-for="(item, index) in nationList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
</template>
|
|
|
+ <!-- 期 -->
|
|
|
+ <template v-if="item.model === 'termid'">
|
|
|
+ <el-option v-for="(item, index) in termList" :key="index" :label="item.term" :value="item._id"></el-option>
|
|
|
+ </template>
|
|
|
+ <!-- 批次 -->
|
|
|
+ <template v-if="item.model === 'batchid'">
|
|
|
+ <el-option v-for="(item, index) in batchList" :key="index" :label="item.term" :value="item._id"></el-option>
|
|
|
+ </template>
|
|
|
+ <!-- 班级 -->
|
|
|
+ <template v-if="item.model === 'classid'">
|
|
|
+ <el-option v-for="(item, index) in classList" :key="index" :label="item.term" :value="item._id"></el-option>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
<template #radios="{item}">
|
|
|
<template v-if="item.model === 'gender'">
|
|
@@ -29,12 +41,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import _ from 'lodash';
|
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
import dataForm from '@frame/components/form';
|
|
|
-import { createNamespacedHelpers } from 'vuex';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions } = createNamespacedHelpers('student');
|
|
|
const { mapActions: mapNation } = createNamespacedHelpers('nation');
|
|
|
const { mapActions: mapschool } = createNamespacedHelpers('school');
|
|
|
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
//缺少字典表:学校表,民族表,院系表,专业表
|
|
|
export default {
|
|
|
metaInfo: { title: '学生信息' },
|
|
@@ -47,6 +61,9 @@ export default {
|
|
|
data: () => ({
|
|
|
schcoolList: [],
|
|
|
nationList: [],
|
|
|
+ termList: [],
|
|
|
+ batchList: [],
|
|
|
+ classList: [],
|
|
|
info: {},
|
|
|
fields: [
|
|
|
{ label: '姓名', required: true, model: 'name' },
|
|
@@ -66,7 +83,7 @@ export default {
|
|
|
{ label: '家庭是否困难', required: true, model: 'family_is_hard', type: 'radio' },
|
|
|
{ label: '是否获得过助学金', required: true, model: 'have_grant', type: 'radio' },
|
|
|
{ label: '职务', model: 'job' },
|
|
|
- { label: '期', model: 'term' },
|
|
|
+ { label: '期', model: 'termid', type: 'select' },
|
|
|
{ label: '批次', model: 'batch' },
|
|
|
{ label: '班级', model: 'class' },
|
|
|
{ label: '是否优秀', model: 'is_fine', type: 'radio' },
|
|
@@ -102,8 +119,10 @@ export default {
|
|
|
created() {
|
|
|
this.otherList();
|
|
|
this.schoolname();
|
|
|
+ this.termSearch();
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapState(['user', 'defaultOption']),
|
|
|
id() {
|
|
|
return this.$route.query.id;
|
|
|
},
|
|
@@ -135,23 +154,32 @@ export default {
|
|
|
...mapActions(['fetch', 'create', 'update']),
|
|
|
...mapNation({ nation: 'query' }),
|
|
|
...mapschool({ zschool: 'query' }),
|
|
|
+ ...trainplan({ trainplanQuery: 'query' }),
|
|
|
async otherList() {
|
|
|
const res = await this.nation();
|
|
|
if (this.$checkRes(res)) this.$set(this, `nationList`, res.data);
|
|
|
},
|
|
|
-
|
|
|
async schoolname() {
|
|
|
const res = await this.zschool();
|
|
|
- console.log(res);
|
|
|
if (this.$checkRes(res)) this.$set(this, `schcoolList`, res.data);
|
|
|
},
|
|
|
-
|
|
|
+ // 期
|
|
|
+ async termSearch() {
|
|
|
+ let planid = _.get(this.defaultOption, 'planid');
|
|
|
+ let planyearid = _.get(this.defaultOption, 'planyearid');
|
|
|
+ const res = await this.trainplanQuery({ planyearid: planyearid });
|
|
|
+ var arr = res.data.filter(item => item.id === planid);
|
|
|
+ console.log(arr[0].termnum);
|
|
|
+ if (this.$checkRes(arr)) this.$set(this, `termList`, arr[0].termnum);
|
|
|
+ },
|
|
|
async search() {
|
|
|
const res = await this.fetch(this.id);
|
|
|
if (this.$checkRes(res)) this.$set(this, `info`, res.data);
|
|
|
this.loading = false;
|
|
|
},
|
|
|
async handleSave({ isNew, data }) {
|
|
|
+ let planid = _.get(this.defaultOption, 'planid');
|
|
|
+ let planyearid = _.get(this.defaultOption, 'planyearid');
|
|
|
let res;
|
|
|
let msg;
|
|
|
if (isNew) {
|
|
@@ -160,14 +188,25 @@ export default {
|
|
|
// data.yard = `测试学院`;
|
|
|
// data.major = `测试专业`;
|
|
|
// data.school_name = `测试学校`;
|
|
|
- res = await this.create(data);
|
|
|
- msg = `${this.keyWord}添加成功`;
|
|
|
+ data.planid = planid;
|
|
|
+ data.planyearid = planyearid;
|
|
|
+ console.log(data);
|
|
|
+ // res = await this.create(data);
|
|
|
+ // msg = `${this.keyWord}添加成功`;
|
|
|
} else {
|
|
|
res = await this.update(data);
|
|
|
msg = `${this.keyWord}修改成功`;
|
|
|
}
|
|
|
if (this.$checkRes(res, msg)) this.$router.push({ path: '/student/index' });
|
|
|
},
|
|
|
+ // 存id与名字
|
|
|
+ selectChild(id) {
|
|
|
+ let res = this.termList.filter(fil => fil._id === id);
|
|
|
+ if (res.length > 0) {
|
|
|
+ this.$set(this.info, `term`, res[0].name);
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|