From cc702f8d62c082c8f4b97b44e094fb8b8c7b97d8 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 31 七月 2024 15:16:06 +0800
Subject: [PATCH] 修改检验任务bug

---
 src/components/view/b4-inspection-item-statistics.vue |  151 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 106 insertions(+), 45 deletions(-)

diff --git a/src/components/view/b4-inspection-item-statistics.vue b/src/components/view/b4-inspection-item-statistics.vue
index 6eb1a49..9b6ee8c 100644
--- a/src/components/view/b4-inspection-item-statistics.vue
+++ b/src/components/view/b4-inspection-item-statistics.vue
@@ -1,80 +1,80 @@
 <template>
-  <div class="inspection-main">
+  <div class="inspection-main" v-loading="loading">
     <div class="inspection-content" style="height:100%">
-      <p style="font-size: 16px;padding:19.5px 0px">妫�娴嬮」鐩粺璁�</p>
+      <!-- <p style="font-size: 16px;padding:19.5px 0px">妫�娴嬮」鐩粺璁�</p> -->
       <el-row :gutter="20">
-        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 30px;">
+        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
           <div class="inspection-card inspection-head">
             <div class="inspection-head-left">
               <h4>浠婃棩椤圭洰鎺ユ敹</h4>
-              <span >2453</span>
+              <span >{{ pageData.RECEVICE }}</span>
               <div class="inspection-head-left-info">
-                <img src="../../../static/img/daliy-up.svg" alt="">
-                <span :class="{active:false}" class="num">&nbsp; 8.5%&nbsp; </span>
+                <img :src="`../../../static/img/daliy-${pageData.RECEIVE_RATIO<0?'down':'up'}.svg`" alt="">
+                <span :class="{active:pageData.RECEIVE_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.RECEIVE_RATIO)}%&nbsp; `"></span>
                 <span style="font-size: 12px;">杈冩槰澶�</span>
               </div>
             </div>
             <img src="../../../static/img/daliy-0.svg" alt="" srcset="">
           </div>
         </el-col>
-        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 30px;">
+        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
           <div class="inspection-card inspection-head">
             <div class="inspection-head-left">
               <h4>浠婃棩椤圭洰瀹屾垚</h4>
-              <span >1687</span>
+              <span >{{ pageData.FINISHE }}</span>
               <div class="inspection-head-left-info">
-                <img src="../../../static/img/daliy-up.svg" alt="">
-                <span :class="{active:false}" class="num">&nbsp; 8.5%&nbsp; </span>
+                <img :src="`../../../static/img/daliy-${pageData.FINISHE_RATIO<0?'down':'up'}.svg`" alt="">
+                <span :class="{active:pageData.FINISHE_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.FINISHE_RATIO)}%&nbsp; `"></span>
                 <span style="font-size: 12px;">杈冩槰澶�</span>
               </div>
             </div>
             <img src="../../../static/img/daliy-1.svg" alt="" srcset="">
           </div>
         </el-col>
-        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 30px;">
+        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
           <div class="inspection-card inspection-head">
             <div class="inspection-head-left">
               <h4>浠婃棩椤圭洰鍓╀綑</h4>
-              <span >766</span>
+              <span >{{ pageData.SURPLUS }}</span>
               <div class="inspection-head-left-info">
-                <img src="../../../static/img/daliy-down.svg" alt="">
-                <span :class="{active:true}" class="num">&nbsp; 8.5%&nbsp; </span>
+                <img :src="`../../../static/img/daliy-${pageData.SURPLUS_RATIO<0?'down':'up'}.svg`" alt="">
+                <span :class="{active:pageData.SURPLUS_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.SURPLUS_RATIO)}%&nbsp; `"></span>
                 <span style="font-size: 12px;">杈冩槰澶�</span>
               </div>
             </div>
             <img src="../../../static/img/daliy-2.svg" alt="" srcset="">
           </div>
         </el-col>
-        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 30px;">
+        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
           <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;">
             <h4 style="margin-bottom: 5px;">浠婃棩椤圭洰鍚堟牸鐜�</h4>
             <echart-module :id="'inspection-qualified'" :config="chartConfig2" :datas="chartData2" style="align-self: center;"></echart-module>
           </div>
         </el-col>
