From fe0caf0eb0c29997b168ac59d71eda6515253b6c Mon Sep 17 00:00:00 2001 From: chenhaojie Date: Mon, 25 Mar 2024 14:12:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=9B=BE=E5=B1=82?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=85=8D=E7=BD=AE=E5=9B=9E=E6=98=BE=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layerManage/resource/LayerDetails.vue | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/views/aiSupervision/layerManage/resource/LayerDetails.vue b/src/views/aiSupervision/layerManage/resource/LayerDetails.vue index fab4be6..13aebd5 100644 --- a/src/views/aiSupervision/layerManage/resource/LayerDetails.vue +++ b/src/views/aiSupervision/layerManage/resource/LayerDetails.vue @@ -274,7 +274,9 @@ export default { activeName: '1', extendTable: [], multipleSelection: [], - fieldsTable: [] + activeFields: [], + fieldsTable: [], + queryServiceUrlMap: new Map() }; }, watch: { @@ -287,18 +289,23 @@ export default { } }, 'editDataInfoForm.serviceUrl'(val) { - if (val && this.fieldsTable.length === 0) { - queryServiceInfoApi(val).then((res) => { - this.fieldsTable = - res?.fields?.map((item) => { - return { - field: item.name, - fieldName: item.alias, - fieldType: item.type, - isShow: 0 - }; - }) || []; - }); + if (val) { + if (!this.queryServiceUrlMap.has(val)) { + queryServiceInfoApi(val).then((res) => { + this.fieldsTable = + res?.fields?.map((item) => { + return { + field: item.name, + fieldName: item.alias, + fieldType: item.type, + isShow: this.activeFields.includes(item.name) ? 1 : 0 + }; + }) || []; + this.queryServiceUrlMap.set(val, this.fieldsTable); + }); + } else { + this.fieldsTable = this.queryServiceUrlMap.get(val); + } } } }, @@ -326,7 +333,7 @@ export default { this.editDataInfoForm.relationStyleId = row.relationStyleId; this.editDataInfoForm.relationStyleName = row.relationStyleName; this.extendTable = (row.extendData && JSON.parse(row.extendData)) || []; - this.fieldsTable = row?.fields || []; + this.activeFields = row?.fields.map((item) => item.field) || []; this.dialogTitle = '编辑图层'; this.dialogFormVisible = true; }, @@ -387,6 +394,7 @@ export default { extendData: JSON.stringify(this.extendTable), fields: this.fieldsTable }; + this.queryServiceUrlMap.set(this.editDataInfoForm.serviceUrl, this.fieldsTable); await saveOrUpdateLayerApi(params); this.getLayerList(); this.dialogFormVisible = false;