From f1853fbb48066de0c3c57b2b7f291f926a06f519 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 25 Aug 2022 14:59:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF-=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=99=A8=E6=8C=89=E9=92=AE):=20=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=8F=AF=E4=BB=A5=E6=8B=96=E5=85=A5=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/components/Editor/SettingMenu.vue | 10 +++++ .../canvas/custom-component/UserView.vue | 2 +- frontend/src/utils/conditionUtil.js | 1 - frontend/src/views/panel/filter/index.vue | 39 ++++--------------- 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/SettingMenu.vue b/frontend/src/components/canvas/components/Editor/SettingMenu.vue index 03f610bc6f..8bf5c7dfec 100644 --- a/frontend/src/components/canvas/components/Editor/SettingMenu.vue +++ b/frontend/src/components/canvas/components/Editor/SettingMenu.vue @@ -135,6 +135,16 @@ export default { }, deleteComponent() { + if (this.curComponent.type === 'custom-button' && this.curComponent.serviceName === 'buttonSureWidget') { + let len = this.componentData.length + while (len--) { + const item = this.componentData[len] + + if (item.type === 'custom-button' && item.serviceName === 'buttonResetWidget') { + this.componentData.splice(len, 1) + } + } + } this.$emit('amRemoveItem') this.deleteCurCondition() this.$store.commit('deleteComponent') diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 10a4e25df5..6805b544de 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -368,7 +368,7 @@ export default { }, 'cfilters': { handler: function(val1, val2) { - if (isChange(val1, val2) && !this.isFirstLoad) { + if ((isChange(val1, val2) || isChange(val1, this.filters)) && !this.isFirstLoad) { this.getData(this.element.propValue.viewId) } }, diff --git a/frontend/src/utils/conditionUtil.js b/frontend/src/utils/conditionUtil.js index a9b8dc42ac..5cbd3ecbea 100644 --- a/frontend/src/utils/conditionUtil.js +++ b/frontend/src/utils/conditionUtil.js @@ -100,7 +100,6 @@ export const buildFilterMap = panelItems => { let result = buildViewKeyMap(panelItems) result = buildViewKeyFilters(panelItems, result) - fillElementsFilter(panelItems, result) return result } diff --git a/frontend/src/views/panel/filter/index.vue b/frontend/src/views/panel/filter/index.vue index a99b39cf2a..49e3f0bc5a 100644 --- a/frontend/src/views/panel/filter/index.vue +++ b/frontend/src/views/panel/filter/index.vue @@ -9,9 +9,9 @@ v-for="(widget, index) in item" :key="widget.widgetName+index" :data-id="widget.widgetName" - :draggable="(widget.widgetName !== 'buttonSureWidget' && widget.widgetName !== 'buttonResetWidget') || (widget.widgetName === 'buttonSureWidget' && !searchButtonExist) || (widget.widgetName === 'buttonResetWidget' && searchButtonExist)" + :draggable="(widget.widgetName !== 'buttonSureWidget' && widget.widgetName !== 'buttonResetWidget') || (widget.widgetName === 'buttonSureWidget' && !searchButtonExist) || (widget.widgetName === 'buttonResetWidget' && searchButtonExist && !resetButtonExist)" :data-index="index" - :class="'filter-widget '+ (widget.defaultClass || '')" + :class="('filter-widget '+ (widget.widgetName === 'buttonSureWidget' ? sureButtonClass : widget.widgetName === 'buttonResetWidget' ? resetButtonClass : widget.defaultClass))" >
@@ -74,38 +74,15 @@ export default { resetButtonExist() { return this.componentData && this.componentData.some(component => component.type === 'custom-button' && component.serviceName === 'buttonResetWidget') }, - resetButtonDisable() { - return !this.resetButtonExist && this.searchButtonExist - } - }, - watch: { - searchButtonExist(val, old) { - if (val === old) return - if (val) { - this.widgetSubjects['按钮'][0].defaultClass = 'button-disable-filter' - if (this.resetButtonExist) { - this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter' - } else { - this.widgetSubjects['按钮'][1].defaultClass = 'time-filter' - } - } else { - this.widgetSubjects['按钮'][0].defaultClass = 'time-filter' - this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter' - } + sureButtonClass() { + return this.searchButtonExist ? 'button-disable-filter' : 'time-filter' }, - resetButtonExist(val, old) { - if (val === old) return - if (val) { - this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter' - } else { - if (this.searchButtonExist) { - this.widgetSubjects['按钮'][1].defaultClass = 'time-filter' - } else { - this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter' - } - } + resetButtonClass() { + return (this.searchButtonExist && !this.resetButtonExist) ? 'time-filter' : 'button-disable-filter' } + }, + created() { this.init() },