甘特图新增弹窗
This commit is contained in:
parent
9a1d82934b
commit
5771243166
@ -2,18 +2,25 @@
|
||||
<!-- saved from url=(0049)http://www.plusgantt.com/gantt/demo/ExtGantt.html -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" class=" ext-strict x-viewport">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Ext甘特图</title>
|
||||
|
||||
<meta name="keywords" content="extgantt,extjs,gantt,甘特图">
|
||||
<meta name="description" content="普加甘特图可以与ExtJS无缝集成">
|
||||
<meta name="keywords" content="extgantt,extjs,gantt,甘特图" />
|
||||
<meta name="description" content="普加甘特图可以与ExtJS无缝集成" />
|
||||
<!--extjs css-->
|
||||
<link href="./Ext甘特图_files/ext-all.css" rel="stylesheet" type="text/css">
|
||||
<link href="./Ext甘特图_files/icons.css" rel="stylesheet" type="text/css">
|
||||
<link href="./Ext甘特图_files/miniui.css" rel="stylesheet" type="text/css">
|
||||
<link href="./Ext甘特图_files/skin.css" rel="stylesheet" type="text/css">
|
||||
<link
|
||||
href="./Ext甘特图_files/ext-all.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link href="./Ext甘特图_files/icons.css" rel="stylesheet" type="text/css" />
|
||||
<link
|
||||
href="./Ext甘特图_files/miniui.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link href="./Ext甘特图_files/skin.css" rel="stylesheet" type="text/css" />
|
||||
<!-- <link href="./Ext甘特图_files/skin.css" rel="stylesheet" type="text/css"> -->
|
||||
|
||||
</head>
|
||||
|
||||
<body class="ext-webkit ext-chrome ext-mac x-border-layout-ct" id="ext-gen3">
|
||||
@ -24,18 +31,54 @@
|
||||
<script src="./Ext甘特图_files/jquery.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/miniui.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/zh_CN.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/CalendarWindow.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/ProjectMenu.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/StatusColumn.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/TaskWindow.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/ResourcesWindow.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/ProjectServices.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/swfobject.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/GanttService.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/GanttMenu.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/GanttSchedule.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/RGanttMenu.js" type="text/javascript"></script>
|
||||
<script src="./Ext甘特图_files/RGanttSchedule.js" type="text/javascript"></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/CalendarWindow.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/ProjectMenu.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/StatusColumn.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/TaskWindow.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/ResourcesWindow.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/ProjectServices.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/swfobject.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/GanttService.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/GanttMenu.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/GanttSchedule.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/RGanttMenu.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
<script
|
||||
src="./Ext甘特图_files/RGanttSchedule.js"
|
||||
type="text/javascript"
|
||||
></script>
|
||||
|
||||
<!-- 引入axios -->
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
@ -44,21 +87,22 @@
|
||||
<script type="text/javascript">
|
||||
//页面加载就绪
|
||||
window.onload = () => {
|
||||
console.log('window.onload')
|
||||
var parentUrl = getParentUrl()
|
||||
console.log('parentUrl', parentUrl)
|
||||
if (parentUrl.indexOf('dataBoard') != -1) {
|
||||
document.getElementById('ext-gen3').classList.add('greyBox')
|
||||
console.log("window.onload");
|
||||
var parentUrl = getParentUrl();
|
||||
console.log("parentUrl", parentUrl);
|
||||
if (parentUrl.indexOf("dataBoard") != -1) {
|
||||
document.getElementById("ext-gen3").classList.add("greyBox");
|
||||
} else {
|
||||
document.getElementById('ext-gen3').classList.remove('greyBox')
|
||||
document.getElementById("ext-gen3").classList.remove("greyBox");
|
||||
}
|
||||
|
||||
//获取请求地址
|
||||
let url = window.parent.document.getElementById("iframe").contentWindow.location.search;
|
||||
var parameter = url.split('='); //所有参数
|
||||
var requestUrl = parameter[1].split('&')[0]; //请求服务器的地址
|
||||
var projectSn = parameter[2].split('&')[0]; //projectSn
|
||||
var token = parameter[3]
|
||||
let url = window.parent.document.getElementById("iframe").contentWindow
|
||||
.location.search;
|
||||
var parameter = url.split("="); //所有参数
|
||||
var requestUrl = parameter[1].split("&")[0]; //请求服务器的地址
|
||||
var projectSn = parameter[2].split("&")[0]; //projectSn
|
||||
var token = parameter[3];
|
||||
var listData = [];
|
||||
|
||||
//转换时间戳
|
||||
@ -81,114 +125,137 @@
|
||||
var date = new Date(inputTime);
|
||||
var y = date.getFullYear();
|
||||
var m = date.getMonth() + 1;
|
||||
m = m < 10 ? ('0' + m) : m;
|
||||
m = m < 10 ? "0" + m : m;
|
||||
var d = date.getDate();
|
||||
d = d < 10 ? ('0' + d) : d;
|
||||
return y + '-' + m + '-' + d
|
||||
};
|
||||
d = d < 10 ? "0" + d : d;
|
||||
return y + "-" + m + "-" + d;
|
||||
}
|
||||
getListData = () => {
|
||||
axios.defaults.headers.common['Authorization'] = 'Bearer' + ' ' + token;
|
||||
axios.get(requestUrl + 'xmgl/progressTask/getParentChildList', { params: { projectSn: projectSn }, }).then(res => {
|
||||
axios.defaults.headers.common["Authorization"] =
|
||||
"Bearer" + " " + token;
|
||||
axios
|
||||
.get(requestUrl + "xmgl/progressTask/getParentChildList", {
|
||||
params: { projectSn: projectSn },
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.code == 200) {
|
||||
console.log('查询结果', res.data.result)
|
||||
console.log("查询结果", res.data.result);
|
||||
let dataArr = res.data.result;
|
||||
let number = 0;
|
||||
let type = false;
|
||||
for (let i = 0; i < dataArr.length; i++) {
|
||||
let data = {
|
||||
"id": dataArr[i].id,
|
||||
id: dataArr[i].id,
|
||||
// "UID": dataArr[i].id, //任务唯一标识符
|
||||
"taskName": dataArr[i].taskName, //任务名称
|
||||
"progressRatio": dataArr[i].progressRatio, //完成百分比
|
||||
"duration": dataArr[i].duration, //工期
|
||||
"Start": dataArr[i].startDate, //计划开始日期
|
||||
"Finish": dataArr[i].finishDate, //计划完成日期
|
||||
"actualStartDate": dataArr[i].actualStartDate, //实际开始日期
|
||||
"actualFinishDate": dataArr[i].actualFinishDate, //实际完成日期
|
||||
"children": [], //子级
|
||||
"remark": dataArr[i].remark, //备注
|
||||
taskName: dataArr[i].taskName, //任务名称
|
||||
PercentComplete: dataArr[i].progressRatio, //完成百分比
|
||||
duration: dataArr[i].duration, //工期
|
||||
Start: dataArr[i].startDate, //计划开始日期
|
||||
Finish: dataArr[i].finishDate, //计划完成日期
|
||||
actualStartDate: dataArr[i].actualStartDate, //实际开始日期
|
||||
actualFinishDate: dataArr[i].actualFinishDate, //实际完成日期
|
||||
children: [], //子级
|
||||
remark: dataArr[i].remark, //备注
|
||||
// "PredecessorLink":dataArr[i].predecessorIds,
|
||||
"PredecessorLink": [
|
||||
PredecessorLink: [
|
||||
{
|
||||
"PredecessorUID": dataArr[i].predecessorIds
|
||||
}
|
||||
],
|
||||
}
|
||||
console.log('参数传进去了吗',data.PredecessorLink)
|
||||
if (dataArr[i].children.length > 0) {
|
||||
let threeData = dataArr[i].children
|
||||
let threeNum = 0
|
||||
for (let j = 0; j < dataArr[i].children.length; j++) {
|
||||
console.log('有关联的前置任务嘛', dataArr[i].children[j].predecessorIds)
|
||||
number++;
|
||||
let children = {
|
||||
"id": dataArr[i].children[j].id,
|
||||
"UID": number, //任务唯一标识符
|
||||
"taskName": dataArr[i].children[j].taskName, //任务名称
|
||||
"progressRatio": dataArr[i].children[j].progressRatio, //完成百分比
|
||||
"duration": dataArr[i].children[j].duration, //工期
|
||||
"Start": dataArr[i].children[j].startDate, //计划开始日期
|
||||
"Finish": dataArr[i].children[j].finishDate, //计划完成日期
|
||||
"actualStartDate": dataArr[i].children[j].actualStartDate, //实际开始日期
|
||||
"actualFinishDate": dataArr[i].children[j].actualFinishDate, //实际完成日期
|
||||
"children": [], //子级
|
||||
"remark": dataArr[i].children[j].remark, //备注
|
||||
// "PredecessorLink":dataArr[i].children[j].predecessorIds,
|
||||
"PredecessorLink": [ //前置任务字段
|
||||
{
|
||||
"PredecessorUID": dataArr[i].children[j].predecessorIds
|
||||
}
|
||||
Type: 1,
|
||||
PredecessorUID: number-1
|
||||
},
|
||||
],
|
||||
};
|
||||
console.log('参数传进去了吗2222',children.PredecessorLink)
|
||||
console.log("参数传进去了吗", data.PredecessorLink);
|
||||
if (dataArr[i].children.length > 0) {
|
||||
let threeData = dataArr[i].children;
|
||||
let threeNum = 0;
|
||||
for (let j = 0; j < dataArr[i].children.length; j++) {
|
||||
console.log(
|
||||
"有关联的前置任务嘛",
|
||||
dataArr[i].children[j].predecessorIds
|
||||
);
|
||||
number++;
|
||||
let children = {
|
||||
id: dataArr[i].children[j].id,
|
||||
UID: number, //任务唯一标识符
|
||||
taskName: dataArr[i].children[j].taskName, //任务名称
|
||||
PercentComplete: dataArr[i].children[j].progressRatio, //完成百分比
|
||||
duration: dataArr[i].children[j].duration, //工期
|
||||
Start: dataArr[i].children[j].startDate, //计划开始日期
|
||||
Finish: dataArr[i].children[j].finishDate, //计划完成日期
|
||||
actualStartDate: dataArr[i].children[j].actualStartDate, //实际开始日期
|
||||
actualFinishDate:
|
||||
dataArr[i].children[j].actualFinishDate, //实际完成日期
|
||||
children: [], //子级
|
||||
remark: dataArr[i].children[j].remark, //备注
|
||||
// "PredecessorLink":dataArr[i].children[j].predecessorIds,
|
||||
PredecessorLink: [
|
||||
//前置任务字段
|
||||
{
|
||||
Type: 1,
|
||||
PredecessorUID:number-1
|
||||
},
|
||||
],
|
||||
};
|
||||
console.log(
|
||||
"参数传进去了吗2222",
|
||||
children.PredecessorLink
|
||||
);
|
||||
data.children.push(children);
|
||||
if (threeData[j].children.length > 0) {
|
||||
for (let k = 0; k < threeData[j].children.length; k++) {
|
||||
number++;
|
||||
console.log('threeData[j].children', threeData[j].children[k])
|
||||
console.log(
|
||||
"threeData[j].children",
|
||||
threeData[j].children[k]
|
||||
);
|
||||
let children2 = {
|
||||
"id": threeData[j].children[k].id,
|
||||
"UID": number,
|
||||
"taskName": threeData[j].children[k].taskName, //任务名称
|
||||
"progressRatio": threeData[j].children[k].progressRatio, //完成百分比
|
||||
"duration": threeData[j].children[k].duration, //工期
|
||||
"Start": threeData[j].children[k].startDate, //计划开始日期
|
||||
"Finish": threeData[j].children[k].finishDate, //计划完成日期
|
||||
"actualStartDate": threeData[j].children[k].actualStartDate, //实际开始日期
|
||||
"actualFinishDate": threeData[j].children[k].actualFinishDate, //实际完成日期
|
||||
"children": [], //子级
|
||||
"remark": threeData[j].children[k].remark, //备注
|
||||
id: threeData[j].children[k].id,
|
||||
UID: number,
|
||||
taskName: threeData[j].children[k].taskName, //任务名称
|
||||
PercentComplete:
|
||||
threeData[j].children[k].progressRatio, //完成百分比
|
||||
duration: threeData[j].children[k].duration, //工期
|
||||
Start: threeData[j].children[k].startDate, //计划开始日期
|
||||
Finish: threeData[j].children[k].finishDate, //计划完成日期
|
||||
actualStartDate:
|
||||
threeData[j].children[k].actualStartDate, //实际开始日期
|
||||
actualFinishDate:
|
||||
threeData[j].children[k].actualFinishDate, //实际完成日期
|
||||
children: [], //子级
|
||||
remark: threeData[j].children[k].remark, //备注
|
||||
// "PredecessorLink":threeData[j].children[k].predecessorIds,
|
||||
"PredecessorLink": [ //前置任务字段
|
||||
PredecessorLink: [
|
||||
//前置任务字段
|
||||
{
|
||||
"PredecessorUID": threeData[j].children[k].predecessorIds
|
||||
}
|
||||
Type: 1,
|
||||
PredecessorUID:number-1
|
||||
},
|
||||
],
|
||||
};
|
||||
data.children[0].children.push(children2)
|
||||
data.children[0].children.push(children2);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log('此时递归后的data数据', data)
|
||||
}
|
||||
console.log("此时递归后的data数据", data);
|
||||
number++;
|
||||
listData.push(data)
|
||||
listData.push(data);
|
||||
}
|
||||
} else {
|
||||
alert(res.data.message)
|
||||
alert(res.data.message);
|
||||
}
|
||||
gantt.loadTasks(listData);
|
||||
gantt.unmask();
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
getListData();
|
||||
|
||||
//创建ext面板
|
||||
var viewport = new Ext.Viewport({
|
||||
layout: 'border',
|
||||
layout: "border",
|
||||
items: [
|
||||
new Ext.BoxComponent({
|
||||
region: 'north',
|
||||
region: "north",
|
||||
height: 0,
|
||||
// autoEl: {
|
||||
// tag: 'div',
|
||||
@ -196,32 +263,35 @@
|
||||
// }
|
||||
}),
|
||||
{
|
||||
region: 'west',
|
||||
id: 'west-panel',
|
||||
title: 'West',
|
||||
region: "west",
|
||||
id: "west-panel",
|
||||
title: "West",
|
||||
split: false,
|
||||
width: 0,
|
||||
minSize: 175,
|
||||
maxSize: 400,
|
||||
collapsible: true,
|
||||
margins: '0 0 0 0',
|
||||
margins: "0 0 0 0",
|
||||
layout: {
|
||||
type: 'accordion',
|
||||
animate: true
|
||||
type: "accordion",
|
||||
animate: true,
|
||||
},
|
||||
items: [{
|
||||
title: 'Navigation',
|
||||
items: [
|
||||
{
|
||||
title: "Navigation",
|
||||
border: false,
|
||||
iconCls: 'nav'
|
||||
}, {
|
||||
title: 'Settings',
|
||||
html: '<p>Some settings in here.</p>',
|
||||
iconCls: "nav",
|
||||
},
|
||||
{
|
||||
title: "Settings",
|
||||
html: "<p>Some settings in here.</p>",
|
||||
border: false,
|
||||
iconCls: 'settings'
|
||||
}]
|
||||
iconCls: "settings",
|
||||
},
|
||||
],
|
||||
},
|
||||
new Ext.TabPanel({
|
||||
region: 'center', //部署的区域,参考上图,center是中间显示页面区域
|
||||
region: "center", //部署的区域,参考上图,center是中间显示页面区域
|
||||
autoScroll: true,
|
||||
animScroll: true,
|
||||
resizTabs: true,
|
||||
@ -229,7 +299,7 @@
|
||||
activeTab: 0,
|
||||
deferredRender: false,
|
||||
defaults: {
|
||||
autoScroll: true
|
||||
autoScroll: true,
|
||||
},
|
||||
tabMargin: 0,
|
||||
items: [
|
||||
@ -237,11 +307,10 @@
|
||||
id: "extwrap",
|
||||
title: "甘特图",
|
||||
region: "center",
|
||||
})
|
||||
]
|
||||
|
||||
})
|
||||
]
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
});
|
||||
////////////////////////////////////////////
|
||||
var extControl = Ext.get("extwrap");
|
||||
@ -258,8 +327,8 @@
|
||||
header: "ID<br/>String",
|
||||
width: 50,
|
||||
editor: {
|
||||
type: "textbox"
|
||||
}
|
||||
type: "textbox",
|
||||
},
|
||||
};
|
||||
columns.push(idColumn);
|
||||
var stringColumn = {
|
||||
@ -268,8 +337,8 @@
|
||||
field: "taskName",
|
||||
width: 150,
|
||||
editor: {
|
||||
type: "textbox"
|
||||
}
|
||||
type: "textbox",
|
||||
},
|
||||
};
|
||||
columns.push(stringColumn);
|
||||
var linkColumn = {
|
||||
@ -278,7 +347,7 @@
|
||||
field: "predecessorLink",
|
||||
width: 150,
|
||||
editor: {
|
||||
type: "textbox"
|
||||
type: "textbox",
|
||||
},
|
||||
// renderer: function (e) {
|
||||
// console.log('前置任务',e)
|
||||
@ -294,11 +363,11 @@
|
||||
renderer: function(e) {
|
||||
var date = e.value;
|
||||
if (!date) return "";
|
||||
return formatDateTime(e.value)
|
||||
return formatDateTime(e.value);
|
||||
},
|
||||
editor: {
|
||||
type: "datepicker"
|
||||
}
|
||||
type: "datepicker",
|
||||
},
|
||||
};
|
||||
columns.push(dateColumn1);
|
||||
var dateColumn2 = {
|
||||
@ -308,11 +377,11 @@
|
||||
renderer: function(e) {
|
||||
var date = e.value;
|
||||
if (!date) return "";
|
||||
return formatDateTime(e.value)
|
||||
return formatDateTime(e.value);
|
||||
},
|
||||
editor: {
|
||||
type: "datepicker"
|
||||
}
|
||||
type: "datepicker",
|
||||
},
|
||||
};
|
||||
columns.push(dateColumn2);
|
||||
var dateColumn3 = {
|
||||
@ -322,11 +391,11 @@
|
||||
renderer: function(e) {
|
||||
var date = e.value;
|
||||
if (!date) return "";
|
||||
return formatDateTime(e.value)
|
||||
return formatDateTime(e.value);
|
||||
},
|
||||
editor: {
|
||||
type: "datepicker"
|
||||
}
|
||||
type: "datepicker",
|
||||
},
|
||||
};
|
||||
columns.push(dateColumn3);
|
||||
var dateColumn4 = {
|
||||
@ -336,11 +405,11 @@
|
||||
renderer: function(e) {
|
||||
var date = e.value;
|
||||
if (!date) return "";
|
||||
return formatDateTime(e.value)
|
||||
return formatDateTime(e.value);
|
||||
},
|
||||
editor: {
|
||||
type: "datepicker"
|
||||
}
|
||||
type: "datepicker",
|
||||
},
|
||||
};
|
||||
columns.push(dateColumn4);
|
||||
var durationColumn = {
|
||||
@ -349,18 +418,18 @@
|
||||
field: "duration",
|
||||
width: 60,
|
||||
editor: {
|
||||
type: "textbox"
|
||||
}
|
||||
type: "textbox",
|
||||
},
|
||||
};
|
||||
columns.push(durationColumn);
|
||||
var proColumn = {
|
||||
name: "percentComplete",
|
||||
header: "进度比例<br/>String",
|
||||
field: "progressRatio",
|
||||
field: "PercentComplete",
|
||||
width: 60,
|
||||
editor: {
|
||||
type: "textbox"
|
||||
}
|
||||
type: "textbox",
|
||||
},
|
||||
};
|
||||
columns.push(proColumn);
|
||||
var remarkColumn = {
|
||||
@ -370,15 +439,15 @@
|
||||
width: 150,
|
||||
editor: {
|
||||
type: "textbox",
|
||||
}
|
||||
},
|
||||
};
|
||||
columns.push(remarkColumn);
|
||||
//将列集合数组设置给甘特图
|
||||
gantt.setColumns(columns);
|
||||
gantt.setTreeColumn("name")
|
||||
gantt.setTreeColumn("name");
|
||||
gantt.addTask({
|
||||
name: "11111"
|
||||
})
|
||||
name: "11111",
|
||||
});
|
||||
// // 新增时触发
|
||||
// var cellCommitAdd = (e) => {
|
||||
// let uid = e.task.UID; //修改行的id
|
||||
@ -391,7 +460,7 @@
|
||||
|
||||
//右键菜单
|
||||
var ganttMenu = new GanttMenu();
|
||||
console.log('右键菜单有哪些', ganttMenu)
|
||||
console.log("右键菜单有哪些", ganttMenu);
|
||||
gantt.setContextMenu(ganttMenu);
|
||||
gantt.loading();
|
||||
//渲染
|
||||
@ -399,9 +468,10 @@
|
||||
var data = listData;
|
||||
gantt.loadTasks(data);
|
||||
gantt.unmask();
|
||||
}, 3000)
|
||||
}, 3000);
|
||||
|
||||
var cellCommitEdit = (e) => {
|
||||
console.log("eeeeeeee", e);
|
||||
var data = {
|
||||
taskName: e.task.taskName,
|
||||
Start: e.task.Start,
|
||||
@ -412,21 +482,22 @@
|
||||
progressRatio: e.task.progressRatio,
|
||||
remark: e.task.remark,
|
||||
id: e.task.id,
|
||||
projectSn: projectSn
|
||||
}
|
||||
data[e.field] = e.value
|
||||
projectSn: projectSn,
|
||||
};
|
||||
data[e.field] = e.value;
|
||||
let data2 = {};
|
||||
for (let d in data) {
|
||||
if(d=='Start'||d=='Finish'){
|
||||
if(d=='Start'){
|
||||
data2.startDate=data[d]
|
||||
}else if(d=='finishDate'){
|
||||
data2.startDate=data[d]
|
||||
if (d == "Start" || d == "Finish" || d == "PercentComplete") {
|
||||
if (d == "Start") {
|
||||
data2.startDate = data[d];
|
||||
} else if (d == "finishDate") {
|
||||
data2.startDate = data[d];
|
||||
}else if( d == "PercentComplete"){
|
||||
data2.progressRatio = data[d];
|
||||
}
|
||||
} else {
|
||||
data2[d]=data[d]
|
||||
data2[d] = data[d];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// let {Start:startDate,Finish:finishDate}=data
|
||||
@ -438,65 +509,144 @@
|
||||
// let value = e.value; //修改的内容
|
||||
// var task = e.task; //修改的内容
|
||||
// // 请求接口的参数
|
||||
console.log('参数', data2)
|
||||
console.log("参数", data2);
|
||||
if (e.task.hasOwnProperty("id")) {
|
||||
setTimeout(() => {
|
||||
axios.post(requestUrl + 'xmgl/progressTask/updateProgressTask', data2).then(res => {
|
||||
console.log('修改返回', res)
|
||||
axios
|
||||
.post(
|
||||
requestUrl + "xmgl/progressTask/updateProgressTask",
|
||||
data2
|
||||
)
|
||||
.then((res) => {
|
||||
console.log("修改返回", res);
|
||||
if (res.data.code == 200) {
|
||||
alert('编辑成功!')
|
||||
alert("编辑成功!");
|
||||
}
|
||||
})
|
||||
}, 500)
|
||||
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
};
|
||||
|
||||
//右侧 拖拽
|
||||
var itemdragcomplete = (e) => {
|
||||
let requestData = {
|
||||
id: e.item.UID,
|
||||
projectSn: projectSn
|
||||
projectSn: projectSn,
|
||||
};
|
||||
let startTime = formatDateTime(e.item.Start).substring(0, 10);
|
||||
let endTime = formatDateTime(e.item.Finish).substring(0, 10);
|
||||
requestData.startTime = startTime;
|
||||
requestData.endTime = endTime;
|
||||
axios.post(requestUrl + 'xmgl/progressItem/edit', requestData).then(res => {
|
||||
axios
|
||||
.post(requestUrl + "xmgl/progressItem/edit", requestData)
|
||||
.then((res) => {
|
||||
if (res.data.code == 200) {
|
||||
}
|
||||
})
|
||||
});
|
||||
// var project = e.source;
|
||||
// var task = e.task;
|
||||
//e是事件对象, 具体请看每个事件的"参数类型"
|
||||
};
|
||||
gantt.on('CellCommitEdit', cellCommitEdit);
|
||||
gantt.on('itemdragcomplete', itemdragcomplete);
|
||||
|
||||
}
|
||||
gantt.on("CellCommitEdit", cellCommitEdit);
|
||||
gantt.on("itemdragcomplete", itemdragcomplete);
|
||||
};
|
||||
function getParentUrl() {
|
||||
var url = "";
|
||||
try {
|
||||
url = window.top.document.location.href
|
||||
url = window.top.document.location.href;
|
||||
} catch (M) {
|
||||
if (window.parent) {
|
||||
try {
|
||||
url = window.parent.document.location.href
|
||||
url = window.parent.document.location.href;
|
||||
} catch (L) {
|
||||
url = ""
|
||||
url = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (url === "") {
|
||||
url = document.location.href
|
||||
url = document.location.href;
|
||||
}
|
||||
return url
|
||||
return url;
|
||||
}
|
||||
document.getElementById('cancel').onclick=function(){
|
||||
console.log('取消')
|
||||
document.getElementById('addDiv').style.display = 'none';
|
||||
}
|
||||
// function cancel(){
|
||||
// console.log('取消')
|
||||
// document.getElementById('addDiv').style.display = 'none';
|
||||
// }
|
||||
// function submit(){
|
||||
// console.log('确定')
|
||||
// }
|
||||
</script>
|
||||
|
||||
<div class="x-layout-split x-layout-split-west x-splitbar-h" id="west-panel-xsplit"
|
||||
style="left: 205px; top: 32px; height: 889px;"> </div>
|
||||
<div id="ext-gen9" class="x-unselectable x-splitbar-proxy x-splitbar-proxy-h"></div>
|
||||
<div class="mini-supergrid-editwrap"
|
||||
style="position: absolute; z-index: 1006; display: none; top: 580px; left: 802px; width: 100px;"></div>
|
||||
</body>
|
||||
<div
|
||||
class="x-layout-split x-layout-split-west x-splitbar-h"
|
||||
id="west-panel-xsplit"
|
||||
style="left: 205px; top: 32px; height: 889px;"
|
||||
>
|
||||
|
||||
</div>
|
||||
<div
|
||||
id="ext-gen9"
|
||||
class="x-unselectable x-splitbar-proxy x-splitbar-proxy-h"
|
||||
></div>
|
||||
<div
|
||||
class="mini-supergrid-editwrap"
|
||||
style="position: absolute; z-index: 1006; display: none; top: 580px; left: 802px; width: 100px;"
|
||||
></div>
|
||||
|
||||
<div class="addDiv" id="addDiv">
|
||||
<div class="addbox">
|
||||
<div class="row">
|
||||
<p>任务名称:</p><input id="taskName" type="input">
|
||||
<div class="row">
|
||||
<p>前置任务:</p><input id="predecessorIds" type="input">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>计划开始日期:</p><input id="startDate" type="text" placeholder="yyyy-MM-dd格式">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>计划完成日期:</p><input id="finishDate" type="text" placeholder="yyyy-MM-dd格式">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>实际开始时间:</p><input id="actualStartDate" type="text" placeholder="yyyy-MM-dd格式">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>实际完成时间:</p><input id="actualFinishDate" type="text" placeholder="yyyy-MM-dd格式">
|
||||
</div>
|
||||
</div>
|
||||
<button id="cancel" class="btn cancel">取消</button>
|
||||
<button id="" class="btn submit">确定</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
<style>
|
||||
.addDiv{
|
||||
display: none;
|
||||
position:absolute;
|
||||
top: 20%;
|
||||
left: 30%;
|
||||
z-index: 9999;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
.addbox{
|
||||
margin: 20px;
|
||||
}
|
||||
.row{
|
||||
margin-top: 10px;
|
||||
}
|
||||
p{
|
||||
display: inline-block;
|
||||
}
|
||||
.btn{
|
||||
width:80px;
|
||||
height: 30px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</html>
|
||||
@ -95,24 +95,38 @@ mini.extend(GanttMenu, mini.Menu, {
|
||||
// },
|
||||
|
||||
__OnAdd: function(e) {
|
||||
console.log("点击新增执行");
|
||||
console.log("点击新增执行",e);
|
||||
var gantt = this.owner;
|
||||
var targetTask = gantt.getSelected();
|
||||
var task = gantt.newTask();
|
||||
console.log("=====添加", task);
|
||||
var task = gantt.newTask()
|
||||
//加到选中任务之后
|
||||
// gantt.addTask(task, "after", targetTask);
|
||||
// 新增弹窗
|
||||
// 没有父级的时候
|
||||
if (!targetTask) {
|
||||
// var x;
|
||||
// var name=prompt("请输入任务名称",""); //显示默认文本 ""
|
||||
// var duration=prompt("请输入工期",""); //显示默认文本 ""
|
||||
// var duration=prompt("请输入工期",""); //显示默认文本 ""
|
||||
// var dutyUserName=prompt("请输入负责人名称",""); //显示默认文本 ""
|
||||
// console.log('name',name,duration,dutyUserName,)
|
||||
document.getElementById('addDiv').style.display = 'block';
|
||||
console.log('vvvvv',document.getElementById('addDiv'))
|
||||
|
||||
// if(!e.task.taskName){
|
||||
// data.taskName = e.task.taskName
|
||||
// }
|
||||
// console.log('data',data)
|
||||
// if(e.task.taskName !="" && e.task.Start!="" && e.task.Finish!="" && e.task.duration!=""&&e.task.progressRatio!=""&&e.task.remark!=""){
|
||||
// var data2 = {
|
||||
// taskName: e.task.taskName,
|
||||
// Start: e.task.Start,
|
||||
// Finish: e.task.Finish,
|
||||
// // actualStartDate: e.task.actualStartDate,
|
||||
// // actualFinishDate: e.task.actualFinishDate,
|
||||
// duration: e.task.duration,
|
||||
// progressRatio: e.task.progressRatio,
|
||||
// remark: e.task.remark,
|
||||
// // projectSn: projectSn,
|
||||
// };
|
||||
// // 没有父级的时候
|
||||
// if (targetTask) {
|
||||
// data.parentId = e.task.id
|
||||
// }
|
||||
// console.log('添加data',data)
|
||||
// }
|
||||
|
||||
}
|
||||
},
|
||||
__OnEdit: function(e) {
|
||||
var gantt = this.owner;
|
||||
@ -129,7 +143,6 @@ mini.extend(GanttMenu, mini.Menu, {
|
||||
.location.search;
|
||||
var parameter = url.split("="); //所有参数
|
||||
var requestUrl = parameter[1].split("&")[0]; //请求服务器的地址
|
||||
console.log("=======task", task);
|
||||
if (task) {
|
||||
if (confirm('确定删除任务 "' + task.taskName + '" ?')) {
|
||||
gantt.removeTask(task);
|
||||
|
||||
@ -35,7 +35,7 @@ GanttSchedule.prototype = {
|
||||
__OnCellBeginEdit: function (e) {
|
||||
var task = e.record, field = e.field;
|
||||
if (task.Summary) {
|
||||
if (field == 'Start' || field == 'Finish' || field == 'Duration') {
|
||||
if (field == 'Start' || field == 'Finish' || field == 'duration') {
|
||||
e.cancel = true;
|
||||
}
|
||||
}
|
||||
@ -59,12 +59,12 @@ GanttSchedule.prototype = {
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case "Duration":
|
||||
task.Duration = value;
|
||||
case "duration":
|
||||
task.duration = value;
|
||||
|
||||
if (task.Start) {
|
||||
task.Finish = maxTime(task.Start);
|
||||
task.Finish.setDate(task.Finish.getDate() + task.Duration - 1);
|
||||
task.Finish.setDate(task.Finish.getDate() + task.duration - 1);
|
||||
|
||||
gantt.setTaskModified(task, "Finish");
|
||||
}
|
||||
@ -75,7 +75,7 @@ GanttSchedule.prototype = {
|
||||
|
||||
if (task.Start) {
|
||||
task.Finish = maxTime(task.Start);
|
||||
task.Finish.setDate(task.Start.getDate() + task.Duration - 1);
|
||||
task.Finish.setDate(task.Start.getDate() + task.duration - 1);
|
||||
|
||||
gantt.setTaskModified(task, "Finish");
|
||||
}
|
||||
@ -86,9 +86,9 @@ GanttSchedule.prototype = {
|
||||
|
||||
if (task.Finish && task.Start) {
|
||||
var days = parseInt((task.Finish - task.Start) / (3600 * 24 * 1000));
|
||||
task.Duration = days + 1;
|
||||
task.duration = days + 1;
|
||||
|
||||
gantt.setTaskModified(task, "Duration");
|
||||
gantt.setTaskModified(task, "duration");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user