Parcourir la source

计划排期完成版

wyh il y a 1 an
Parent
commit
2b4f38253f
3 fichiers modifiés avec 93 ajouts et 56 suppressions
  1. 8 0
      itdmWeb/public/index.html
  2. 15 10
      itdmWeb/src/api/api.js
  3. 70 46
      itdmWeb/src/components/Gantt.vue

+ 8 - 0
itdmWeb/public/index.html

@@ -8,6 +8,14 @@
   <title>iTDM试验协同管理平台</title>
   <link rel="icon" href="<%= BASE_URL %>logo.png">
   <script src="<%= BASE_URL %>cdn/babel-polyfill/polyfill_7_2_5.js"></script>
+  <script src="https://code.jquery.com/jquery-3.3.1.min.js?v=5.2.4" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="    crossorigin="anonymous"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.jquery.js?v=5.2.4"></script>
+  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.css?v=5.2.4">
+  <!-- jQuery本地化 -->
+  <!-- <script src="<%= BASE_URL %>cdn/babel-polyfill/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
+  <script src="<%= BASE_URL %>cdn/babel-polyfill/chosen.jquery.js"></script> -->
+  <!-- <link rel="stylesheet" type="text/css" href="<%= BASE_URL %>cdn/babel-polyfill/chosen.css"> -->
+  <!-- <link rel="stylesheet" type="text/css" href="./cdn/babel-polyfill/chosen.css"> -->
   <style>
     html,
     body,

+ 15 - 10
itdmWeb/src/api/api.js

@@ -53,18 +53,21 @@ const saveDeptRolePermission = (params)=>postAction("/sys/sysDepartPermission/sa
 const queryMyDepartTreeList = (params)=>getAction("/sys/sysDepart/queryMyDeptTreeList",params);
 
 // 设备故障判断
-const checkGuzhang = (params) => putAction('/itdmDevice/itdmDevice/edit1', params)
+const checkGuzhang = (params) => putAction('/itdmDevice/itdmDevice/edit1', params);
 // 获取设备下拉列表
-const getDeviceList = (params) => getAction('/itdmDevice/itdmDevice/xialalist', params)
+const getDeviceList = (params) => getAction('/itdmDevice/itdmDevice/xialalist', params);
 // 获取项目经理下拉列表
-const getManagerList = (params) => getAction('/itdmPersonManage/itdmPersonManage/xialalist', params)
+const getManagerList = (params) => getAction('/itdmPersonManage/itdmPersonManage/xialalist', params);
 // 获取传感器下拉列表
-const getCgqList = (params) => getAction('/chuanganqi/itdmChuanganqi/xialalist', params)
-// 计划员计划列表
-const getJhList = (params) => getAction('/sych/JHYList', params)
-// 计划员给检测项目选项目经理等等
-const saveProject = (params)=>postAction("/sych/addOrUpdate",params);
-
+const getCgqList = (params) => getAction('/chuanganqi/itdmChuanganqi/xialalist', params);
+// 计划员查询计划列表
+const getJhList = (params) => getAction('/sych/JHYList', params);
+// 计划员给检测项目选项目经理等等的提交按钮
+const saveProject = (params)=>postAction("/sych/JHYAddOrUpdate",params);
+// 项目经理查询计划列表
+const getXmjlList = (params) => getAction('/sych/XMJLList', params);
+// 项目经理拆单后的提交按钮
+const saveProjectJl = (params)=>postAction("/sych/XMJLAddOrUpdate",params);
 
 
 //日志管理
@@ -176,7 +179,9 @@ export {
   getManagerList,
   getCgqList,
   getJhList,
-  saveProject
+  saveProject,
+  getXmjlList,
+  saveProjectJl
 }
 
 

+ 70 - 46
itdmWeb/src/components/Gantt.vue

@@ -1,8 +1,6 @@
 {{ src/components/Gantt.vue }}
 <template>
-  <div>
-    <div ref="gantt" style="height:600px;"></div>
-  </div>
+    <div ref="gantt"></div>
 </template>
 <script>
 import {gantt} from 'dhtmlx-gantt';
@@ -52,7 +50,7 @@ export default {
             label: response.deviceName
           }
         })
-        gantt.init(this.$refs.gantt);
+        this.initData()
       })
     },
     // 获取项目经理下拉列表
@@ -68,7 +66,7 @@ export default {
             label: response.name
           }
         })
-        gantt.init(this.$refs.gantt);
+        this.initData()
       })
     },
     // 获取传感器下拉列表
@@ -103,7 +101,7 @@ export default {
               shebeiId:res.shebeiId,
               pm: res.pm,
               reportNo: res.reportNo,
-              chuanganqi:res.chuanganqi,
+              chuanganqi:res.chuanganqiArray,
               testPlanId:res.testPlanId,
               status:res.status,
 
@@ -114,7 +112,6 @@ export default {
               sampleName: res.sampleName,
               testItems: res.testItems,
               deviceName: res.deviceName,
-              status: res.status,
               statusC: res.statusC
             }
           })
