From 1975b8af1dec4ff5fee8146a8a1983ac7aca5e84 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 6 Jan 2022 23:15:04 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=97=A5=E5=8E=86=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=B7=BB=E5=8A=A0=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/pages/manage/calendar.vue | 17 ++++++++--------- .../js/pages/manage/components/TaskAdd.vue | 10 ++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/resources/assets/js/pages/manage/calendar.vue b/resources/assets/js/pages/manage/calendar.vue index dd8361a9..fffeef87 100644 --- a/resources/assets/js/pages/manage/calendar.vue +++ b/resources/assets/js/pages/manage/calendar.vue @@ -31,6 +31,7 @@ :calendars="calendarList" :schedules="list" :taskView="false" + :useCreationPopup="false" @beforeCreateSchedule="onBeforeCreateSchedule" @beforeClickSchedule="onBeforeClickSchedule" @beforeUpdateSchedule="onBeforeUpdateSchedule" @@ -47,6 +48,7 @@ import 'tui-calendar-hi/dist/tui-calendar-hi.css' import {mapState, mapGetters} from "vuex"; import Calendar from "./components/Calendar"; import moment from "moment"; +import {Store} from "le5le-store"; export default { components: {Calendar}, @@ -254,16 +256,13 @@ export default { return currentDate.format(format); }, - onBeforeCreateSchedule(res) { - this.$store.dispatch("taskAdd", { - project_id: res.calendarId, - times: [res.start.toDate(), res.end.toDate()], - name: res.title, + onBeforeCreateSchedule({start, end, guide}) { + Store.set('addTask', { + times: [start.toDate(), end.toDate()], owner: this.userId, - }).then(({msg}) => { - $A.messageSuccess(msg); - }).catch(({msg}) => { - $A.modalError(msg); + beforeClose: () => { + guide.clearGuideElement(); + } }); }, diff --git a/resources/assets/js/pages/manage/components/TaskAdd.vue b/resources/assets/js/pages/manage/components/TaskAdd.vue index e8af6a39..156b60d3 100644 --- a/resources/assets/js/pages/manage/components/TaskAdd.vue +++ b/resources/assets/js/pages/manage/components/TaskAdd.vue @@ -216,6 +216,8 @@ export default { }, loadIng: 0, + + beforeClose: [], } }, mounted() { @@ -246,6 +248,10 @@ export default { this.$refs.input.focus() }) } else { + this.beforeClose.some(func => { + typeof func === "function" && func() + }) + this.beforeClose = []; this.taskTimeOpen = false; } }, @@ -479,6 +485,10 @@ export default { }, setData(data) { + if (typeof data.beforeClose !== "undefined") { + this.beforeClose.push(data.beforeClose) + delete data.beforeClose; + } this.addData = Object.assign({}, this.addData, data); },