wuhongyuq vor 5 Jahren
Ursprung
Commit
503a80c866

BIN
src/assets/timg.jpg


+ 3 - 0
src/store/index.js

@@ -11,6 +11,8 @@ import subject from './subject';
 import question from './question';
 import questionnaire from './questionnaire';
 import teacher from './teacher';
+import trainplan from './trainplan';
+
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -26,6 +28,7 @@ export default new Vuex.Store({
     question,
     questionnaire,
     teacher,
+    trainplan,
   },
   state: {},
   mutations: {},

+ 38 - 0
src/store/trainplan.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  interface: `/api/train/trainplan`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.interface}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 7 - 4
src/views/certificaate/look.vue

@@ -26,10 +26,9 @@
           ><el-col :span="2"></el-col>{{ zhengshuList.years }}年<el-col :span="2"> </el-col>{{ zhengshuList.morths }}月<el-col :span="2"> </el-col>
           {{ zhengshuList.datas }}日
         </el-col>
-
-        <el-col>
-          <button size="mini">打印证书</button>
-        </el-col>
+      </el-col>
+      <el-col :span="24" class="anniu">
+        <button size="mini">打印证书</button>
       </el-col>
     </el-col>
   </div>
@@ -173,6 +172,7 @@ export default {
 .info_1 {
   padding: 0 20px 0 20px;
 }
+// background-image: url(assets/timg.jpg);
 .title {
   font-size: 20px;
   font-weight: 700;
@@ -201,4 +201,7 @@ export default {
 .zhuanye {
   text-align: center;
 }
+.anniu {
+  padding: 30px 0 0 0;
+}
 </style>

+ 2 - 1
src/views/classes/detail.vue

@@ -25,7 +25,7 @@ export default {
     fields: [
       { label: '班级名称', required: true, model: 'name' },
       { label: '人数', required: true, model: 'number' },
-      { label: '批次', required: true, model: 'batch' },
+      { label: '批次', required: true, model: 'batch', type: 'select' },
     ],
     rules: {
       name: [{ required: true, message: '请输入班级名称' }],
@@ -72,6 +72,7 @@ export default {
     async handleSave({ isNew, data }) {
       let res;
       let msg;
+      console.log(isNew);
       if (isNew) {
         res = await this.create(data);
         console.log(res);

+ 34 - 79
src/views/plan/detail.vue

@@ -4,8 +4,8 @@
       <el-row :gutter="10" type="flex">
         <el-col :span="12">
           <el-card header="全年计划信息">
-            <el-form :model="info" :rules="rules" label-width="60px" size="small" @submit.native.prevent>
-              <el-form-item label="年份">
+            <el-form :model="info" :rules="rules" :isNew="isNew" label-width="60px" size="small" @submit.native.prevent>
+              <el-form-item label="年份" required>
                 {{ info.year }}
               </el-form-item>
               <el-form-item label="标题" prop="title" required>
@@ -77,6 +77,7 @@ import calendar from '@frame/components/calendar';
 import dataTable from '@frame/components/data-table';
 import _ from 'lodash';
 import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: mapClass } = createNamespacedHelpers('trainplan');
 export default {
   metaInfo: { title: '计划详情' },
   name: 'detail',
@@ -129,87 +130,21 @@ export default {
       termnum: [
         {
           term: '1',
-          batchnum: [
-            {
-              start: '2020-01-01',
-              end: '2020-01-09',
-              type: '0',
-              number: '56',
-              color: '#0BEB95',
-              batch: '1',
-              class: '1',
-              title: '第1期第1批次',
-              id: 'p1580869239498',
-            },
-            {
-              start: '2020-01-01',
-              end: '2020-01-09',
-              type: '1',
-              number: '56',
-              color: '#409EFF',
-              name: '第一期特殊1班',
-              title: '第一期特殊1班',
-              id: 'p1580869422724',
-            },
-          ],
+          batchnum: [],
           classnum: 2,
         },
         {
           term: '2',
-          batchnum: [
-            {
-              start: '2020-01-01',
-              end: '2020-01-09',
-              type: '0',
-              number: '56',
-              color: '#0BEB95',
-              batch: '1',
-              class: '1',
-              title: '第2期第1批次',
-              id: 'p1580869239490',
-            },
-            {
-              start: '2020-01-01',
-              end: '2020-01-09',
-              type: '1',
-              number: '56',
-              color: '#409EFF',
-              name: '第二期特殊1班',
-              title: '第二期特殊1班',
-              id: 'p1580869422726',
-            },
-            {
-              start: '2020-01-01',
-              end: '2020-01-09',
-              type: '1',
-              number: '56',
-              color: '#409EFF',
-              name: '第二期特殊2班',
-              title: '第二期特殊2班',
-              id: 'p1580869422725',
-            },
-          ],
+          batchnum: [],
           classnum: 3,
         },
         {
           term: '3',
-          batchnum: [
-            {
-              start: '2020-01-01',
-              end: '2020-01-09',
-              type: '0',
-              number: '56',
-              color: '#ff4444',
-              batch: '1',
-              class: '1',
-              title: '第3期第1批次',
-              id: 'p1580869239499',
-            },
-          ],
+          batchnum: [],
           classnum: 1,
         },
       ],
-      title: 'test',
+      title: '',
       year: 2020,
     },
   }),
@@ -218,12 +153,15 @@ export default {
   },
   mounted() {},
   methods: {
+    ...mapClass(['fetch', 'create', 'update']),
     // ...mapClass(['fetch', 'create', 'update']),
     //查询计划
     async search() {
-      // const res = await this.fetch(this.id);
-      // if (this.$checkRes(res)) this.$set(this, `info`, res.data);
-      // this.loading = false;
+      const res = await this.fetch(this.id);
+
+      if (this.$checkRes(res)) this.$set(this, `info`, res.data);
+
+      this.loading = false;
       let events = [];
       events = _.flatten(
         this.axiosData.termnum.map(item => {
@@ -234,8 +172,11 @@ export default {
           return item.batchnum;
         })
       );
+      console.log(events);
       let { termnum, year, title } = this.axiosData;
+
       this.$set(this, `events`, events);
+
       this.$set(this, `info`, { title, year });
     },
     //拖拽选择事件
@@ -264,10 +205,13 @@ export default {
       this.events.splice(index, 1);
     },
     //保存计划事件
-    savePlan() {
+    savePlan({ isNew }) {
       //全年计划内容
+
       let data = JSON.parse(JSON.stringify(this.info));
-      data.year = this.year;
+
+      data.year = this.info.year;
+      console.log(data.year);
       let termnum = [];
       //1,获取所有期数
       //2,按期数将events内数据分组
@@ -281,7 +225,18 @@ export default {
         return object;
       });
       data.termnum = termnum;
-      //TODO 连接接口
+      let res;
+      let msg;
+      console.log(this.isNew);
+      if (this.isNew) {
+        res = this.create(data);
+        console.log(data);
+        msg = `${this.keyWord}添加成功`;
+      } else {
+        res = this.update(data);
+        msg = `${this.keyWord}修改成功`;
+      }
+      if (this.$checkRes(res, msg)) this.$router.push({ path: '/plan/index' });
     },
     //保存表单函数
     saveForm() {
@@ -356,7 +311,7 @@ export default {
       return this.$route.query.id;
     },
     isNew() {
-      return this.$route.query.id ? true : false; //false : true;
+      return this.$route.query.id ? false : true; //false : true;
     },
     mainTitle() {
       let meta = this.$route.meta;

+ 5 - 4
src/views/plan/index.vue

@@ -10,7 +10,7 @@
 import listFrame from '@frame/layout/admin/list-frame';
 import dataTable from '@frame/components/data-table';
 import { createNamespacedHelpers } from 'vuex';
-const { mapActions } = createNamespacedHelpers('dept');
+const { mapActions } = createNamespacedHelpers('trainplan');
 export default {
   metaInfo: { title: '计划管理' },
   name: 'index',
@@ -40,7 +40,7 @@ export default {
       // },
     ],
     fields: [
-      { label: '计划标题', prop: 'name' },
+      { label: '计划标题', prop: 'title' },
       { label: '年度', prop: 'year' },
       { label: '状态', prop: 'status' },
     ],
@@ -48,7 +48,7 @@ export default {
     total: 0,
   }),
   created() {
-    // this.search();
+    this.search();
   },
   methods: {
     ...mapActions(['query', 'delete']),
@@ -57,10 +57,11 @@ export default {
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
+        console.log(res.data);
       }
     },
     toEdit({ data }) {
-      this.$router.push({ path: '/dept/detail', query: { id: data.id } });
+      this.$router.push({ path: '/plan/detail', query: { id: data.id } });
     },
     async toDelete({ data }) {
       const res = await this.delete(data.id);