-        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 30px;">
+        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
           <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;">
             <h4 style="margin-bottom: 5px;">浠婃棩椤圭洰瀹屾垚鐜�</h4>
             <echart-module :id="'inspection-complete'" :config="chartConfig3" :datas="chartData3" style="align-self: center;"></echart-module>
           </div>
         </el-col>
-        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 30px;">
+        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
           <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;">
             <h4 style="margin-bottom: 5px;">浠婃棩椤圭洰寤舵湡鐜�</h4>
             <echart-module :id="'inspection-extension'" :config="chartConfig4" :datas="chartData4" style="align-self: center;"></echart-module>
           </div>
         </el-col>
       </el-row>
-      <el-row :gutter="20">
-        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 30px;">
-          <div class="inspection-card chart-box">
+      <el-row :gutter="20" style="height: calc(100% - 170px);">
+        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px; height: 100%;">
+          <div class="inspection-card chart-box" style="height: 100%;">
             <h4>杩�10鏃ラ」鐩帴鏀堕噺</h4>
-            <echart-module :id="'inspection-left'" :config="chartConfig0" :datas="chartData0"></echart-module>
+            <echart-module :id="'inspection-left'" :config="chartConfig0" :datas="chartData0" style="height: calc(100% - 32px);"></echart-module>
           </div>
         </el-col>
-        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 30px;">
-          <div class="inspection-card chart-box">
+        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px;height: 100%;">
+          <div class="inspection-card chart-box" style="height: 100%;">
             <h4>杩�10鏃ュ疄闄呭畬鎴愰」鐩笌鎺ユ敹椤圭洰瀵规瘮</h4>
-            <echart-module :id="'inspection-right'" :config="chartConfig1" :datas="chartData1"></echart-module>
+            <echart-module :id="'inspection-right'" :config="chartConfig1" :datas="chartData1" style="height: calc(100% - 32px);"></echart-module>
           </div>
         </el-col>
       </el-row>
