From fadbd95daeb9f807c8b8cba4c8b45f83ca3a3890 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 01 Dec 2021 16:39:00 +0800
Subject: [PATCH] +

---
 src/views/securityUnitOperation/operationAnalysis.vue |  273 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 179 insertions(+), 94 deletions(-)

diff --git a/src/views/securityUnitOperation/operationAnalysis.vue b/src/views/securityUnitOperation/operationAnalysis.vue
index c50cbfc..3d83130 100644
--- a/src/views/securityUnitOperation/operationAnalysis.vue
+++ b/src/views/securityUnitOperation/operationAnalysis.vue
@@ -2,40 +2,30 @@
   <div class="yyPage">
     <el-row :gutter="20">
       <el-col :span="14">
-        <div class="rowContent first-menu" style="position: relative;">
+        <div class="rowContent first-menu" style="position: relative">
           <div class="rowTitle">
             <img src="../../../public/img/bajgxt/u1618.png" />
             <span>数据概览</span>
-            <el-select
+            <avue-input-tree
               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
+              default-expand-all
+              v-model="value1"
+              placeholder="请选择辖区"
+              type="tree"
+              :dic="options1"
+              :props="props"
+              @change="handleNodeClick"
+            ></avue-input-tree>
+            <avue-input-tree
               class="select2"
+              default-expand-all
               v-model="value2"
-              placeholder="请选择"
+              placeholder="请选择公司"
+              type="tree"
+              :dic="options2"
+              :props="props2"
               @change="changeCompanys"
-            >
-              <el-option
-                v-for="item in options2"
-                :key="item.departmentid"
-                :label="item.enterpriseName"
-                :value="item.departmentid"
-              ></el-option>
-            </el-select>
+            ></avue-input-tree>
             <el-button @click="toOperationTable">进入数据统计表</el-button>
           </div>
 
@@ -80,33 +70,33 @@
             <span>预警分析</span>
           </div>
 
-          <div class="col-content" style="margin-left: 55px;">
+          <div class="col-content" style="margin-left: 55px">
             <div
               class="box-card"
-              style="margin-right: 50px;cursor: pointer; "
+              style="margin-right: 50px; cursor: pointer"
               @click="showTable('fw')"
             >
               <span>服务对象预警(家)</span>
-              <span>{{ card.czBaoan }}</span>
-              <span>服务对象不多于1家</span>
+              <span>{{ yj.fuwu }}</span>
+              <span>服务对象小于2家</span>
             </div>
             <div
               class="box-card"
-              style="margin-right: 50px;cursor: pointer;"
+              style="margin-right: 50px; cursor: pointer"
               @click="showTable('pq')"
             >
               <span>派遣预警(家)</span>
-              <span>{{ card.kh }}</span>
-              <span>派遣比例低于50%</span>
+              <span>{{ yj.paiqian }}</span>
+              <span>派遣率小于50%</span>
             </div>
             <div
               class="box-card"
-              style="margin-right: 50px;cursor: pointer;"
+              style="margin-right: 50px; cursor: pointer"
               @click="showTable('cz')"
             >
               <span>持证上岗预警(家)</span>
-              <span>{{ card.sheb }}</span>
-              <span>持证率低于50%</span>
+              <span>{{ yj.chizheng }}</span>
+              <span>持证率小于50%</span>
             </div>
           </div>
         </div>
@@ -171,116 +161,117 @@
           <el-table-column :key="gridData.type" type="index"> </el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="realName"
+            prop="enterprisename"
             label="保安公司名称"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="deptName"
+            prop="jurisdictionName"
             label="所属辖区"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="sex"
+            prop="znum"
             label="服务对象数"
             :formatter="sexFormatter"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="cardid"
+            prop="dispatchUnitName"
             label="服务单位名称"
             :show-overflow-tooltip="true"
           ></el-table-column>
-          <el-table-column
+          <!-- <el-table-column
             :key="gridData.type"
             prop="age"
             label="备注"
             :show-overflow-tooltip="true"
             width="100"
-          ></el-table-column>
+          ></el-table-column> -->
         </template>
         <template v-if="gridData.type === 'pq'">
           <el-table-column :key="gridData.type" type="index"> </el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="enterpriseName"
+            prop="enterprisename"
             label="保安公司名称"
-            width="180"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="znum"
+            prop="jurisdictionName"
             label="所属辖区"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="cznum"
+            prop="znum"
             label="保安总人数"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="czl"
+            prop="cnum"
             label="派遣人数"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="sbnum"
+            prop="pnum"
             label="派遣比例"
+            :formatter="kslFormatter"
             :show-overflow-tooltip="true"
           ></el-table-column>
-          <el-table-column
+          <!-- <el-table-column
             :key="gridData.type"
             prop="sbl"
             label="备注"
             :show-overflow-tooltip="true"
