reloaded 5 gadi atpakaļ
vecāks
revīzija
ca6d48911d

+ 1 - 0
src/router/index.js

@@ -129,6 +129,7 @@ const router = new VueRouter({
 });
 router.beforeEach((to, form, next) => {
   store.commit('setUser');
+  store.dispatch('setting/checkCache');
   if (to.name === 'login') {
     next();
     return;

+ 8 - 2
src/store/index.js

@@ -12,10 +12,14 @@ import login from '@frame/store/login';
 import count from '@frame/store/count';
 import dirPlan from '@frame/store/dir-plan';
 import attendance from '@frame/store/attendance';
+import setting from '@frame/store/setting';
+import trainBatch from '@frame/store/train-plan-year';
 
 import util from '@frame/store/util';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
+import * as dostate from '@frame/store/setting/state';
+import * as domutations from '@frame/store/setting/mutations';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -33,8 +37,10 @@ export default new Vuex.Store({
     util,
     attendance, //考勤
     count,
+    setting,
+    trainBatch,
   },
-  state: { ...ustate },
-  mutations: { ...umutations },
+  state: { ...ustate, ...dostate },
+  mutations: { ...umutations, ...domutations },
   actions: {},
 });

+ 2 - 5
src/views/kaoqin/index.vue

@@ -102,7 +102,7 @@ export default {
   created() {
     this.searchinfo();
   },
-  computed: { ...mapState(['user']) },
+  computed: { ...mapState(['user', 'defaultOption']) },
   methods: {
     ...mapActions(['query', 'delete']),
     ...student({ stuquery: 'query' }),
@@ -110,7 +110,7 @@ export default {
     ...util({ fetchUtil: 'fetch' }),
     ...classes({ classesquery: 'query' }),
     async searchinfo() {
-      // let stuid = this.user.id;
+      let stuid = this.user.id;
       const res = await this.schPlanquery();
       this.$set(this, `planList`, res.data);
     },
@@ -135,9 +135,6 @@ export default {
 
     async onsearch({ skip = 0, limit = 10, ...info } = {}) {
       const res = await this.query({ skip, termid: this.form.termid, classid: this.form.classid, limit, ...info });
-
-      console.log(res.data);
-
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);

+ 7 - 1
src/views/leave/index.vue

@@ -61,7 +61,7 @@ export default {
     this.search();
   },
   computed: {
-    ...mapState(['user']),
+    ...mapState(['user', 'defaultOption']),
     mainTitle() {
       let meta = this.$route.meta;
       let main = meta.title || '';
@@ -78,6 +78,12 @@ export default {
     ...mapActions(['query', 'delete', 'update']),
     ...student({ allRequest: 'mergeRequest' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
+      if (this.defaultOption.termid) {
+        info = { termid: this.defaultOption.termid };
+      }
+      if (!this.defaultOption.termid && this.defaultOption.planid) {
+        info = { termid: this.defaultOption.planid };
+      }
       const res = await this.query({ skip, limit, ...info, schid: this.user.code });
       if (this.$checkRes(res)) {
         let studs = await this.allRequest({ method: 'fetch', data: _.uniq(res.data.map(i => i.studentid)) });

+ 2 - 1
src/views/new-plan/index.vue

@@ -69,6 +69,7 @@ export default {
     ...trainplan(['query', 'create', 'delete', 'update']),
     ...schPlan({ schPlanQuery: 'query', createSchPlan: 'create', updateSchPlan: 'update' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
+      info = { planyearid: this.defaultOption.planyearid };
       const res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
@@ -114,7 +115,7 @@ export default {
     },
   },
   computed: {
-    ...mapState(['user']),
+    ...mapState(['user', 'defaultOption']),
     pageTitle() {
       return `${this.$route.meta.title}`;
     },