diff --git a/resources/assets/js/pages/manage/calendar.vue b/resources/assets/js/pages/manage/calendar.vue index efa30d9f9..9079ab19b 100644 --- a/resources/assets/js/pages/manage/calendar.vue +++ b/resources/assets/js/pages/manage/calendar.vue @@ -297,7 +297,7 @@ export default { return currentDate.format(format); }, - onBeforeCreateSchedule({start, end, isAllDay, guide}) { + async onBeforeCreateSchedule({start, end, isAllDay, guide}) { if (isAllDay || this.calendarView == 'month') { start = $A.dayjs(start.toDate()).startOf('day') end = $A.dayjs(end.toDate()).endOf('day') @@ -305,16 +305,12 @@ export default { start = $A.dayjs(start.toDate()) end = $A.dayjs(end.toDate()) } - this.$store.dispatch("taskDefaultTime", [ - start.format('YYYY-MM-DD HH:mm:ss'), - end.format('YYYY-MM-DD HH:mm:ss') - ]).then(times => { - emitter.emit('addTask', { - times, - owner: [this.userId], - beforeClose: () => guide.clearGuideElement() - }); - }) + const times = await this.$store.dispatch("taskDefaultTime", $A.newDateString([start, end], "YYYY-MM-DD HH:mm")) + emitter.emit('addTask', { + times, + owner: [this.userId], + beforeClose: () => guide.clearGuideElement() + }); }, onBeforeClickSchedule(event) { diff --git a/resources/assets/js/pages/manage/components/TaskAdd.vue b/resources/assets/js/pages/manage/components/TaskAdd.vue index 1ab0ebbd2..188d26fa0 100644 --- a/resources/assets/js/pages/manage/components/TaskAdd.vue +++ b/resources/assets/js/pages/manage/components/TaskAdd.vue @@ -416,9 +416,7 @@ export default { async taskTimeChange(data) { const times = $A.newDateString(data.times, "YYYY-MM-DD HH:mm"); - if (/\s+(00:00|23:59)$/.test(times[0]) && /\s+(00:00|23:59)$/.test(times[1])) { - this.$set(data, 'times', await this.$store.dispatch("taskDefaultTime", times)) - } + this.$set(data, 'times', await this.$store.dispatch("taskDefaultTime", times)) }, taskTimeOpenChange(val) { @@ -463,7 +461,7 @@ export default { const days = $A.runNum(item.days); if (days > 0) { const end = start.clone().add(days, 'day'); - this.$set(this.addData, 'times', await this.$store.dispatch("taskDefaultTime", $A.newDateString([start, end]))) + this.$set(this.addData, 'times', await this.$store.dispatch("taskDefaultTime", $A.newDateString([start, end], 'YYYY-MM-DD 00:00'))) } else { this.$set(this.addData, 'times', []) } diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index 9c349318e..f18198e31 100755 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -1357,10 +1357,7 @@ export default { }, async taskTimeChange() { - const times = $A.newDateString(this.timeValue, "YYYY-MM-DD HH:mm"); - if (/\s+(00:00|23:59)$/.test(times[0]) && /\s+(00:00|23:59)$/.test(times[1])) { - this.timeValue = await this.$store.dispatch("taskDefaultTime", times) - } + this.timeValue = await this.$store.dispatch("taskDefaultTime", $A.newDateString(this.timeValue, "YYYY-MM-DD HH:mm")) }, async onOwner(pick) { diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 27001ea13..fa6dc1cc3 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -2662,9 +2662,11 @@ export default { */ taskDefaultTime({state, dispatch}, array) { return new Promise(async resolve => { - if ($A.isArray(array)) { - array[0] = await dispatch("taskDefaultStartTime", array[0]) - array[1] = await dispatch("taskDefaultEndTime", array[1]) + if ($A.isArray(array) && array.length === 2) { + if (/\s+(00:00|23:59)$/.test(array[0]) && /\s+(00:00|23:59)$/.test(array[1])) { + array[0] = await dispatch("taskDefaultStartTime", array[0]) + array[1] = await dispatch("taskDefaultEndTime", array[1]) + } } resolve(array) });