@@ -90,101 +90,158 @@
     data(){
       return{
         chartConfig0:{
-          height: '435px',
+          height: '',
           isLoading:true,
           type:'line'
         },
         chartData0:{
-          xData:['4-11','4-12','4-13','4-14','4-15','4-16','4-17','4-18','4-19','4-20'],
+          xData:[],
           yData:[
             {
               title:'椤圭洰鎺ユ敹閲�',
-              data:[10,20,10,40,50,20,70,40,90,50]
+              data:[]
             }
           ]
         },
         chartConfig1:{
-          height: '435px',
+          height: '',
           isLoading:true,
           type:'bar'
         },
         chartData1:{
-          xData:['4-11','4-12','4-13','4-14','4-15','4-16','4-17','4-18','4-19','4-20'],
+          xData:[],
           yData:[
             {
               title:'浠婃棩鎺ユ敹',
-              data:[10,20,10,40,50,20,70,40,90,50]
+              data:[]
             },
             {
               title:'浠婃棩瀹屾垚',
-              data:[15,10,6,33,66,44,56,77,44,55]
+              data:[]
             },
           ]
         },
         chartConfig2:{
-          height: '118px',
+          height: '103px',
           width:'140px',
           isLoading:true,
           type:'pie'
         },
         chartData2:{
           title:'浠婃棩椤圭洰鍚堟牸鐜�',
-          percentage:'68%',
+          percentage:'0',
           color:['#1CCAB8','#E1E4E8'],
           data:[
             {
               name:'鍚堟牸',
-              value:'68'
+              value:'0'
             },
             {
               name:'涓嶅悎鏍�',
-              value:'32'
+              value:'0'
             },
           ]
         },
         chartConfig3:{
-          height: '118px',
+          height: '103px',
           width:'140px',
           isLoading:true,
           type:'pie'
         },
         chartData3:{
           title:'浠婃棩椤圭洰瀹屾垚鐜�',
-          percentage:'68%',
+          percentage:'0',
           color:['#FBB647','#E1E4E8'],
           data:[
             {
               name:'瀹屾垚',
-              value:'68'
+              value:'0'
             },
             {
               name:'鏈畬鎴�',
-              value:'32'
+              value:'0'
             },
           ]
         },
         chartConfig4:{
-          height: '118px',
+          height: '103px',
           width:'140px',
           isLoading:true,
           type:'pie'
         },
         chartData4:{
           title:'浠婃棩椤瑰欢鏈熺巼',
-          percentage:'68%',
+          percentage:'0',
           color:['#FF3838','#E1E4E8'],
           data:[
             {
               name:'寤舵湡',
-              value:'68'
+              value:'0'
             },
             {
               name:'鏈欢鏈�',
-              value:'32'
+              value:'0'
             },
           ]
         },
+        loading:false,
+        pageData:{},
+        timers:null
       }
+    },
+    mounted(){
+      this.init()
+      this.timers&&clearInterval(this.timers);
+      setInterval(this.init(),1000*60*5)
+    },
+    methods:{
+      init(){
+      this.chartConfig0.isLoading = false
+      this.chartConfig1.isLoading = false
+      this.chartConfig2.isLoading = false
+      this.chartConfig3.isLoading = false
+      this.chartConfig4.isLoading = false
+      this.loading = true;
+      this.$axios.get(this.$api.report.testProductByDay).then(res => {
+        if (res.code == 201) return
+        this.pageData = this.HaveJson(res.data)
+        let xData = res.data.DAYS.map(m=>{
+          let arr = m.split('-')
+          return `${arr[1]}-${arr[2]}`
+        })
+        this.chartData0.xData = xData
+        this.chartData1.xData = xData
+        this.chartData0.yData[0].data = this.pageData.RECETENDAYS
+        this.chartData1.yData[0].data = this.pageData.RECETENDAYS
+        this.chartData1.yData[1].data = this.pageData.FINISHTENDAYS
+        this.chartData2.percentage = (this.pageData.ACCEPT_RATE_TODAY*100).toFixed(0)+'%'
+        this.chartData3.percentage = (this.pageData.FINISH_RATE_TODAY*100).toFixed(0)+'%'
+        this.chartData4.percentage = (this.pageData.DELAY_RATE_TODAY*100).toFixed(0)+'%'
+        this.chartData2.data[0].value = this.pageData.ACCEPT
+        this.chartData2.data[1].value = this.pageData.FINISHE - this.pageData.ACCEPT
+        this.loading = false;
+        this.chartData3.data[0].value = this.pageData.FINISHE
+        this.chartData3.data[1].value = this.pageData.RECEVICE - this.pageData.FINISHE
+        this.chartData4.data[0].value = this.pageData.SURPLUS
+        this.chartData4.data[1].value = this.pageData.RECEVICE - this.pageData.SURPLUS
+        this.chartConfig0.isLoading = true
+        this.chartConfig1.isLoading = true
+        this.chartConfig2.isLoading = true
+        this.chartConfig3.isLoading = true
+        this.chartConfig4.isLoading = true
+      })
+      },
+      handleData(val){
+        if(val){
+          let num = Math.abs(val)*100
+          return num.toFixed(0);
+        }else{
+          return '0'
+        }
+      }
+    },
+    deactivated(){
+      this.timers&&clearInterval(this.timers);
     }
   }
   </script>
@@ -194,6 +251,10 @@
     height: 100%;
     overflow-y: auto;
     overflow-x: hidden;
+  }
+  .inspection-content{
+    padding: 20px 0;
+    box-sizing: border-box;
   }
   .inspection-card{
     width: 100%;
@@ -223,7 +284,7 @@
     font-weight: bold;
     font-size: 28px;
     display: inline-block;
-    margin-bottom: 30px;
+    margin-bottom: 16px;
   }
 
   .inspection-head-left .inspection-head-left-info{
@@ -242,7 +303,7 @@
   }
 
   .chart-box{
-    padding: 30px 24px;
+    padding: 16px 24px;
     box-sizing: border-box;
   }
 

--
Gitblit v1.9.3