浏览代码

计划排期查询改为通过委托编号查询(原来是通过委托id查询)

wyh 2 年之前
父节点
当前提交
3ec62079c0
共有 3 个文件被更改,包括 167 次插入50 次删除
  1. 6 0
      itdmWeb/src/api/api.js
  2. 148 31
      itdmWeb/src/components/Gantt.vue
  3. 13 19
      itdmWeb/src/views/module-iTDM/itdmTestPlan/itdmTestPlanList1.vue

+ 6 - 0
itdmWeb/src/api/api.js

@@ -56,6 +56,10 @@ const queryMyDepartTreeList = (params)=>getAction("/sys/sysDepart/queryMyDeptTre
 const checkGuzhang = (params) => putAction('/itdmDevice/itdmDevice/edit1', params)
 // 获取设备下拉列表
 const getDeviceList = (params) => getAction('/itdmDevice/itdmDevice/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)
 
@@ -167,6 +171,8 @@ export {
   getDictItemsFromCache,
   checkGuzhang,
   getDeviceList,
+  getManagerList,
+  getCgqList,
   getJhList
 }
 

+ 148 - 31
itdmWeb/src/components/Gantt.vue

@@ -5,29 +5,41 @@
 
 <script>
 import {gantt} from 'dhtmlx-gantt';
-import {getDeviceList,getJhList} from '@/api/api'
+import {getDeviceList, getJhList, getManagerList, getCgqList} from '@/api/api'
 export default {
   name: 'gantt',
-  props: {
-    tasks: {
-      type: Object,
-      default () {
-        return {data: [], links: [], collections:{}}
-      }
-    }
-  },
+  // props: {
+  //   tasks: {
+  //     type: Object,
+  //     default () {
+  //       return {data: [], links: [], collections:{}}
+  //     }
+  //   }
+  // },
   data () {
     return {
-      queryParam:{
-        weituoId: undefined
-      }
+      tasks: {
+        data: [
+        ],
+        collections: {
+          staff:[],
+          manager:[],
+          chuanganqi:[],
+        },
+        queryParam:{
+          weituoNo: undefined
+        }
+      },
     }
   },
   created() {
     this.getDevicelist();
+    this.getCgqlist();
+    this.getManagerList();
     console.log(1112,this.tasks)
   },
   methods: {
+    // 获取设备下拉列表
     getDevicelist(){
       getDeviceList().then((res) => {
         this.tasks.collections.staff = res.map(response =>{
@@ -36,14 +48,43 @@ export default {
             label: response.deviceName
           }
         })
-        console.log('this.tasks.collections.staff:',this.tasks.collections.staff)
-        this.tasks.collections.staff2.push(
-          { id: 2, label: '999' },
-          { id: 3, label: '777' }
-        )
+        // 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()
+      })
+    },
+    // 获取项目经理下拉列表
+    getManagerList(){
+      var query ={
+        position: "项目经理"
+      }
+      getManagerList(query).then((res) => {
+        console.log(17,res)
+        this.tasks.collections.manager = res.map(response =>{
+          return {
+            value: response.id,
+            label: response.name
+          }
+        })
+        this.initData()
+      })
+    },
+    // 获取传感器下拉列表
+    getCgqlist(){
+      getCgqList().then((res) => {
+        this.tasks.collections.chuanganqi = res.map(response =>{
+          return {
+            value: response.id,
+            label: response.xuliehao
+          }
+        })
         this.initData()
       })
     },
+    // 通过委托编号查询检测项目
     getinit(queryParam){
       console.log(22,queryParam)
       getJhList(queryParam).then((res) => {
@@ -55,15 +96,39 @@ export default {
             start_date:res.jihuaStartDate,
             duration:res.lastTime,
             sampleName:res.sampleName,
-            testItems:res.testItems
-
+            testItems:res.testItems,
+            taskProgress: res.status
           }
         })
         gantt.init(this.$refs.gantt);
-        gantt.parse(this.$props.tasks);
+        // gantt.parse(this.$props.tasks);
+        gantt.parse(this.tasks);
         console.log(33,this.tasks)
       })
     },
+    // 提交
+    searchReset() {
+      console.log(this.tasks)
+    },
+    // // 今日线
+    // createTodayLine() {
+    //       var dateToStr = gantt.date.date_to_str("%Y年%M%d日");
+    //       var markerId = gantt.addMarker({
+    //         id: 'markerLine',
+    //         start_date: new Date(),
+    //         css: "today",
+    //         text: "今日",
+    //         title: dateToStr(new Date()) 
+    //       });
+    //       gantt.updateMarker(markerId);
+    //     },
+    // //定位到今日线
+    // changeToday() {
+    //       this.$nextTick(() => {
+    //         let ganTT = document.getElementsByClassName('gantt_marker today')
+    //         gantt.scrollTo(ganTT[0].offsetLeft-300, null);
+    //       })
+    // },
     initData(){
         // 启用动态加载
         gantt.config.branch_loading = true
@@ -89,6 +154,26 @@ export default {
             },
             { view: "scrollbar", scroll: "x", id: "scrollHor", height: 20 }
           ],
+          // rows: [
+          //   {
+          //     cols: [
+          //       {
+          //         width:400,
+          //         min_width: 300,
+          //         rows:[
+          //           {view: "grid", scrollX: "gridScroll", scrollable: true, scrollY: "scrollVer"},
+          //           {view: "scrollbar", id: "gridScroll", group:"horizontal"}            ]
+          //       },
+          //       {resizer: true, width: 1},
+          //       {
+          //         rows:[
+          //           {view: "timeline", scrollX: "scrollHor", scrollY: "scrollVer"},
+          //           {view: "scrollbar", id: "scrollHor", group:"horizontal"}            ]
+          //       },
+          //       {view: "scrollbar", id: "scrollVer"}
+          //     ]
+          //   },
+          // ],
           // cols: [
           //   {
           //     width:400,
@@ -108,6 +193,11 @@ export default {
         };
         // 重置布局
         gantt.resetLayout();
+        // var state = gantt.getState();
+ 
+        // console.log(55,state.min_date);
+        
+        // console.log(66,state.max_date);
         gantt.config.start_on_monday = true;
         gantt.config.work_time = true;
         gantt.config.fit_tasks = true;   //自动调整图表坐标轴区间用于适配task的长度
@@ -142,11 +232,12 @@ export default {
             taskProjectType_1: "普通任务",
             section_head: "项目经理:",
             section_device: "试验设备:",
+            section_sensor: "传感器:",
             section_priority: '优先级:',
             taskProgress: '任务状态',
-            taskProgress_0: "未开始",
-            taskProgress_1: "进行中",
-            taskProgress_2: "完成",
+            taskProgress_0: "未确认",
+            taskProgress_1: "已确认",
+            taskProgress_2: "完成",
             taskProgress_3: "已延期",
             taskProgress_4: "搁置中",
             section_template: 'Details',
@@ -212,32 +303,58 @@ 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: "sampleName", label: "样品名称", width: 130, resize: true, align: "center" },
-          { name: "start_date", label: "开始时间", width: 130, resize: true, align: "center" },
-          { name: "end_date", label: "结束时间", width: 130, resize: true, align: "center" },
+          { name: "sampleName", label: "样品名称", width: 90, resize: true, align: "center" },
+          { name: "start_date", label: "开始时间", width: 100, resize: true, align: "center" },
+          { name: "end_date", label: "结束时间", width: 100, resize: true, align: "center" },
+          // { name: "taskProgress", label: "状态", width: 130, resize: true, align: "center", options: [
+          //     { key: "0", label: gantt.locale.labels.taskProgress_0 },
+          //     { key: "1", label: gantt.locale.labels.taskProgress_1 },
+          //     { key: "2", label: gantt.locale.labels.taskProgress_2 },
+          //   ],
+          //   template:function(obj){
+          //   let re = '';
+          //   switch (obj.taskProgress) {
+          //     case "0":
+          //       re = `<div class='taskProgress color_bg_1' >未开始</div>`
+          //       break;
+          //     case "1":
+          //       re = `<div class='taskProgress color_bg_2' >进行中</div>`
+          //       break;
+          //     case "2":
+          //       re = `<div class='taskProgress color_bg_3'  >已完成</div>`
+          //       break;
+          //   }
+          //   return re}
+          // },
           { name: "add", label:"", width: 30 }
         ];
-        //弹出层
+        //弹出层(灯箱)
         gantt.config.lightbox.sections = [
-          { name: "text", height: 30, map_to: "text", type: "textarea", focus: true, width: "*" },
+          // { name: "text", height: 30, map_to: "text", type: "textarea", focus: true, width: "*" },
           {
             name: "time", height: 40, map_to: "auto", type: "duration",
             time_format: ["%Y", "%m", "%d"],
+            
           },
-          { name: "head", height: 30, map_to: "head_id", type: "select", options:gantt.serverList("staff2") },
+          { name: "head", height: 30, map_to: "head_id", type: "select", options:gantt.serverList("manager") },
           {
             name: "device", height: 30, map_to: "device_id", type: "select", options: gantt.serverList('staff',[]),
           },
-          { name: "description", height: 70, map_to: "description", type: "textarea" },
+          {
+            name: "sensor", height: 30, map_to: "sensor_id", type: "select", options: gantt.serverList('chuanganqi',[]),
+          },
+          // { name: "description", height: 70, map_to: "description", type: "textarea" },
           // {
           //   name: "priority", height: 40, map_to: "priority", type: "radio", options: gantt.serverList("priority")
           // },
 
         ];
+        
 
 
         gantt.init(this.$refs.gantt);
-        gantt.parse(this.$props.tasks);
+        // gantt.parse(this.$props.tasks);
+        gantt.parse(this.tasks);
     }
   }
 }

