Merge pull request #6896 from dataease/pr@dev@perf_filter

perf: 过滤器在编辑页面触发两次请求
This commit is contained in:
fit2cloud-chenyw 2023-11-28 16:04:25 +08:00 committed by GitHub
commit da4df430d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 14 deletions

View File

@ -509,7 +509,7 @@ export default {
this.$store.commit('setComponentWithId', this.currentFilterCom) this.$store.commit('setComponentWithId', this.currentFilterCom)
this.$store.commit('recordSnapshot', 'sureFilter') this.$store.commit('recordSnapshot', 'sureFilter')
this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex }) 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() this.closeFilter()
}, },
reFreshComponent(component) { reFreshComponent(component) {

View File

@ -418,8 +418,10 @@ export default {
this.$refs.dateRef.hidePicker() this.$refs.dateRef.hidePicker()
} }
}, },
resetDefaultValue(id) { resetDefaultValue(ele) {
if (this.inDraw && this.manualModify && this.element.id === id) { 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) { if (!this.element.options.attrs.default.isDynamic) {
this.values = this.fillValueDerfault() this.values = this.fillValueDerfault()
this.dateChange(this.values) this.dateChange(this.values)

View File

@ -99,8 +99,10 @@ export default {
clearHandler() { clearHandler() {
this.value = null this.value = null
}, },
resetDefaultValue(id) { resetDefaultValue(ele) {
if (this.inDraw && this.manualModify && this.element.id === id) { 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.value = this.fillValueDerfault()
this.search() this.search()
} }

View File

@ -160,8 +160,10 @@ export default {
this.form.min = null this.form.min = null
this.form.max = null this.form.max = null
}, },
resetDefaultValue(id) { resetDefaultValue(ele) {
if (this.inDraw && this.manualModify && this.element.id === id) { 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) { if (!this.element.options.value) {
this.form.min = null this.form.min = null
this.form.max = null this.form.max = null

View File

@ -345,8 +345,10 @@ export default {
this.$refs.deSelect.$refs.visualSelect.blur() this.$refs.deSelect.$refs.visualSelect.blur()
} }
}, },
resetDefaultValue(id) { resetDefaultValue(ele) {
if (this.inDraw && this.manualModify && this.element.id === id) { 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) { if (this.selectFirst) {
this.fillFirstValue() this.fillFirstValue()
this.firstChange(this.value) this.firstChange(this.value)

View File

@ -282,8 +282,10 @@ export default {
this.checkAll = false this.checkAll = false
this.isIndeterminate = false this.isIndeterminate = false
}, },
resetDefaultValue(id) { resetDefaultValue(ele) {
if (this.inDraw && this.manualModify && this.element.id === id) { 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.value = this.fillValueDerfault()
this.changeValue(this.value) this.changeValue(this.value)

View File

@ -234,8 +234,10 @@ export default {
this.value = this.element.options.attrs.multiple ? [] : null this.value = this.element.options.attrs.multiple ? [] : null
this.$refs.deSelectTree && this.$refs.deSelectTree.resetSelectAll && this.$refs.deSelectTree.resetSelectAll() this.$refs.deSelectTree && this.$refs.deSelectTree.resetSelectAll && this.$refs.deSelectTree.resetSelectAll()
}, },
resetDefaultValue(id) { resetDefaultValue(ele) {
if (this.inDraw && this.manualModify && this.element.id === id) { 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.value = this.fillValueDerfault()
this.changeValue(this.value) this.changeValue(this.value)
} }

View File

@ -1269,7 +1269,7 @@ export default {
this.$store.commit('recordSnapshot', 'sureFilter') this.$store.commit('recordSnapshot', 'sureFilter')
this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex }) this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex })
this.$store.commit('setComponentFromList', this.currentFilterCom) this.$store.commit('setComponentFromList', this.currentFilterCom)
bus.$emit('reset-default-value', this.currentFilterCom.id) bus.$emit('reset-default-value', this.currentFilterCom)
this.closeFilter() this.closeFilter()
}, },
reFreshComponent(component) { reFreshComponent(component) {