-          ></el-table-column>
+          ></el-table-column> -->
         </template>
         <template v-if="gridData.type === 'cz'">
           <el-table-column :key="gridData.type" type="index"> </el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="enterpriseName"
+            prop="enterprisename"
             label="保安公司名称"
             width="180"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="znum"
+            prop="jurisdictionName"
             label="所属辖区"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="cznum"
+            prop="znum"
             label="保安总人数"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="painum"
+            prop="cnum"
             label="持证人数"
             :show-overflow-tooltip="true"
           ></el-table-column>
           <el-table-column
             :key="gridData.type"
-            prop="fwnum"
+            prop="pnum"
             label="持证比例"
+            :formatter="kslFormatter"
             :show-overflow-tooltip="true"
           ></el-table-column>
-          <el-table-column
+          <!-- <el-table-column
             :key="gridData.type"
             prop="pql"
             label="备注"
             :show-overflow-tooltip="true"
-          ></el-table-column>
+          ></el-table-column> -->
         </template>
       </el-table>
       <el-pagination
@@ -305,7 +296,10 @@
   getCompanys,
   queryYearKh,
   queryYearG,
-  selectAge
+  selectAge,
+  getSecurityUnitServerLessPage,
+  getSecurityUnitDispatcherLessPage,
+  getSecurityUnitHoldLessPage,
 } from "../../api/securityUnitOperation/securityUnitOperation";
 export default {
   data() {
@@ -327,33 +321,38 @@
         sheb: 0,
         addsheb: 0,
         baoanPq: 0,
-        addbaoanPq: 0
+        addbaoanPq: 0,
+      },
+      yj: {
+        fuwu: 0,
+        paiqian: 0,
+        chizheng: 0,
       },
       options0: [
         {
           value: "2012",
-          label: "2012年"
+          label: "2012年",
         },
         {
           value: "2011",
-          label: "2011年"
+          label: "2011年",
         },
         {
           value: "2010",
-          label: "2010年"
+          label: "2010年",
         },
         {
           value: "2009",
-          label: "2009年"
+          label: "2009年",
         },
         {
           value: "2008",
-          label: "2008年"
+          label: "2008年",
         },
         {
           value: "2007",
-          label: "2007年"
-        }
+          label: "2007年",
+        },
       ],
       options1: [],
       options2: [],
@@ -366,17 +365,22 @@
         middleEchart1: null,
         middleEchart2: null,
         bottomEchart: null,
-        bottomEchart1: null
+        bottomEchart1: null,
       },
       ageData: {
         qing: 0,
         zhong: 0,
-        lao: 0
+        lao: 0,
       },
       props: {
         children: "children",
         label: "title",
-        value: "id"
+        value: "id",
+      },
+      props2: {
+        children: "children",
+        label: "enterpriseName",
+        value: "departmentid",
       },
       node: {}, //选中的记录
       gridData: {
@@ -384,38 +388,56 @@
         total: 0,
         current: 1,
         type: "fw",
-        title: ""
+        title: "",
       },
       dialogloading: false,
