diff --git a/core/frontend/src/components/canvas/DeCanvas.vue b/core/frontend/src/components/canvas/DeCanvas.vue index 3ea8fbaa34..d97346a6d1 100644 --- a/core/frontend/src/components/canvas/DeCanvas.vue +++ b/core/frontend/src/components/canvas/DeCanvas.vue @@ -509,7 +509,7 @@ export default { this.$store.commit('setComponentWithId', this.currentFilterCom) this.$store.commit('recordSnapshot', 'sureFilter') this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex }) - bus.$emit('reset-default-value', this.currentFilterCom.id) + bus.$emit('reset-default-value', this.currentFilterCom) this.closeFilter() }, reFreshComponent(component) { diff --git a/core/frontend/src/components/widget/deWidget/DeDate.vue b/core/frontend/src/components/widget/deWidget/DeDate.vue index ff355563cc..36b42c5827 100644 --- a/core/frontend/src/components/widget/deWidget/DeDate.vue +++ b/core/frontend/src/components/widget/deWidget/DeDate.vue @@ -418,8 +418,10 @@ export default { this.$refs.dateRef.hidePicker() } }, - resetDefaultValue(id) { - if (this.inDraw && this.manualModify && this.element.id === id) { + resetDefaultValue(ele) { + const id = ele.id + const eleVal = ele.options.value.toString() + if (this.inDraw && this.manualModify && this.element.id === id && this.values.toString() !== eleVal && this.defaultValueStr === eleVal) { if (!this.element.options.attrs.default.isDynamic) { this.values = this.fillValueDerfault() this.dateChange(this.values) diff --git a/core/frontend/src/components/widget/deWidget/DeInputSearch.vue b/core/frontend/src/components/widget/deWidget/DeInputSearch.vue index f2becf0ad6..cd63f8d1bc 100644 --- a/core/frontend/src/components/widget/deWidget/DeInputSearch.vue +++ b/core/frontend/src/components/widget/deWidget/DeInputSearch.vue @@ -99,8 +99,10 @@ export default { clearHandler() { this.value = null }, - resetDefaultValue(id) { - if (this.inDraw && this.manualModify && this.element.id === id) { + resetDefaultValue(ele) { + const id = ele.id + const eleVal = ele.options.value.toString() + if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) { this.value = this.fillValueDerfault() this.search() } diff --git a/core/frontend/src/components/widget/deWidget/DeNumberRange.vue b/core/frontend/src/components/widget/deWidget/DeNumberRange.vue index beb9410fdf..bc20b38d30 100644 --- a/core/frontend/src/components/widget/deWidget/DeNumberRange.vue +++ b/core/frontend/src/components/widget/deWidget/DeNumberRange.vue @@ -160,8 +160,10 @@ export default { this.form.min = null this.form.max = null }, - resetDefaultValue(id) { - if (this.inDraw && this.manualModify && this.element.id === id) { + resetDefaultValue(ele) { + const id = ele.id + const eleVal = ele.options.value.toString() + if (this.inDraw && this.manualModify && this.element.id === id && this.defaultValueStr === eleVal) { if (!this.element.options.value) { this.form.min = null this.form.max = null diff --git a/core/frontend/src/components/widget/deWidget/DeSelect.vue b/core/frontend/src/components/widget/deWidget/DeSelect.vue index 970ec23773..599e192c0e 100644 --- a/core/frontend/src/components/widget/deWidget/DeSelect.vue +++ b/core/frontend/src/components/widget/deWidget/DeSelect.vue @@ -345,8 +345,10 @@ export default { this.$refs.deSelect.$refs.visualSelect.blur() } }, - resetDefaultValue(id) { - if (this.inDraw && this.manualModify && this.element.id === id) { + resetDefaultValue(ele) { + const id = ele.id + const eleVal = ele.options.value.toString() + if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) { if (this.selectFirst) { this.fillFirstValue() this.firstChange(this.value) diff --git a/core/frontend/src/components/widget/deWidget/DeSelectGrid.vue b/core/frontend/src/components/widget/deWidget/DeSelectGrid.vue index 892719dfee..5c0e9188e2 100644 --- a/core/frontend/src/components/widget/deWidget/DeSelectGrid.vue +++ b/core/frontend/src/components/widget/deWidget/DeSelectGrid.vue @@ -282,8 +282,10 @@ export default { this.checkAll = false this.isIndeterminate = false }, - resetDefaultValue(id) { - if (this.inDraw && this.manualModify && this.element.id === id) { + resetDefaultValue(ele) { + const id = ele.id + const eleVal = ele.options.value.toString() + if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) { this.value = this.fillValueDerfault() this.changeValue(this.value) diff --git a/core/frontend/src/components/widget/deWidget/DeSelectTree.vue b/core/frontend/src/components/widget/deWidget/DeSelectTree.vue index 86c2c4a678..834d9a9607 100644 --- a/core/frontend/src/components/widget/deWidget/DeSelectTree.vue +++ b/core/frontend/src/components/widget/deWidget/DeSelectTree.vue @@ -234,8 +234,10 @@ export default { this.value = this.element.options.attrs.multiple ? [] : null this.$refs.deSelectTree && this.$refs.deSelectTree.resetSelectAll && this.$refs.deSelectTree.resetSelectAll() }, - resetDefaultValue(id) { - if (this.inDraw && this.manualModify && this.element.id === id) { + resetDefaultValue(ele) { + const id = ele.id + const eleVal = ele.options.value.toString() + if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) { this.value = this.fillValueDerfault() this.changeValue(this.value) } diff --git a/core/frontend/src/views/panel/edit/index.vue b/core/frontend/src/views/panel/edit/index.vue index e1b623485b..99447afee8 100644 --- a/core/frontend/src/views/panel/edit/index.vue +++ b/core/frontend/src/views/panel/edit/index.vue @@ -1269,7 +1269,7 @@ export default { this.$store.commit('recordSnapshot', 'sureFilter') this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex }) this.$store.commit('setComponentFromList', this.currentFilterCom) - bus.$emit('reset-default-value', this.currentFilterCom.id) + bus.$emit('reset-default-value', this.currentFilterCom) this.closeFilter() }, reFreshComponent(component) {