批量复制
This commit is contained in:
parent
715b97dbc5
commit
8ff46f5098
@ -2701,38 +2701,6 @@ const submitBatchCopyingFormSuccess = async (form) => {
|
|||||||
const nodeIdMap = new Map()
|
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(
|
const newPointList = await Promise.all(
|
||||||
newPoints.map(async (node) => {
|
newPoints.map(async (node) => {
|
||||||
const newId = await MapApi.getNodeId()
|
const newId = await MapApi.getNodeId()
|
||||||
@ -2742,12 +2710,33 @@ const submitBatchCopyingFormSuccess = async (form) => {
|
|||||||
const locationY = Number(node.locationY) + Number(form.y)
|
const locationY = Number(node.locationY) + Number(form.y)
|
||||||
const actualPoint = disposeEventPoint(locationX, locationY)
|
const actualPoint = disposeEventPoint(locationX, locationY)
|
||||||
|
|
||||||
const { sortNum, createTime, type, dataObj, dataList, ...restNode } = node
|
const { sortNum, createTime, ...restNode } = node
|
||||||
const {
|
|
||||||
dataObj: processedDataObj,
|
let dataObj = {}
|
||||||
dataList: processedDataList,
|
let dataList = []
|
||||||
dataJson
|
let dataJson = ''
|
||||||
} = processNodeData({ type, dataObj, dataList })
|
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 {
|
return {
|
||||||
...restNode,
|
...restNode,
|
||||||
@ -2756,8 +2745,8 @@ const submitBatchCopyingFormSuccess = async (form) => {
|
|||||||
locationY,
|
locationY,
|
||||||
actualLocationX: actualPoint.actualLocationX,
|
actualLocationX: actualPoint.actualLocationX,
|
||||||
actualLocationY: actualPoint.actualLocationY,
|
actualLocationY: actualPoint.actualLocationY,
|
||||||
dataObj: processedDataObj,
|
dataObj,
|
||||||
dataList: processedDataList,
|
dataList,
|
||||||
dataJson
|
dataJson
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user