|
@@ -1,12 +1,12 @@
|
|
|
<template>
|
|
|
<div id="default-select">
|
|
|
<el-row type="flex" align="middle" justify="start" class="user-menu" v-loading="loading">
|
|
|
- <el-col :span="15" v-if="options">
|
|
|
+ <el-col :span="15" v-loading="!topOptions">
|
|
|
当前默认:
|
|
|
<span>
|
|
|
<!-- @change="data => changeList('plan', data)" -->
|
|
|
<el-tooltip :disabled="this.user.type != 0" content="点击更改默认批次" effect="dark" placement="bottom">
|
|
|
- <el-select v-model="options.planyearid" :disabled="this.user.type != 0" placeholder="未设置培训计划" size="mini" @change="initPlan">
|
|
|
+ <el-select v-model="topOptions.planyearid" :disabled="this.user.type != 0" placeholder="未设置培训计划" size="mini" @change="initPlan">
|
|
|
<el-option v-for="(i, index) in planYearList" :key="index" :label="i.title" :value="i._id"></el-option>
|
|
|
</el-select>
|
|
|
</el-tooltip>
|
|
@@ -14,7 +14,7 @@
|
|
|
<span>
|
|
|
<!-- @change="getTermList" -->
|
|
|
<el-tooltip :disabled="this.user.type != 0" content="点击更改默认年度计划" effect="dark" placement="bottom">
|
|
|
- <el-select v-model="options.planid" :disabled="this.user.type != 0" placeholder="未设置年度计划" size="mini">
|
|
|
+ <el-select v-model="topOptions.planid" :disabled="this.user.type != 0" placeholder="未设置年度计划" size="mini">
|
|
|
<el-option v-for="(i, index) in planList" :key="index" :label="i.title" :value="i._id"></el-option>
|
|
|
</el-select>
|
|
|
</el-tooltip>
|
|
@@ -22,7 +22,7 @@
|
|
|
<span>
|
|
|
<!-- @change="toCheckUserType()" -->
|
|
|
<el-tooltip content="点击更改默认期" effect="dark" placement="bottom">
|
|
|
- <el-select v-model="options.termid" placeholder="未设置默认期" size="mini" @change="initClass">
|
|
|
+ <el-select v-model="topOptions.termid" placeholder="未设置默认期" size="mini" @change="initClass">
|
|
|
<el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :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="options.classid" placeholder="选择要查看的班级" size="mini">
|
|
|
+ <el-select v-model="topOptions.classid" placeholder="选择要查看的班级" size="mini">
|
|
|
<el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i._id"></el-option>
|
|
|
</el-select>
|
|
|
</el-tooltip>
|
|
@@ -46,7 +46,7 @@
|
|
|
<script>
|
|
|
import _ from 'lodash';
|
|
|
const moment = require('moment');
|
|
|
-import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
|
|
|
+import { mapState, mapMutations, mapGetters, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: trainBatch } = createNamespacedHelpers('trainBatch');
|
|
|
const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: setting } = createNamespacedHelpers('setting');
|
|
@@ -87,11 +87,12 @@ export default {
|
|
|
async init() {
|
|
|
let res = await this.getplanYear();
|
|
|
if (this.$checkRes(res)) this.$set(this, `planYearList`, res.data);
|
|
|
- const { planyearid } = this.options;
|
|
|
+ if (!this.topOptions) return;
|
|
|
+ const { planyearid } = this.topOptions;
|
|
|
if (planyearid) this.initPlan();
|
|
|
},
|
|
|
async initPlan() {
|
|
|
- const { planyearid, planid, termid } = this.options;
|
|
|
+ const { planyearid, planid, termid } = this.topOptions;
|
|
|
if (!planyearid) return;
|
|
|
const res = await this.getPlan({ planyearid });
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -123,7 +124,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async initClass(type) {
|
|
|
- const { termid, classid, planid } = this.options;
|
|
|
+ const { termid, classid, planid } = this.topOptions;
|
|
|
let res;
|
|
|
// 检查身份
|
|
|
let query = { termid };
|
|
@@ -149,7 +150,7 @@ export default {
|
|
|
const r = moment().isBetween(startdate, enddate, null, '[]');
|
|
|
if (r) {
|
|
|
const { _id, termid } = i;
|
|
|
- let options = _.cloneDeep(this.options);
|
|
|
+ let options = _.cloneDeep(this.topOptions);
|
|
|
options.classid = _id;
|
|
|
this.$set(this, `options`, options);
|
|
|
break;
|
|
@@ -158,14 +159,14 @@ export default {
|
|
|
sessionStorage.setItem('needInit', false);
|
|
|
},
|
|
|
toClear(type) {
|
|
|
- this.$set(this, `options`, _.omit(this.options, type));
|
|
|
+ this.$set(this, `options`, _.omit(this.topOptions, type));
|
|
|
},
|
|
|
// setVuexOpt() {
|
|
|
- // console.log(this.options);
|
|
|
- // this.changeOpt(this.options);
|
|
|
+ // console.log(this.topOptions);
|
|
|
+ // this.changeOpt(this.topOptions);
|
|
|
// },
|
|
|
async settingSave() {
|
|
|
- let res = await this.sUpdate(this.options);
|
|
|
+ let res = await this.sUpdate(this.topOptions);
|
|
|
this.$checkRes(res, '设置成功', res.errmsg);
|
|
|
},
|
|
|
},
|
|
@@ -179,6 +180,7 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user', 'defaultOption']),
|
|
|
+ ...mapGetters(['topOptions']),
|
|
|
pageTitle() {
|
|
|
return `${this.$route.meta.title}`;
|
|
|
},
|