lrf402788946 4 年之前
父節點
當前提交
8856d3d22a
共有 3 個文件被更改,包括 41 次插入3 次删除
  1. 24 2
      src/views/school/index.vue
  2. 14 1
      src/views/train-plan/class-lesson.vue
  3. 3 0
      src/views/train-plan/parts/class-table.vue

+ 24 - 2
src/views/school/index.vue

@@ -7,10 +7,12 @@
 </template>
 
 <script>
+import _ from 'lodash';
 import listFrame from '@frame/layout/admin/list-frame';
 import dataTable from '@frame/components/filter-page-table';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: school } = createNamespacedHelpers('school');
+const { mapActions: login } = createNamespacedHelpers('login');
 export default {
   name: 'index',
   props: {},
@@ -32,23 +34,37 @@ export default {
       ],
       fields: [
         { label: '学校名称', prop: 'name', filter: true },
+        { label: '学校负责人', prop: 'userName' },
+        { label: '学校负责人电话', prop: 'userMobile' },
         { label: '学校代码', prop: 'code', filter: true },
         { label: '学校地点', prop: 'address' },
         { label: '学校简称', prop: 'shortname' },
       ],
       list: [],
+      userList: [],
       total: 0,
     };
   },
-  created() {
+  async created() {
+    await this.getOtherList();
     this.search();
   },
   methods: {
+    ...login({ getUserList: 'userList' }),
     ...school(['query', 'delete']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       const res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
-        this.$set(this, `list`, res.data);
+        let { data } = res;
+        data = data.map(i => {
+          const r = this.userList.find(f => f.uid == i.id);
+          if (r) {
+            i.userName = r.name;
+            i.userMobile = r.mobile;
+          }
+          return i;
+        });
+        this.$set(this, `list`, data);
         this.$set(this, `total`, res.total);
       }
     },
@@ -62,6 +78,12 @@ export default {
       this.$checkRes(res, '删除成功', '删除失败');
       this.search();
     },
+    async getOtherList() {
+      const res = await this.getUserList({ type: '2' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `userList`, res.data);
+      }
+    },
   },
   computed: {
     ...mapState(['user']),

+ 14 - 1
src/views/train-plan/class-lesson.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="class-lesson">
     <detail-frame title="班级课表" returns="/train/plan/term/lesson">
-      <class-table ref="lesson" :classInfo="classInfo" @saveResult="getRes"></class-table>
+      <class-table ref="lesson" :classInfo="classInfo" @saveResult="getRes" @toConfirm="toConfirm"></class-table>
       <el-divider></el-divider>
       <info-class
         ref="classes"
@@ -15,6 +15,9 @@
         <el-col :span="2">
           <el-button type="primary" @click="classSave">保存</el-button>
         </el-col>
+        <el-col :span="2">
+          <el-button type="primary" @click="toStatus">确定课表</el-button>
+        </el-col>
       </el-row>
     </detail-frame>
   </div>
@@ -27,6 +30,7 @@ import classTable from './parts/class-table';
 import infoClass from './parts/class-info';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
 //info-class
 const { mapActions: location } = createNamespacedHelpers('location'); //地点
 const { mapActions: teacher } = createNamespacedHelpers('teacher'); //教师
@@ -55,6 +59,7 @@ export default {
     ...dirPlan({ dirQuery: 'getDirTeacher' }),
     ...mapDept({ getDept: 'query' }),
     ...teaplan(['findTeacher']),
+    ...lesson(['confirmLesson']),
     async getClassInfo() {
       let res = await this.fetch(this.classid);
       if (this.$checkRes(res)) {
@@ -118,6 +123,14 @@ export default {
         }
       }
     },
+    async toStatus() {
+      this.$refs.lesson.toConfirm();
+    },
+    async toConfirm(id) {
+      let lessonIds = [id];
+      const res = await this.confirmLesson(lessonIds);
+      this.$checkRes(res, '课表确定成功', res.errmsg || '课表确定失败');
+    },
   },
   watch: {
     classid: {

+ 3 - 0
src/views/train-plan/parts/class-table.vue

@@ -418,6 +418,9 @@ export default {
       }
       return fields;
     },
+    toConfirm() {
+      this.$emit('toConfirm', _.get(this.lessonInfo, `_id`));
+    },
   },
   computed: {
     ...mapState(['user']),