|
@@ -107,7 +107,7 @@ export default {
|
|
if (res.result.length > 0 ) {
|
|
if (res.result.length > 0 ) {
|
|
this.tasks.data = res.result.map(res => {
|
|
this.tasks.data = res.result.map(res => {
|
|
return {
|
|
return {
|
|
- id: res.testItemsId,
|
|
|
|
|
|
+ id: res.id,
|
|
|
|
|
|
weituoId: res.weituoId,
|
|
weituoId: res.weituoId,
|
|
testItemsId: res.testItemsId,
|
|
testItemsId: res.testItemsId,
|
|
@@ -119,9 +119,15 @@ export default {
|
|
testPlanId:res.testPlanId,
|
|
testPlanId:res.testPlanId,
|
|
status:res.status,
|
|
status:res.status,
|
|
|
|
|
|
- // text:res.reportNo,
|
|
|
|
|
|
+ weituoNo: res.weituoNo,
|
|
|
|
+ neirong: res.neirong,
|
|
start_date: res.jihuaStartDate,
|
|
start_date: res.jihuaStartDate,
|
|
// jihuaEndDate: res.jihuaEndDate,
|
|
// jihuaEndDate: res.jihuaEndDate,
|
|
|
|
+ shiiyanType: res.shiiyanType,
|
|
|
|
+ shijiStartDate: res.shijiStartDate,
|
|
|
|
+ worker: res.worker,
|
|
|
|
+ yangpinCount:res.yangpinCount,
|
|
|
|
+
|
|
duration: res.lastTime,
|
|
duration: res.lastTime,
|
|
sampleName: res.sampleName,
|
|
sampleName: res.sampleName,
|
|
testItems: res.testItems,
|
|
testItems: res.testItems,
|
|
@@ -263,6 +269,33 @@ export default {
|
|
years: "年"
|
|
years: "年"
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ gantt.attachEvent("onTaskClick", function(id, e){
|
|
|
|
+ var button = e.target.closest("[data-action]")
|
|
|
|
+ if(button){
|
|
|
|
+ var action = button.getAttribute("data-action");
|
|
|
|
+ switch (action) {
|
|
|
|
+ case "edit":
|
|
|
|
+ gantt.showLightbox(id);
|
|
|
|
+ break;
|
|
|
|
+ case "add":
|
|
|
|
+ gantt.createTask(null, id);
|
|
|
|
+ break;
|
|
|
|
+ case "delete":
|
|
|
|
+ gantt.confirm({
|
|
|
|
+ title: gantt.locale.labels.confirm_deleting_title,
|
|
|
|
+ text: gantt.locale.labels.confirm_deleting,
|
|
|
|
+ callback: function (res) {
|
|
|
|
+ if (res)
|
|
|
|
+ gantt.deleteTask(id);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ });
|
|
// 左侧列表内容
|
|
// 左侧列表内容
|
|
gantt.config.columns = [
|
|
gantt.config.columns = [
|
|
// { name: "text", min_width:100,max_width:200, label:"任务", align: "left",resize: true, tree: true },
|
|
// { name: "text", min_width:100,max_width:200, label:"任务", align: "left",resize: true, tree: true },
|
|
@@ -271,7 +304,14 @@ export default {
|
|
{ name: "start_date", label: "开始时间", width: 90, resize: true, align: "center" },
|
|
{ name: "start_date", label: "开始时间", width: 90, resize: true, align: "center" },
|
|
{ name: "end_date", label: "结束时间", width: 90, resize: true, align: "center" },
|
|
{ name: "end_date", label: "结束时间", width: 90, resize: true, align: "center" },
|
|
{ name: "statusC", label: "状态", width: 60, resize: true, align: "center" },
|
|
{ name: "statusC", label: "状态", width: 60, resize: true, align: "center" },
|
|
- { name: "add", label:"", width: 30 }
|
|
|
|
|
|
+ // { name: "add", label:"", width: 30 }
|
|
|
|
+ {name: "buttons",label: colHeader,width: 75,template: function (task) {
|
|
|
|
+ return (
|
|
|
|
+ '<i class="fa fa-pencil" data-action="edit"></i>' +
|
|
|
|
+ '<i class="fa fa-plus" data-action="add"></i>' +
|
|
|
|
+ '<i class="fa fa-times" data-action="delete"></i>'
|
|
|
|
+ );
|
|
|
|
+ }}
|
|
];
|
|
];
|
|
// 更改左侧显示的结束日期时间
|
|
// 更改左侧显示的结束日期时间
|
|
gantt.templates.task_end_date = function(date){
|
|
gantt.templates.task_end_date = function(date){
|
|
@@ -339,7 +379,6 @@ export default {
|
|
}};
|
|
}};
|
|
//弹出层(灯箱)
|
|
//弹出层(灯箱)
|
|
gantt.config.lightbox.sections = [
|
|
gantt.config.lightbox.sections = [
|
|
- // { name: "text", height: 30, map_to: "text", type: "textarea", focus: true, width: "*" },
|
|
|
|
{
|
|
{
|
|
name: "time", height: 40, map_to: "auto", type: "duration",
|
|
name: "time", height: 40, map_to: "auto", type: "duration",
|
|
time_format: ["%Y", "%m", "%d"],
|
|
time_format: ["%Y", "%m", "%d"],
|
|
@@ -358,6 +397,7 @@ export default {
|
|
// },
|
|
// },
|
|
|
|
|
|
];
|
|
];
|
|
|
|
+ // 展示灯箱里的删除按钮
|
|
gantt.config.buttons_right = ["gantt_delete_btn"];
|
|
gantt.config.buttons_right = ["gantt_delete_btn"];
|
|
// 点击灯箱的保存按钮触发
|
|
// 点击灯箱的保存按钮触发
|
|
gantt.attachEvent("onLightboxSave", function(id, task, is_new){
|
|
gantt.attachEvent("onLightboxSave", function(id, task, is_new){
|
|
@@ -367,12 +407,46 @@ export default {
|
|
})
|
|
})
|
|
// 隐藏某行的添加按钮
|
|
// 隐藏某行的添加按钮
|
|
gantt.templates.grid_row_class = function( start, end, task ){
|
|
gantt.templates.grid_row_class = function( start, end, task ){
|
|
- console.log("隐藏",task)
|
|
|
|
|
|
+ // console.log("隐藏",task)
|
|
if ( task.$level > 0 ){
|
|
if ( task.$level > 0 ){
|
|
return "nested_task"
|
|
return "nested_task"
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
};
|
|
};
|
|
|
|
+ // 单击获取当前行信息
|
|
|
|
+ gantt.attachEvent("onTaskRowClick", function (id, e){
|
|
|
|
+ console.log("单击当前行",id,e)
|
|
|
|
+ //any custom logic here
|
|
|
|
+ return true;
|
|
|
|
+ });
|
|
|
|
+ let that = this
|
|
|
|
+ gantt.attachEvent("onTaskDblClick", function (id, e){
|
|
|
|
+ gantt.form_blocks.textarea.set_value=function(node,value,ev){
|
|
|
|
+ console.log("动态隐藏部分",node,value,ev)
|
|
|
|
+ node.firstChild.value=value||"";
|
|
|
|
+ var style = ev.some_property?"":"none";
|
|
|
|
+ node.style.display=style; // editor area
|
|
|
|
+ node.previousSibling.style.display=style; //section header
|
|
|
|
+ gantt.resizeLightbox(); //correct size of lightbox
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // // 自定义弹框
|
|
|
|
+ // let that = this
|
|
|
|
+ // gantt.attachEvent("onTaskDblClick", function (id, e){
|
|
|
|
+ // console.log(111,id, e);
|
|
|
|
+ // that.id = id
|
|
|
|
+ // gantt.getTask(that.id);
|
|
|
|
+ // console.log("双击获取当前行信息",gantt.getTask(that.id),gantt.getTask(that.id).parent);
|
|
|
|
+ // if (gantt.getTask(that.id).parent == 0) {
|
|
|
|
+
|
|
|
|
+ // } else {
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+ // return true;
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
|
|
gantt.init(this.$refs.gantt);
|
|
gantt.init(this.$refs.gantt);
|