From 04b13a0cdb319ccddc9ec3d4ec6cd3fd11c6eda6 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 14 九月 2023 17:26:09 +0800
Subject: [PATCH] 面板 样式修改  工序+第一次的倒计时修改为 闪+工序运行时间

---
 src/views/visualization.vue |  247 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 180 insertions(+), 67 deletions(-)

diff --git a/src/views/visualization.vue b/src/views/visualization.vue
index 9640465..b0763dc 100644
--- a/src/views/visualization.vue
+++ b/src/views/visualization.vue
@@ -7,15 +7,15 @@
         <p class="title">
           <span
             class="font set-title"
-            style="float: left; margin-right: 15px"
+            style="float: left; margin-right: 15px;"
             @click="cutClick(1)"
           >
-            <img v-if="activeName == 1" src="../../public/one-blue.png" />
-            <img v-else src="../../public/one.png" />
+            <img style="width:32px;" v-if="activeName == 1" src="../../public/one-blue.png" />
+            <img style="width:32px;" v-else src="../../public/one.png" />
           </span>
           <span class="font set-title" style="float: left" @click="cutClick(2)">
-            <img v-if="activeName == 2" src="../../public/two-blue.png" />
-            <img v-else src="../../public/two.png" />
+            <img style="width:32px;" v-if="activeName == 2" src="../../public/two-blue.png" />
+            <img style="width:32px;" v-else src="../../public/two.png" />
           </span>
           鐢熶骇绠$悊鐪嬫澘
           <span
@@ -27,8 +27,8 @@
             style="float: right;margin-right:20px;font-size:28px;line-height:25px;"
             @click="taskClick"
           >
-          <el-badge :value="TaskCount" class="item">
-            <i   class="el-icon-chat-round"/>
+          <el-badge :value="TaskCount"  :class="TaskCount==0?'item color_666':'item color_fff'">
+            <i   class="el-icon-chat-dot-round" />
           </el-badge>
         </span>
         </p>
@@ -37,6 +37,9 @@
           v-for="(taskData, index) in Tasks"
           :key="index"
         >
+          <div class="gong-date">
+            宸ュ簭杩愯鏃堕棿锛歿{ getFormatTime(taskData.Procedure.startTime) }}
+          </div>
           <div class="statelist">
             <span class="title-item"
               >宸ュ崟缂栧彿:
@@ -56,7 +59,7 @@
                 {{ taskData.Procedure.procedure.nextProcedureName || "--" }}
               </span>
             </span>
-            <span class="title-item"
+            <!-- <span class="title-item"
               >宸ヤ綔浜烘暟:
               <span class="color_4efefa">
                 <span
@@ -69,11 +72,11 @@
                 <span v-else>0</span>
                 浜�
               </span>
-            </span>
+            </span> -->
           </div>
           <div class="gongx" v-if="taskData.AllProcedures">
-          <el-steps :active="taskData.CurrentProcedureIndex?taskData.CurrentProcedureIndex:0" finish-status="success" simple>
-            <el-step :title="item" v-for="(item,index) in taskData.AllProcedures" :key="index"></el-step>
+          <el-steps :active="taskData.CurrentProcedureIndex?taskData.CurrentProcedureIndex:0"  finish-status="success" class="steps">
+            <el-step icon="" :title="item" v-for="(item,index) in taskData.AllProcedures" :key="index"></el-step>
           </el-steps>
         </div>
           <div class="content">
@@ -83,7 +86,7 @@
                 <div class="content_leftBttom">
                   <dl>
                     <dd
-                      style="font-size: 26px; font-weight: 600"
+                      style="font-size: 35px; font-weight: 600"
                       class="color_green"
                     >
                       {{ taskData.finishNumber }}{{ taskData.Order.unit }}
@@ -96,7 +99,7 @@
                 <div class="content_leftBttom">
                   <dl>
                     <dd
-                      style="font-size: 26px; font-weight: 600"
+                      style="font-size: 35px; font-weight: 600"
                       class="color_green"
                     >
                       {{ taskData.Order.amount || 0 }}{{ taskData.Order.unit }}
