Forráskód Böngészése

gantt实绩优化

wyh 1 éve%!(EXTRA string=óta)
szülő
commit
e9c01bc640

+ 98 - 47
itdmWeb/src/components/Gantt.vue

@@ -157,6 +157,7 @@ export default {
           /* grid columns */
           column_text: "计划名称",
           column_sampleName: "样品名称",
+          column_weituoNo: "委托编号",
           column_testItems: "检测项目",
           column_start_date: "开始时间",
           column_duration: "持续时间",
@@ -217,11 +218,13 @@ export default {
 
       gantt.config.columns = [
         // { name: "text", min_width:100,max_width:200, label:"任务", align: "left",resize: true, tree: true },
-        { name: "testItems", label: "检测项目", width: 130, resize: true, align: "left",resize: true, tree: true },
+        { name: "weituoNo", label: "委托编号", width: 140, resize: true, align: "left",resize: true, tree: true },
+        { name: "testItems", label: "检测项目", width: 80, resize: true, align: "center" },
         { name: "sampleName", 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: "statusC", label: "状态", width: 60, resize: true, align: "center" },
+        // { name: "izShiji", label: "类型", width: 60, resize: true, align: "center" },
         // { name: "status", label: "状态", width: 130, resize: true, align: "center",
         //   // options: [
         //   //   { key: "0", label: gantt.locale.labels.status_0 },
@@ -248,6 +251,21 @@ export default {
         // },
         // { name: "add", label:"", width: 30 }
       ];
+      // 改变任务颜色
+      gantt.templates.task_class=function(start, end, task){
+        console.log("变颜色",start, end, task)
+            switch (task.izShiji){
+              case "实绩":
+                  return "high";
+                  break;
+              // case "2":
+              //     return "medium";
+              //     break;
+              // case "3":
+              //     return "low";
+              //     break;
+          }
+      };
       // 更改左侧显示的结束日期时间
       gantt.templates.task_end_date = function(date){
         return gantt.templates.task_date(new Date(date.valueOf() - 1));
@@ -316,12 +334,24 @@ export default {
       // 重置灯箱
       gantt.attachEvent("onBeforeLightbox", function(task_id) {
         gantt.resetLightbox();
-        gantt.config.lightbox.sections = restricted_lightbox;
-        // 删除灯箱中的删除按钮
-        gantt.config.buttons_right = [];
-        // 保留灯箱的关闭和保存按钮
-        gantt.config.buttons_left = ["gantt_save_btn", "gantt_cancel_btn"];
-        return true;
+        var task = gantt.getTask(task_id);
+        console.log(task)
+        if (task.izShiji == "实绩") {
+          return false;
+        } else {
+          gantt.config.lightbox.sections = restricted_lightbox;
+          // 删除灯箱中的删除按钮
+          gantt.config.buttons_right = [];
+          // 保留灯箱的关闭和保存按钮
+          gantt.config.buttons_left = ["gantt_save_btn", "gantt_cancel_btn"];
+          return true;
+        }
+        // gantt.config.lightbox.sections = restricted_lightbox;
+        // // 删除灯箱中的删除按钮
+        // gantt.config.buttons_right = [];
+        // // 保留灯箱的关闭和保存按钮
+        // gantt.config.buttons_left = ["gantt_save_btn", "gantt_cancel_btn"];
+        // return true;
       });
       //弹出层(灯箱)
       var restricted_lightbox = [
@@ -418,49 +448,57 @@ export default {
     // 通过委托编号查询检测项目
     getinit(queryParam){
       this.tasks.queryParam = queryParam
-      getJhList(queryParam).then((res) => {
-        console.log(17,res)
-        this.tasks.data = []
-        gantt.clearAll();
-        if (res.result.length > 0 ) {
-          this.tasks.data = res.result.map(res => {
-            return {
-              id: res.testItemsId,
+      console.log(23232,queryParam)
+      if (queryParam.weituoClient != undefined && queryParam.weituoNo == undefined) {
+        this.$message.error("请选择委托编号后再进行查询!")
+      } else {
+        getJhList(queryParam).then((res) => {
+          console.log(17,res)
+          this.tasks.data = []
+          gantt.clearAll();
+          if (res.result.length > 0 ) {
+            this.tasks.data = res.result.map(res => {
+              return {
+                id: res.id,
 
-              weituoId: res.weituoId,
-              testItemsId: res.testItemsId,
-              yangpinId:res.yangpinId,
-              shebeiId:res.shebeiId,
-              pm: res.pm,
-              reportNo: res.reportNo,
-              chuanganqi:res.chuanganqiArray,
-              testPlanId:res.testPlanId,
-              status:res.status,
+                weituoId: res.weituoId,
+                testItemsId: res.testItemsId,
+                yangpinId:res.yangpinId,
+                shebeiId:res.shebeiId,
+                pm: res.pm,
+                reportNo: res.reportNo,
+                chuanganqi:res.chuanganqiArray,
+                testPlanId:res.testPlanId,
+                status:res.status,
 
-              // text:res.reportNo,
-              start_date: res.jihuaStartDate,
-              // jihuaEndDate: res.jihuaEndDate,
-              duration: res.lastTime,
-              sampleName: res.sampleName,
-              testItems: res.testItems,
-              deviceName: res.deviceName,
-              statusC: res.statusC
-            }
-          })
+                // text:res.reportNo,
+                start_date: res.jihuaStartDate,
+                // jihuaEndDate: res.jihuaEndDate,
+                weituoNo: res.weituoNo,
+                duration: res.lastTime,
+                sampleName: res.sampleName,
+                testItems: res.testItems,
+                deviceName: res.deviceName,
+                statusC: res.statusC,
+                izShiji: res.izShiji
+              }
+            })
 
-          // gantt.init(this.$refs.gantt);
-          // // gantt.parse(this.$props.tasks);
-          // gantt.parse(this.tasks);
-        } else {
-          notification.open({
-            message: '注意',
-            description: '该委托编号不存在',
-          });
-        }
-        gantt.init(this.$refs.gantt);
-        // gantt.parse(this.$props.tasks);
-        gantt.parse(this.tasks);
-      })
+            // gantt.init(this.$refs.gantt);
+            // // gantt.parse(this.$props.tasks);
+            // gantt.parse(this.tasks);
+          }
+          // } else {
+          //   notification.open({
+          //     message: '注意',
+          //     description: '该委托编号不存在',
+          //   });
+          // }
+          gantt.init(this.$refs.gantt);
+          // gantt.parse(this.$props.tasks);
+          gantt.parse(this.tasks);
+        })
+      }
     },
     // 提交
     searchReset() {
@@ -481,6 +519,7 @@ export default {
             testPlanId:res.testPlanId,
             status:res.status,
             testItems: res.testItems,
+            izShiji: res.izShiji
         }
       })
       console.log(data.length)
@@ -554,4 +593,16 @@ export default {
     .color_bg_3{
       background-color:#78e08f ;
     }
+    .gantt_task_line{
+        border-color: rgba(0, 0, 0, 0.25);
+    }
+    .gantt_task_line .gantt_task_progress {
+        background-color: rgba(0, 0, 0, 0.25);
+    }
+    .gantt_task_line.high {
+        background-color: #78e08f;
+    }
+    .gantt_task_line.high .gantt_task_content {
+        color: #fff;
+    }
 </style>

+ 6 - 0
itdmWeb/src/views/module-iTDM/itdmGongdanMaster/itdmGongdanMasterList.vue

@@ -226,6 +226,12 @@ export default {
           return gridDateToStr(date);
         }
       }
+      // // 右侧进度条
+      // gantt.templates.progress_text = function (start, end, task) {
+      //   console.log(78787878,start, end, task)
+      //   return "<div style='text-align:left;color:#fff;padding-left:20px'>" + Math.round(task.progress) +
+      //     "% </div>";
+      // };
       // 右侧项目展示
       gantt.templates.task_text = function (start, end, task) {
         console.log("右侧展示",task)

+ 5 - 1
itdmWeb/src/views/module-iTDM/itdmTestPlan/itdmTestPlanList1.vue

@@ -75,6 +75,8 @@ export default {
   },
   created() {
     this.getClientList();
+    // this.getHjlist();
+    this.$nextTick(() => { this.getHjlist() })
   },
 
   methods: {
@@ -95,7 +97,7 @@ export default {
       console.log(value);
       console.log(this.tasks.queryParamNo)
       this.weituoNoOptions = []
-      this.tasks.queryParam.weituoNo = ''
+      this.tasks.queryParam.weituoNo = undefined
       getWeituoInfoListByClient(this.tasks.queryParamNo).then((res) =>{
         this.weituoNoOptions = res.result.map( res => {
           return{
@@ -106,8 +108,10 @@ export default {
       })
     },
     getHjlist(){
+      console.log(1111)
       let that = this
       var queryParam = that.tasks.queryParam
+      queryParam.weituoClient = that.tasks.queryParamNo.weituoClient
       this.$refs.gantt.getinit( queryParam )
 
     },