From 81c9b1f75b80fade52653243b914ccb2677b4a8f Mon Sep 17 00:00:00 2001 From: ZZJ <zzjdsg2300@163.com> Date: 星期二, 22 三月 2022 18:34:17 +0800 Subject: [PATCH] 禅道bug修复 --- src/pages/cameraAccess/components/TimeSlider.vue | 39 +++++++++++++++++++++++++-------------- 1 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/pages/cameraAccess/components/TimeSlider.vue b/src/pages/cameraAccess/components/TimeSlider.vue index 14cc70b..0f326d3 100644 --- a/src/pages/cameraAccess/components/TimeSlider.vue +++ b/src/pages/cameraAccess/components/TimeSlider.vue @@ -79,6 +79,7 @@ { day: 6, time_range: [{ start: "00:00", end: "24:00" }] }, { day: 7, time_range: [{ start: "00:00", end: "24:00" }] }, ], + isAdding: false, }; }, mounted() { @@ -88,16 +89,19 @@ handleTabsEdit(tabId, action) { let tabs = this.VideoManageData.TimeRules; if (action === "add") { - let newRule = { - id: "", - name: "鏃堕棿娈�" + this.VideoManageData.TimeRules.length, - time_rule: this.allDay, - }; - this.updateTimeRule(newRule); + if (this.isAdding) { + return; + } else { + this.isAdding = true; + let newRule = { + id: "", + name: "鏃堕棿娈�" + this.VideoManageData.TimeRules.length, + time_rule: this.allDay, + }; + this.updateTimeRule(newRule); + } } if (action === "remove") { - console.log(); - if (this.VideoManageData.TimeRules.length == 1) { this.$notify({ title: "璀﹀憡", @@ -144,12 +148,19 @@ console.log("鏃堕棿缁勪欢瀹藉害锛�", timeSlideWidth); }, updateTimeRule(rule) { - saveTimeRule(rule).then((rsp) => { - if (rsp && rsp.success) { - this.VideoManageData.getTimeRule(); - this.activeTab = rsp.data.id; - } - }); + saveTimeRule(rule) + .then(async (rsp) => { + if (rsp && rsp.success) { + await this.VideoManageData.getTimeRule(); + this.isAdding = false; + this.activeTab = rsp.data.id; + } else { + this.isAdding = false; + } + }) + .catch(() => { + this.isAdding = false; + }); }, tabClick(item) { if (this.activeTab === item.id) { -- Gitblit v1.8.0