From 7c1753585d6c462b0eea8341d216caeea918467a Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 29 May 2023 14:51:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=99=A8=E5=88=A0=E9=99=A4=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AD=97=E6=AE=B5=E5=90=8E=E5=89=8D=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=B9=9F=E6=97=A0=E6=B3=95=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/panel/filter/FilterDialog.vue | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/panel/filter/FilterDialog.vue b/frontend/src/views/panel/filter/FilterDialog.vue index 4b9ffb0a74..96dd3e5a14 100644 --- a/frontend/src/views/panel/filter/FilterDialog.vue +++ b/frontend/src/views/panel/filter/FilterDialog.vue @@ -463,7 +463,7 @@ export default { bus.$off('valid-values-change', this.validateFilterValue) }, methods: { - checkSuperior(list) { + async checkSuperior(list, anotherTableIds) { let fieldValid = false const fieldId = this.myAttrs?.fieldId if (fieldId && list?.length) { @@ -479,6 +479,17 @@ export default { } } } + if (!fieldValid && anotherTableIds?.length) { + const ps = await Promise.all(anotherTableIds.map(id => fieldListWithPermission(id))) + let anotherList = [] + ps.forEach(p => { + anotherList = [...anotherList, ...p.data] + }) + + if (anotherList?.length && this.checkSuperior(anotherList, null)) { + fieldValid = true + } + } if (!fieldValid) { this.myAttrs.fieldId = null this.myAttrs.dragItems = [] @@ -486,6 +497,7 @@ export default { } return fieldValid }, + treeNode(cache) { const modelInfo = localStorage.getItem('dataset-tree') const userCache = (modelInfo && cache) @@ -759,11 +771,16 @@ export default { this.viewKeyWord = '' this.comRemoveTail() }, - + anotherTableInfo(tableId) { + if (this.myAttrs?.dragItems?.length) { + return this.myAttrs.dragItems.filter(item => item.tableId !== tableId).map(item => item.tableId) + } + return null + }, async loadField(tableId, init) { const res = await fieldListWithPermission(tableId) let data = res.data || [] - if (init && !this.checkSuperior(data)) { + if (init && !this.checkSuperior(data, this.anotherTableInfo(tableId))) { this.backToLink() } if (this.widget && this.widget.filterFieldMethod) { @@ -787,7 +804,7 @@ export default { async comLoadField(tableId, init) { const res = await fieldListWithPermission(tableId) let data = res.data || [] - if (init && !this.checkSuperior(data)) { + if (init && !this.checkSuperior(data, this.anotherTableInfo(tableId))) { this.comBackLink() } if (this.widget && this.widget.filterFieldMethod) {