From e8f9a6ab3d258c028da4fdc4a51c3985a9eba67c Mon Sep 17 00:00:00 2001
From: zhengpz <1838927346@qq.com>
Date: Wed, 18 Aug 2021 22:44:00 +0800
Subject: [PATCH] 对接口

---
 src/views/securityUnitOperation/economicAnalysis.vue |   86 +++++++++++++++++++++++++++++--------------
 1 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/src/views/securityUnitOperation/economicAnalysis.vue b/src/views/securityUnitOperation/economicAnalysis.vue
index 23c01cc..50446a7 100644
--- a/src/views/securityUnitOperation/economicAnalysis.vue
+++ b/src/views/securityUnitOperation/economicAnalysis.vue
@@ -59,13 +59,13 @@
             </div>
             <div class="box-card">
               <span>公司派遣人数</span>
-              <span>1121</span>
-              <span>较上月增加13人</span>
+              <span>{{ socialSecurity.paiQ }}</span>
+              <span>较上月增加{{ socialSecurity.addPaiQ }}人</span>
             </div>
             <div class="box-card">
               <span>社保缴纳人数占比</span>
-              <span>85%</span>
-              <span>较上月上涨2%</span>
+              <span>{{ socialSecurity.sheBPerson }}</span>
+              <span>较上月上涨{{ socialSecurity.addSheBPerson }}</span>
             </div>
           </div>
         </div>
@@ -106,6 +106,7 @@
   selectTo,
   queryYearSoil,
   queryYearAn,
+  queryYearPz
 } from "../../api/securityUnitOperation/securityUnitOperation";
 export default {
   data() {
@@ -116,28 +117,28 @@
       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: [],
@@ -146,7 +147,11 @@
         addNum: 0,
         money: 0,
         addMoney: 0,
-      },
+        paiQ: 0,
+        addPaiQ: 0,
+        sheBPerson: 0,
+        addSheBPerson: 0
+      }
     };
   },
   methods: {
@@ -154,7 +159,7 @@
       this.$router.push({ path: "/securityUnitOperation/economicTable" });
     },
     getFenju() {
-      lazyTreeJu().then((res) => {
+      lazyTreeJu().then(res => {
         if (res.data.code === 200) {
           this.options1 = res.data.data;
           this.value1 = this.options1[0] ? this.options1[0].id : "";
@@ -170,9 +175,9 @@
     pieChange() {
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2,
+        deptid: this.value2
       };
-      selectPCount(params).then((res) => {
+      selectPCount(params).then(res => {
         if (res.data.code === 200) {
           let middleEchart2 = echarts.init(
             document.getElementById("middleEchart2")
@@ -184,7 +189,7 @@
       });
     },
     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 : "";
@@ -195,15 +200,34 @@
     getSocialSecurity() {
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2,
+        deptid: this.value2
       };
-      selectTo(params).then((res) => {
+      selectTo(params).then(res => {
         if (res.data.code === 200) {
           let data = res.data.data[0];
           this.socialSecurity.num = data.thismouth;
           this.socialSecurity.addNum = data.thismouth - data.lastmonth;
           this.socialSecurity.money = data.thisamount;
           this.socialSecurity.addMoney = data.thisamount - data.lastamount;
+          this.socialSecurity.paiQ = data.userpcthismouth;
+          this.socialSecurity.addPaiQ =
+            data.userpcthismouth - data.userpclastmouth;
+          this.socialSecurity.sheBPerson =
+            data.userthismouth && (data.thismouth / data.userthismouth) * 100
+              ? ((data.thismouth / data.userthismouth) * 100).toFixed(2) + "%"
+              : 0;
+          this.socialSecurity.addSheBPerson =
+            data.userthismouth &&
+            data.userlastmouth &&
+            (data.thismouth / data.userthismouth) * 100 &&
+            (data.lastmonth / data.userlastmouth) * 100 &&
+            (data.thismouth / data.userthismouth) * 100 -
+              (data.lastmonth / data.userlastmouth) * 100
+              ? (
+                  (data.thismouth / data.userthismouth) * 100 -
+                  (data.lastmonth / data.userlastmouth) * 100
+                ).toFixed(2) + "%"
+              : 0;
         } else {
           this.$message.error(res.msg);
         }
@@ -212,14 +236,20 @@
     getQueryYearSoil() {
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2,
+        deptid: this.value2
       };
-      queryYearSoil(params).then((res) => {
+      queryYearSoil(params).then(res => {
         if (res.data.code === 200) {
-          let middleEchart1 = echarts.init(
-            document.getElementById("middleEchart1")
-          );
-          middleEchart1.setOption(echartJs.economicMiddle(res.data.data));
+          queryYearPz(params).then(res1 => {
+            if (res1.data.code === 200) {
+              let middleEchart1 = echarts.init(
+                document.getElementById("middleEchart1")
+              );
+              middleEchart1.setOption(
+                echartJs.economicMiddle(res.data.data, res1.data.data)
+              );
+            }
+          });
         } else {
           this.$message.error(res.msg);
         }
@@ -228,9 +258,9 @@
     getQueryYearAn() {
       let params = {
         jurisdiction: this.value1,
-        deptid: this.value2,
+        deptid: this.value2
       };
-      queryYearAn(params).then((res) => {
+      queryYearAn(params).then(res => {
         if (res.data.code === 200) {
           let bottomEchart = echarts.init(
             document.getElementById("bottomEchart")
@@ -246,11 +276,11 @@
       this.getSocialSecurity();
       this.getQueryYearSoil();
       this.getQueryYearAn();
-    },
+    }
   },
   mounted() {
     this.getFenju();
-  },
+  }
 };
 </script>
 <style lang="scss" scoped>

--
Gitblit v1.9.3