|
@@ -8,7 +8,7 @@
|
|
|
<template #custom="{item,form}">
|
|
|
<template v-if="item.model == 'daterange'">
|
|
|
<el-checkbox-group v-model="form[item.model]">
|
|
|
- <el-checkbox v-for="i in 12" :key="i" :label="`${i}`">{{ i }}月</el-checkbox>
|
|
|
+ <el-checkbox v-for="i in 12" :key="i" :label="`${i}`" :disabled="inRange(i)">{{ i }}月</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</template>
|
|
|
</template>
|
|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
<script>
|
|
|
var moment = require('moment');
|
|
|
+moment.locale('zh-cn');
|
|
|
import _ from 'lodash';
|
|
|
import Vue from 'vue';
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
@@ -55,11 +56,14 @@ export default {
|
|
|
Ffields: [
|
|
|
{ label: '年度', model: 'year', type: 'text' },
|
|
|
{ label: '标题', model: 'title', type: 'text' },
|
|
|
+ { label: '时间范围', model: 'planrange', type: 'text' },
|
|
|
{ label: '请假日期', model: 'daterange', custom: true },
|
|
|
],
|
|
|
rules: {},
|
|
|
list: [],
|
|
|
total: 0,
|
|
|
+ startmonth: 1,
|
|
|
+ endmonth: 12,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -77,13 +81,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async toEdit({ data }) {
|
|
|
- let res = await this.schPlanQuery({ planid: data.id, schid: _.get(this.user, 'code', '99991') });
|
|
|
- let { year, id, title } = data;
|
|
|
+ let res = await this.schPlanQuery({ planid: data.id, schid: _.get(this.user, 'code') });
|
|
|
+ let { year, id, title, termnum } = data;
|
|
|
let plan = { schid: this.user.code, year, planid: id, title, daterange: [] };
|
|
|
this.$set(this, `info`, plan);
|
|
|
if (this.$checkRes(res)) {
|
|
|
if (res.data.length > 0) this.$set(this, `info`, { ...res.data[0], title });
|
|
|
}
|
|
|
+ if (termnum) {
|
|
|
+ let mid = termnum.map(i => i.batchnum).flat();
|
|
|
+ let start = _.get(_.head(_.orderBy(mid, 'startdate', 'asc')), 'startdate');
|
|
|
+ let end = _.get(_.head(_.orderBy(mid, 'enddate', 'desc')), 'enddate');
|
|
|
+ let planrange = `${start} 至 ${end}`;
|
|
|
+ this.$set(this, `info`, { ...this.info, planrange });
|
|
|
+ let sm = moment(start).month() + 1;
|
|
|
+ let em = moment(end).month() + 1;
|
|
|
+ this.$set(this, `startmonth`, sm);
|
|
|
+ this.$set(this, `endmonth`, em);
|
|
|
+ }
|
|
|
this.dialog = true;
|
|
|
},
|
|
|
async handleSave({ data, isNew }) {
|
|
@@ -106,6 +121,8 @@ export default {
|
|
|
handleClose() {
|
|
|
this.dialog = false;
|
|
|
this.info = { daterange: [] };
|
|
|
+ this.$set(this, `startmonth`, 1);
|
|
|
+ this.$set(this, `endmonth`, 12);
|
|
|
},
|
|
|
toSort() {
|
|
|
this.info.daterange.sort((a, b) => a - b);
|
|
@@ -113,6 +130,9 @@ export default {
|
|
|
toArrange({ data }) {
|
|
|
this.$router.push({ path: './detail', query: { id: data.id } });
|
|
|
},
|
|
|
+ inRange(val) {
|
|
|
+ return !_.inRange(val, this.startmonth, this.endmonth + 1);
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user', 'defaultOption']),
|