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/securityEchart.js |  220 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 165 insertions(+), 55 deletions(-)

diff --git a/src/views/securityUnitOperation/securityEchart.js b/src/views/securityUnitOperation/securityEchart.js
index 971c5e6..9184b69 100644
--- a/src/views/securityUnitOperation/securityEchart.js
+++ b/src/views/securityUnitOperation/securityEchart.js
@@ -1,7 +1,7 @@
 function bottomOption(alldata) {
   let data = [];
   for (var i in alldata) {
-    data.push(alldata[i])
+    data.push(alldata[i]);
   }
   let option = {
     // title: {
@@ -26,15 +26,15 @@
       "#96dee8"
     ],
     grid: {
-      top: "10%",
+      top: "15%",
       left: "3%",
       right: "4%",
-      bottom: "15%",
+      bottom: "0%",
       containLabel: true
     },
     legend: {
-      data: ["趋势"],
-      bottom: "0%",
+      data: ["服务客户数量"],
+      top: "0%",
       textStyle: {
         color: "#fff"
       }
@@ -47,7 +47,7 @@
       // borderColor: "gray", //设置边框颜色
       textStyle: {
         color: "#fff" //设置文字颜色
-      },
+      }
     },
     xAxis: {
       type: "category",
@@ -71,7 +71,6 @@
       ]
     },
     yAxis: {
-      name: "(元)",
       type: "value",
       axisLabel: {
         color: "#fff"
@@ -79,7 +78,7 @@
     },
     series: [
       {
-        name: "趋势",
+        name: "服务对象数量",
         data: data,
         type: "line",
         smooth: true,
@@ -90,7 +89,22 @@
   return option;
 }
 function bottomOption1(alldata) {
-
+  let baoan = [];
+  let chiz = [];
+  let paiq = [];
+  alldata.forEach(item => {
+    for (var i in item) {
+      for (var j in item[i]) {
+        if (i === "baoan") {
+          baoan.push(item[i][j]);
+        } else if (i === "chiz") {
+          chiz.push(item[i][j]);
+        } else if (i === "paiq") {
+          paiq.push(item[i][j]);
+        }
+      }
+    }
+  });
   let option = {
     // title: {
     //   text: "公司运营趋势",
@@ -100,7 +114,6 @@
     // },
     color: [
       "#73c0de",
-
       "#fac858",
       "#91cc75",
       "#3ba272",
@@ -114,28 +127,28 @@
       "#96dee8"
     ],
     grid: {
-      top: "10%",
+      top: "15%",
       left: "3%",
       right: "4%",
-      bottom: "15%",
+      bottom: "0%",
       containLabel: true
     },
     legend: {
-      data: ["趋势"],
-      bottom: "0%",
+      data: ["保安员数量", "派遣数量", "持证数量"],
+      top: "0%",
       textStyle: {
         color: "#fff"
       }
     },
     tooltip: {
-      trigger: "item",
+      trigger: "axis",
       backgroundColor: "#031952",
       color: "#fff",
       borderWidth: "0", //边框宽度设置1
       // borderColor: "gray", //设置边框颜色
       textStyle: {
         color: "#fff" //设置文字颜色
-      },
+      }
     },
     xAxis: {
       type: "category",
@@ -159,7 +172,7 @@
       ]
     },
     yAxis: {
-      name: "(元)",
+      // name: "(元)",
       type: "value",
       axisLabel: {
         color: "#fff"
@@ -167,11 +180,22 @@
     },
     series: [
       {
-        name: "趋势",
-        data: [10,20,14,15,16,17,24,15,3,7,11,23],
+        name: "保安员数量",
         type: "line",
-        smooth: true,
-        areaStyle: {}
+        stack: "总量",
+        data: baoan
+      },
+      {
+        name: "派遣数量",
+        type: "line",
+        stack: "总量",
+        data: paiq
+      },
+      {
+        name: "持证数量",
+        type: "line",
+        stack: "总量",
+        data: chiz
       }
     ]
   };
@@ -186,23 +210,20 @@
   alldata.forEach(item => {
     for (var i in item) {
       for (var j in item[i]) {
-        if (i === 'baoan') {
-          baoan.push(item[i][j])
-        } else if (i === 'zc') {
-          zc.push(item[i][j])
-        }
-        else if (i === 'chiz') {
-          chiz.push(item[i][j])
-        }
-        else if (i === 'sheb') {
-          sheb.push(item[i][j])
-        }
-        else if (i === 'paiq') {
-          paiq.push(item[i][j])
+        if (i === "baoan") {
+          baoan.push(item[i][j]);
+        } else if (i === "zc") {
+          zc.push(item[i][j]);
+        } else if (i === "chiz") {
+          chiz.push(item[i][j]);
+        } else if (i === "sheb") {
+          sheb.push(item[i][j]);
+        } else if (i === "paiq") {
+          paiq.push(item[i][j]);
         }
       }
     }
-  })
+  });
   let option = {
     // title: {
     //   text: "公司保安类数据对比",
@@ -218,7 +239,7 @@
       // borderColor: "gray", //设置边框颜色
       textStyle: {
         color: "#fff" //设置文字颜色
-      },
+      }
     },
     legend: {
       data: [
@@ -302,12 +323,12 @@
         barWidth: 9,
         data: chiz
       },
-      {
-        name: "过考保安数",
-        type: "bar",
-        barWidth: 9,
-        data: []
-      },
+      // {
+      //   name: "过考保安数",
+      //   type: "bar",
+      //   barWidth: 9,
+      //   data: []
+      // },
       {
         name: "缴纳社保保安数",
         type: "bar",
@@ -327,7 +348,7 @@
 function middleOption2(alldata) {
   let data = [];
   for (var i in alldata) {
-    data.push(alldata[i])
+    data.push(alldata[i]);
   }
   let option = {
     // title: {
@@ -347,7 +368,7 @@
       // borderColor: "gray", //设置边框颜色
       textStyle: {
         color: "#fff" //设置文字颜色
-      },
+      }
     },
     legend: {
       data: ["客户数"],
@@ -417,11 +438,97 @@
   };
   return option;
 }
+function bottomOption2(alldata) {
+  let data = [];
+  for (var key in alldata) {
+    let obj = null;
+    if (key === "lcount") {
+      obj = {
+        name: "老年",
+        value: alldata[key]
+      };
+    } else if (key === "zcount") {
+      obj = {
+        name: "中年",
+        value: alldata[key]
+      };
+    }
+    else if (key === "qcount") {
+      obj = {
+        name: "青年",
+        value: alldata[key]
+      };
+    }
+    data.push(obj);
+  }
+  let option = {
+    tooltip: {
+      trigger: "item",
+      formatter: "{a}<br>{b}:{c}({d}%)",
+      axisPointer: {
+        type: "shadow"
+      },
+      backgroundColor: "#031952", //设置背景图片 rgba格式
+      color: "#fff",
+      borderWidth: "0", //边框宽度设置1
+      // borderColor: "gray", //设置边框颜色
+      textStyle: {
+        color: "#fff" //设置文字颜色
+      }
+    },
+    // legend: {
+    //   data: ["青年", "中年", "老年"],
+    //   top: "0%",
+    //   itemHeight: 10,
+    //   textStyle: {
+    //     color: "#fff"
+    //   }
+    // },
+    color: [
+      "#73c0de",
+      "#fac858",
+      "#91cc75",
+      "#3ba272",
+      "#fc8452",
+      "#9a60b4",
+      "#3fb1e3",
+      "#6be6c1",
+      "#626c91",
+      "#a0a7e6",
+      "#c4ebad",
+      "#96dee8"
+    ],
+    grid: {
+      top: "10%",
+      left: "5%",
+      right: "30%",
+      bottom: "4%",
+      containLabel: true
+    },
+    series: [
+      {
+        name: "年龄结构",
+        type: "pie",
+        center: ["33%", "50%"],
+        radius: "70%",
+        data:data,
+        label: {
+          color: "#fff"
+        }
+      }
+    ]
+  };
+  return option;
+}
 
-function economicMiddle(data) {
-  let data1 = [];
-  for (var a in data) {
-    data1.push(data[a])
+function economicMiddle(data1, data2) {
+  let sbData = [];
+  let pqData = [];
+  for (var a in data1) {
+    sbData.push(data1[a]);
+  }
+  for (var b in data2) {
+    pqData.push(data2[b]);
   }
   let option = {
     tooltip: {
@@ -432,7 +539,7 @@
       // borderColor: "gray", //设置边框颜色
       textStyle: {
         color: "#fff" //设置文字颜色
-      },
+      }
     },
     legend: {
       data: ["缴纳社保人数", "公司派遣人数"],
@@ -495,20 +602,19 @@
         name: "缴纳社保人数",
         type: "line",
         stack: "总量",
-        data: data1
+        data: sbData
       },
       {
         name: "公司派遣人数",
         type: "line",
         stack: "总量",
-        data: [220, 182, 191, 234, 290, 330, 310, 111, 222, 132, 143, 123]
+        data: pqData
       }
     ]
   };
   return option;
 }
 function economicPieOption(allData) {
-
   let title = "总";
   let total = Number(allData.PCount) + Number(allData.WPCount);
   let option = {
@@ -542,7 +648,7 @@
       // borderColor: "gray", //设置边框颜色
       textStyle: {
         color: "#fff" //设置文字颜色
-      },
+      }
     },
     legend: {
       bottom: "0%",
@@ -572,9 +678,12 @@
         name: "人员分布",
         type: "pie",
         radius: ["40%", "70%"],
+        label: {
+          color: "#fff"
+        },
         data: [
           { value: allData.PCount, name: "已派遣人数" },
-          { value: allData.WPCount, name: "未派遣人" }
+          { value: allData.WPCount, name: "未派遣人数" }
         ]
       }
     ]
@@ -588,5 +697,6 @@
   middleOption1,
   middleOption2,
   economicMiddle,
-  economicPieOption
+  economicPieOption,
+  bottomOption2
 };

--
Gitblit v1.9.3