lrf402788946 5 anni fa
parent
commit
713460512c
3 ha cambiato i file con 91 aggiunte e 86 eliminazioni
  1. 64 83
      config/menu-config.js
  2. 1 1
      layout/admin/admin-menu.vue
  3. 26 2
      layout/admin/navBar/default-select.vue

+ 64 - 83
config/menu-config.js

@@ -1,4 +1,66 @@
-export const center = [
+export const school = [
+  // {
+  //   path: '',
+  //   name: '测试',
+  //   module: 'school',
+  //   children: [
+  //     {
+  //       path: '/list',
+  //       name: '测试列表',
+  //     },
+  //     {
+  //       path: '/detail',
+  //       name: '测试详情',
+  //     },
+  //   ],
+  // },
+  {
+    path: '/plan/index',
+    name: '计划管理', //上报名单
+    module: 'school',
+  },
+  {
+    path: '/newPlan/index',
+    name: '新计划管理', //上报名单
+    module: 'school',
+  },
+  {
+    path: '/teacher/index',
+    name: '教师确认',
+    module: 'school',
+  },
+  {
+    path: '/leave/index',
+    name: '请假管理',
+    module: 'school',
+  },
+
+  {
+    path: '/kaoqin/index',
+    name: '考勤管理',
+    module: 'school',
+  },
+];
+export const director = [
+  {
+    path: '/newPlan/index',
+    name: '计划管理', //上报名单
+    module: 'director',
+  },
+  // {
+  //   path: '/classes/index',
+  //   name: '班级管理',
+  //   module: 'director',
+  // },
+];
+export const teacher = [
+  {
+    path: '/plan/index',
+    name: '查看计划', //上报名单
+    module: 'teacher',
+  },
+];
+export const menu = [
   {
     //选择年度,期数,班级
     path: '/',
@@ -125,6 +187,7 @@ export const center = [
       },
     ],
   },
+  ...director,
   {
     //班主任只有这个
     path: '',
@@ -203,85 +266,3 @@ export const center = [
     module: 'center',
   },
 ];
-export const school = [
-  {
-    path: '',
-    name: '测试',
-    module: 'school',
-    children: [
-      {
-        path: '/list',
-        name: '测试列表',
-      },
-      {
-        path: '/detail',
-        name: '测试详情',
-      },
-    ],
-  },
-  {
-    path: '/plan/index',
-    name: '计划管理', //上报名单
-    module: 'school',
-  },
-  {
-    path: '/newPlan/index',
-    name: '新计划管理', //上报名单
-    module: 'school',
-  },
-  {
-    path: '/teacher/index',
-    name: '教师确认',
-    module: 'school',
-  },
-  {
-    path: '/leave/index',
-    name: '请假管理',
-    module: 'school',
-  },
-
-  {
-    path: '/kaoqin/index',
-    name: '考勤管理',
-    module: 'school',
-  },
-];
-export const director = [
-  {
-    path: '',
-    name: '测试',
-    module: 'director',
-    children: [
-      {
-        path: '/list',
-        name: '测试列表',
-      },
-      {
-        path: '/detail',
-        name: '测试详情',
-      },
-    ],
-  },
-  {
-    path: '/plan/index',
-    name: '计划管理', //上报名单
-    module: 'director',
-  },
-  {
-    path: '/newPlan/index',
-    name: '新计划管理', //上报名单
-    module: 'director',
-  },
-  {
-    path: '/classes/index',
-    name: '班级管理',
-    module: 'director',
-  },
-];
-export const teacher = [
-  {
-    path: '/plan/index',
-    name: '查看计划', //上报名单
-    module: 'teacher',
-  },
-];

+ 1 - 1
layout/admin/admin-menu.vue

@@ -53,7 +53,7 @@ export default {
     },
   },
   mounted() {
-    let arr = _.get(menus, this.project_modules, []);
+    let arr = _.get(menus, 'menu', []); //this.project_modules
     let r = this.filterMenu(_.cloneDeep(arr), this.project_modules);
     this.$set(this, `menu`, r);
   },

+ 26 - 2
layout/admin/navBar/default-select.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="default-select">
     <el-row type="flex" align="middle" justify="start" class="user-menu" v-loading="loading">
-      <el-col :span="12" v-if="options">
+      <el-col :span="15" v-if="options">
         当前默认:
         <span>
           <el-tooltip :disabled="this.user.type != 0" content="点击更改默认批次" effect="dark" placement="bottom">
@@ -25,11 +25,18 @@
         </span>
         <span>
           <el-tooltip content="点击更改默认期" effect="dark" placement="bottom">
-            <el-select v-model="options.termid" placeholder="未设置默认期" size="mini" @change="setVuexOpt()">
+            <el-select v-model="options.termid" placeholder="未设置默认期" size="mini" @change="toCheckUserType()">
               <el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
             </el-select>
           </el-tooltip>
         </span>
+        <span v-if="user.type == 1">
+          <el-tooltip content="选择要查看的班级" effect="dark" placement="bottom">
+            <el-select v-model="options.classid" placeholder="选择要查看的班级" size="mini" @change="setVuexOpt()">
+              <el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i._id"></el-option>
+            </el-select>
+          </el-tooltip>
+        </span>
         <span>
           <el-button type="text" size="mini" @click="settingSave" v-if="this.user.type == 0">保存默认值</el-button>
         </span>
@@ -44,6 +51,7 @@ import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
 const { mapActions: trainBatch } = createNamespacedHelpers('trainBatch');
 const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 const { mapActions: setting } = createNamespacedHelpers('setting');
+const { mapActions: classes } = createNamespacedHelpers('classes');
 export default {
   name: 'default-select',
   props: {},
@@ -55,12 +63,14 @@ export default {
       planYearList: [],
       planList: [],
       termList: [],
+      classList: [],
     };
   },
   async created() {
     // this.$set(this, `options`, _.cloneDeep(this.defaultOption));
     this.search({ type: 'planYear' });
     this.checkOption();
+    if (this.user.type == 1) this.getClassOption();
     this.loading = false;
   },
   methods: {
@@ -68,6 +78,7 @@ export default {
     ...trainBatch({ getplanYear: 'query' }),
     ...trainplan({ getplan: 'query' }),
     ...setting({ sFetch: 'fetch', sUpdate: 'update' }),
+    ...classes({ getClassList: 'query' }), //仅供班主任使用
     async search({ type, ...info }) {
       let res = await _.get(this, `get${type}`)({ ...info });
       if (this.$checkRes(res)) {
@@ -103,6 +114,12 @@ export default {
       }
       this.setVuexOpt();
     },
+    //为了处理班主任的班级列表,先复制,再看看是不是需要查询班级列表
+    toCheckUserType() {
+      this.setVuexOpt();
+      this.options.classid = undefined;
+      if (this.user.type == 1) this.getClassOption();
+    },
     setVuexOpt() {
       this.changeOpt(this.options);
     },
@@ -122,6 +139,13 @@ export default {
       let res = await this.sUpdate(this.options);
       this.$checkRes(res, '设置成功', res.errmsg);
     },
+    //班主任使用,默认班级
+    async getClassOption() {
+      let termid = _.get(this.defaultOption, 'termid');
+      if (!termid) return;
+      let res = await this.getClassList({ termid: this.defaultOption.termid, headteacherid: this.user.userid });
+      if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
+    },
   },
   watch: {
     defaultOption: {