|
@@ -14,7 +14,7 @@
|
|
|
<span>
|
|
|
<!-- @change="getTermList" -->
|
|
|
<el-tooltip :disabled="this.user.type != 0" content="点击更改默认年度计划" effect="dark" placement="bottom">
|
|
|
- <el-select v-model="topOptions.planid" :disabled="this.user.type != 0" placeholder="未设置年度计划" size="mini" clearable>
|
|
|
+ <el-select v-model="topOptions.planid" :disabled="this.user.type != 0" placeholder="未设置年度计划" size="mini" clearable @change="getTermList">
|
|
|
<el-option v-for="(i, index) in planList" :key="index" :label="i.title" :value="i._id"></el-option>
|
|
|
</el-select>
|
|
|
</el-tooltip>
|
|
@@ -30,7 +30,7 @@
|
|
|
<span v-if="user.type == 1 || user.type == 3">
|
|
|
<!-- @change="setVuexOpt()" -->
|
|
|
<el-tooltip content="选择要查看的班级" effect="dark" placement="bottom">
|
|
|
- <el-select v-model="topOptions.classid" placeholder="选择要查看的班级" size="mini" clearable>
|
|
|
+ <el-select v-model="topOptions.classid" placeholder="选择要查看的班级" size="mini" clearable @change="selectClass">
|
|
|
<el-option v-for="(i, index) in classList" :key="index" :label="`${i.name}班`" :value="i._id"></el-option>
|
|
|
</el-select>
|
|
|
</el-tooltip>
|
|
@@ -86,7 +86,9 @@ export default {
|
|
|
if (this.$checkRes(res)) this.$set(this, `planYearList`, res.data);
|
|
|
if (!this.topOptions) return;
|
|
|
const { planyearid } = this.topOptions;
|
|
|
- if (planyearid) this.initPlan();
|
|
|
+ if (planyearid) await this.initPlan();
|
|
|
+ if (this.user.type === '1' || this.user.type === '3') this.useClassTemp();
|
|
|
+ this.$emit('defaultLoad');
|
|
|
},
|
|
|
async initPlan() {
|
|
|
const { planyearid, planid, termid } = this.topOptions;
|
|
@@ -117,9 +119,21 @@ export default {
|
|
|
['asc']
|
|
|
);
|
|
|
this.$set(this, `termList`, tlist);
|
|
|
- if (termid) this.initClass();
|
|
|
+ if (termid) await this.initClass();
|
|
|
}
|
|
|
},
|
|
|
+ getTermList(planid) {
|
|
|
+ const plan = this.planList.find(f => f._id === planid);
|
|
|
+ if (!plan) return;
|
|
|
+ // 找到计划了
|
|
|
+ const { termnum } = plan;
|
|
|
+ const tlist = _.orderBy(
|
|
|
+ termnum.map(i => ({ ...i, term: i.term * 1 })),
|
|
|
+ ['term'],
|
|
|
+ ['asc']
|
|
|
+ );
|
|
|
+ this.$set(this, `termList`, tlist);
|
|
|
+ },
|
|
|
async initClass() {
|
|
|
const { termid, classid, planid } = this.topOptions;
|
|
|
let res;
|
|
@@ -156,6 +170,13 @@ export default {
|
|
|
}
|
|
|
sessionStorage.setItem('needInit', false);
|
|
|
},
|
|
|
+ selectClass(id) {
|
|
|
+ sessionStorage.setItem('tempClassId', id);
|
|
|
+ },
|
|
|
+ useClassTemp() {
|
|
|
+ const classid = sessionStorage.getItem('tempClassId');
|
|
|
+ if (classid) this.$set(this.topOptions, `classid`, classid);
|
|
|
+ },
|
|
|
toClear() {
|
|
|
this.$set(this.topOptions, `classid`, undefined);
|
|
|
|
|
@@ -179,6 +200,7 @@ export default {
|
|
|
deep: true,
|
|
|
handler(val, oval) {
|
|
|
this.changeOpt(val);
|
|
|
+ if (this.user.type === '1' || this.user.type === '3') this.useClassTemp();
|
|
|
},
|
|
|
},
|
|
|
},
|