浏览代码

选择下啦修改

wolyshaw 4 年之前
父节点
当前提交
49608a38b5
共有 2 个文件被更改,包括 45 次插入25 次删除
  1. 27 2
      src/store/modules/selects.js
  2. 18 23
      src/views/teamDetail/teamCourseList.vue

+ 27 - 2
src/store/modules/selects.js

@@ -1,6 +1,7 @@
 /* eslint-disable no-empty */
 import { branchQueryPage } from '@/api/specialSetting'
-import { getSubject } from '@/api/buildTeam'
+import { getSubject, getTeacher } from '@/api/buildTeam'
+import { getSchool } from '@/api/systemManage'
 
 /**
  *
@@ -17,6 +18,8 @@ export default {
   state: {
     branchs: [],
     subjects: [],
+    teachers: [],
+    schools: [],
   },
   mutations: {
     commit_branchs: (state, branchs) => {
@@ -25,6 +28,12 @@ export default {
     commit_subjects: (state, subjects) => {
       state.subjects = subjects
     },
+    commit_teachers: (state, teachers) => {
+      state.teachers = teachers
+    },
+    commit_schools: (state, schools) => {
+      state.schools = schools
+    },
   },
   actions: {
     async setBranchs ({ commit, state }, force) {
@@ -42,6 +51,22 @@ export default {
           commit('commit_subjects', res.data)
         } catch (error) { }
       }
-    }
+    },
+    async setTeachers ({ commit, state }, force) {
+      if (!state.subjects.length || force === true) {
+        try {
+          const res = await getTeacher()
+          commit('commit_teachers', res.data)
+        } catch (error) { }
+      }
+    },
+    async setSchools ({ commit, state }, force) {
+      if (!state.subjects.length || force === true) {
+        try {
+          const res = await getSchool()
+          commit('commit_schools', res.data)
+        } catch (error) { }
+      }
+    },
   }
 }

+ 18 - 23
src/views/teamDetail/teamCourseList.vue

@@ -19,7 +19,7 @@
                      clearable
                      filterable
                      placeholder="请选择教学点">
-            <el-option v-for="(item, index) in schoolList"
+            <el-option v-for="(item, index) in selects.schools"
                        :key="index"
                        :value="item.id"
                        :label="item.name"></el-option>
@@ -30,7 +30,7 @@
                      clearable
                      filterable
                      placeholder="请选择老师">
-            <el-option v-for="(item, index) in teacherList"
+            <el-option v-for="(item, index) in selects.teachers"
                        :key="index"
                        :value="item.id"
                        :label="item.realName"></el-option>
@@ -220,6 +220,17 @@
             </template>
           </el-table-column> -->
           <el-table-column align="center"
+                           prop="isLock"
+                           label="是否冻结">
+            <template slot-scope="scope">{{ scope.row.isLock ? '是' : '否' }}</template>
+          </el-table-column>
+          <el-table-column align="center"
+                           prop="newCourseId"
+                           label="是否被合并"
+                           width="130px">
+            <template slot-scope="scope">{{ scope.row.newCourseId > 0 ? '是' : '否' }}</template>
+          </el-table-column>
+          <el-table-column align="center"
                            prop="isCallNames"
                            label="是否点名"
                            fixed="right">
@@ -258,11 +269,12 @@
             </template>
           </el-table-column>
         </el-table>
-        <pagination :total="rules.total"
+        <pagination :total.sync="rules.total"
                     :page.sync="rules.page"
                     :limit.sync="rules.limit"
                     :page-sizes="rules.page_size"
-                    @pagination="getList" />
+                    @pagination="getList"
+                    sync />
       </div>
     </div>
     <el-dialog title="课表详情"
@@ -491,30 +503,13 @@ export default {
   },
   mounted () {
     this.$store.dispatch('setBranchs')
+    this.$store.dispatch('setTeachers')
+    this.$store.dispatch('setSchools')
     this.init();
   },
   methods: {
     init () {
       this.getList();
-      // 获取所有老师
-      getTeacher().then(res => {
-        if (res.code == 200) {
-          this.teacherList = res.data;
-        }
-      });
-
-      // 获取教学点
-      getSchool().then(res => {
-        if (res.code == 200) {
-          this.schoolList = res.data;
-        }
-      });
-
-      // getEmployeeOrgan().then(res => {
-      //   if (res.code == 200) {
-      //     this.organList = res.data;
-      //   }
-      // });
     },
     permission (str, parent) {
       return permission(str, parent);