进度管理(甘特图):右侧拖拽事件
This commit is contained in:
parent
1243ede43e
commit
e6d68d55d8
@ -157,12 +157,12 @@
|
||||
children: [], //子级
|
||||
remark: dataArr[i].remark, //备注
|
||||
// "PredecessorLink":dataArr[i].predecessorIds,
|
||||
PredecessorLink: [
|
||||
{
|
||||
Type: 1,
|
||||
PredecessorUID: number-1
|
||||
},
|
||||
],
|
||||
// PredecessorLink: [
|
||||
// {
|
||||
// Type: 1,
|
||||
// PredecessorUID: number-1
|
||||
// },
|
||||
// ],
|
||||
};
|
||||
console.log("参数传进去了吗", data.PredecessorLink);
|
||||
if (dataArr[i].children.length > 0) {
|
||||
@ -188,13 +188,13 @@
|
||||
children: [], //子级
|
||||
remark: dataArr[i].children[j].remark, //备注
|
||||
// "PredecessorLink":dataArr[i].children[j].predecessorIds,
|
||||
PredecessorLink: [
|
||||
//前置任务字段
|
||||
{
|
||||
Type: 1,
|
||||
PredecessorUID:number-1
|
||||
},
|
||||
],
|
||||
// PredecessorLink: [
|
||||
// //前置任务字段
|
||||
// {
|
||||
// Type: 1,
|
||||
// PredecessorUID:number-1
|
||||
// },
|
||||
// ],
|
||||
};
|
||||
console.log(
|
||||
"参数传进去了吗2222",
|
||||
@ -224,13 +224,13 @@
|
||||
children: [], //子级
|
||||
remark: threeData[j].children[k].remark, //备注
|
||||
// "PredecessorLink":threeData[j].children[k].predecessorIds,
|
||||
PredecessorLink: [
|
||||
//前置任务字段
|
||||
{
|
||||
Type: 1,
|
||||
PredecessorUID:number-1
|
||||
},
|
||||
],
|
||||
// PredecessorLink: [
|
||||
// //前置任务字段
|
||||
// {
|
||||
// Type: 1,
|
||||
// PredecessorUID:number-1
|
||||
// },
|
||||
// ],
|
||||
};
|
||||
data.children[0].children.push(children2);
|
||||
}
|
||||
@ -446,7 +446,7 @@
|
||||
gantt.setColumns(columns);
|
||||
gantt.setTreeColumn("name");
|
||||
gantt.addTask({
|
||||
name: "11111",
|
||||
taskName: "11111",
|
||||
});
|
||||
// // 新增时触发
|
||||
// var cellCommitAdd = (e) => {
|
||||
@ -490,8 +490,8 @@
|
||||
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 == "Finish") {
|
||||
data2.finishDate = data[d];
|
||||
}else if( d == "PercentComplete"){
|
||||
data2.progressRatio = data[d];
|
||||
}
|
||||
@ -529,17 +529,21 @@
|
||||
|
||||
//右侧 拖拽
|
||||
var itemdragcomplete = (e) => {
|
||||
// console.log('=====拖拽回调',e)
|
||||
let requestData = {
|
||||
id: e.item.UID,
|
||||
id: e.item.id,
|
||||
projectSn: projectSn,
|
||||
taskName:e.item.taskName,
|
||||
progressRatio:e.item.PercentComplete
|
||||
};
|
||||
let startTime = formatDateTime(e.item.Start).substring(0, 10);
|
||||
let endTime = formatDateTime(e.item.Finish).substring(0, 10);
|
||||
requestData.startTime = startTime;
|
||||
requestData.endTime = endTime;
|
||||
requestData.startDate = startTime;
|
||||
requestData.finishDate = endTime;
|
||||
axios
|
||||
.post(requestUrl + "xmgl/progressItem/edit", requestData)
|
||||
.post(requestUrl + "xmgl/progressTask/updateProgressTask", requestData)
|
||||
.then((res) => {
|
||||
// console.log('=======',res)
|
||||
if (res.data.code == 200) {
|
||||
}
|
||||
});
|
||||
@ -568,17 +572,6 @@
|
||||
}
|
||||
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
|
||||
@ -601,9 +594,16 @@
|
||||
<div class="addbox">
|
||||
<div class="row">
|
||||
<p>任务名称:</p><input id="taskName" type="input">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>工期:</p><input id="duration" type="input">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>前置任务:</p><input id="predecessorIds" type="input">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>进度比例:</p><input id="progressRatio" type="input">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>计划开始日期:</p><input id="startDate" type="text" placeholder="yyyy-MM-dd格式">
|
||||
</div>
|
||||
@ -616,9 +616,12 @@
|
||||
<div class="row">
|
||||
<p>实际完成时间:</p><input id="actualFinishDate" type="text" placeholder="yyyy-MM-dd格式">
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>备注:</p><input id="remark" type="input">
|
||||
</div>
|
||||
</div>
|
||||
<button id="cancel" class="btn cancel">取消</button>
|
||||
<button id="" class="btn submit">确定</button>
|
||||
<button id="submit" class="btn submit">确定</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -93,40 +93,50 @@ mini.extend(GanttMenu, mini.Menu, {
|
||||
// gantt.downgradeTask(task);
|
||||
// }
|
||||
// },
|
||||
|
||||
__OnAdd: function(e) {
|
||||
console.log("点击新增执行",e);
|
||||
var gantt = this.owner;
|
||||
var targetTask = gantt.getSelected();
|
||||
var task = gantt.newTask()
|
||||
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 createUserId = store.state.userInfo.userId
|
||||
//加到选中任务之后
|
||||
// gantt.addTask(task, "after", targetTask);
|
||||
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)
|
||||
// }
|
||||
|
||||
document.getElementById('cancel').onclick=function(){
|
||||
document.getElementById('addDiv').style.display = 'none';
|
||||
}
|
||||
document.getElementById('submit').onclick=function(){
|
||||
let data = {}
|
||||
data.taskName = document.getElementById("taskName").value;
|
||||
data.duration = document.getElementById("duration").value;
|
||||
data.progressRatio = document.getElementById("progressRatio").value;
|
||||
data.predecessorIds = document.getElementById("predecessorIds").value;
|
||||
data.startDate = document.getElementById("startDate").value;
|
||||
data.finishDate = document.getElementById("finishDate").value;
|
||||
data.actualStartDate = document.getElementById("actualStartDate").value;
|
||||
data.actualFinishDate = document.getElementById("actualFinishDate").value;
|
||||
data.remark = document.getElementById("remark").value;
|
||||
console.log('data',data)
|
||||
// document.getElementById('addDiv').style.display = 'none';
|
||||
// if (!targetTask) {
|
||||
// data.parentId = e.task.id
|
||||
// }
|
||||
data.projectSn = projectSn
|
||||
data.createUserId = '4'
|
||||
console.log('data',data)
|
||||
axios
|
||||
.post(requestUrl + "xmgl/progressTask/addProgressTask", data)
|
||||
.then((res) => {
|
||||
console.log('====新增',res)
|
||||
alert('新增成功!')
|
||||
document.getElementById('addDiv').style.display = 'none';
|
||||
});
|
||||
}
|
||||
},
|
||||
__OnEdit: function(e) {
|
||||
var gantt = this.owner;
|
||||
|
||||
@ -128,16 +128,16 @@ GanttSchedule.prototype = {
|
||||
task.Finish = maxTime(value);
|
||||
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");
|
||||
}
|
||||
}
|
||||
if (action == "percentcomplete") {
|
||||
console.log('是更改进度',task)
|
||||
gantt.setTaskModified(task, "PercentComplete");
|
||||
|
||||
// console.log('更改进度的时候的task',task)
|
||||
task.PercentComplete = value;
|
||||
|
||||
}
|
||||
if (action == "move") {
|
||||
gantt.setTaskModified(task, "Start");
|
||||
@ -146,7 +146,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");
|
||||
}
|
||||
@ -168,7 +168,7 @@ GanttSchedule.prototype = {
|
||||
if (nodes && nodes.length > 0) {
|
||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||
var node = nodes[i];
|
||||
var d = parseInt(node.Duration);
|
||||
var d = parseInt(node.duration);
|
||||
if (!isNaN(d)) {
|
||||
duration += d;
|
||||
}
|
||||
@ -184,9 +184,9 @@ GanttSchedule.prototype = {
|
||||
var t = ans[i];
|
||||
//2)获取父任务下子任务的Duration之和
|
||||
var duration = getDuration(t);
|
||||
if (t.Duration != duration) {
|
||||
t.Duration = duration;
|
||||
gantt.setTaskModified(t, "Duration");
|
||||
if (t.duration != duration) {
|
||||
t.duration = duration;
|
||||
gantt.setTaskModified(t, "duration");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,8 @@ if (process.env.NODE_ENV == 'development') {
|
||||
// axios.defaults.baseURL = 'http://124.71.178.44:100/' // 河南
|
||||
// tag: 本地
|
||||
// axios.defaults.baseURL = 'http://192.168.34.174:6023/' // 老大本地
|
||||
axios.defaults.baseURL = 'http://192.168.34.116:6023/' // 邱平毅本地
|
||||
// axios.defaults.baseURL = 'http://192.168.34.116:6023/' // 邱平毅本地
|
||||
axios.defaults.baseURL = 'http://192.168.34.117:6023/' // 杨杰本地
|
||||
// axios.defaults.baseURL = 'http://ue6a4s.natappfree.cc' // 邱平毅vpn本地
|
||||
// axios.defaults.baseURL = 'http://139.9.66.234:6324/' // 河南春笋
|
||||
// axios.defaults.baseURL ='http://124.71.67.160:8088/' //中建四局线上
|
||||
|
||||
@ -44,9 +44,9 @@ export default new Vuex.Store({
|
||||
PAGESIZRS: [10, 20, 30, 50],
|
||||
// UPLOADURL:'http://10.0.1.43:6023/upload/image',//测试
|
||||
// FILEURL:'http://10.0.1.43:6023/image/',//测试
|
||||
// BASEURL: baseUrl ? baseUrl : window.location.protocol + '//' + window.location.host + '/', //
|
||||
// UPLOADURL: window.location.protocol + '//' + window.location.host + '/upload/image', //
|
||||
// FILEURL: window.location.protocol + '//' + window.location.host + '/image/', //测试 // tag: 本地测试接口
|
||||
BASEURL: baseUrl ? baseUrl : window.location.protocol + '//' + window.location.host + '/', //
|
||||
UPLOADURL: window.location.protocol + '//' + window.location.host + '/upload/image', //
|
||||
FILEURL: window.location.protocol + '//' + window.location.host + '/image/', //测试 // tag: 本地测试接口
|
||||
/* 2022-05-16 */
|
||||
// tag: 部署河南项目时,需要打开这两行代码
|
||||
// UPLOADURL: 'http://139.9.66.234:6324/upload/image',
|
||||
@ -56,9 +56,9 @@ export default new Vuex.Store({
|
||||
// UPLOADURL: 'http://182.90.224.237:7000/upload/image',
|
||||
// FILEURL: 'http://182.90.224.237:7000/image/',
|
||||
// 邱平毅的
|
||||
BASEURL:'http://192.168.34.116:6023/',
|
||||
UPLOADURL: 'http://192.168.34.116:6023/upload/image',
|
||||
FILEURL: 'http://192.168.34.116:6023/image/',
|
||||
// BASEURL:'http://192.168.34.116:6023/',
|
||||
// UPLOADURL: 'http://192.168.34.116:6023/upload/image',
|
||||
// FILEURL: 'http://192.168.34.116:6023/image/',
|
||||
// UPLOADURL: 'http://124.71.67.160:8088/upload/image',
|
||||
// FILEURL: 'http://124.71.67.160:8088/image/',
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user