yuhan 1 year ago
parent
commit
4f1c07da09

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

@@ -50,6 +50,9 @@ const getWeiYi = (params)=>getAction("/gongdandetail/itdmGongdanDetail/gongdanDa
 const getWeiSb = (params)=>getAction("/gongdandetail/itdmGongdanDetail/gongdanShebeiListByWoId",params);
 // 根据日期和工单号,实验类型,实际试验设备获取实绩开始时间,实绩结束时间
 const getWeiSj = (params)=>getAction("/gongdandetail/itdmGongdanDetail/gongdanDateListByWoId1",params);
+// 日历
+const getDeviceCalendar = (params)=>getAction("/deviceCalendar/list",params);
+
 
 // 部门管理
 const queryDepartTreeList = (params)=>getAction("/sys/sysDepart/queryTreeList",params);
@@ -259,7 +262,8 @@ export {
   createBarcode,
   deleteBarcode,
   sampleExpireSH,
-  rukuSampleBarcodeList
+  rukuSampleBarcodeList,
+  getDeviceCalendar
 }
 
 

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

@@ -32,18 +32,53 @@
             <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="showCalendar" icon="reload" style="margin-left: 8px">测试</a-button>
             </span>
           </a-col>
         </a-row>
       </a-form>
     </div>
     <gantt ref="gantt" class="left-container" :tasks="tasks" style="height:600px;"></gantt>
+    <!-- 日历弹窗 -->
+    <el-dialog title="设备日历" :visible.sync="showCalendarDialog" width="60%">
+      <el-calendar>
+        <template slot="dateCell" slot-scope="{date, data}">
+          <!-- <div> -->
+            <!-- 如果是当前选择月 -->
+            <template v-if="data.type === 'current-month'">
+              <!-- 这里加了周六周天的判断 -->
+              <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.substring(8,10)}}</div>
+              <!-- <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.split('-').slice(2).join('-')}}</div> -->
+              <!-- 方法二:在方法中判断设置返回 -->
+              <template v-if="dealMyDate(data.day)">
+                <template v-for="(item, index) in dealMyDate(data.day)">
+                  <el-tag type="danger" :key="index" style="margin-right: 2px;" @click="chooseDevice(item)">
+                    {{ item.deviceName }}
+                  </el-tag>
+                </template>
+              </template>
+              <!-- <el-tag type="danger" v-if="dealMyDate(data.day).length > 0">
+                {{ dealMyDate(data.day)[0].deviceName }}
+              </el-tag> -->
+            </template>
+            <!-- 不是 -->
+            <template v-else>
+              <div style="text-align: right;">{{ data.day.split('-').slice(1).join('-') }}</div>
+            </template>
+          <!-- </div> -->
+        </template>
+      </el-calendar>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="showCalendarDialog = false">取 消</el-button>
+        <el-button type="primary" @click="showCalendarDialog = false">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import Gantt from '../../../components/Gantt.vue';
-import {getWeituoClientList, getWeituoInfoListByClient } from '@/api/api'
+import {getWeituoClientList, getWeituoInfoListByClient, getDeviceCalendar } from '@/api/api'
 import { getAction } from '@api/manage'
 import { gantt } from 'dhtmlx-gantt'
 
@@ -71,12 +106,16 @@ export default {
       weituoClientOptions : [],
       // 委托编号列表
       weituoNoOptions:[],
+      // 日历弹窗
+      showCalendarDialog: false,
+      scheduleData: [],
     }
   },
   created() {
     this.getClientList();
     // this.getHjlist();
     this.$nextTick(() => { this.getHjlist() })
+    this.getDeviceCalendar()
   },
 
   methods: {
@@ -117,6 +156,30 @@ export default {
     },
     searchReset(){
       this.$refs.gantt.searchReset()
+    },
+    // 获取设备日历
+    getDeviceCalendar(){
+      getDeviceCalendar().then((res) =>{
+        this.scheduleData = res
+      })
+    },
+    showCalendar(){
+      this.showCalendarDialog = true
+    },
+    dealMyDate(v) {
+      let res = ''
+      for (let index = 0; index < this.scheduleData.length; index++) {
+        const element = this.scheduleData[index];
+        if(element.workDate === v){
+          res = this.scheduleData[index].deviceList
+          break
+        }
+      }
+      console.log(res)
+      return res
+    },
+    chooseDevice(item){
+      console.log(item)
     }
   }
 }