From 8ff46f5098a92b19b16892875b420e95bc6ee13d Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Thu, 12 Jun 2025 11:22:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mapPage/realTimeMap/editMap.vue | 69 ++++++++++------------- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/src/views/mapPage/realTimeMap/editMap.vue b/src/views/mapPage/realTimeMap/editMap.vue index 4b6d3e5e..77e9ae5b 100644 --- a/src/views/mapPage/realTimeMap/editMap.vue +++ b/src/views/mapPage/realTimeMap/editMap.vue @@ -2701,38 +2701,6 @@ const submitBatchCopyingFormSuccess = async (form) => { const nodeIdMap = new Map() // 处理节点列表 - const processNodeData = (node) => { - const { type, dataObj, dataList } = node - const dataProcessors = { - 1: () => ({ dataObj: {}, dataList: [], dataJson: '' }), - 2: () => { - const processedList = dataList.map( - ({ locationDeep, locationStorey, locationWide, positionMapId }) => ({ - locationDeep, - locationStorey, - locationWide, - positionMapId - }) - ) - return { - dataObj: {}, - dataList: processedList, - dataJson: JSON.stringify(processedList) - } - }, - 4: () => { - const { locationDeep, locationWide, positionMapId } = dataObj - const processedObj = { locationDeep, locationWide, positionMapId } - return { - dataObj: processedObj, - dataList: [], - dataJson: JSON.stringify(processedObj) - } - } - } - return dataProcessors[type]?.() || { dataObj: {}, dataList: [], dataJson: '' } - } - const newPointList = await Promise.all( newPoints.map(async (node) => { const newId = await MapApi.getNodeId() @@ -2742,12 +2710,33 @@ const submitBatchCopyingFormSuccess = async (form) => { const locationY = Number(node.locationY) + Number(form.y) const actualPoint = disposeEventPoint(locationX, locationY) - const { sortNum, createTime, type, dataObj, dataList, ...restNode } = node - const { - dataObj: processedDataObj, - dataList: processedDataList, - dataJson - } = processNodeData({ type, dataObj, dataList }) + const { sortNum, createTime, ...restNode } = node + + let dataObj = {} + let dataList = [] + let dataJson = '' + if (restNode.type === 1) { + dataObj = {} + dataList = [] + dataJson = '' + } else if (restNode.type === 2) { + dataList = restNode.dataList.map((item) => { + return { + locationDeep: item.locationDeep, + locationStorey: item.locationStorey, + locationWide: item.locationWide, + positionMapId: item.positionMapId + } + }) + dataJson = JSON.stringify(dataList) + } else if (restNode.type === 4) { + dataObj = { + locationDeep: restNode.dataObj.locationDeep, + locationWide: restNode.dataObj.locationWide, + positionMapId: restNode.dataObj.positionMapId + } + dataJson = JSON.stringify(dataObj) + } return { ...restNode, @@ -2756,8 +2745,8 @@ const submitBatchCopyingFormSuccess = async (form) => { locationY, actualLocationX: actualPoint.actualLocationX, actualLocationY: actualPoint.actualLocationY, - dataObj: processedDataObj, - dataList: processedDataList, + dataObj, + dataList, dataJson } })