lrf402788946 hace 5 años
padre
commit
b616ea393e

+ 43 - 9
src/views/new-plan/deal-list.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="deal-list">
     <detail-frame :title="pageTitle">
-      <data-table :fields="fields" :data="list" :total="total" :opera="opera" @edit="toEdit" @download="toDownLoad"></data-table>
+      <data-table :fields="fields" :data="list" :total="total" :opera="opera" @edit="toEdit" @download="toDownLoad" :toFormat="toFormat"></data-table>
       <!-- @edit="toEdit" @delete="toDelete" -->
     </detail-frame>
     <el-dialog title="学校上传人数与规定不符" width="30%" :visible.sync="dialog" @close="toClose">
@@ -10,9 +10,9 @@
         <el-col :span="24">原因:{{ form.reason }}</el-col>
       </el-row>
       <template #footer>
-        <el-row type="flex" align="middle" justify="center">
-          <el-col :span="4"><el-button type="primary" plain size="mini">同意入库</el-button></el-col>
-          <el-col :span="4"><el-button type="danger" plain size="mini">拒绝入库</el-button></el-col>
+        <el-row type="flex" align="middle" justify="center" v-if="form.isstore == '0'">
+          <el-col :span="4"><el-button type="primary" plain size="mini" @click="toUpdate('1')">同意入库</el-button></el-col>
+          <el-col :span="4"><el-button type="danger" plain size="mini" @click="toUpdate('2')">拒绝入库</el-button></el-col>
         </el-row>
       </template>
     </el-dialog>
@@ -24,6 +24,8 @@ import detailFrame from '@frame/layout/admin/detail-frame';
 import _ from 'lodash';
 import dataTable from '@frame/components/filter-page-table';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: school } = createNamespacedHelpers('school');
+const { mapActions: classtype } = createNamespacedHelpers('classtype');
 export default {
   name: 'deal-list',
   props: {},
@@ -46,28 +48,60 @@ export default {
       fields: [
         { label: '学校', prop: 'name' },
         { label: '期数', prop: 'term' },
+        { label: '班级类型', prop: 'type', format: true },
+        { label: '入库状态', prop: 'isstore', format: i => (i == '0' ? '未入库' : i == '1' ? '已入库' : '已拒绝') },
         { label: '未入库原因', prop: 'reason' },
       ],
-      list: [{ name: '吉林大学', term: 336, reason: '上报人数超过范围' }],
+      list: [],
       form: {},
       total: 0,
-      options: {},
+      options: undefined,
+      classTypeList: [],
     };
   },
