|
@@ -30,7 +30,7 @@
|
|
|
</el-select>
|
|
|
</el-tooltip>
|
|
|
</span>
|
|
|
- <span v-if="user.type == 1">
|
|
|
+ <span v-if="user.type == 1 || user.type == 3">
|
|
|
<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>
|
|
@@ -52,6 +52,7 @@ const { mapActions: trainBatch } = createNamespacedHelpers('trainBatch');
|
|
|
const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: setting } = createNamespacedHelpers('setting');
|
|
|
const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
|
export default {
|
|
|
name: 'default-select',
|
|
|
props: {},
|
|
@@ -70,7 +71,7 @@ export default {
|
|
|
// this.$set(this, `options`, _.cloneDeep(this.defaultOption));
|
|
|
this.search({ type: 'planYear' });
|
|
|
this.checkOption();
|
|
|
- if (this.user.type == 1) this.getClassOption();
|
|
|
+ if (this.user.type == 1 || this.user.type == 3) this.getClassOption();
|
|
|
this.loading = false;
|
|
|
},
|
|
|
methods: {
|
|
@@ -79,6 +80,7 @@ export default {
|
|
|
...trainplan({ getplan: 'query' }),
|
|
|
...setting({ sFetch: 'fetch', sUpdate: 'update' }),
|
|
|
...classes({ getClassList: 'query' }), //仅供班主任使用
|
|
|
+ ...lesson({ teaclass: 'teaclass' }), //仅供老师使用
|
|
|
async search({ type, ...info }) {
|
|
|
let res = await _.get(this, `get${type}`)({ ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -118,7 +120,7 @@ export default {
|
|
|
toCheckUserType() {
|
|
|
this.setVuexOpt();
|
|
|
this.options.classid = undefined;
|
|
|
- if (this.user.type == 1) this.getClassOption();
|
|
|
+ if (this.user.type == 1 || this.user.type == 3) this.getClassOption();
|
|
|
},
|
|
|
setVuexOpt() {
|
|
|
this.changeOpt(this.options);
|
|
@@ -142,9 +144,18 @@ export default {
|
|
|
//班主任使用,默认班级
|
|
|
async getClassOption() {
|
|
|
let termid = _.get(this.defaultOption, 'termid');
|
|
|
+ let planid = _.get(this.defaultOption, 'planid');
|
|
|
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);
|
|
|
+ let res;
|
|
|
+ if (this.user.type == 1) {
|
|
|
+ res = await this.getClassList({ termid: this.defaultOption.termid, headteacherid: this.user.userid });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
|
|
|
+ }
|
|
|
+ if (this.user.type == 3) {
|
|
|
+ res = await this.teaclass({ planid: planid, teaid: this.user.userid });
|
|
|
+ const elm = res.data.filter(item => item.termid == termid);
|
|
|
+ this.$set(this, `classList`, elm);
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
watch: {
|