Browse Source

fix: 解决图层字段配置回显错误的问题

sy-water-data-board-ui
chenhaojie 1 year ago
parent
commit
fe0caf0eb0
  1. 36
      src/views/aiSupervision/layerManage/resource/LayerDetails.vue

36
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;

Loading…
Cancel
Save