From 2d50c51214f0ced8c992a415c72ea33b519fff59 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 03 Sep 2021 15:53:05 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/zhba_regulatory

---
 src/views/securityUnitOperation/operationAnalysis.vue |  336 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 283 insertions(+), 53 deletions(-)

diff --git a/src/views/securityUnitOperation/operationAnalysis.vue b/src/views/securityUnitOperation/operationAnalysis.vue
index 4aa5080..3da4c0b 100644
--- a/src/views/securityUnitOperation/operationAnalysis.vue
+++ b/src/views/securityUnitOperation/operationAnalysis.vue
@@ -7,23 +7,37 @@
             <img src="../../../public/img/bajgxt/u1618.png" />
             <span>数据概览</span>
 
-            <el-select class="select0" v-model="value0" placeholder="请选择">
+            <!-- <el-select class="select0" v-model="value0" placeholder="请选择">
               <el-option
                 v-for="item in options0"
                 :key="item.value"
                 :label="item.label"
                 :value="item.value"
               ></el-option>
+            </el-select> -->
+            <el-select
+              class="select1"
+              ref="treeForm"
+              v-model="node.title"
+              placeholder="请选择"
+            >
+              <el-option style="height: auto;" :value="node">
+                <el-tree
+                  :data="options1"
+                  default-expand-all
+                  node-key="id"
+                  @node-click="handleNodeClick"
+                  :props="props"
+                >
+                </el-tree>
+              </el-option>
             </el-select>
-            <el-select class="select1" v-model="value1" placeholder="请选择" @change="fenjuChange">
-              <el-option
-                v-for="item in options1"
-                :key="item.id"
-                :label="item.title"
-                :value="item.id"
-              ></el-option>
-            </el-select>
-            <el-select class="select2" v-model="value2" placeholder="请选择" @change="changeCompanys">
+            <el-select
+              class="select2"
+              v-model="value2"
+              placeholder="请选择"
+              @change="changeCompanys"
+            >
               <el-option
                 v-for="item in options2"
                 :key="item.departmentid"
@@ -37,38 +51,38 @@
           <div class="col-content">
             <div class="box-card">
               <span>总保安数</span>
-              <span>{{card.baoanTotal}}</span>
-              <span>较上月增加{{card.addbaoanTotal}}人</span>
+              <span>{{ card.baoanTotal }}</span>
+              <span>较上月增加{{ card.addbaoanTotal }}人</span>
             </div>
             <div class="box-card">
               <span>正常保安员</span>
-              <span>{{card.zcBaoan}}</span>
-              <span>较上月增加{{card.addzcBaoan}}人</span>
+              <span>{{ card.zcBaoan }}</span>
+              <span>较上月增加{{ card.addzcBaoan }}人</span>
             </div>
             <div class="box-card">
               <span>持证保安员</span>
-              <span>{{card.czBaoan}}</span>
-              <span>较上月增加{{card.addczBaoan}}人</span>
+              <span>{{ card.czBaoan }}</span>
+              <span>较上月增加{{ card.addczBaoan }}人</span>
             </div>
-            <div class="box-card">
+            <!-- <div class="box-card">
               <span>过考保安员</span>
-              <span>{{card.gkBaoan}}</span>
-              <span>较上月增加{{card.addgkBaoan}}人</span>
-            </div>
+              <span>{{ card.gkBaoan }}</span>
+              <span>较上月增加{{ card.addgkBaoan }}人</span>
+            </div> -->
             <div class="box-card">
               <span>服务客户</span>
-              <span>{{card.kh}}</span>
-              <span>较上月增加{{card.addkh}}家</span>
+              <span>{{ card.kh }}</span>
+              <span>较上月增加{{ card.addkh }}家</span>
             </div>
             <div class="box-card">
               <span>缴纳社保</span>
-              <span>{{card.sheb}}</span>
-              <span>较上月增加{{card.addsheb}}人</span>
+              <span>{{ card.sheb }}</span>
+              <span>较上月增加{{ card.addsheb }}人</span>
             </div>
             <div class="box-card">
               <span>保安派遣</span>
-              <span>{{card.baoanPq}}</span>
-              <span>较上月增加{{card.addbaoanPq}}人</span>
+              <span>{{ card.baoanPq }}</span>
+              <span>较上月增加{{ card.addbaoanPq }}人</span>
             </div>
           </div>
         </div>
@@ -76,23 +90,47 @@
     </el-row>
     <el-row :gutter="20">
       <el-col :span="16">
-        <div class="rowContent">
+        <div class="rowContent" v-loading="loading1">
           <span class="span-title">保安类数据统计</span>
           <div id="middleEchart1"></div>
         </div>
       </el-col>
       <el-col :span="8">
-        <div class="rowContent">
+        <div class="rowContent" v-loading="loading2">
           <span class="span-title">服务客户</span>
           <div id="middleEchart2"></div>
         </div>
       </el-col>
     </el-row>