+ 13 - 19
itdmWeb/src/views/module-iTDM/itdmTestPlan/itdmTestPlanList1.vue

@@ -6,13 +6,13 @@
         <a-row :gutter="24">
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <a-form-item label="委托编号">
-              <a-input placeholder="请输入委托编号" v-model="tasks.queryParam.weituoId"></a-input>
+              <a-input placeholder="请输入委托编号" v-model="tasks.queryParam.weituoNo"></a-input>
             </a-form-item>
           </a-col>
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
               <a-button type="primary" @click="getHjlist" icon="search">查询</a-button>
-              <!-- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> -->
+              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">提交</a-button>
             </span>
           </a-col>
         </a-row>
@@ -34,24 +34,15 @@ export default {
   data () {
     return {
       tasks: {
-        data: [
-          // {id: 1, text: 'Task #1', start_date: '2020-01-17', duration: 3, progress: 0.6,"open": true},
-          // {id: 1, text: 'Task #1', start_date: '2020-01-17', duration: 3},
-          // {id: 2, text: 'Task #2', start_date: '2020-01-20', duration: 3}
-          // {"id":"1", "text":"Project #2", "start_date":"2020-01-17", "duration":3, "sampleName":"样品名称", "testItems":"检测项目" ,},
-          // {"id":"2", "text":"Task #1", "start_date":"2020-01-17", "duration":17,  "parent":"1"},
-          // {"id":"3", "text":"Task #2", "start_date":"2020-01-20", "duration":1,  "parent":"1"}
-        ],
-        // links: [
-        //   {id: 1, source: 1, target: 2, type: '0'},
-        //   {id: 2, source: 2, target: 3, type: '0'},
+        // data: [
         // ],
-        collections: {
-          staff:[],
-          staff2:[],
-        },
+        // collections: {
+        //   staff:[],
+        //   manager:[],
+        //   chuanganqi:[],
+        // },
         queryParam:{
-          weituoId: undefined
+          weituoNo: undefined
         }
       },
     }
@@ -59,11 +50,14 @@ export default {
   methods: {
     getHjlist(){
       let that = this
-      console.log(that.tasks.queryParam.weituoId)
+      console.log(that.tasks.queryParam.weituoNo)
       var queryParam = that.tasks.queryParam
       console.log(11,queryParam)
       this.$refs.gantt.getinit( queryParam )
 
+    },
+    searchReset(){
+      this.$refs.gantt.searchReset()
     }
   }
 }