perf: 日历选择时间添加任务
This commit is contained in:
parent
b870f5f4d1
commit
1975b8af1d
@ -31,6 +31,7 @@
|
|||||||
:calendars="calendarList"
|
:calendars="calendarList"
|
||||||
:schedules="list"
|
:schedules="list"
|
||||||
:taskView="false"
|
:taskView="false"
|
||||||
|
:useCreationPopup="false"
|
||||||
@beforeCreateSchedule="onBeforeCreateSchedule"
|
@beforeCreateSchedule="onBeforeCreateSchedule"
|
||||||
@beforeClickSchedule="onBeforeClickSchedule"
|
@beforeClickSchedule="onBeforeClickSchedule"
|
||||||
@beforeUpdateSchedule="onBeforeUpdateSchedule"
|
@beforeUpdateSchedule="onBeforeUpdateSchedule"
|
||||||
@ -47,6 +48,7 @@ import 'tui-calendar-hi/dist/tui-calendar-hi.css'
|
|||||||
import {mapState, mapGetters} from "vuex";
|
import {mapState, mapGetters} from "vuex";
|
||||||
import Calendar from "./components/Calendar";
|
import Calendar from "./components/Calendar";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import {Store} from "le5le-store";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {Calendar},
|
components: {Calendar},
|
||||||
@ -254,16 +256,13 @@ export default {
|
|||||||
return currentDate.format(format);
|
return currentDate.format(format);
|
||||||
},
|
},
|
||||||
|
|
||||||
onBeforeCreateSchedule(res) {
|
onBeforeCreateSchedule({start, end, guide}) {
|
||||||
this.$store.dispatch("taskAdd", {
|
Store.set('addTask', {
|
||||||
project_id: res.calendarId,
|
times: [start.toDate(), end.toDate()],
|
||||||
times: [res.start.toDate(), res.end.toDate()],
|
|
||||||
name: res.title,
|
|
||||||
owner: this.userId,
|
owner: this.userId,
|
||||||
}).then(({msg}) => {
|
beforeClose: () => {
|
||||||
$A.messageSuccess(msg);
|
guide.clearGuideElement();
|
||||||
}).catch(({msg}) => {
|
}
|
||||||
$A.modalError(msg);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -216,6 +216,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
|
|
||||||
|
beforeClose: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -246,6 +248,10 @@ export default {
|
|||||||
this.$refs.input.focus()
|
this.$refs.input.focus()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
this.beforeClose.some(func => {
|
||||||
|
typeof func === "function" && func()
|
||||||
|
})
|
||||||
|
this.beforeClose = [];
|
||||||
this.taskTimeOpen = false;
|
this.taskTimeOpen = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -479,6 +485,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setData(data) {
|
setData(data) {
|
||||||
|
if (typeof data.beforeClose !== "undefined") {
|
||||||
|
this.beforeClose.push(data.beforeClose)
|
||||||
|
delete data.beforeClose;
|
||||||
|
}
|
||||||
this.addData = Object.assign({}, this.addData, data);
|
this.addData = Object.assign({}, this.addData, data);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user