From 248896ac0e9bb76906a270bbc5f83b1c6bd970dd Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 03 十月 2022 17:22:11 +0800
Subject: [PATCH] 1.综合看板基本实现

---
 src/views/kb/zhkb.vue |  417 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 389 insertions(+), 28 deletions(-)

diff --git a/src/views/kb/zhkb.vue b/src/views/kb/zhkb.vue
index 2779003..605cd2f 100644
--- a/src/views/kb/zhkb.vue
+++ b/src/views/kb/zhkb.vue
@@ -26,9 +26,9 @@
                 <div>璁″垝瀹屾垚杩涘害锛堝璐級 30000鍚�</div>
               </div>
               <div class="kb_flex_space_between" style="padding: 0 15px;height: 20px;">
-                <div>鐢熶骇绫诲瀷</div>
-                <div>鐢熶骇鏁伴噺</div>
-                <div>瀹屾垚杩涘害</div>
+                <div style="color:#fff">鐢熶骇绫诲瀷</div>
+                <div style="color:#fff">鐢熶骇鏁伴噺</div>
+                <div style="color:#fff">瀹屾垚杩涘害</div>
               </div>
               <div>
                 <div class="kb_flex_space_between">
@@ -40,12 +40,12 @@
                 </div>
               </div>
               <div style="height: 180px;" class="kb_flex_column">
-                <div class="small_title">
-                  <div class="small_bar" />
-                  <div class="small_content">棰勬湡璁″垝鍘熷洜鍒嗘瀽</div>
-                </div>
-                <div style="height: 160px;" class="kb_flex_space_between">
-                  <div id="zhkb02" style="height: 160px;width: 520px;" />
+                <!--                <div class="small_title">-->
+                <!--                  <div class="small_bar" />-->
+                <!--                  <div class="small_content">棰勬湡璁″垝鍘熷洜鍒嗘瀽</div>-->
+                <!--                </div>-->
+                <div style="height: 180px;" class="kb_flex_space_between">
+                  <div id="zhkb02" style="height: 180px;width: 520px;" />
                 </div>
               </div>
             </div>
@@ -57,8 +57,55 @@
               </div>
               <div class="title">浠撳簱绠$悊</div>
             </div>
-            <div class="ckgl kb_block horn">
-              123
+            <div class="ckgl kb_block horn kb_flex_column">
+              <div style="height: 60px" class="kb_flex_space_between">
+                <div style="width: 50%;">
+                  <div class="middle_title">
+                    <div class="icon">
+                      <svg-icon icon-class="zncc" class="svg_class" />
+                    </div>
+                    <div style="margin-left: 30px;">
+                      <div>8000鍚�</div>
+                      <div style="color:#fff;">鏄ㄦ棩鍏ュ簱鏁伴噺</div>
+                    </div>
+                  </div>
+                </div>
+                <div style="width: 50%;">
+                  <div class="middle_title">
+                    <div class="icon">
+                      <svg-icon icon-class="zncc" class="svg_class" />
+                    </div>
+                    <div style="margin-left: 30px;">
+                      <div>10000鍚�</div>
+                      <div style="color:#fff;">鏄ㄦ棩鍑哄簱鏁伴噺</div>
+                    </div>
+                  </div>
+                </div>
+
+              </div>
+              <div style="height: 190px;position: relative" class="kb_flex_space_between">
+                <div id="zhkb12" style="width: 190px;padding: 0;" class="kb_block" />
+                <div style="position: absolute;bottom: 40px;left: 55px;width: 100px;height: 30px;color: #fff">鍏ュ簱鍙婃椂鐜�
+                </div>
+
+                <div style="width: 320px;margin-left: 10px;align-items: center" class="kb_block kb_flex_space_between">
+                  <div class="kb_flex_column" style="position: relative">
+                    <div style="position: absolute;left: 42px;top: 20px">0.01%</div>
+                    <div class="box03" />
+                    <div style="text-align: center">閫�璐х巼</div>
+                  </div>
+                  <div class="kb_flex_column" style="position: relative">
+                    <div style="position: absolute;left: 42px;top: 20px">0.02%</div>
+                    <div class="box03" />
+                    <div style="text-align: center">鎹熷潖鐜�</div>
+                  </div>
+
+                </div>
+              </div>
+              <div style="height: 280px;position: relative" class="kb_flex_column">
+                <div style="height: 20px;font-size: 18px;position: absolute;left: 220px;top: 24px">鎴愬搧搴撳瓨缁撴瀯</div>
+                <div id="zhkb13" style="height: 260px;width: 100%;" />
+              </div>
             </div>
           </div>
         </div>
