Parcourir la source

计划排期,拆解工单优化

wyh il y a 2 ans
Parent
commit
93b5f8c10c

+ 3 - 0
itdmWeb/src/components/Gantt.vue

@@ -485,6 +485,9 @@ export default {
           },
 
         ];
+        gantt.attachEvent("onLightboxSave", function(id, task, is_new){
+            return true;
+        })
         // 自定义弹框
         // let that = this
         // gantt.config.details_on_dblclick = false;

+ 20 - 9
itdmWeb/src/views/module-iTDM/itdmGongdanMaster/itdmGongdanMasterList.vue

@@ -124,10 +124,10 @@ export default {
       console.log(22,queryParam)
       getXmjlList(queryParam).then((res) => {
         console.log(17,res)
-        this.tasks.data = []
+        that.tasks.data = []
         gantt.clearAll();
         if (res.result.length > 0 ) {
-          this.tasks.data = res.result.map(res => {
+          that.tasks.data = res.result.map(res => {
             return {
               id: res.id,
               parent: res.parent,
@@ -159,6 +159,8 @@ export default {
               statusC: res.statusC
             }
           })
+          gantt.init(this.$refs.gantt);
+          gantt.parse(that.tasks);
 
           // gantt.init(this.$refs.gantt);
           // // gantt.parse(this.$props.tasks);
@@ -169,9 +171,8 @@ export default {
             description: '该委托编号不存在',
           });
         }
-        gantt.init(this.$refs.gantt);
-        // gantt.parse(this.$props.tasks);
-        gantt.parse(this.tasks);
+        // gantt.init(this.$refs.gantt);
+        // gantt.parse(this.tasks);
       })
     },
     // // 提交
@@ -331,7 +332,7 @@ export default {
         // 右侧项目展示
         gantt.templates.task_text = function (start, end, task) {
           // console.log(task)
-          return task.pm + ", " + task.deviceName;
+          return task.worker + ", " + task.deviceName;
         };
         // 灯箱多选框
         gantt.form_blocks["multiselect"] = {
@@ -384,6 +385,7 @@ export default {
         //     //any custom logic here
         //     return true;
         // });
+        // 给灯箱赋默认值(将父任务的参数赋给灯箱)
         gantt.attachEvent("onTaskCreated", function(task){
           console.log("给灯箱赋默认值",task,gantt.getTask(task.parent))
           // 灯箱部分
@@ -450,11 +452,17 @@ export default {
         let that = this
         gantt.attachEvent("onLightboxSave", function(id, task, is_new){
             console.log(id, task, is_new)
-            task.jihuaStartDate = task.start_date
+            let y = task.start_date.getFullYear()
+            let m = task.start_date.getMonth() + 1
+            m = m < 10 ? ('0' + m) : m
+            let d = task.start_date.getDate()
+            d = d < 10 ? ('0' + d) : d
+            task.jihuaStartDate = y + '-' + m + '-' + d ;
+            // task.jihuaStartDate = task.start_date
             task.lastTime = task.duration
             console.log("提交",task)
             saveProjectJl(task).then((res) => {
-              console.log("提交返回",res)
+              console.log("提交返回",task,res)
               gantt.init(that.$refs.gantt);
               gantt.parse(that.tasks);
               // that.getHjlist(that.tasks.queryParam)
@@ -516,7 +524,7 @@ export default {
 
 
         gantt.init(this.$refs.gantt);
-        gantt.parse(this.tasks);
+        // gantt.parse(this.tasks);
     }
   }
 }
@@ -535,6 +543,9 @@ export default {
 			width: 400px;
       margin-bottom: 10px;
 		}
+    /* ::v-deep .gantt_task_content{
+      font-size: 8px !important;
+    } */
     .taskProgress{
       margin: 0 auto;
       margin-top: 5px;