lrf402788946 5 년 전
부모
커밋
0c0e4b1859
2개의 변경된 파일13개의 추가작업 그리고 13개의 파일을 삭제
  1. 2 0
      src/store/index.js
  2. 11 13
      src/views/new-plan/index.vue

+ 2 - 0
src/store/index.js

@@ -9,6 +9,7 @@ import leave from '@frame/store/leave';
 import schPlan from '@frame/store/sch-plan';
 import schimport from '@frame/store/sch-import';
 import login from '@frame/store/login';
+import dirPlan from '@frame/store/dir-plan';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 Vue.use(Vuex);
@@ -24,6 +25,7 @@ export default new Vuex.Store({
     subject,
     leave,
     login,
+    dirPlan,
   },
   state: { ...ustate },
   mutations: { ...umutations },

+ 11 - 13
src/views/new-plan/index.vue

@@ -7,9 +7,9 @@
       <data-form :data="info" :fields="Ffields" :rules="rules" @save="handleSave" :isNew="!info.id" :styles="{ padding: 0 }" labelWidth="80px" :reset="false">
         <template #custom="{item,form}">
           <template v-if="item.model == 'daterange'">
-            <el-select v-model="form[item.model]" multiple @change="toSort">
-              <el-option v-for="i in 12" :key="i" :label="`${i}月`" :value="i"></el-option>
-            </el-select>
+            <el-checkbox-group v-model="form[item.model]">
+              <el-checkbox v-for="i in 12" :key="i" :label="`${i}`">{{ i }}月</el-checkbox>
+            </el-checkbox-group>
           </template>
         </template>
       </data-form>
@@ -26,7 +26,7 @@ import dataTable from '@frame/components/data-table';
 import dataForm from '@frame/components/form';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
-const { mapActions: dirPlan } = createNamespacedHelpers('dirPlan');
+const { mapActions: schPlan } = createNamespacedHelpers('schPlan');
 export default {
   name: 'index',
   props: {},
@@ -45,12 +45,12 @@ export default {
         { label: '年度', prop: 'year' },
         { label: '标题', prop: 'title' },
       ],
-      info: {},
+      info: { daterange: [] },
       form: {},
       Ffields: [
         { label: '年度', model: 'year', type: 'text' },
         { label: '标题', model: 'title', type: 'text' },
-        { label: '请假日期', model: 'nodate', custom: true },
+        { label: '请假日期', model: 'daterange', custom: true },
       ],
       rules: {},
       list: [],
@@ -61,8 +61,8 @@ export default {
     this.search();
   },
   methods: {
-    ...dirPlan({ dirQuery: 'query', dirCreatPlan: 'create', dirUpdatePlan: 'update' }),
     ...trainplan(['query', 'create', 'delete', 'update']),
+    ...schPlan({ schPlanQuery: 'query', createSchPlan: 'create', updateSchPlan: 'update' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       const res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
@@ -71,13 +71,12 @@ export default {
       }
     },
     async toEdit({ data }) {
-      let res = await this.dirQuery({ trainplanid: data.id, headteacherid: this.user.userid });
+      let res = await this.schPlanQuery({ planid: data.id, schid: _.get(this.user, 'code', '99991') });
       let { year, id, title } = data;
-      let plan = { schid: this.user.code, year, planid: id, title };
+      let plan = { schid: this.user.code, year, planid: id, title, daterange: [] };
       this.$set(this, `info`, plan);
       if (this.$checkRes(res)) {
-        let daterange = JSON.parse(res.data[0].daterange);
-        if (res.data.length > 0) this.$set(this, `info`, { ...res.data[0], daterange, title });
+        if (res.data.length > 0) this.$set(this, `info`, { ...res.data[0], title });
       }
       this.dialog = true;
     },
@@ -85,7 +84,6 @@ export default {
       let res;
       let msg;
       let duplicate = JSON.parse(JSON.stringify(data));
-      duplicate.daterange = JSON.stringify(duplicate.daterange);
       if (isNew) {
         //create
         res = await this.createSchPlan(duplicate);
@@ -101,7 +99,7 @@ export default {
     },
     handleClose() {
       this.dialog = false;
-      this.info = {};
+      this.info = { daterange: [] };
     },
     toSort() {
       this.info.daterange.sort((a, b) => a - b);