批量复制
This commit is contained in:
parent
715b97dbc5
commit
8ff46f5098
@ -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
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user