From 77536cfa95b1e3c5e60f94dce3a53aa2e93f121a Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期三, 14 九月 2022 17:35:54 +0800
Subject: [PATCH] echarts添加显示隐藏按钮

---
 src/pages/show/personnelTalents/personnelTalentsChild/PersonnelTalents_UnitPersonnel.vue |   67 +++++++++++++++++----------------
 1 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/src/pages/show/personnelTalents/personnelTalentsChild/PersonnelTalents_UnitPersonnel.vue b/src/pages/show/personnelTalents/personnelTalentsChild/PersonnelTalents_UnitPersonnel.vue
index 617659e..2b77815 100644
--- a/src/pages/show/personnelTalents/personnelTalentsChild/PersonnelTalents_UnitPersonnel.vue
+++ b/src/pages/show/personnelTalents/personnelTalentsChild/PersonnelTalents_UnitPersonnel.vue
@@ -46,16 +46,19 @@
           </el-radio>
         </el-radio-group>
       </div>
-      <div class="PT_unitPersonnel--Echarts" v-show="isShow"></div>
+      <div class="PT_unitPersonnel--Echarts" v-show="echartsShow"></div>
     </div>
-
+    <div class="yincang-box">
+      <el-button @click="showEchartsBtn" v-show="echartsShow" type="primary">闅愯棌</el-button>
+      <el-button @click="showEchartsBtn" v-show="!echartsShow" type="primary">鏄剧ず</el-button>
+    </div>
   </div>
 </template>
 
 <script>
 
 import nowSize from "../../../../libs/nowSize";
-import {getPersonTable,getUnitLine} from '@/api/personnelTalents';
+import {getPersonTable, getUnitLine} from '@/api/personnelTalents';
 
 export default {
   name: "PersonnelTalents_UnitPersonnel",
@@ -144,10 +147,10 @@
       checkedCategory: '浜嬩笟鍗曚綅',
       CARE_GORY: ['浜嬩笟鍗曚綅', '鍦ㄨ亴浜哄憳', '骞翠汉鍧囨敹鍏�'],
       tableHeight: window.innerHeight - nowSize(1000),
-      isShow:true,
+      echartsShow: true,
       echartSeries: {},
       selectIndex: {
-        type:1
+        type: 1
       }
     }
   },
@@ -157,6 +160,14 @@
     this.getUnitLine()
   },
   methods: {
+    showEchartsBtn() {
+        this.echartsShow = !this.echartsShow
+        if(this.echartsShow) {
+            this.tableHeight = window.innerHeight - nowSize(960)
+        }else {
+            this.tableHeight = window.innerHeight - nowSize(320)
+        }
+    },
     mergeColumnTableCell({rowIndex, columnIndex}) {
       if (columnIndex === 0) {
         if (rowIndex === 0) {
@@ -182,7 +193,7 @@
       const option = {
         color: ['#FF5151', '#51FF5D', '#FFD151'],
         title: {
-          text: '鍘嗗勾鍏ㄥ競灞呮皯浜哄潎鍙敮閰嶆敹鍏ュ垎鏋愬浘',
+          text: '杩戜竴骞翠簨涓氭暟閲忓彉鍖栬秼鍔垮浘',
           left: 'center',
           top: '5%',
           textStyle: {
@@ -220,7 +231,7 @@
           containLabel: true
         },
         xAxis: {
-          name: '鍗曚綅锛氬勾',
+          name: '鍗曚綅锛氬勾/鏈�',
           nameTextStyle: {
             color: '#FFFFFF',
             fontSize: nowSize(24)
@@ -248,7 +259,7 @@
           }
         },
         yAxis: {
-          name: '鍗曚綅锛氬勾',
+          name: '鍗曚綅锛氬',
           nameTextStyle: {
             color: '#FFFFFF',
             fontSize: nowSize(24)
@@ -275,17 +286,17 @@
         },
         series: [
           {
-            name: '灞呮皯浜哄潎鍙敮閰嶆敹鍏�',
+            name: '鍏ㄥ競',
             type: 'line',
             data: this.echartSeries.quanshi
           },
           {
-            name: '鍩庨晣灞呮皯',
+            name: '甯傜洿',
             type: 'line',
             data: this.echartSeries.shizhi
           },
           {
-            name: '鍐滄潙灞呮皯',
+            name: '鍘匡紙甯傘�佸尯锛�',
             type: 'line',
             data: this.echartSeries.xian
           }
@@ -298,22 +309,9 @@
     },
     // 閫氳繃鐐瑰嚮鏇存崲echarts鍥捐〃淇℃伅
     selectEcharts(index) {
-      this.selectIndex.type = index+1
-      switch(index){
-        case 0:
-          this.isShow = true;
-          this.getUnitLine()
-          this.Init_echarts()
-          break;
-        // case 1:
-        //   this.getUnitLine()
-        //   this.Init_echarts()
-        //   console.log('鎴戞槸1');
-        //   break;
-        default:
-          this.isShow = false;
-          break;
-      }
+      this.selectIndex.type = index + 1
+      this.getUnitLine()
+      this.Init_echarts()
     },
     // 29. 鏌ヨ浜嬩笟鍗曚綅浜哄憳鎯呭喌琛ㄦ牸鏁版嵁鎺ュ彛
     getPersonTable() {
@@ -324,10 +322,11 @@
       })
     },
     // 41.鏌ヨ浜嬩笟骞村害鍙樺寲鎯呭喌鎶樼嚎鍥炬暟鎹帴鍙�
-    getUnitLine(){
-      getUnitLine(this.selectIndex).then(res=>{
-        if(res.code === 1000){
+    getUnitLine() {
+      getUnitLine(this.selectIndex).then(res => {
+        if (res.code === 1000) {
           this.echartSeries = res.obj
+          console.log(this.echartSeries);
           this.Init_echarts()
         }
       })
@@ -456,7 +455,12 @@
 .PersonnelTalents_unitPersonnel--warp {
   width: 100%;
   height: 100%;
-
+  position: relative;
+  .yincang-box{
+    position: absolute;
+    right: 0.078125rem  /* 20/256 */;
+    bottom: 0;
+  }
   .PT_unitPersonnel--table {
     width: 100%;
   }
@@ -469,7 +473,6 @@
     height: calc(100% - 2.5rem/* 640/256 */ - 0.254375rem /* 60/256 */
     );
     position: relative;
-
     .PT_navEchart--title {
       width: 1px;
       display: inline-block;

--
Gitblit v1.9.1