-    <el-row>
-      <el-col :span="24">
-        <div class="rowContent">
+    <el-row :gutter="20">
+      <el-col :span="16">
+        <div class="rowContent" v-loading="loading3">
           <span class="span-title">公司运营趋势</span>
           <div id="bottomEchart"></div>
+        </div>
+      </el-col>
+      <el-col :span="8">
+        <div class="rowContent" v-loading="loading4">
+          <span class="span-title">年龄结构</span>
+          <div class="leftEchartTitle qing">
+            <div class="block1"></div>
+            <span>青年</span>
+            <span>{{ ageData.qing }}</span>
+            <span>人</span>
+          </div>
+          <div class="leftEchartTitle zhong">
+            <div class="block1"></div>
+            <span>中年</span>
+            <span>{{ ageData.zhong }}</span>
+            <span>人</span>
+          </div>
+          <div class="leftEchartTitle lao">
+            <div class="block1"></div>
+            <span>老年</span>
+            <span>{{ ageData.lao }}</span>
+            <span>人</span>
+          </div>
+          <div id="bottomEchart1"></div>
         </div>
       </el-col>
     </el-row>
@@ -102,12 +140,13 @@
 <script>
 import * as echarts from "echarts";
 import echartJs from "./securityEchart.js";
-import { lazyTreeJu } from "../../api/index/index";
+import { lazyTreeJu, lazyTrees } from "../../api/index/index";
 import {
   queryCounts,
   getCompanys,
   queryYearKh,
-  queryYearG
+  queryYearG,
+  selectAge
 } from "../../api/securityUnitOperation/securityUnitOperation";
 export default {
   data() {
@@ -158,39 +197,99 @@
         }
       ],
       options1: [],
-      options2: []
+      options2: [],
+      enterpriseName: "",
+      loading1: true,
+      loading2: true,
+      loading3: true,
+      loading4: false,
+      echartDom: {
+        middleEchart1: null,
+        middleEchart2: null,
+        bottomEchart: null,
+        bottomEchart1: null
+      },
+      ageData: {
+        qing: 0,
+        zhong: 0,
+        lao: 0
+      },
+      props: {
+        children: "children",
+        label: "title",
+        value: "id"
+      },
+      node: {} //选中的记录
     };
   },
   methods: {
-    setEchart() {
-      let data = [];
-      let bottomEchart = echarts.init(document.getElementById("bottomEchart"));
-      bottomEchart.setOption(echartJs.bottomOption1(data));
+    //点击节点
+    handleNodeClick(data) {
+      this.node = data;
+      this.value1 = data.id;
+      this.$refs.treeForm.blur();
+      this.getCompanys();
+    },
+    setAgeEchart() {
+      this.loading4 = true;
+      let params = {
+        jurisdiction: this.value1,
+        deptid: this.value2
+      };
+      selectAge(params).then(res => {
+        if (res.data.code === 200) {
+          if (!this.echartDom.bottomEchart1) {
+            this.echartDom.bottomEchart1 = echarts.init(
+              document.getElementById("bottomEchart1")
+            );
+          }
+          this.echartDom.bottomEchart1.setOption(
+            echartJs.bottomOption2(res.data.data)
+          );
+          this.ageData.qing = res.data.data.qcount;
+          this.ageData.zhong = res.data.data.zcount;
+          this.ageData.lao = res.data.data.lcount;
+        } else {
+          this.$message.error(res.data.msg);
+        }
+        this.loading4 = false;
+      });
     },
     toOperationTable() {
-      this.$router.push({ path: "/securityUnitOperation/operationTable" });
+      this.$router.push({
+        path:
+          "/securityUnitOperation/operationTable?jurisdiction=" +
+          this.value2 +
+          "&enterpriseName=" +
+          this.enterpriseName +
+          "&jurisdiction1=" +
+          this.value1
+      });
     },
     getFenju() {
       this.options1 = [];
       this.value1 = "";
-      lazyTreeJu().then(res => {
+      this.node = {};
+      lazyTrees().then(res => {
         if (res.data.code === 200) {
           this.options1 = res.data.data;
           this.value1 = this.options1[0] ? this.options1[0].id : "";
+          this.node = this.options1[0];
           this.getCompanys();
         } else {
           this.$message.error(res.msg);
         }
       });
     },
-    fenjuChange() {
-      this.getCompanys();
-    },
+
     getCompanys() {
       getCompanys({ jurisdiction: this.value1 }).then(res => {
         if (res.data.code === 200) {
           this.options2 = res.data.data;
           this.value2 = this.options2[0] ? this.options2[0].departmentid : "";
+          this.enterpriseName = this.options2[0]
+            ? this.options2[0].enterpriseName
+            : "";
           this.changeCompanys();
         }
       });
@@ -223,31 +322,53 @@
       });
     },
     getQueryYearKh() {
+      this.loading2 = true;
       let params = {
         jurisdiction: this.value1,
         deptid: this.value2
       };
       queryYearKh(params).then(res => {
         if (res.data.code === 200) {
-          let middleEchart2 = echarts.init(
-            document.getElementById("middleEchart2")
+          if (!this.echartDom.middleEchart2) {
+            this.echartDom.middleEchart2 = echarts.init(
+              document.getElementById("middleEchart2")
+            );
+          }
+          this.echartDom.middleEchart2.setOption(
+            echartJs.middleOption2(res.data.data)
           );
-          middleEchart2.setOption(echartJs.middleOption2(res.data.data));
         }
+        this.loading2 = false;
       });
     },
     getQueryYearG() {
+      this.loading1 = true;
+      this.loading3 = true;
       let params = {
         jurisdiction: this.value1,
         deptid: this.value2
       };
-      queryYearG().then(res => {
+      queryYearG(params).then(res => {
         if (res.data.code === 200) {
-          let middleEchart1 = echarts.init(
-            document.getElementById("middleEchart1")
+          if (!this.echartDom.middleEchart1) {
+            this.echartDom.middleEchart1 = echarts.init(
+              document.getElementById("middleEchart1")
+            );
+          }
+          this.echartDom.middleEchart1.setOption(
+            echartJs.middleOption1(res.data.data)
           );
-          middleEchart1.setOption(echartJs.middleOption1(res.data.data));
+          if (!this.echartDom.bottomEchart) {
+            this.echartDom.bottomEchart = echarts.init(
+              document.getElementById("bottomEchart")
+            );
+          }
+          this.echartDom.bottomEchart.setOption(
+            echartJs.bottomOption1(res.data.data)
+          );
         }
+        this.loading3 = false;
+        this.loading1 = false;
       });
     },
     // 清空之前的查询结果
@@ -268,16 +389,26 @@
         baoanPq: 0,
         addbaoanPq: 0
       };
+      this.ageData = {
+        qing: 0,
+        zhong: 0,
+        lao: 0
+      };
     },
     changeCompanys() {
+      this.options2.forEach(item => {
+        if (item.departmentid === this.value2) {
+          this.enterpriseName = item.enterpriseName;
+        }
+      });
       this.clear();
       this.getQueryCounts();
       this.getQueryYearKh();
       this.getQueryYearG();
+      this.setAgeEchart();
     }
   },
   mounted() {
-    this.setEchart();
     this.getFenju();
   }
 };
@@ -289,8 +420,9 @@
 }
 #bottomEchart,
 #middleEchart1,
-#middleEchart2 {
-  height: calc(100% - 40px);
+#middleEchart2,
+#bottomEchart1 {
+  height: calc(100% - 25px);
   width: 100%;
 }
 .el-row:first-child {
@@ -378,4 +510,102 @@
   margin-top: 15px;
   margin-left: 36px;
 }
