lrf402788946 4 yıl önce
ebeveyn
işleme
46ef507f91
2 değiştirilmiş dosya ile 29 ekleme ve 3 silme
  1. 25 2
      src/views/new-plan/detail.vue
  2. 4 1
      src/views/new-plan/student.vue

+ 25 - 2
src/views/new-plan/detail.vue

@@ -45,11 +45,13 @@ const { mapActions: schPlan } = createNamespacedHelpers('schPlan');
 const { mapActions: util } = createNamespacedHelpers('util');
 const { mapActions: imports } = createNamespacedHelpers('schimport');
 const { mapActions: classtype } = createNamespacedHelpers('classtype');
+const { mapActions: student } = createNamespacedHelpers('student');
 export default {
   name: 'detail',
   props: {},
   components: { listFrame, dataTable },
   data: function() {
+    var _this = this;
     return {
       dialog: false,
       info: {},
@@ -67,6 +69,7 @@ export default {
           label: '上报名单',
           icon: 'el-icon-document',
           method: 'namelist',
+          display: i => !i.is_upload,
         },
         {
           label: '查看名单',
@@ -88,6 +91,7 @@ export default {
     this.search();
   },
   methods: {
+    ...student({ getStudent: 'query' }),
     ...classtype({ getClasstype: 'query' }),
     ...trainplan({ getTrainplan: 'fetch' }),
     ...imports(['create']),
@@ -107,6 +111,7 @@ export default {
       return wbout;
     },
     async search() {
+      const msg = this.$message({ message: '正在加载中', duration: 0 });
       let tp = await this.getTrainplan(this.id);
       if (this.$checkRes(tp)) {
         this.$set(this, `plan`, tp.data);
@@ -131,11 +136,15 @@ export default {
           resArr.push({ ...obj, ...arr });
         }
         resArr = _.orderBy(resArr, ['term', 'batch'], ['asc', 'asc']);
+        resArr = await this.checkUpload(resArr);
+        console.log(resArr);
         this.$set(this, `info`, res.data);
         this.$set(this, `list`, resArr);
+        msg.close();
+        this.$message.success('加载完成!');
       }
     },
-    toNamelist({ data }) {
+    async toNamelist({ data }) {
       this.$set(this, `form`, JSON.parse(JSON.stringify(data)));
       this.dialog = true;
     },
@@ -156,7 +165,7 @@ export default {
       }
     },
     toView({ data }) {
-      this.$router.push({ path: './student', query: { termid: data.termid } });
+      this.$router.push({ path: './student', query: { termid: data.termid, batchid: data.batchid } });
     },
     async getOtherList() {
       const res = await this.getClasstype();
@@ -168,6 +177,20 @@ export default {
         if (res) return res.name;
       }
     },
+    async checkUpload(list) {
+      for (const i of list) {
+        const { termid, batchid } = i;
+        const r = await this.getStudent({ termid, batchid, schid: this.user.code, skip: 0, limit: 1 });
+        if (this.$checkRes(r)) {
+          const { total } = r;
+          console.log(total);
+          i.is_upload = total > 0;
+        } else {
+          i.is_upload = false;
+        }
+      }
+      return list;
+    },
   },
   computed: {
     ...mapState(['user']),

+ 4 - 1
src/views/new-plan/student.vue

@@ -57,6 +57,9 @@ export default {
     termid() {
       return this.$route.query.termid;
     },
+    batchid() {
+      return this.$route.query.batchid;
+    },
     pageTitle() {
       return `${this.$route.meta.title}`;
     },
@@ -64,7 +67,7 @@ export default {
   methods: {
     ...mapStu(['query', 'delete', 'removeAll']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      const res = await this.query({ skip, limit, ...info, termid: this.termid, schid: this.user.code });
+      const res = await this.query({ skip, limit, ...info, termid: this.termid, batchid: this.batchid, schid: this.user.code });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);