|
@@ -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);
|