@@ -148,7 +145,7 @@ export default {
             lastTime: res.duration,
             // jihuaEndDate: res.jihuaEndDate,
             reportNo: res.reportNo,
-            chuanganqi:res.chuanganqi,
+            chuanganqiArray:res.chuanganqi,
             testPlanId:res.testPlanId,
             status:res.status,
             testItems: res.testItems,
@@ -407,12 +404,57 @@ export default {
         }
         // 右侧项目展示
         gantt.templates.task_text = function (start, end, task) {
-          console.log(task)
+          // console.log(task)
           // return "<b>设备:</b> " + task.shebeiId + ",<b> 项目经理:</b> " + task.pm;
-          // return "<b> 项目经理:</b> " + task.pm;
-          // return "<b>项目经理:</b> "+ task.pm + ", <b>设备:</b> " + task.deviceName;
           return task.pm + ", " + task.deviceName;
         };
+        // 灯箱多选框
+        gantt.form_blocks["multiselect"] = {
+        render: function (sns) {
+          var height = (sns.height || "23") + "px";
+          var html = "<div class='gantt_cal_ltext gantt_cal_chosen gantt_cal_multiselect'"+
+            "style='height:"+ height + ";'><select data-placeholder='...'"+
+                "class='chosen-select' multiple>";
+          if (sns.options) {
+          for (var i = 0; i < sns.options.length; i++) {
+            if(sns.unassigned_value !== undefined && sns.options[i].key==sns.unassigned_value){
+                continue;
+            }
+            html+="<option value='" +sns.options[i].key+ "'>"+sns.options[i].label+"</option>";
+          }}
+          html += "</select></div>";
+          return html;},
+        
+        set_value: function (node, value, ev, sns) {
+            node.style.overflow = "visible";
+            node.parentNode.style.overflow = "visible";
+            node.style.display = "inline-block";
+            var select = $(node.firstChild);
+        
+            if (value) {
+                value = (value + "").split(",");
+                select.val(value);
+            }
+            else {
+                select.val([]);
+            }
+        
+            select.chosen();
+            if(sns.onchange){
+                select.change(function(){
+                    sns.onchange.call(this);
+                })
+            }
+            select.trigger('chosen:updated');
+            select.trigger("change");},
+        
+        get_value: function (node, ev) {
+            var value = $(node.firstChild).val();
+            //value = value ? value.join(",") : null
+            return value;},
+        focus: function (node) {
+            $(node.firstChild).focus();
+        }};
         //弹出层(灯箱)
         gantt.config.lightbox.sections = [
           // { name: "text", height: 30, map_to: "text", type: "textarea", focus: true, width: "*" },
@@ -429,7 +471,7 @@ export default {
             name: "device", height: 30, map_to: "shebeiId", type: "select", options: gantt.serverList('staff',[]),
           },
           {
-            name: "sensor", height: 30, map_to: "chuanganqi", type: "checkbox", options: gantt.serverList('chuanganqi',[]),
+            name: "sensor", height: 30, map_to: "chuanganqi", type: "multiselect", options: gantt.serverList('chuanganqi',[]),
           },
           // {
           //   name: "sensor", height: 30, map_to: "chuanganqi", type: "multiselect", options: gantt.serverList('chuanganqi'), unassigned_value:5 ,
@@ -442,6 +484,19 @@ export default {
         ];
         // 删除灯箱中的删除按钮
         gantt.config.buttons_right = [];
+        // 自定义弹框
+        // let that = this
+        // gantt.config.details_on_dblclick = false;
+        // gantt.attachEvent("onTaskDblClick", function (id, e){
+        //   console.log(111,id, e);
+        //   that.id = id
+        //   // gantt.getTask(id);
+        //   // console.log(gantt.getTask(id));
+        //   // gantt.getTask(that.id);
+        //   // console.log(gantt.getTask(that.id));
+        //     // that.visible = true;
+        //     return true;
+        // });
         
 
 
@@ -455,44 +510,13 @@ export default {
 
 <style>
     @import "~dhtmlx-gantt/codebase/dhtmlxgantt.css";
-    html, body {
-			padding: 0px;
-			margin: 0px;
-			height: 100%;
-		}
-
-		#gantt_here {
-			width:100%;
-			height:100%;
-		}
-
-		.gantt_grid_scale .gantt_grid_head_cell,
-		.gantt_task .gantt_task_scale .gantt_scale_cell {
-			/* font-weight: bold; */
-			font-size: 14px;
-			color: rgba(0, 0, 0, 0.7);
-		}
-
-		.owner-label{
-			width: 20px;
-			height: 20px;
-			line-height: 20px;
-			font-size: 12px;
-			display: inline-block;
-			border: 1px solid #cccccc;
-			border-radius: 25px;
-			background: #e6e6e6;
-			color: #6f6f6f;
-			margin: 0 3px;
-			font-weight: bold;
-		}
-
-		.gantt_cal_larea{
+    .gantt_cal_larea{
 			overflow:visible;
 		}
-		.gantt_cal_chosen,
+    .gantt_cal_chosen,
 		.gantt_cal_chosen select{
 			width: 400px;
+      margin-bottom: 20px;
 		}
     .status{
       margin: 0 auto;