@@ -91,7 +138,10 @@
               </div>
               <div class="title">杞﹂棿鑰楄兘</div>
             </div>
-            <div class="cjhn kb_block horn">123</div>
+            <div class="cjhn kb_block horn kb_flex_column">
+              <div id="zhkb08" style="height: 200px;width:100%" />
+              <div id="zhkb09" style="height: 200px;width:100%" />
+            </div>
           </div>
         </div>
         <!--        鍙宠竟-->
@@ -129,7 +179,7 @@
               </div>
               <div class="title">浜哄憳鍒嗘瀽</div>
             </div>
-            <div class="ryfx kb_block horn">123</div>
+            <div id="zhkb10" class="ryfx kb_block horn" />
           </div>
           <div class="kb_content_right_bottom">
             <div class="middle_title">
@@ -138,7 +188,7 @@
               </div>
               <div class="title">璁惧鍒嗘瀽</div>
             </div>
-            <div class="sbfx kb_block horn">123</div>
+            <div id="zhkb11" class="sbfx kb_block horn" />
           </div>
         </div>
       </div>
@@ -150,7 +200,21 @@
 <script>
 import * as echarts from 'echarts'
 import '@/utils/world'
-import { loadEcharts, zhkb01, zhkb02, zhkb03, zhkb04, zhkb05, zhkb06, zhkb07 } from '@/utils/myEcharts'
+import {
+  loadEcharts,
+  zhkb01,
+  zhkb02,
+  zhkb03,
+  zhkb04,
+  zhkb05,
+  zhkb06,
+  zhkb07,
+  zhkb08,
+  zhkb09,
+  zhkb10, zhkb11, zhkb12
+} from '@/utils/myEcharts'
+
+import '@/utils/echarts-liquidfill.min.js'
 
 export default {
   name: 'Index',
@@ -174,11 +238,14 @@
     // setInterval(() => {
     //   this.getzhkb02()
     // }, 10000)
+
+    this.getzhkb12()
+
+    this.getzhkb13()
   },
   methods: {
     getAllEcharts() {
       loadEcharts('zhkb01', zhkb01())
-      // loadEcharts('zhkb02', zhkb02())
       loadEcharts('zhkb03', zhkb03())
       loadEcharts('zhkb03_2', zhkb03())
       loadEcharts('zhkb04', zhkb04())
@@ -191,6 +258,293 @@
       loadEcharts('zhkb07_4', zhkb07())
       loadEcharts('zhkb07_5', zhkb07())
       loadEcharts('zhkb07_6', zhkb07())
+      loadEcharts('zhkb08', zhkb08())
+      loadEcharts('zhkb09', zhkb09())
+      loadEcharts('zhkb10', zhkb10())
+      loadEcharts('zhkb11', zhkb11())
+    },
+    getzhkb13() {
+      const colorList = ['#47A2FF ', '#53C8D1', '#59CB74', '#FBD444', '#7F6AAD', '#585247', '#00FFFF', '#ff00ff', '#00ff00', '#ffff00', '#ff0000', '#0000ff']
+      const data = [
+        { name: '浜у搧1', value: 100 },
+        { name: '浜у搧2', value: 200 },
+        { name: '浜у搧3', value: 300 },
+        { name: '浜у搧4', value: 400 },
+        { name: '浜у搧5', value: 500 },
+        { name: '浜у搧6', value: 550 },
+        { name: '浜у搧7', value: 570 },
+        { name: '浜у搧8', value: 570 },
+        { name: '浜у搧9', value: 570 },
+        { name: '浜у搧10', value: 570 },
+        { name: '浜у搧11', value: 570 },
+        { name: '浜у搧12', value: 570 }
+      ]
+      const option = {
+        backgroundColor: 'transparent',
+        grid: {
+          left: '0%',
+          right: '0%',
+          bottom: '0%',
+          top: '20%',
+          containLabel: true
+        },
+        title: {
+          text: '38%',
+          // subtext: '3',
+          textStyle: {
+            fontSize: 26,
+            color: '#09d8f2',
+            lineHeight: 20
+          },
+          // subtextStyle: {
+          //     fontSize: 28,
+          //     color: '#333'
+          // },
+          textAlign: 'center',
+          left: '74%',
+          top: '55%'
+        },
+        tooltip: {
+          trigger: 'item'
+        },
+        legend: {
+          // type: 'scroll',
+          orient: 'vertical',
+          left: '4%',
+          top: '20%',
+          itemGap: 20,
+          // selectedMode: false,
+          // icon: 'pin',
+          icon: 'roundRect',
+          data: data.map(r => r.name),
+          textStyle: {
+            color: colorList.map(r => r),
+            fontSize: 16,
+            rich: {
+              uname: {
+                width: 100
+              },
+              unum: {
+                // color: '#4ed139',
+                color: function(value, index) {
+                  console.log(value, index)
+                },
+                width: 20,
+                align: 'right'
+              }
+            }
+          }
+          // formatter(name) {
+          //   return `{uname|${name}}{unum|5000鍚▆`
+          // }
+        },
+        color: colorList,
+        series: [
+          {
+            // name: 'title',
+            type: 'pie',
+            radius: [60, 90],
+            center: ['75%', '60%'],
+            label: {
+              show: false
+            },
+            labelLine: {
+              show: false
+            },
+            // itemStyle: {
+            //   borderWidth: 3,
+            //   borderColor: '#fff'
+            // },
+            data: data
+          }
+        ]
+      }
+      const myChart = echarts.init(document.getElementById('zhkb13'))
+
+      if (option.textStyle == null) {
+        option.textStyle = {
+          fontFamily: 'Microsoft YaHei',
+          color: '#ffffff'
+        }
+      }
+
+      // 浣跨敤鍒氭寚瀹氱殑閰嶇疆椤瑰拰鏁版嵁鏄剧ず鍥捐〃銆�
+      myChart.clear()
+      myChart.setOption(option, true)
+
+      window.addEventListener('resize', function() {
+        myChart.resize()
+      })
+
+      var index = 0 // 鎾斁鎵�鍦ㄤ笅鏍�
+      var mTime = setInterval(function() {
+        myChart.dispatchAction({
+          type: 'showTip',
+          seriesIndex: 0,
+          dataIndex: index
+        })
+        index++
+        if (index > data.length - 1) {
+          index = 0
+        }
+      }, 2000)
+
+      var currentIndex = -1 // 褰撳墠楂樹寒鍥惧舰鍦ㄩゼ鍥炬暟鎹腑鐨勪笅鏍�
+      var changePieInterval = setInterval(selectPie, 2000) // 璁剧疆鑷姩鍒囨崲楂樹寒鍥惧舰鐨勫畾鏃跺櫒
+
+      function highlightPie() { // 鍙栨秷鎵�鏈夐珮浜苟楂樹寒褰撳墠鍥惧舰
+        // 閬嶅巻楗煎浘鏁版嵁锛屽彇娑堟墍鏈夊浘褰㈢殑楂樹寒鏁堟灉
+        option.series[0].data.forEach((item, index) => {
+          myChart.dispatchAction({
+            type: 'downplay',
+            // type: 'showTip',
+            seriesIndex: 0,
+            dataIndex: index
+          })
+        })
+
+        // // 楂樹寒褰撳墠鍥惧舰
+        myChart.dispatchAction({
+          type: 'highlight',
+          seriesIndex: 0,
+          dataIndex: currentIndex
+        })
+      }
+
+      myChart.on('mouseover', (params) => { // 鐢ㄦ埛榧犳爣鎮诞鍒版煇涓�鍥惧舰鏃讹紝鍋滄鑷姩鍒囨崲骞堕珮浜紶鏍囨偓娴殑鍥惧舰
+        clearInterval(changePieInterval)
+        currentIndex = params.dataIndex
+        highlightPie()
+      })
+
+      myChart.on('mouseout', (params) => { // 鐢ㄦ埛榧犳爣绉诲嚭鏃讹紝閲嶆柊寮�濮嬭嚜鍔ㄥ垏鎹�
+        if (changePieInterval) {
+          clearInterval(changePieInterval)
+        }
+        changePieInterval = setInterval(selectPie, 1000)
+      })
+
+      function selectPie() { // 楂樹寒鏁堟灉鍒囨崲鍒颁笅涓�涓浘褰�
+        var dataLen = option.series[0].data.length
+        currentIndex = (currentIndex + 1) % dataLen
+        highlightPie()
+      }
+    },
+    getzhkb12() {
+      const option = {
+        backgroundColor: 'transparent',
+        grid: {
+          left: '0%',
+          right: '0%',
+          bottom: '0%',
+          top: '0%',
+          containLabel: true
+        },
+        title: {
+          text: '85%',
+          x: '36%',
+          y: '40%',
+          textStyle: {
+            color: '#fff',
+            fontSize: 26
+          }
+        },
+        series: [
+          {
+            type: 'liquidFill',
+            radius: '80%',
+            // data: [0.6],
+            data: [0.6, 0.4, 0.2],
+            backgroundStyle: {
+              color: {
+                type: 'radial',
+                x: 0.5,
+                y: 0.5,
+                r: 0.5,
+                colorStops: [
+                  {
+                    offset: 0,
+                    color: 'rgba(0,24,55, 0)'
+                  },
+                  {
+                    offset: 0.75,
+                    color: 'rgba(0,24,55, 0)'
+                  },
+                  {
+                    offset: 1,
+                    color: 'rgba(37,237,259, 1)'
+                  }],
+                globalCoord: false
+              }
+            },
+            outline: {
+              borderDistance: 0,
+              itemStyle: {
+                borderWidth: 0,
+                borderColor: {
+                  type: 'linear',
+                  x: 0,
+                  y: 0,
+                  x2: 0,
+                  y2: 1,
+                  colorStops: [{
+                    offset: 0,
+                    color: 'rgba(50,115,256, 1)'
+                  }, {
+                    offset: 0.5,
+                    color: 'rgba(50,115,233, .75)'
+                  }, {
+                    offset: 1,
+                    color: 'rgba(50,115,233, 1)'
+                  }],
+                  globalCoord: false
+                }
+              }
+            },
+            color: ['rgba(9,216,242, .8)', 'rgba(9,216,242, 0.6)', 'rgba(9,216,242, 0.4)'],
+            // color: {
+            // type: 'linear',
+            // x: 0,
+            // y: 0,
+            // x2: 0,
+            // y2: 1
+            // colorStops: [{
+            //   offset: 0,
+            //   color: 'rgba(37,237,259, 1)'
+            // }, {
+            //   offset: 0.5,
+            //   color: 'rgba(0,100,259, 0.5)'
+            // }, {
+            //   offset: 1,
+            //   color: 'darkblue'
+            // }
+            // ]
+            // globalCoord: false
+            // },
+            label: {
+              normal: {
+                formatter: ''
+              }
+            }
+          }
+        ]
+      }
+      const myChart = echarts.init(document.getElementById('zhkb12'))
+
+      if (option.textStyle == null) {
+        option.textStyle = {
+          fontFamily: 'Microsoft YaHei',
+          color: '#ffffff'
+        }
+      }
+
+      // 浣跨敤鍒氭寚瀹氱殑閰嶇疆椤瑰拰鏁版嵁鏄剧ず鍥捐〃銆�
+      myChart.clear()
+      myChart.setOption(option, true)
+
+      window.addEventListener('resize', function() {
+        myChart.resize()
+      })
     },
     getEchartsHead(id) {
       const barWidth = 12
@@ -419,26 +773,26 @@
         color: colorArr,
         backgroundColor: 'transparent',
         title: {
-          show: false,
-          text: '鎬绘暟',
-          subtext: 7789,
+          show: true,
+          text: '棰勬湡璁″垝鍘熷洜鍒嗘瀽',
+          // subtext: 7789,
           textStyle: {
-            color: '#f2f2f2',
-            fontSize: 40
+            color: '#09d8f2',
+            fontSize: 16
             // align: 'center'
           },
-          subtextStyle: {
-            fontSize: 30,
-            color: ['#ff9d19']
-          },
+          // subtextStyle: {
+          //   fontSize: 30,
+          //   color: ['#ff9d19']
+          // },
           x: 'center',
-          y: 'center'
+          y: '-2%'
         },
         grid: {
           left: '0%',
           right: '4%',
           bottom: '4%',
-          top: '15%',
+          top: '20%',
           containLabel: true
         },
         legend: {
@@ -621,7 +975,7 @@
         highlightPie()
       }
 
-      return myChart
+      // return myChart
     }
 
   }
@@ -794,6 +1148,12 @@
   //background-color: rgba(0,255,255,1);
 }
 
+.box03 {
+  width: 124px;
+  height: 139px;
+  background: url("../../assets/images/box03.png");
+}
+
 .middle_title {
   display: flex;
   align-items: flex-end;
@@ -809,6 +1169,7 @@
     font-size: 26px;
     margin-left: 5px;
   }
+
 }
 
 .small_title {

--
Gitblit v1.9.3