From b46e6d2306515f94bf77c06e8d80ac76267e3ddb Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期日, 02 六月 2024 21:44:23 +0800
Subject: [PATCH] 搜索

---
 src/views/mdc/time-analysis.vue |   76 +++++++++++++++++++++++++++++---------
 1 files changed, 58 insertions(+), 18 deletions(-)

diff --git a/src/views/mdc/time-analysis.vue b/src/views/mdc/time-analysis.vue
index 0c08f99..5af9166 100644
--- a/src/views/mdc/time-analysis.vue
+++ b/src/views/mdc/time-analysis.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-04-26 09:36:18
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-05-02 20:46:36
+ * @LastEditTime: 2024-05-14 18:30:07
  * @FilePath: /smart-web/src/views/mdc/status-record.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -48,7 +48,7 @@
                             <el-collapse v-model="activeNames" accordion>
                             <el-collapse-item v-for="(item,index) in setTitle" :name="index + 1">
                                 <template #title>
-                                    <el-icon size="16" color="#409eff"><Memo /></el-icon>
+                                    <el-icon size="16" color="#3b8e8e"><Memo /></el-icon>
                                     <span class="collr-title">鐝{{index + 1}}</span>
                                     <el-button size="small">{{item.indexName}}</el-button>
                                 </template>
@@ -81,7 +81,7 @@
                             <el-collapse v-model="activeNames1" accordion>
                                 <el-collapse-item v-for="(item,index) in setTitle1" :name="index + 1">
                                     <template #title>
-                                        <el-icon size="16" color="#409eff"><Memo /></el-icon>
+                                        <el-icon size="16" color="#3b8e8e"><Memo /></el-icon>
                                         <span class="collr-title">{{item.name}}</span>
                                         <el-button size="small" v-if="index != 0">{{item.indexName}}</el-button>
                                     </template>
@@ -136,6 +136,7 @@
         	btnLeftList: [{title: "鎸夊伐浣嶇粺璁�",id:"1"},{title: "鎸夊伐浣嶇粍缁熻",id:"2"}],
         	btnLeftctive: "1",
             isshowempty: true,
+            getGlobalColorList: [],
             shortcuts: [
                 {
                     text: '鏈�杩�3澶�',
@@ -180,6 +181,7 @@
                         params.forEach(item=> {
                             dom += `<div>${item.marker}${item.seriesName}锛�${item.data}%</div>`
                         })
+                        console.log(params)
                         return dom;
                     }
                 },
@@ -198,7 +200,7 @@
                     show: true,
                     axisLabel: {
                         formatter: function (value) {
-                            return value * 100 + "%";
+                            return value + "%";
                         }
                     },
                     data: [2,20,40,60,80,100]
@@ -322,8 +324,16 @@
         this.init();
         this.getTree2List();  //鎸夊伐浣嶇粺璁℃爲
         this.getDataA();
+        this.getGlobal(); //鑾峰彇棰滆壊
     },
     methods: {
+        getGlobal() {
+            this.$HTTP.get(`/api/blade-cps/global_wcs/list`).then(res=> {
+                if(res.code == 200) {
+                    this.getGlobalColorList = res.data;
+                }
+            })
+        },
     	getDataA() {
             if(this.btnLeftctive == 1) {  //鎸夊伐浣嶇粺璁�
                 var obj = {
@@ -369,17 +379,43 @@
             
             // 鎺掗櫎杩愯鏃堕棿涓�0鐨勬儏鍐�  
             var totalRunTime = timeSums[0] || 1;  
-            
             // 璁$畻姣忎釜鐘舵�佺殑鐧惧垎姣旀暟鎹�  
-            var lastData = Object.keys(resultObject).map(key => {  
-                var data = resultObject[key].map((item, index) => {  
-                    if (index === 0) { // 鍙绠楁椂闂寸殑鐧惧垎姣�  
-                        return item == 0?0:Number((item / totalRunTime * 100).toFixed(2));
-                    } else {  
-                        return item; // 璁℃暟淇濇寔涓嶅彉  
-                    }  
-                });  
-                return {
+            // var lastData = Object.keys(resultObject).map(key => {  
+            //     var data = resultObject[key].map((item, index) => {  
+            //         if (index === 0) { // 鍙绠楁椂闂寸殑鐧惧垎姣�  
+            //             return item == 0?0:Number((item / totalRunTime * 100).toFixed(2));
+            //         } else {  
+            //             return item; // 璁℃暟淇濇寔涓嶅彉  
+            //         }  
+            //     });  
+            //     return {
+            //         name: key,
+            //         type: 'bar',
+            //         stack: 'total',
+            //         label: {
+            //             show: false
+            //         },
+            //         emphasis: {
+            //             focus: 'series'
+            //         },
+            //         barWidth: 60,
+            //         data
+            //     }
+            // }); 
+            var lastData = [];
+            var colorObj = {};  //璁剧疆棰滆壊
+            this.getGlobalColorList.forEach(item=> {
+                colorObj[item.name] = item.color;
+            })
+            Object.keys(resultObject).map(key => {
+                resultObject[key].forEach((item,index)=> {
+                    if(item != 0) {
+                        var num = item/timeSums[index]* 100;
+                        item = num.toFixed(2);
+                    }
+                    resultObject[key][index] = item;
+                })
+                lastData.push({
                     name: key,
                     type: 'bar',
                     stack: 'total',
@@ -389,11 +425,14 @@
                     emphasis: {
                         focus: 'series'
                     },
+                    itemStyle: {
+                        "color": colorObj[key]
+                    },
                     barWidth: 60,
-                    data
-                }
-            }); 
-            return lastData;
+                    data: resultObject[key]
+                })
+            })
+            return lastData.reverse();
         },
         getDataChartsA(index) {
             var obj = {
@@ -424,6 +463,7 @@
                     this.chartOptionA.series = this.formatChartData(res.data.countStatus);
                     var myChart = echarts.init(recordDom);
                     myChart.setOption(this.chartOptionA);
+                    console.log(JSON.stringify(this.chartOptionA))
                 }
             })
         },

--
Gitblit v1.9.3