From a2441175073f8b09a7eff29effd7e3e617de2f7d Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期四, 06 六月 2024 18:23:01 +0800
Subject: [PATCH] Merge branch 'master' of http://www.beijingsoft.cn:9090/r/smart-web

---
 src/views/mdc/components/recordChartsByWorkstation.vue |   90 ++++++++++++++++++++++++++------------------
 1 files changed, 53 insertions(+), 37 deletions(-)

diff --git a/src/views/mdc/components/recordChartsByWorkstation.vue b/src/views/mdc/components/recordChartsByWorkstation.vue
index 55c94a6..2413dfa 100644
--- a/src/views/mdc/components/recordChartsByWorkstation.vue
+++ b/src/views/mdc/components/recordChartsByWorkstation.vue
@@ -1,6 +1,6 @@
 <template>
-    <div>
-        <div id="recordwork" style="width: 1000px;height:500px;"></div>
+    <div id="recordworkParse">
+        <div id="recordwork" style="height:400px;"></div>
         <div class="paginationwork">
             <el-pagination layout="prev, pager, next" @current-change="recordChange" :total="total" :default-page-size="6"/>
         </div>
@@ -11,16 +11,16 @@
 import moment from 'moment';
 import * as echarts from 'echarts';
 export default {
-    props: ['collectionstatus','date','workstationInfoList'],
+    props: ['setWork','achievements',"select"],
     watch: {
-        date(val) {
-            this.current = "1";
-            this.getCharts();
-        },
-        workstationInfoList(val) {
-            this.current = "1";
-            this.getCharts();
-        }
+        // setWork(val) {
+        //     this.current = "1";
+        //     this.getCharts();
+        // },
+        // select(val) {
+        //     this.current = "1";
+        //     this.getCharts();
+        // }
     },
     data() {
         return {
@@ -67,40 +67,48 @@
         },
         getColor(name) {
             var color = '';
-            this.collectionstatus.forEach(item=> {
-                if(item.name == name) {
+            this.achievements.forEach(item=> {
+                if(item.code == name) {
                     color = item.color;
                 }
             })
             return color;
         },
+        getStatus(name) {
+            var stauts = {};
+            this.achievements.forEach(item=> {
+                if(item.code == name) {
+                    stauts.name= item.name;
+                    stauts.type= item.type;
+                }
+            })
+            return stauts;
+        },
         getCharts() {
-            var obj = {
-                date: this.date,
-                humanFeedback: true,
-                machineFeedback: true,
-                workstationInfoList: this.workstationInfoList
-            }
-            this.$HTTP.post(`/api/blade-mdc/status-record/status-record-by-date?current=${this.current}&size=${this.size}`,obj).then(res => {
+            if(!this.setWork) return;
+            if(this.select.length == 0) return;
+            this.$HTTP.post(`/api/blade-mdc/status-record/status-record-by-workstation?current=${this.current}&size=${this.size}`,this.setWork).then(res => {
                 if (res.code === 200) {
                     var yAxisData = [];
                     var newData = [];
                     this.records = res.data.records;
                     res.data.records.reverse();
                     res.data.records.forEach((item,index)=> {
-                        yAxisData.push(item.workstationInfo.name);
+                        yAxisData.push(item.date);
                         //璁$畻寮�濮嬫椂闂达紝鏄剧ず鏃堕棿
                         item.statusRecordList.forEach(item1=> {
                             var initstart = item1.startTime.split(" ")[0];  //鏍规嵁鏃ユ湡璁$畻宸��
                             var startTime = moment(item1.startTime).diff(moment(initstart + " 00:00:00"), 'minutes');
                             var endTime = moment(item1.endTime).diff(moment(initstart + " 00:00:00"), 'minutes');
                             var diff = moment(item1.endTime).diff(moment(item1.startTime), 'minutes') //寮�濮嬩簡澶氫箙
-                            var color = this.getColor(item1.wcsDesc);
+                            var color = this.getColor(item1.wcs);
                             item1.value = [index,startTime,endTime,diff];
                             item1.itemStyle = {"normal": {"color": color}};
-                            item1.code = item.workstationInfo.code;
-                            item1.name = item.workstationInfo.name;
-                            item1.id = item.workstationInfo.id;
+                            item1.statusName = this.getStatus(item1.wcs).name;
+                            item1.statusType = this.getStatus(item1.wcs).type;
+                            item1.code = item.date;
+                            item1.name = item.date;
+                            item1.id = item.date;
                         })
                         newData.push(...item.statusRecordList);
                     })
@@ -114,20 +122,25 @@
             var option = {
                 tooltip: {
                     formatter: function (params) {
-                        console.log(params)
-                    return `<span class="tipdesc">宸ヤ綅</span>${params.data.name}</br>
-                            <span class="tipdesc">鐘舵��</span>${params.data.wcsDesc}</br>
-                            <span class="tipdesc">鎻忚堪</span>${params.data.feedbackDesc}</br>
-                            <span class="tipdesc">鐘舵�佹椂闂�</span>${params.data.startTime} 锝� ${params.data.endTime}</br>
-                            <span class="tipdesc">鍙嶉鏃堕棿</span>${params.data.feedbackTime}</br>
-                            <span class="tipdesc">鍙嶉浜�</span>${params.data.feedUser}</br>`;
+                       if(params.data.statusType == 4) {
+                            var dom = `<span class="tipdesc">宸ヤ綅:</span>${params.data.name}</br>
+                                        <span class="tipdesc">鐘舵��:</span>${params.data.wcsDesc}</br>
+                                        <span class="tipdesc">鎻忚堪:</span>${params.data.feedbackDesc}</br>
+                                        <span class="tipdesc">鐘舵�佹椂闂�:</span>${params.data.startTime} 锝� ${params.data.endTime}</br>
+                                        <span class="tipdesc">鍙嶉鏃堕棿:</span>${params.data.feedbackTime}</br>
+                                        <span class="tipdesc">鍙嶉浜�:</span>${params.data.feedUser}</br>`
+                       }else {
+                            var dom = `<span class="tipstatus">${params.data.statusName}</span></br>
+                                    <span class="tipdesc">鏃舵:</span><span>${params.data.startTime.split(" ")[1]} 锝� ${params.data.endTime.split(" ")[1]}</span></br>`
+                       }
+                        return dom;
                     }
                 },
                 grid: {
                     top: 10,
-                    left: 70,
-                    bottom: 130,
-                    right: 0
+                    left: 100,
+                    bottom: 30,
+                    right: 30
                 },
                 xAxis: {
                     min: 0,
@@ -173,7 +186,11 @@
                 ]
             };
             var recordDom = document.getElementById('recordwork');
+            var recordworkParse = document.getElementById('recordworkParse');
             var myChart = echarts.init(recordDom);
+            myChart.resize({
+              width:  document.documentElement.clientWidth - 340 + "px"
+            });
             myChart.setOption(option);
         },
         recordChange(current) {
@@ -204,8 +221,7 @@
         text-align: right;
         display: flex;
         justify-content: end;
-        margin-top: -60px;
+        margin-top: 20px;
         position: relative;
-        z-index: 99;
     }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3