-      dialogTableVisible: false
+      dialogTableVisible: false,
     };
   },
   methods: {
+    kslFormatter(row) {
+      if (row.pnum && row.pnum !== "0") {
+        return row.pnum + "%";
+      } else {
+        return row.pnum;
+      }
+    },
+    changePage() {
+      this.showcurTable(this.gridData.type);
+    },
     showTable(type) {
       this.gridData.type = type;
+      this.gridData.current = 1;
+      this.gridData.data = [];
+      this.showcurTable(type);
+    },
+    showcurTable(type) {
       this.dialogTableVisible = true;
+      // this.dialogloading = true;
       if (type === "fw") {
         this.gridData.title = "服务对象预警保安公司";
+        this.getSecurityUnitServerLessPage();
       } else if (type === "pq") {
         this.gridData.title = "派遣预警保安公司";
+        this.getSecurityUnitDispatcherLessPage();
       } else if (type === "cz") {
         this.gridData.title = "持证上岗预警保安公司";
+        this.getSecurityUnitHoldLessPage();
       }
     },
     //点击节点
     handleNodeClick(data) {
-      this.node = data;
-      this.value1 = data.id;
-      this.$refs.treeForm.blur();
+      // debugger
+      this.value1 = data;
       this.getCompanys();
     },
     setAgeEchart() {
       this.loading4 = true;
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2
+        deptid: this.value2,
       };
-      selectAge(params).then(res => {
+      selectAge(params).then((res) => {
         if (res.data.code === 200) {
           if (!this.echartDom.bottomEchart1) {
             this.echartDom.bottomEchart1 = echarts.init(
@@ -442,18 +464,19 @@
           "&enterpriseName=" +
           this.enterpriseName +
           "&jurisdiction1=" +
-          this.value1
+          this.value1,
       });
     },
     getFenju() {
       this.options1 = [];
       this.value1 = "";
       this.node = {};
-      lazyTrees().then(res => {
+      lazyTrees().then((res) => {
         if (res.data.code === 200) {
           this.options1 = res.data.data;
-          this.value1 = this.options1[0] ? this.options1[0].id : "";
+          // this.value1 = this.options1[0] ? this.options1[0].id : "";
           this.node = this.options1[0];
+          // debugger
           this.getCompanys();
         } else {
           this.$message.error(res.msg);
@@ -462,10 +485,10 @@
     },
 
     getCompanys() {
-      getCompanys({ jurisdiction: this.value1 }).then(res => {
+      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.value2 = this.options2[0] ? this.options2[0].departmentid : "";
           this.enterpriseName = this.options2[0]
             ? this.options2[0].enterpriseName
             : "";
@@ -476,9 +499,9 @@
     getQueryCounts() {
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2
+        deptid: this.value2,
       };
-      queryCounts(params).then(res => {
+      queryCounts(params).then((res) => {
         if (res.data.code === 200) {
           let data = res.data.data[0];
           this.card = {
@@ -495,7 +518,7 @@
             sheb: data.sheb.thisnum,
             addsheb: data.sheb.thisnum - data.sheb.lastnum,
             baoanPq: data.paiq.thisnum,
-            addbaoanPq: data.paiq.thisnum - data.paiq.lastnum
+            addbaoanPq: data.paiq.thisnum - data.paiq.lastnum,
           };
         }
       });
@@ -504,9 +527,9 @@
       this.loading2 = true;
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2
+        deptid: this.value2,
       };
-      queryYearKh(params).then(res => {
+      queryYearKh(params).then((res) => {
         if (res.data.code === 200) {
           if (!this.echartDom.middleEchart2) {
             this.echartDom.middleEchart2 = echarts.init(
@@ -525,9 +548,9 @@
       this.loading3 = true;
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2
+        deptid: this.value2,
       };
-      queryYearG(params).then(res => {
+      queryYearG(params).then((res) => {
         if (res.data.code === 200) {
           if (!this.echartDom.middleEchart1) {
             this.echartDom.middleEchart1 = echarts.init(
@@ -566,16 +589,75 @@
         sheb: 0,
         addsheb: 0,
         baoanPq: 0,
-        addbaoanPq: 0
+        addbaoanPq: 0,
+      };
+      this.yj = {
+        fuwu: 0,
+        paiqian: 0,
+        chizheng: 0,
       };
       this.ageData = {
         qing: 0,
         zhong: 0,
-        lao: 0
+        lao: 0,
       };
     },
+    getSecurityUnitServerLessPage() {
+      let params = {
+        jurisdiction: this.value1,
+        departmentid: this.value2,
+        current: this.gridData.current,
+        size: 10,
+      };
+      getSecurityUnitServerLessPage(params).then((res) => {
+        if (res.data.code === 200) {
+          this.yj.fuwu = res.data.data.total;
+          this.gridData.data = res.data.data.records;
+          this.gridData.total = res.data.data.total;
+        }
+        if (this.dialogloading) {
+          this.dialogloading = false;
+        }
+      });
+    },
+    getSecurityUnitDispatcherLessPage() {
+      let params = {
+        jurisdiction: this.value1,
+        departmentid: this.value2,
+        current: this.gridData.current,
+        size: 10,
+      };
+      getSecurityUnitDispatcherLessPage(params).then((res) => {
+        if (res.data.code === 200) {
+          this.yj.paiqian = res.data.data.total;
+          this.gridData.data = res.data.data.records;
+          this.gridData.total = res.data.data.total;
+        }
+        if (this.dialogloading) {
+          this.dialogloading = false;
+        }
+      });
+    },
+    getSecurityUnitHoldLessPage() {
+      let params = {
+        jurisdiction: this.value1,
+        departmentid: this.value2,
+        current: this.gridData.current,
+        size: 10,
+      };
+      getSecurityUnitHoldLessPage(params).then((res) => {
+        if (res.data.code === 200) {
+          this.yj.chizheng = res.data.data.total;
+          this.gridData.data = res.data.data.records;
+          this.gridData.total = res.data.data.total;
+        }
+        if (this.dialogloading) {
+          this.dialogloading = false;
+        }
+      });
+    },
     changeCompanys() {
-      this.options2.forEach(item => {
+      this.options2.forEach((item) => {
         if (item.departmentid === this.value2) {
           this.enterpriseName = item.enterpriseName;
         }
@@ -585,11 +667,14 @@
       this.getQueryYearKh();
       this.getQueryYearG();
       this.setAgeEchart();
-    }
+      this.getSecurityUnitServerLessPage();
+      this.getSecurityUnitDispatcherLessPage();
+      this.getSecurityUnitHoldLessPage();
+    },
   },
   mounted() {
     this.getFenju();
-  }
+  },
 };
 </script>
 <style lang="scss" scoped>

--
Gitblit v1.9.3