From 964ab96fa41fc3f465d3d274fb2121dffd11dc79 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期四, 07 十一月 2024 17:16:44 +0800
Subject: [PATCH] 1、调整总控车间看板右侧图表标题 2、调整分控车间看板刀具寿命管理中的当前寿命颜色标识

---
 src/views/mdc/base/SubControlWorkshopSignage.vue |  100 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 71 insertions(+), 29 deletions(-)

diff --git a/src/views/mdc/base/SubControlWorkshopSignage.vue b/src/views/mdc/base/SubControlWorkshopSignage.vue
index 9d66565..49b6eda 100644
--- a/src/views/mdc/base/SubControlWorkshopSignage.vue
+++ b/src/views/mdc/base/SubControlWorkshopSignage.vue
@@ -59,22 +59,40 @@
           <td>{{item.clazz}}</td>
         </template>
       </tr>
+      <template v-if="todayProductionPlanList.length<=3">
+        <tr v-for="(item,index) in 3-todayProductionPlanList.length"
+            :key="index">
+          <td colspan="2"></td>
+          <td colspan="2"></td>
+          <td colspan="2"></td>
+          <td colspan="2"></td>
+          <td></td>
+          <td></td>
+          <td></td>
+          <td></td>
+          <td colspan="2"></td>
+          <td colspan="2"></td>
+          <td></td>
+        </tr>
+      </template>
       </tbody>
     </table>
 
     <div class="device-container">
       <div class="single-device-container" v-for="item in equipmentStatusList" :key="item.id"
-           :style="{marginRight:isDeviceContinuous(currentProductionInfo.productionOrder)?'':'5%'}">
+           :style="{marginRight:isDeviceContinuous(currentProductionInfo.productionOrder)?'':'5%'}"
+           @click="openDetail(item)">
         <div class="status-image-container">
           <img src="@/assets/page/subControlWorkshopSignage/grey.png" v-if="item.oporation===0">
           <img src="@/assets/page/subControlWorkshopSignage/green.png" v-if="item.oporation===3">
           <img src="@/assets/page/subControlWorkshopSignage/yellow.png" v-if="item.oporation===2">
+          <img src="@/assets/page/subControlWorkshopSignage/yellow.png" v-if="item.oporation===1">
           <img src="@/assets/page/subControlWorkshopSignage/red.png" v-if="item.oporation===22">
         </div>
         <div class="device-image-container">
           <img :src="require('@/assets/page/subControlWorkshopSignage/'+item.equipmentId+'.png')">
         </div>
-        1
+        {{item.equipmentId}}
         <div class="device-name">
           {{item.equipmentName}}
         </div>
@@ -102,7 +120,7 @@
             <template v-for="(listItem,listIndex) in maxBrandToolLifeListLength">
               <template>
                 <tr>
-                  <td style="width: 7vw">棰濆畾瀵垮懡</td>
+                  <td style="width: 5vw;min-width: 5vw">棰濆畾瀵垮懡</td>
                   <template v-for="(item,index) in toolLife.brandList">
                     <td rowspan="2" style="width: 2.5vw">
                       {{toolLife.lifeList[index][listIndex]?toolLife.lifeList[index][listIndex]?toolLife.lifeList[index][listIndex].tid:'':''}}
@@ -116,7 +134,7 @@
                 <tr>
                   <td>褰撳墠瀵垮懡</td>
                   <template v-for="(item,index) in toolLife.brandList">
-                    <td :style="{backgroundColor:getToolCurrentLifeDataBgColor(item)}">
+                    <td :style="{backgroundColor:getToolCurrentLifeDataBgColor(toolLife.lifeList[index][listIndex])}">
                       {{toolLife.lifeList[index][listIndex]?toolLife.lifeList[index][listIndex]?toolLife.lifeList[index][listIndex].currentLife:'':''}}
                     </td>
                   </template>
