Browse Source

计划排期新增提交按钮(测试版)

wyh 2 years ago
parent
commit
6e5ec4f21e
2 changed files with 37 additions and 10 deletions
  1. 4 1
      itdmWeb/src/api/api.js
  2. 33 9
      itdmWeb/src/components/Gantt.vue

+ 4 - 1
itdmWeb/src/api/api.js

@@ -62,6 +62,8 @@ const getManagerList = (params) => getAction('/itdmPersonManage/itdmPersonManage
 const getCgqList = (params) => getAction('/chuanganqi/itdmChuanganqi/xialalist', params)
 // 计划员计划列表
 const getJhList = (params) => getAction('/sych/JHYList', params)
+// 计划员给检测项目选项目经理等等
+const saveProject = (params)=>postAction("/sych/addOrUpdate",params);
 
 
 
@@ -173,7 +175,8 @@ export {
   getDeviceList,
   getManagerList,
   getCgqList,
-  getJhList
+  getJhList,
+  saveProject
 }
 
 

+ 33 - 9
itdmWeb/src/components/Gantt.vue

@@ -5,7 +5,7 @@
 
 <script>
 import {gantt} from 'dhtmlx-gantt';
-import {getDeviceList, getJhList, getManagerList, getCgqList} from '@/api/api'
+import {getDeviceList, getJhList, getManagerList, getCgqList, saveProject} from '@/api/api'
 export default {
   name: 'gantt',
   // props: {
@@ -48,11 +48,6 @@ export default {
             label: response.deviceName
           }
         })
-        // console.log('this.tasks.collections.staff:',this.tasks.collections.staff)
-        // this.tasks.collections.manager.push(
-        //   { id: 2, label: '999' },
-        //   { id: 3, label: '777' }
-        // )
         this.initData()
       })
     },
@@ -89,6 +84,7 @@ export default {
       console.log(22,queryParam)
       getJhList(queryParam).then((res) => {
         console.log(res.result)
+        this.tasks.data = []
         this.tasks.data = res.result.map(res => {
           return {
             id: res.testItemsId,
@@ -100,15 +96,19 @@ export default {
             taskProgress: res.status
           }
         })
+        console.log(33,this.tasks.data)
         gantt.init(this.$refs.gantt);
         // gantt.parse(this.$props.tasks);
         gantt.parse(this.tasks);
-        console.log(33,this.tasks)
       })
     },
     // 提交
     searchReset() {
-      console.log(this.tasks)
+      var json = gantt.serialize();
+      console.log(json)
+      saveProject(json.data).then((res) => {
+        console.log(res)
+      })
     },
     // // 今日线
     // createTodayLine() {
@@ -312,6 +312,7 @@ export default {
           //     { key: "2", label: gantt.locale.labels.taskProgress_2 },
           //   ],
           //   template:function(obj){
+          //     console.log(obj)
           //   let re = '';
           //   switch (obj.taskProgress) {
           //     case "0":
@@ -324,7 +325,8 @@ export default {
           //       re = `<div class='taskProgress color_bg_3'  >已完成</div>`
           //       break;
           //   }
-          //   return re}
+          //   return re
+          //   }
           // },
           { name: "add", label:"", width: 30 }
         ];
@@ -349,6 +351,8 @@ export default {
           // },
 
         ];
+        // 删除灯箱中的删除按钮
+        gantt.config.buttons_right = [];
         
 
 
@@ -362,4 +366,24 @@ export default {
 
 <style>
     @import "~dhtmlx-gantt/codebase/dhtmlxgantt.css";
+    .taskProgress{
+      margin: 0 auto;
+      margin-top: 5px;
+      height: 24px;
+      width: 65px;
+      font-size: 12px;
+      line-height: 24px;
+      font-weight: bold;
+      color: #f7fbfe;
+      border-radius: 20px;
+    }
+    .color_bg_1{
+      background-color:#60a3bc ;
+    }
+    .color_bg_2{
+      background-color:#079992 ;
+    }
+    .color_bg_3{
+      background-color:#78e08f ;
+    }
 </style>