components: {
"ejs-gantt": GanttComponent,
WorkcardDetail,
},
provide: {
gantt: [
DayMarkers,
Resize,
Filter,
ContextMenu,
DayMarkers,
Toolbar,
Edit,
Selection,
RowDD,
],
},
setup() {
const pageHook = usePageHook(pageConfig);
const viewPageHook = useViewPageHook(pageHook);
const toolPage = pageHook.toolPage;
if (
!toolPage.hasPrivilege({
privilege: "planning:ganttChart:edit",
})
) {
//没有编辑权限,跳转到查看
toolPage.router.push({ path: "/planning/viewer" });
}
const gantt = ref(null);
var criticalTasks: any[] = [];
let currentWorkPackageNo: string = "";
const state = reactive({
...toRefs(pageHook.state),
...toRefs(viewPageHook.state),
taskFields: {
id: "taskID",
name: "taskName",
milestone: "milestone",
startDate: "startDate",
endDate: "endDate",
duration: "duration",
progress: "progress",
dependency: "dependency",
notes: "notes",
child: "subtasks",
expandState: "expandState",
cssClass: "cssClass",
baselineStartDate: "baselineStartDate",
baselineEndDate: "baselineEndDate",
},
editSettings: {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true,
mode: "Dialog",
},
contextMenuItems: [
"TaskInformation",
"Add",
{ text: "Import WorkCard", target: ".e-content", id: "importWorkCard" },
{ separator: true },
"DeleteTask",
"DeleteDependency",
"Convert",
{
text: "Critical Path",
target: ".e-content",
id: "criticalPath",
items: [
{
text: "Set Critical Path",
target: ".e-content",
id: "setCritical",
},
{
text: "Unset Critical Path",
target: ".e-content",
id: "unsetCritical",
},
],
},
{ separator: true },
{ text: "Collapse Row", target: ".e-content", id: "collapserow" },
{ text: "Expand Row", target: ".e-content", id: "expandrow" },
],
toolbar: [
{ text: "Status: ", id: "toolbarStatus", align: "Right" },
{ type: "Separator", align: "Right" },
{
text: "Import Template",
tooltipText: "Load Template",
id: "toolbarLoadTemplate",
align: "Right",
prefixIcon: "e-folder-open",
},
{
text: "Save",
tooltipText: "Save to Server",
id: "toolbarSave",
align: "Right",
prefixIcon: "e-save",
},
{
text: "Save & Publish",
tooltipText: "Save to Server and publish it to customer",
id: "toolbarPublish",
align: "Right",
prefixIcon: "e-bring-to-front",
},
"Add",
"Edit",
{
text: "Set BaseLine",
tooltipText: "Set BaseLine",
id: "toolbarBaseLine",
prefixIcon: "e-stamp",
},
{ type: "Separator" },
"ExpandAll",
"CollapseAll",
"ZoomIn",
"ZoomOut",
"ZoomToFit",
{
id: "toolbarToday",
text: "Today",
prefixIcon: "e-timeline-today",
tooltipText: "Scroll to Today",
},
],
height: "768px",
labelSettings: {
// leftLabel: "Task Name"
},
columns: [
{
field: "taskName",
width: "250",
//template: "${taskName}",
},
{ field: "taskID", width: "0" }, // BUG: 去掉后修改不了task
],
splitterSettings: {
columnIndex: 1,
},
tooltipSettings: {
taskbar: "taskbarTooltipTemplate",
},
eventMarkers: [{ day: new Date(), label: "Today" }],
collapseAllParentTasks: "true",
renderBaseline: "true",
publishStatus: "",
});