From a0fb3a62adda3fcffbd987c83750f4e10bb0f26c Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 26 May 2022 13:15:50 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=A0=91=E5=BD=A2=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E5=99=A8=E5=9F=BA=E6=9C=AC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/widget/DeWidget/DeSelectTree.vue | 7 ++++--- frontend/src/components/widget/bean/Condition.js | 3 ++- frontend/src/utils/conditionUtil.js | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/widget/DeWidget/DeSelectTree.vue b/frontend/src/components/widget/DeWidget/DeSelectTree.vue index 30bbf4edc9..0c73552eda 100644 --- a/frontend/src/components/widget/DeWidget/DeSelectTree.vue +++ b/frontend/src/components/widget/DeWidget/DeSelectTree.vue @@ -129,7 +129,7 @@ export default { method(param).then(res => { this.datas = this.optionDatas(res.data) this.$nextTick(() => { - this.$refs.deSelectTree.treeDataUpdateFun(this.datas) + this.$refs.deSelectTree && this.$refs.deSelectTree.treeDataUpdateFun(this.datas) }) }) || (this.element.options.value = '') }, @@ -191,7 +191,7 @@ export default { method({ fieldIds: this.element.options.attrs.fieldId.split(',') }).then(res => { this.datas = this.optionDatas(res.data) this.$nextTick(() => { - this.$refs.deSelectTree.treeDataUpdateFun(this.datas) + this.$refs.deSelectTree && this.$refs.deSelectTree.treeDataUpdateFun(this.datas) }) }) } @@ -231,7 +231,8 @@ export default { const param = { component: this.element, value: this.formatFilterValue(), - operator: this.operator + operator: this.operator, + isTree: true } this.inDraw && this.$store.commit('addViewFilter', param) }, diff --git a/frontend/src/components/widget/bean/Condition.js b/frontend/src/components/widget/bean/Condition.js index 566a2e1a82..ad3c1dc985 100644 --- a/frontend/src/components/widget/bean/Condition.js +++ b/frontend/src/components/widget/bean/Condition.js @@ -5,11 +5,12 @@ * viewIds 过滤视图范围 */ export class Condition { - constructor(componentId, fieldId, operator, value, viewIds) { + constructor(componentId, fieldId, operator, value, viewIds, isTree) { this.componentId = componentId this.fieldId = fieldId this.operator = operator || 'eq' this.value = value this.viewIds = viewIds + this.isTree = isTree || false } } diff --git a/frontend/src/utils/conditionUtil.js b/frontend/src/utils/conditionUtil.js index f557d516c6..4416b25f4c 100644 --- a/frontend/src/utils/conditionUtil.js +++ b/frontend/src/utils/conditionUtil.js @@ -26,10 +26,10 @@ export const valueValid = condition => { } export const formatCondition = obj => { - const { component, value, operator } = obj + const { component, value, operator, isTree } = obj const fieldId = component.options.attrs.fieldId const viewIds = component.options.attrs.viewIds - const condition = new Condition(component.id, fieldId, operator, value, viewIds) + const condition = new Condition(component.id, fieldId, operator, value, viewIds, isTree) return condition }