style:修复甘特图保存后弹框报错

pull/1/head
黄伟杰 4 weeks ago
parent 0ac051e4fc
commit 7574ca1324

@ -492,6 +492,11 @@ const movePlanDataToDevice = (task: any, targetDeviceTaskId: string | number, so
}
const normalizeDeviceChildren = (deviceTaskId: string | number, priorityTaskId?: string | number) => {
try {
gantt.getTask(deviceTaskId)
} catch {
return
}
const childTaskIds = gantt.getChildren(deviceTaskId)
if (!Array.isArray(childTaskIds) || !childTaskIds.length) return
const childTasks = childTaskIds
@ -513,11 +518,13 @@ const normalizeDeviceChildren = (deviceTaskId: string | number, priorityTaskId?:
}
const refreshPlanLinksByRowOrder = () => {
try {
const allLinks = gantt.getLinks()
allLinks.forEach((item: any) => gantt.deleteLink(item.id))
let linkIndex = 1
const deviceTaskIds = gantt.getChildren(0)
deviceTaskIds.forEach((deviceTaskId: string | number) => {
try {
const childTaskIds = gantt.getChildren(deviceTaskId).filter((childId: string | number) => {
const task = gantt.getTask(childId)
return !!task?._planData
@ -534,7 +541,9 @@ const refreshPlanLinksByRowOrder = () => {
}
previousTaskId = taskId
})
} catch {}
})
} catch {}
}
const getDeviceInsertIndex = (deviceTaskId: string | number, startDate: dayjs.Dayjs) => {
@ -672,8 +681,8 @@ const applyTaskAdjust = (task: any, targetDeviceTaskId: string | number, startDa
syncPlanTimeFromTask(task)
normalizeDeviceChildren(targetDeviceTaskId, task.id)
if (sourceDeviceTaskId && sourceDeviceTaskId !== targetDeviceTaskId) {
normalizeDeviceChildren(sourceDeviceTaskId)
removeDeviceFromGanttIfNoCurrent(sourceDeviceTaskId)
normalizeDeviceChildren(sourceDeviceTaskId)
}
refreshPlanLinksByRowOrder()
refreshTimelineRangeByTasks()

Loading…
Cancel
Save