style:甘特图-条块拖拽超出时间轴提示

main
黄伟杰 4 days ago
parent e472d4cb86
commit ad79342616

@ -4654,6 +4654,7 @@ export default {
warningCompleteDeviceDate: 'Please complete device, start date and end date',
warningValidTime: 'Please select a valid time',
warningEndBeforeStart: 'End time cannot be earlier than start time',
warningDragOutOfRange: 'Drag out of date range, reverted to original position',
columnTaskName: 'Task Name',
columnDeviceName: 'Device Name',
columnPlanInfo: 'Plan Info',

@ -4865,6 +4865,7 @@ export default {
warningCompleteDeviceDate: '请完善设备、计划开始日期和计划结束日期',
warningValidTime: '请选择有效的时间',
warningEndBeforeStart: '结束时间不能早于开始时间',
warningDragOutOfRange: '拖拽超出日期范围,已恢复原位',
columnTaskName: '任务名称',
columnDeviceName: '设备名称',
columnPlanInfo: '计划信息',

@ -462,11 +462,18 @@ const attachPlanBarDrag = (bar: HTMLElement, plan: any, task: any) => {
if (!moved) return
moved = false
saveUndoSnapshot()
const dx = e.clientX - startX
const newLeft = Math.max(0, startLeft + dx)
const newStartDate = gantt.dateFromPos(newLeft)
if (!newStartDate || !dayjs(newStartDate).isValid()) {
message.warning(t('GanttChart.GanttPanel.warningDragOutOfRange'))
initGanttPreview()
return
}
saveUndoSnapshot()
const planDuration = dayjs(plan.planEndTimeStr).diff(dayjs(plan.planStartTimeStr), 'millisecond')
const newEndDate = new Date(newStartDate.getTime() + planDuration)
@ -568,13 +575,19 @@ const attachPlanBarResize = (bar: HTMLElement, plan: any, task: any) => {
resizing = false
bar.style.zIndex = '2'
saveUndoSnapshot()
const newLeft = parseFloat(bar.style.left) || startLeft
const newWidth = parseFloat(bar.style.width) || startWidth
const newStartDate = gantt.dateFromPos(newLeft)
const newEndDate = gantt.dateFromPos(newLeft + newWidth)
if (!newStartDate || !newEndDate || !dayjs(newStartDate).isValid() || !dayjs(newEndDate).isValid()) {
message.warning(t('GanttChart.GanttPanel.warningDragOutOfRange'))
initGanttPreview()
return
}
saveUndoSnapshot()
const identity = makePlanIdentity(plan)
const original = findOriginalPlan(identity)
if (original) {

Loading…
Cancel
Save