|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div id="default-select">
|
|
|
<el-row type="flex" align="middle" justify="start" class="user-menu" v-loading="loading">
|
|
|
- <el-col :span="12" v-if="options">
|
|
|
+ <el-col :span="15" v-if="options">
|
|
|
当前默认:
|
|
|
<span>
|
|
|
<el-tooltip :disabled="this.user.type != 0" content="点击更改默认批次" effect="dark" placement="bottom">
|
|
@@ -25,11 +25,18 @@
|
|
|
</span>
|
|
|
<span>
|
|
|
<el-tooltip content="点击更改默认期" effect="dark" placement="bottom">
|
|
|
- <el-select v-model="options.termid" placeholder="未设置默认期" size="mini" @change="setVuexOpt()">
|
|
|
+ <el-select v-model="options.termid" placeholder="未设置默认期" size="mini" @change="toCheckUserType()">
|
|
|
<el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
|
|
|
</el-select>
|
|
|
</el-tooltip>
|
|
|
</span>
|
|
|
+ <span v-if="user.type == 1">
|
|
|
+ <el-tooltip content="选择要查看的班级" effect="dark" placement="bottom">
|
|
|
+ <el-select v-model="options.classid" placeholder="选择要查看的班级" size="mini" @change="setVuexOpt()">
|
|
|
+ <el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i._id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-tooltip>
|
|
|
+ </span>
|
|
|
<span>
|
|
|
<el-button type="text" size="mini" @click="settingSave" v-if="this.user.type == 0">保存默认值</el-button>
|
|
|
</span>
|
|
@@ -44,6 +51,7 @@ import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: trainBatch } = createNamespacedHelpers('trainBatch');
|
|
|
const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: setting } = createNamespacedHelpers('setting');
|
|
|
+const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
export default {
|
|
|
name: 'default-select',
|
|
|
props: {},
|
|
@@ -55,12 +63,14 @@ export default {
|
|
|
planYearList: [],
|
|
|
planList: [],
|
|
|
termList: [],
|
|
|
+ classList: [],
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
|
// this.$set(this, `options`, _.cloneDeep(this.defaultOption));
|
|
|
this.search({ type: 'planYear' });
|
|
|
this.checkOption();
|
|
|
+ if (this.user.type == 1) this.getClassOption();
|
|
|
this.loading = false;
|
|
|
},
|
|
|
methods: {
|
|
@@ -68,6 +78,7 @@ export default {
|
|
|
...trainBatch({ getplanYear: 'query' }),
|
|
|
...trainplan({ getplan: 'query' }),
|
|
|
...setting({ sFetch: 'fetch', sUpdate: 'update' }),
|
|
|
+ ...classes({ getClassList: 'query' }), //仅供班主任使用
|
|
|
async search({ type, ...info }) {
|
|
|
let res = await _.get(this, `get${type}`)({ ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -103,6 +114,12 @@ export default {
|
|
|
}
|
|
|
this.setVuexOpt();
|
|
|
},
|
|
|
+ //为了处理班主任的班级列表,先复制,再看看是不是需要查询班级列表
|
|
|
+ toCheckUserType() {
|
|
|
+ this.setVuexOpt();
|
|
|
+ this.options.classid = undefined;
|
|
|
+ if (this.user.type == 1) this.getClassOption();
|
|
|
+ },
|
|
|
setVuexOpt() {
|
|
|
this.changeOpt(this.options);
|
|
|
},
|
|
@@ -122,6 +139,13 @@ export default {
|
|
|
let res = await this.sUpdate(this.options);
|
|
|
this.$checkRes(res, '设置成功', res.errmsg);
|
|
|
},
|
|
|
+ //班主任使用,默认班级
|
|
|
+ async getClassOption() {
|
|
|
+ let termid = _.get(this.defaultOption, 'termid');
|
|
|
+ if (!termid) return;
|
|
|
+ let res = await this.getClassList({ termid: this.defaultOption.termid, headteacherid: this.user.userid });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
defaultOption: {
|