@@ -120,7 +123,7 @@
                 <el-descriptions-item label="宸ユ椂">
                   {{ taskData.Procedure.procedure.workHours || "" }}
                 </el-descriptions-item>
-                <el-descriptions-item label="璧锋鏃堕棿"
+                <el-descriptions-item label="璁″垝鏃堕棿"
                   >{{ formatDate(taskData.Order.startTime) || "" }}
                   -
                   {{ formatDate(taskData.Order.endTime) }}</el-descriptions-item
@@ -433,9 +436,13 @@
         </div>
         <div class="right-top-m">
           璁惧鐘舵��:
+          <!-- 1鏂紑2鐢熶骇3寰呮満 -->
           <span style="position: relative"
-            >姝e父
-            <span class="yuandian"></span>
+            >
+            <img v-if="plcStatus == 1" src="../../public/duan.png" />
+            <img v-else src="../../public/lian.png" />
+            <!-- <span class="yuandian"></span> -->
+            {{ plcStatus==1?'鏂紑':(plcStatus==2?'鐢熶骇涓�':'寰呮満') }}
           </span>
         </div>
         <div class="right-top-m-btn">
@@ -654,9 +661,10 @@
       countDownMinute: 0,
       Arr: [],
       // 璁板綍瀹氭椂鍣ㄧ姸鎬�
-      procInfoTimer: [null, null],
+      procInfoTimer: null,
       cutdownTimer: null,
       TaskCount:0,
+      plcStatus:1,
     };
   },
   mounted() {
@@ -743,6 +751,16 @@
         return "";
       }
     },
