mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 20:12:48 +00:00
perf: 优化任务时间范围选择
This commit is contained in:
parent
0c8517667f
commit
52babf82ae
@ -297,7 +297,7 @@ export default {
|
|||||||
return currentDate.format(format);
|
return currentDate.format(format);
|
||||||
},
|
},
|
||||||
|
|
||||||
onBeforeCreateSchedule({start, end, isAllDay, guide}) {
|
async onBeforeCreateSchedule({start, end, isAllDay, guide}) {
|
||||||
if (isAllDay || this.calendarView == 'month') {
|
if (isAllDay || this.calendarView == 'month') {
|
||||||
start = $A.dayjs(start.toDate()).startOf('day')
|
start = $A.dayjs(start.toDate()).startOf('day')
|
||||||
end = $A.dayjs(end.toDate()).endOf('day')
|
end = $A.dayjs(end.toDate()).endOf('day')
|
||||||
@ -305,16 +305,12 @@ export default {
|
|||||||
start = $A.dayjs(start.toDate())
|
start = $A.dayjs(start.toDate())
|
||||||
end = $A.dayjs(end.toDate())
|
end = $A.dayjs(end.toDate())
|
||||||
}
|
}
|
||||||
this.$store.dispatch("taskDefaultTime", [
|
const times = await this.$store.dispatch("taskDefaultTime", $A.newDateString([start, end], "YYYY-MM-DD HH:mm"))
|
||||||
start.format('YYYY-MM-DD HH:mm:ss'),
|
|
||||||
end.format('YYYY-MM-DD HH:mm:ss')
|
|
||||||
]).then(times => {
|
|
||||||
emitter.emit('addTask', {
|
emitter.emit('addTask', {
|
||||||
times,
|
times,
|
||||||
owner: [this.userId],
|
owner: [this.userId],
|
||||||
beforeClose: () => guide.clearGuideElement()
|
beforeClose: () => guide.clearGuideElement()
|
||||||
});
|
});
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onBeforeClickSchedule(event) {
|
onBeforeClickSchedule(event) {
|
||||||
|
|||||||
@ -416,9 +416,7 @@ export default {
|
|||||||
|
|
||||||
async taskTimeChange(data) {
|
async taskTimeChange(data) {
|
||||||
const times = $A.newDateString(data.times, "YYYY-MM-DD HH:mm");
|
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) {
|
taskTimeOpenChange(val) {
|
||||||
@ -463,7 +461,7 @@ export default {
|
|||||||
const days = $A.runNum(item.days);
|
const days = $A.runNum(item.days);
|
||||||
if (days > 0) {
|
if (days > 0) {
|
||||||
const end = start.clone().add(days, 'day');
|
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 {
|
} else {
|
||||||
this.$set(this.addData, 'times', [])
|
this.$set(this.addData, 'times', [])
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1357,10 +1357,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async taskTimeChange() {
|
async taskTimeChange() {
|
||||||
const times = $A.newDateString(this.timeValue, "YYYY-MM-DD HH:mm");
|
this.timeValue = await this.$store.dispatch("taskDefaultTime", $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)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async onOwner(pick) {
|
async onOwner(pick) {
|
||||||
|
|||||||
4
resources/assets/js/store/actions.js
vendored
4
resources/assets/js/store/actions.js
vendored
@ -2662,10 +2662,12 @@ export default {
|
|||||||
*/
|
*/
|
||||||
taskDefaultTime({state, dispatch}, array) {
|
taskDefaultTime({state, dispatch}, array) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
if ($A.isArray(array)) {
|
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[0] = await dispatch("taskDefaultStartTime", array[0])
|
||||||
array[1] = await dispatch("taskDefaultEndTime", array[1])
|
array[1] = await dispatch("taskDefaultEndTime", array[1])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
resolve(array)
|
resolve(array)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user