lrf 1 vuosi sitten
vanhempi
commit
abce68225d

+ 11 - 7
components/export-range.vue

@@ -9,7 +9,7 @@
         </el-select>
       </el-form-item>
       <el-form-item label="期(可选)" v-if="useterm">
-        <el-select clearable v-model="form.termid" multiple @change="selectTerm">
+        <el-select clearable v-model="form.termid" :multiple="mult" @change="selectTerm">
           <el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
         </el-select>
       </el-form-item>
@@ -55,6 +55,7 @@ export default {
     usebatch: { type: Boolean, default: true },
     useclass: { type: Boolean, default: true },
     usestudent: { type: Boolean, default: true },
+    mult: { type: Boolean, default: true },
   },
   components: {},
   data: function() {
@@ -87,12 +88,15 @@ export default {
     },
     // 找到批次列表,查询班级列表
     async selectTerm(termids = []) {
-      if (termids.length != 1) {
-        this.$set(this.form, `classid`, undefined);
-        this.$set(this.form, `batchid`, undefined);
-        return;
-      }
-      const termid = _.head(termids);
+      let termid;
+      if (this.mult) {
+        if (termids.length != 1) {
+          this.$set(this.form, `classid`, undefined);
+          this.$set(this.form, `batchid`, undefined);
+          return;
+        }
+        termid = _.head(termids);
+      } else termid = termids;
       const r = this.termList.find(f => f._id === termid);
       if (!r) return;
       const { batchnum } = r;

+ 1 - 1
layout/admin/navBar.vue

@@ -29,7 +29,7 @@
         </div>
       </div>
       <div>
-        <def-sel @refresh="toRefresh" :key="defSelKey"></def-sel>
+        <def-sel @refresh="toRefresh" :key="defSelKey" v-on="$listeners"></def-sel>
       </div>
     </el-menu>
     <el-dialog title="修改密码" :visible.sync="dialog" center @close="toClose" :destroy-on-close="true">

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

@@ -14,7 +14,7 @@
         <span>
           <!-- @change="getTermList" -->
           <el-tooltip :disabled="this.user.type != 0" content="点击更改默认年度计划" effect="dark" placement="bottom">
-            <el-select v-model="topOptions.planid" :disabled="this.user.type != 0" placeholder="未设置年度计划" size="mini" clearable>
+            <el-select v-model="topOptions.planid" :disabled="this.user.type != 0" placeholder="未设置年度计划" size="mini" clearable @change="getTermList">
               <el-option v-for="(i, index) in planList" :key="index" :label="i.title" :value="i._id"></el-option>
             </el-select>
           </el-tooltip>
@@ -30,7 +30,7 @@
         <span v-if="user.type == 1 || user.type == 3">
           <!--  @change="setVuexOpt()" -->
           <el-tooltip content="选择要查看的班级" effect="dark" placement="bottom">
-            <el-select v-model="topOptions.classid" placeholder="选择要查看的班级" size="mini" clearable>
+            <el-select v-model="topOptions.classid" placeholder="选择要查看的班级" size="mini" clearable @change="selectClass">
               <el-option v-for="(i, index) in classList" :key="index" :label="`${i.name}班`" :value="i._id"></el-option>
             </el-select>
           </el-tooltip>
@@ -86,7 +86,9 @@ export default {
       if (this.$checkRes(res)) this.$set(this, `planYearList`, res.data);
       if (!this.topOptions) return;
       const { planyearid } = this.topOptions;
-      if (planyearid) this.initPlan();
+      if (planyearid) await this.initPlan();
+      if (this.user.type === '1' || this.user.type === '3') this.useClassTemp();
+      this.$emit('defaultLoad');
     },
     async initPlan() {
       const { planyearid, planid, termid } = this.topOptions;
@@ -117,9 +119,21 @@ export default {
           ['asc']
         );
         this.$set(this, `termList`, tlist);
-        if (termid) this.initClass();
+        if (termid) await this.initClass();
       }
     },
+    getTermList(planid) {
+      const plan = this.planList.find(f => f._id === planid);
+      if (!plan) return;
+      // 找到计划了
+      const { termnum } = plan;
+      const tlist = _.orderBy(
+        termnum.map(i => ({ ...i, term: i.term * 1 })),
+        ['term'],
+        ['asc']
+      );
+      this.$set(this, `termList`, tlist);
+    },
     async initClass() {
       const { termid, classid, planid } = this.topOptions;
       let res;
@@ -156,6 +170,13 @@ export default {
       }
       sessionStorage.setItem('needInit', false);
     },
+    selectClass(id) {
+      sessionStorage.setItem('tempClassId', id);
+    },
+    useClassTemp() {
+      const classid = sessionStorage.getItem('tempClassId');
+      if (classid) this.$set(this.topOptions, `classid`, classid);
+    },
     toClear() {
       this.$set(this.topOptions, `classid`, undefined);
 
@@ -179,6 +200,7 @@ export default {
       deep: true,
       handler(val, oval) {
         this.changeOpt(val);
+        if (this.user.type === '1' || this.user.type === '3') this.useClassTemp();
       },
     },
   },

+ 1 - 1
store/experience.js

@@ -32,7 +32,7 @@ const actions = {
     return res;
   },
   async export({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.export}`, payload);
+    const res = await this.$axios.$post(`${api.export}`, payload);
     return res;
   },
 };

+ 5 - 0
store/login.js

@@ -13,6 +13,7 @@ const api = {
   connection: `/api/train/qrcode`,
   wxCheck: `/api/train/wxcheck`,
   wxLogin: `/api/train/wxlogin`,
+  openidLogin: `/api/train/openidLogin`,
 };
 const state = () => ({});
 const mutations = {};
@@ -101,6 +102,10 @@ const actions = {
     const res = await this.$axios.$get(api.userList, payload);
     return res;
   },
+  async openidLogin({ commit }, payload) {
+    let res = await this.$axios.$post(`${api.openidLogin}`, payload);
+    return res;
+  },
 };
 export default {
   namespaced: true,

+ 1 - 1
store/talented.js

@@ -31,7 +31,7 @@ const actions = {
     return res;
   },
   async export({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.export}`, payload);
+    const res = await this.$axios.$post(`${api.export}`, payload);
     return res;
   },
 };