+.leftEchartTitle {
+  height: 30px;
+  display: flex;
+  line-height: 30px;
+  margin-top: 10px;
+  margin-left: 28px;
+  position: absolute;
+  .block1 {
+    width: 23px;
+    height: 13px;
+    background: #2ec7c9;
+    border-radius: 3px;
+    margin-top: 9px;
+  }
+  span:nth-child(2) {
+    color: #fff;
+    font-size: 13px;
+    margin: 0px 10px 0px 3px;
+  }
+  span:nth-child(3) {
+    color: #2ec7c9;
+    font-size: 17px;
+    font-weight: 700;
+    display: block;
+    width: 65px;
+    text-align: center;
+  }
+  span:nth-child(4) {
+    font-size: 13px;
+    color: #2ec7c9;
+  }
+}
+.leftEchartTitle.qing {
+  right: 37px;
+  margin-top: 42px;
+  .block1 {
+    width: 30px;
+    height: 15px;
+    background: #73c0de;
+    margin-top: 7px;
+  }
+  span:nth-child(2) {
+    color: #fff;
+    font-size: 13px;
+  }
+  span:nth-child(3) {
+    color: #73c0de;
+    font-size: 17px;
+  }
+  span:nth-child(4) {
+    font-size: 13px;
+    color: #73c0de;
+  }
+}
+.leftEchartTitle.zhong {
+  right: 37px;
+  margin-top: 83px;
+  .block1 {
+    width: 30px;
+    height: 15px;
+    background: #fac858;
+    margin-top: 7px;
+  }
+  span:nth-child(2) {
+    color: #fff;
+    font-size: 13px;
+  }
+  span:nth-child(3) {
+    color: #fac858;
+    font-size: 17px;
+  }
+  span:nth-child(4) {
+    font-size: 13px;
+    color: #fac858;
+  }
+}
+.leftEchartTitle.lao {
+  right: 37px;
+  margin-top: 125px;
+  .block1 {
+    width: 30px;
+    height: 15px;
+    background: #91cc75;
+    margin-top: 7px;
+  }
+  span:nth-child(2) {
+    color: #fff;
+    font-size: 13px;
+  }
+  span:nth-child(3) {
+    color: #91cc75;
+    font-size: 17px;
+  }
+  span:nth-child(4) {
+    font-size: 13px;
+    color: #91cc75;
+  }
+}
 </style>

--
Gitblit v1.9.3