|
@@ -22,34 +22,55 @@
|
|
|
<div class="showDateDay">{{ date | dateNewType }}</div>
|
|
|
<div class="schedulingUser">
|
|
|
<template v-for="(item, index) in calendarData">
|
|
|
- <div :key="index" v-if="data.day == item.partrolDate" @click="add(data, item)">
|
|
|
+ <div :key="index" v-if="data.day == item.partrolDate" class="222">
|
|
|
<template v-for="itx in item.rosterUserDtos">
|
|
|
<div :key="itx" class="listTime">
|
|
|
<span>{{ itx.partrolTime }}</span>
|
|
|
<span>{{ itx.partolName }}</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <template
|
|
|
+ v-if="
|
|
|
+ date.getTime() <= $moment($parent.thisObj.endDate).valueOf() &&
|
|
|
+ date.getTime() >= $moment(new Date()).valueOf()
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <!-- 每周那几天 -->
|
|
|
+ <span v-if="thisObj.periodType == 1">
|
|
|
+ <template v-if="periodValueType(thisObj.periodValue).includes(date.getDay() + '')">
|
|
|
+ <div class="pointSet" @click="addItem(date, data, item)">点击设置</div>
|
|
|
+ </template>
|
|
|
+ </span>
|
|
|
+ <!-- 每隔N天 -->
|
|
|
+ <span v-else>
|
|
|
+ <template v-if="timeAddDay($parent.thisObj, thisObj.periodValue, data)">
|
|
|
+ <div class="pointSet" @click="addItem(date, data, item)">点击设置</div>
|
|
|
+ </template>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <!-- <div
|
|
|
- class="pointSet"
|
|
|
+ <!-- 时间范围内且没有排班 -->
|
|
|
+ <template
|
|
|
v-if="
|
|
|
date.getTime() <= $moment($parent.thisObj.endDate).valueOf() &&
|
|
|
- date.getTime() >= new Date(new Date().toLocaleDateString()).getTime() &&
|
|
|
+ date.getTime() >= $moment(new Date()).valueOf() &&
|
|
|
!trueArr.includes(data.day)
|
|
|
"
|
|
|
- @click="add(data)"
|
|
|
- > -->
|
|
|
- <div
|
|
|
- class="pointSet"
|
|
|
- v-if="
|
|
|
- date.getTime() <= $moment($parent.thisObj.endDate).valueOf() &&
|
|
|
- date.getTime() >= new Date(new Date().toLocaleDateString()).getTime()
|
|
|
- "
|
|
|
- @click="add(data)"
|
|
|
>
|
|
|
- 点击设置
|
|
|
- </div>
|
|
|
+ <!-- 每周那几天 -->
|
|
|
+ <span v-if="thisObj.periodType == 1">
|
|
|
+ <template v-if="periodValueType(thisObj.periodValue).includes(date.getDay() + '')">
|
|
|
+ <div class="pointSet" @click="add(data)">点击设置</div>
|
|
|
+ </template>
|
|
|
+ </span>
|
|
|
+ <!-- 每隔N天 -->
|
|
|
+ <span v-else>
|
|
|
+ <template v-if="timeAddDay($parent.thisObj, thisObj.periodValue, data)">
|
|
|
+ <div class="pointSet" @click="add(data)">点击设置</div>
|
|
|
+ </template>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-calendar>
|
|
@@ -63,6 +84,7 @@ export default {
|
|
|
findUser: [],
|
|
|
thisObj: {},
|
|
|
calendarData: [],
|
|
|
+ indexThis: 0,
|
|
|
trueArr: [] //已有设置时间集合
|
|
|
};
|
|
|
},
|
|
@@ -85,17 +107,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- add(dateDe, onj) {
|
|
|
+ add(dateDe) {
|
|
|
let title = '排班',
|
|
|
isSingle = true;
|
|
|
- if (dateDe == undefined && onj == undefined) {
|
|
|
+ if (dateDe == undefined) {
|
|
|
title = '批量排班';
|
|
|
isSingle = false;
|
|
|
}
|
|
|
- if (dateDe !== undefined && onj !== undefined) {
|
|
|
- new Date(dateDe).getTime() >= new Date(new Date().toLocaleDateString()).getTime();
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
new Promise((resolve) => {
|
|
|
this.$store.dispatch('addPopup', {
|
|
|
url: '/patrolManagement/popups/schedulingAdd.vue',
|
|
@@ -105,7 +124,6 @@ export default {
|
|
|
callback: resolve,
|
|
|
findUser: this.findUser,
|
|
|
dateDe,
|
|
|
- onj,
|
|
|
thisObj: this.thisObj,
|
|
|
isSingle: isSingle
|
|
|
},
|
|
@@ -122,6 +140,37 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ addItem(da, dateDe, onj) {
|
|
|
+ if (da.getTime() <= this.$moment(new Date()).valueOf()) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ new Promise((resolve) => {
|
|
|
+ this.$store.dispatch('addPopup', {
|
|
|
+ url: '/patrolManagement/popups/schedulingAdd.vue',
|
|
|
+ width: '450px',
|
|
|
+ height: '300px',
|
|
|
+ props: {
|
|
|
+ callback: resolve,
|
|
|
+ findUser: this.findUser,
|
|
|
+ dateDe,
|
|
|
+ onj,
|
|
|
+ thisObj: this.thisObj,
|
|
|
+ isSingle: true
|
|
|
+ },
|
|
|
+ title: '排班'
|
|
|
+ });
|
|
|
+ }).then(() => {
|
|
|
+ let newTime = this.$moment(this.monthValue).format('YYYY-MM-DD');
|
|
|
+ let timeArr = newTime.split('-');
|
|
|
+ let time = new Date(timeArr[0], Number(timeArr[1]), 0);
|
|
|
+ this.getShiftInformation({
|
|
|
+ patrolRouteId: this.thisObj.id,
|
|
|
+ startTime: `${timeArr[0]}-${timeArr[1]}-01`,
|
|
|
+ endTime: `${timeArr[0]}-${timeArr[1]}-${time.getDate()}`
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
goback() {
|
|
|
this.$emit('initPage');
|
|
|
},
|
|
@@ -138,7 +187,8 @@ export default {
|
|
|
data[inx].map((item) => {
|
|
|
rosterUserDtos.push({
|
|
|
partrolTime: item.patrolTime,
|
|
|
- partolName: item.partolName
|
|
|
+ partolName: item.partolName,
|
|
|
+ patrolUserId: item.patrolUserId
|
|
|
});
|
|
|
});
|
|
|
trueArr.push(this.$moment(inx).format('YYYY-MM-DD'));
|
|
@@ -149,8 +199,38 @@ export default {
|
|
|
}
|
|
|
this.calendarData = calendarData;
|
|
|
this.trueArr = trueArr;
|
|
|
+ this.indexThis = 0;
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ periodValueType(value) {
|
|
|
+ if (!!value) {
|
|
|
+ return value.split(',').sort();
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+ },
|
|
|
+ timeAddDay(val, sunDay, d) {
|
|
|
+ let sum = sunDay || 0;
|
|
|
+ let bb = false;
|
|
|
+ if (!!val && !!sunDay) {
|
|
|
+ if (this.indexThis <= 30) {
|
|
|
+ this.indexThis++;
|
|
|
+ }
|
|
|
+ let { startDate } = val;
|
|
|
+ let thisD = this.$moment(d.day + ' 00:00:00').valueOf();
|
|
|
+ if (this.thisTimeTypeShow(this.$moment(startDate).valueOf(), sum).includes(thisD)) {
|
|
|
+ bb = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return bb;
|
|
|
+ },
|
|
|
+ thisTimeTypeShow(kai, sum) {
|
|
|
+ let oneDay = 86400000,
|
|
|
+ indU = [];
|
|
|
+ for (let x = 0; x <= 30; x++) {
|
|
|
+ indU.push(kai + x * sum * oneDay);
|
|
|
+ }
|
|
|
+ return indU;
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -159,6 +239,8 @@ export default {
|
|
|
mounted() {
|
|
|
this.findUser = this.$parent.findUser;
|
|
|
this.thisObj = this.$parent.thisObj;
|
|
|
+ this.thisObj.periodType == 1;
|
|
|
+ console.log(this.thisObj);
|
|
|
this.$el.querySelector('div.el-calendar__header').remove();
|
|
|
}
|
|
|
};
|