@@ -130,6 +148,8 @@
 
     <SignageModal :todayProductionPlanList="todayProductionPlanList" :modalVisible="modalVisible"
                   @closeModal="modalVisible=false"/>
+
+    <EquipmentDetailModal ref="equipmentDetailModal"/>
   </div>
 </template>
 
@@ -137,10 +157,11 @@
   import moment from 'moment'
   import api from '@/api/mdc'
   import SignageModal from './modules/SubControlWorkshopSignage/SignageModal'
+  import EquipmentDetailModal from './modules/SubControlWorkshopSignage/EquipmentDetailModal'
 
   export default {
     name: 'SubControlWorkshopSignage',
-    components: { SignageModal },
+    components: { EquipmentDetailModal, SignageModal },
     data() {
       return {
         currentProductionInfo: {
@@ -188,22 +209,22 @@
         // ],
         todayProductionPlanList: [],
         equipmentStatusList: [
-          {
-            oporation: 0,
-            equipmentId: '5045-7076'
-          },
-          {
-            oporation: 3,
-            equipmentId: '5068-7005'
-          },
-          {
-            oporation: 22,
-            equipmentId: '5045-7157'
-          },
-          {
-            oporation: 2,
-            equipmentId: '5045-7815'
-          }
+          // {
+          //   oporation: 0,
+          //   equipmentId: '5045-7076'
+          // },
+          // {
+          //   oporation: 3,
+          //   equipmentId: '5068-7005'
+          // },
+          // {
+          //   oporation: 22,
+          //   equipmentId: '5045-7157'
+          // },
+          // {
+          //   oporation: 2,
+          //   equipmentId: '5045-7815'
+          // }
         ],
         // toolLife: {
         //   brandList: ['鍖楅綈浜�', '閾� 闀�', '妫� 浜�', '涓� 鏇�', '瑗� 鏇�', '瑗� 寰�', '涓� 寰�'],
@@ -396,8 +417,18 @@
           })
       },
 
-      clickToLoadMore() {
 
+      openDetail(item) {
+        if (item.oporation == 0) {
+          this.$notification.warning({
+            message: '娑堟伅',
+            description: '璁惧澶勪簬鍏虫満鐘舵�侊紒'
+          })
+          return false
+        }
+        console.log(item)
+        this.$refs.equipmentDetailModal.initData(item.equipmentId)
+        this.$refs.equipmentDetailModal.timerModel(item.equipmentId)
       },
 
       getEquipmentStatusByApi() {
@@ -424,20 +455,30 @@
                 lifeList.push(currentBrandLifeList)
               })
               this.maxBrandToolLifeListLength = Object.assign([], lifeList).sort((a, b) => b.length - a.length)[0].length
-              console.log('brandList', brandList)
-              console.log('lifeList', lifeList)
-              console.log('maxBrandToolLifeListLength', this.maxBrandToolLifeListLength)
+              // console.log('brandList', brandList)
+              // console.log('lifeList', lifeList)
+              // console.log('maxBrandToolLifeListLength', this.maxBrandToolLifeListLength)
               this.toolLife = { brandList, lifeList }
             }
           })
       },
 
       getToolCurrentLifeDataBgColor(record) {
-        if (record.currentLife / record.ratedLife > 0.8) {
-          return '#FF9A10'
-        } else {
-          return '#218A21'
+        if (record && record.currentLife) {
+          if (record.currentLife > 10) {
+            return '#218A21'
+          } else if (record.currentLife >= 5 && record.currentLife <= 10) {
+            return '#FF9A10'
+          } else {
+            return '#f00'
+          }
         }
+
+        // if (record.currentLife / record.ratedLife > 0.8) {
+        //   return '#FF9A10'
+        // } else {
+        //   return '#218A21'
+        // }
       },
 
       mouseEnterItem(e) {
@@ -536,6 +577,7 @@
         align-items: center;
         padding-top: 2%;
         font-size: 1vw;
+        cursor: pointer;
 
         .status-image-container {
           height: 20%;

--
Gitblit v1.9.3