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