From 05f3dd19cd55fef61fa89ac9f60f915ef7bd9e07 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期五, 15 九月 2023 10:52:52 +0800
Subject: [PATCH] 提示 修改为2种状态+ 无任务页面的显示问题

---
 src/views/visualization.vue |  274 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 199 insertions(+), 75 deletions(-)

diff --git a/src/views/visualization.vue b/src/views/visualization.vue
index 9640465..3745c30 100644
--- a/src/views/visualization.vue
+++ b/src/views/visualization.vue
@@ -2,20 +2,20 @@
 <template>
   <div class="home">
     <!-- v-if="Object.keys(taskData).length > 0 && taskData.Procedure.ID" -->
-    <template>
+    <template v-if="Tasks&&Tasks.length>0">
       <div class="left">
         <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||isTipShow)?'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,21 +72,21 @@
                 <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">
             <div class="content_left">
               <div class="content-top">
-                <div class="small_title">褰撳墠瀹屾垚</div>
+                <div class="small_title">鍔犲伐鏁�</div>
                 <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 }}
@@ -92,11 +95,11 @@
                 </div>
               </div>
               <div class="content-top">
-                <div class="small_title">姝e搧鐢熶骇</div>
+                <div class="small_title">鐩爣鏁�</div>
                 <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
@@ -149,8 +152,10 @@
                         ? parseInt(
                             (taskData.finishNumber / taskData.Order.amount) *
                               100
-                          )
-                        : 0
+                        )>100?100:parseInt(
+                            (taskData.finishNumber / taskData.Order.amount) *
+                              100
+                        ): 0
                     "
                   ></el-progress>
                 </el-descriptions-item>
@@ -271,7 +276,11 @@
                                     (taskData.finishNumber /
                                       taskData.Order.amount) *
                                       100
-                                  )
+                                )>100?100:parseInt(
+                                    (taskData.finishNumber /
+                                      taskData.Order.amount) *
+                                      100
+                                )
                                 : 0
                             "
                             :show-text="false"
@@ -433,9 +442,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">
@@ -492,7 +505,7 @@
       </div>
     </template>
     <!-- v-else -->
-    <template>
+    <template v-else>
       <div class="home-img-box">
         <div class="bg-title">
           <img src="../../public/bg-title.png" />
@@ -532,6 +545,7 @@
       :taskData="taskData"
       :Order="taskData.Order"
       @getSetProductNumber="getTaskInfo"
+      @isTip="isTip"
     />
   </div>
 </template>
@@ -654,9 +668,11 @@
       countDownMinute: 0,
       Arr: [],
       // 璁板綍瀹氭椂鍣ㄧ姸鎬�
-      procInfoTimer: [null, null],
+      procInfoTimer: null,
       cutdownTimer: null,
       TaskCount:0,
+      plcStatus:1,
+      isTipShow:false,
     };
   },
   mounted() {
@@ -680,6 +696,9 @@
       }else{
         this.$message.error('鐩墠娌℃湁浠诲姟锛�')
       }
+    },
+    isTip(val){
+      this.isTipShow=val
     },
     cutClick(val) {
       this.activeName = val;
@@ -743,6 +762,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 +779,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 +844,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 +878,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 +886,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 +913,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 +951,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 +988,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 +1013,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 +1030,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 +1168,12 @@
   font-size: 30px;
   font-weight: 700;
 }
-
+.color_666{
+  color:#666!important;
+}
+.color_fff{
+  color:#fff!important;
+}
 .color_4efefa {
   color: #4efefa;
 }
@@ -1095,16 +1200,16 @@
   position: relative;
   padding: 10px;
   width: 30%;
-  height: 100%;
+  height: calc(100% - 20px);
   border-radius: 6px;
   background: rgb(22 72 173);
   // float:left;
   .bottom-title {
     font-weight: 600;
-    font-size: 22px;
+    font-size: 20px;
     height: 30px;
     line-height: 30px;
-    margin-bottom: 30px;
+    margin-bottom: 5px;
     .el-button--primary {
       color: #fff;
       float: right;
@@ -1146,14 +1251,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 +1309,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 +1342,7 @@
     }
     .content {
       width: 100%;
-      margin: 0px 0px 30px;
+      margin: 0px 0px 20px;
       overflow: hidden;
       .content_left {
         width: 24%;
@@ -1238,8 +1351,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 +1580,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 +1617,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