+    // 鏍煎紡鍖栨椂闂� ==> yyyy-mm-dd
+    formatDate2(value) {
+      if (value) {
+        const now = value ? new Date(value * 1000) : new Date();
+        let time = this.getDateObj(now, "yyyy/MM/dd hh:mm:ss");
+        return time;
+      } else {
+        return "";
+      }
+    },
     getDate3() {
       let now = new Date();
       this.formatTime3 = this.getDateObj(now, "hh:mm");
@@ -750,6 +768,24 @@
     getDate2() {
       let now = new Date();
       this.formatTime2 = this.getDateObj(now, "yyyy骞碝M鏈坉d鏃�");
+    },
+    getFormatTime(date){
+      const getCha=()=>{
+        let now=new Date().getTime()
+        let String=now-date*1000;
+        let seconds=Math.floor(String/1000)
+        let minutes=Math.floor(seconds/60)
+        
+        let days=Math.floor(String/1000/60/60/24)
+        let hours=Math.floor(minutes/60)-days*24
+        let m=minutes-days*24*60-hours*60
+        return days+'澶�'+hours+'鏃�'+m+'鍒�'
+      }
+      let d= getCha()
+      setInterval(() => {
+       d= getCha();
+      }, 6000);
+      return d;
     },
     setInterCard(value, name, i) {
       if (this.Tasks[i].Procedure.procedure[value]) {
@@ -797,7 +833,7 @@
       };
       this.Tasks = [];
       getTaskInfo({ page: 1, pageSize: this.activeName }).then((res) => {
-        if (res.code == 200) {
+        if (res.code == 200&&res.data) {
           let arr=[]
           if(res.data.Tasks){
            arr.sort(function(a,b){
@@ -831,6 +867,7 @@
                 ...this.Tasks[i].Procedure.procedure,
               },
             ]);
+            
             if (this.Tasks[i].Procedure.ID) {
               startTask({ id: this.Tasks[i].Procedure.ID }).then((res) => {
                 if (res.code == 200) {
@@ -838,22 +875,20 @@
                   this.Tasks[i].procedureList[0].push({
                     number: res.data.Number,
                     name: "宸ヨ壓",
+                    Arr:res.data.Params ? res.data.Params : [],
                   });
-                  if (i == 0) {
-                    this.Arr = res.data.Params ? res.data.Params : [];
-                    this.taskData=this.Tasks[i]
-                  }
                 }
               });
-              this.getProgressInfo(i);
-              if (!this.procInfoTimer[i]) {
-                this.procInfoTimer[i] = setInterval(() => {
-                  this.getProgressInfo(i);
-                }, 6000);
-              }
             }
             this.setInterCard("inputMaterials", "cardBox1&" + i, i);
             this.setInterCard("outputMaterials", "cardBox3&" + i, i);
+          }
+          this.getStartArr()
+          this.getProgressInfo();
+              if (!this.procInfoTimer) {
+                this.procInfoTimer = setInterval(() => {
+                  this.getProgressInfo();
+                }, 9000);
           }
         }
         if (res.code != 200 || this.Tasks.length == 0) {
@@ -867,17 +902,30 @@
         }
       });
     },
-    getProgressInfo(i) {
-      getProgress({
-        position: Number(i),
-        procedureId: this.Tasks[i].Procedure.ID,
-      }).then((res) => {
-        if (res.code == 200) {
-          this.Tasks[i].finishNumber = res.data.finishNumber
-            ? res.data.finishNumber
-            : 0;
+    getStartArr(){
+      for (let i in this.Tasks) {
+        if (this.Tasks[i].Procedure.Status==1) {
+            this.Arr = this.Tasks[i].procedureList[0].Arr ?this.Tasks[i].procedureList[0].Arr: [];
+            this.taskData=this.Tasks[i];
+            break;
         }
-      });
+      }
+    },
+    getProgressInfo() {
+      for (let i in this.Tasks){
+        getProgress({
+          position: Number(i),
+          procedureId: this.Tasks[i].Procedure.ID,
+        }).then((res) => {
+          if (res.code == 200) {
+            this.Tasks[i].finishNumber = res.data.finishNumber
+              ? res.data.finishNumber
+              : 0;
+              this.plcStatus=res.data.plcStatus?res.data.plcStatus:1
+          }
+        });
+      }
+      
     },
     // 璁剧疆
     setUrl() {
@@ -892,7 +940,12 @@
     // 鍙充晶鎺у埗
     controlClick() {
       if (this.Tasks.length > 0) {
-        this.$refs.control.islook = true;
+        for(let i in this.Tasks){
+          if(this.Tasks[i].Procedure.Status==1){
+            this.$refs.control.islook = true;
+            break;
+          }
+        }
       } else {
         this.$message.error("褰撳墠璁惧娌℃湁宸ュ簭锛�");
       }
@@ -924,20 +977,23 @@
 <style lang="scss">
 .active-one {
   width: 100%;
-  height: 100%;
+  height: calc(100% - 100px);
   .statelist {
     height: 50px;
+  }
+  .small_title {
+    margin-bottom: 20px;
   }
   .content {
     height: 240px;
   }
   .bottom {
-    height: calc(100% - 500px - 30px);
+    height: calc(100% - 410px);
   }
 }
 .active-two {
   width: calc(50% - 10px);
-  height: 100%;
+  height: calc(100% - 100px);
   float: left;
   padding-left: 10px;
   &:nth-of-type(1) {
@@ -946,8 +1002,14 @@
     box-sizing: border-box;
     border-right: 1px solid #eee;
   }
+  .small_title {
+    margin-bottom: 30px;
+  }
   .statelist {
     height: 60px;
+   .title-item{
+    font-size:14px!important;
+   }
   }
   .title-item > span {
     display: block;
@@ -957,27 +1019,54 @@
     height: 370px;
 
     .content-top {
-      height: calc(50% - 60px) !important;
-      padding-top: 50px !important;
+      height: calc(50% - 20px) !important;
+      padding-top: 10px !important;
     }
     .el-descriptions__body {
       font-size: 16px !important;
     }
   }
   .bottom {
-    height: calc(100% - 630px - 50px);
+    height: calc(100% - 560px);
   }
   .bottom_list .bottom-title {
-    font-size: 18px;
+    font-size: 16px;
   }
+}
+.gong-date{
+ width:100%;
+ height:20px;
+ line-height:20px;
+ margin-bottom:10px;
+ font-size:16px;
 }
 .gongx{
   width:100%;
-  height:30px;
-  margin-bottom:10px;
-   .el-steps--simple{
-    background:transparent;
-    padding:5px 10px;
+  height:50px;
+  overflow-x:auto;
+  // overflow-y:hidden;
+  margin-top:-5px;
+  .steps{
+    height:100%;
+    .el-step__icon{
+      width:16px;
+      height:16px;
+    }
+    .el-step__title{
+      line-height:25px;
+      font-size:14px;
+    }
+  }
+  
+  .el-step{
+    .el-step__icon{
+     background:#00cc66;
+    }
+    .is-wait{
+      .el-step__icon{
+        background:#fff;
+      }
+    }
   }
   .el-step__head.is-process{
     color: #00cc66 !important;
@@ -1068,7 +1157,12 @@
   font-size: 30px;
   font-weight: 700;
 }
-
+.color_666{
+  color:#666!important;
+}
+.color_fff{
+  color:#fff!important;
+}
 .color_4efefa {
   color: #4efefa;
 }
@@ -1095,7 +1189,7 @@
   position: relative;
   padding: 10px;
   width: 30%;
-  height: 100%;
+  height: calc(100% - 20px);
   border-radius: 6px;
   background: rgb(22 72 173);
   // float:left;
@@ -1104,7 +1198,7 @@
     font-size: 22px;
     height: 30px;
     line-height: 30px;
-    margin-bottom: 30px;
+    margin-bottom: 5px;
     .el-button--primary {
       color: #fff;
       float: right;
@@ -1146,14 +1240,18 @@
   .card-box {
     width: 100%;
     height: calc(100% - 50px - 50px);
-    // overflow:auto;
     // height:300px;
+    .el-carousel__container{
+      overflow-y:auto;
+    }
+    // .el-carousel__item{
+    //   min-height:116px;
+    // }
   }
 }
 
 .small_title {
-  font-size: 24px;
-  margin-bottom: 10px;
+  font-size: 20px;
 }
 .right-small-btn {
   margin-top: 10px;
@@ -1200,19 +1298,23 @@
     .title {
       font-size: 30px;
       font-weight: 600;
-
+      height:40px;
+      margin:10px 0 30px;
       text-align: center;
+      .el-badge__content, .el-progress.is-exception .el-progress-bar__inner{
+        background-color:green;
+      }
     }
 
     .statelist {
       width: 100%;
-      margin: 0 auto 20px;
+      margin: 0 auto 10px;
       flex-wrap: nowrap;
       align-content: center;
       justify-content: space-around;
       align-items: center;
       .title-item {
-        width: calc(25% - 50px);
+        width: calc(33.333% - 50px);
         float: left;
         margin-right: 10px;
         padding: 15px 20px;
@@ -1229,7 +1331,7 @@
     }
     .content {
       width: 100%;
-      margin: 0px 0px 30px;
+      margin: 0px 0px 20px;
       overflow: hidden;
       .content_left {
         width: 24%;
@@ -1238,8 +1340,8 @@
         // padding:2%;
         .content-top {
           background: rgb(22 72 173);
-          height: calc(50% - 30px);
-          padding-top: 20px;
+          height: calc(50% - 20px);
+          padding-top: 10px;
           text-align: center;
           line-height: 30px;
           border-radius: 6px;
@@ -1467,9 +1569,19 @@
       line-height: 50px;
       font-weight: 700;
       font-size: 18px;
-      padding: 0 4%;
+      padding: 0 3%;
       overflow-x: hidden;
-      margin-left: -4%;
+      margin-left: -3%;
+      span{
+        display:inline-block;
+        img{
+          width:23px;
+          vertical-align: middle;
+          // float:left;
+          display:inline-block;
+        }
+      }
+      
       .yuandian {
         width: 25px;
         height: 25px;
@@ -1494,15 +1606,16 @@
       }
     }
     .right_dutyLst {
-      width: calc(100% - 20px);
+      width: calc(106% - 20px);
       // height: 270px;
       height: 310px;
       border-radius: 4px;
       line-height: 30px;
       overflow: hidden;
-      // background: #00cc66;
+      background: #4565c9;
       margin-top: 10px;
       padding: 5px 10px;
+      margin-left:-3%;
       position: relative;
       .right-small-title {
         width: auto;

--
Gitblit v1.8.0