lrf402788946 5 gadi atpakaļ
vecāks
revīzija
6a92fea2de
1 mainītis faili ar 12 papildinājumiem un 2 dzēšanām
  1. 12 2
      src/views/student/detail.vue

+ 12 - 2
src/views/student/detail.vue

@@ -171,11 +171,21 @@ export default {
       let planyearid = _.get(this.defaultOption, 'planyearid');
       const res = await this.trainplanQuery({ planyearid: planyearid });
       var arr = res.data.filter(item => item.id === planid);
-      if (this.$checkRes(arr)) this.$set(this, `termList`, arr[0].termnum);
+      if (this.$checkRes(arr)) {
+        this.$set(this, `termList`, arr[0].termnum);
+        let { termid, batchid } = this.info;
+        if (termid) this.termChange({ data: termid, model: 'termid' });
+        if (batchid) this.termChange({ data: batchid, model: 'batchid' });
+      }
     },
     async search() {
       const res = await this.fetch(this.id);
-      if (this.$checkRes(res)) this.$set(this, `info`, res.data);
+      if (this.$checkRes(res)) {
+        this.$set(this, `info`, res.data);
+        let { batchid, termid } = res.data;
+        if (termid) this.termChange({ data: termid, model: 'termid' });
+        if (batchid) this.termChange({ data: batchid, model: 'batchid' });
+      }
       this.loading = false;
     },
     async handleSave({ isNew, data }) {