-  created() {},
+  created() {
+    this.getOtherList();
+  },
   methods: {
+    ...classtype({ getClassType: 'query' }),
+    ...school(['getNoticeList', 'updateNoticeStatus']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let planid = _.get(this.options, 'planid');
+      const res = await this.getNoticeList({ skip, limit, ...info, planid: planid });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
     toEdit({ data }) {
-      // TODO处理有问题的名单,是保留,还是删除,保留就直接导入数据库
       this.$set(this, `form`, data);
       this.dialog = true;
     },
+    async toUpdate(type) {
+      const res = await this.updateNoticeStatus({ id: this.form._id, isstore: type });
+      if (this.$checkRes(res, '保存成功', res.errmsg || '保存失败')) {
+        this.toClose();
+        this.search();
+      }
+    },
     toDownLoad({ data }) {
-      // TODO下载学校上传的名单
+      window.open(data.filepath);
     },
     toClose() {
       this.dialog = false;
       this.form = {};
     },
+    async getOtherList() {
+      const res = await this.getClassType();
+      if (this.$checkRes(res)) this.$set(this, `classTypeList`, res.data);
+    },
+    toFormat({ model, value }) {
+      if (model == 'type') {
+        console.log('in function:');
+        const res = this.classTypeList.find(f => f.code == value);
+        if (res) return res.name;
+      }
+    },
   },
   computed: {
     ...mapState(['user']),

+ 13 - 0
src/views/new-plan/template.vue

@@ -161,6 +161,7 @@ export default {
     addClass(bindex) {
       let len = _.get(this.info.batchnum[bindex].classnum, 'length', 0);
       this.info.batchnum[bindex].classnum.push({ class: len + 1, number: 56 });
+      this.resetClass();
       this.$forceUpdate();
     },
     toDelete(bindex, index) {
@@ -173,6 +174,7 @@ export default {
         return i;
       });
       this.$set(this.info.batchnum, bindex, duplicate);
+      this.resetClass();
     },
     init() {
       this.info.color = ['#E60000', '#FF7300', '#996B1F', '#FFD700', '#AFA4E0', '#74868A', '#09A343', '#E9F1F4'];
@@ -195,6 +197,17 @@ export default {
       });
       this.$set(this.info, `batchnum`, duplicate);
     },
+    resetClass() {
+      let batchnums = _.get(this.info, 'batchnum');
+      let num = 1;
+      for (const batch of batchnums) {
+        for (const cla of batch.classnum) {
+          cla.class = num;
+          num++;
+        }
+      }
+      this.$set(this.info, `batchnum`, batchnums);
+    },
   },
   computed: {
     ...mapState(['user', 'defaultOption']),

+ 15 - 7
src/views/train-plan/classes.vue

@@ -12,7 +12,7 @@
           <el-form :inline="true" size="mini">
             <el-form-item label="批次">
               <el-select v-model="selectInfo.batchid" placeholder="请先选择期数" @change="getClasses">
-                <el-option v-for="(i, index) in batchList" :key="index" :label="i.name" :value="i._id"></el-option>
+                <el-option v-for="(i, index) in batchList" :key="index" :label="i.batch" :value="i._id"></el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="班级">
@@ -87,6 +87,7 @@ export default {
     directorList: [],
     deptList: [],
     options: undefined,
+    classtype: '0',
   }),
   created() {},
   methods: {
@@ -104,13 +105,13 @@ export default {
         let termid = _.get(this.options, `termid`);
         if (termid) {
           this.getBatch(termid);
-          this.stuSearch();
+          // this.stuSearch();
         }
       }
     },
     //查询选择期上报的学生,提供批次选择
     async stuSearch({ skip = 0, limit = 10, ...info } = {}) {
-      const res = await this.getStudentList({ termid: this.options.termid, skip, limit });
+      const res = await this.getStudentList({ termid: this.options.termid, skip, limit, type: this.classtype });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
@@ -128,10 +129,13 @@ export default {
     },
     //根据批次id,查询下面的班级
     async getClasses(data) {
-      const res = await this.getClassesList({ batchid: data });
-      if (this.$checkRes(res)) {
-        this.$set(this, `classList`, res.data);
+      let res = [];
+      for (const term of this.termList) {
+        let { batchnum } = term;
+        let r = batchnum.find(f => f._id == data);
+        if (r) res = r.class;
       }
+      this.$set(this, `classList`, res);
     },
     toEdit({ data }) {
       this.$router.push({ path: '/dept/detail', query: { id: data.id } });
@@ -192,7 +196,11 @@ export default {
     },
     getLimit(selected) {
       let res = this.classList.find(f => f._id == selected);
-      this.$set(this.selectInfo, `personReq`, res.number);
+      if (res) {
+        this.$set(this.selectInfo, `personReq`, res.number);
+        this.$set(this, `classtype`, res.type);
+        this.stuSearch();
+      }
     },
     resetData() {
       this.list = [];

+ 1 - 0
src/views/train-plan/term-lesson.vue

@@ -627,6 +627,7 @@ export default {
           .then(async () => {
             let res = await this.autoArrange(planid);
             this.$checkRes(res, '排课成功', res.errmsg || '排课失败');
+            this.search();
           })
           .catch(async () => {
             console.log('已取消');