保安服务企业管理-验收版本
liuyg
2021-12-06 5a3ace296c010b5c11501dedf252e1c144cda9e2
src/views/securityAnalysis/index.vue
@@ -1,111 +1,103 @@
<template>
  <div class="securityAnalysis">
    <!-- securityAnalysis -->
    <div class="securityAnalysisleft">
      <!-- <div class="examines"> -->
      <!-- <div class="examine" ref="ech1"></div> -->
      <!-- <div class="examine1"> -->
      <!-- <div>审查时间:</div>
    <div class="securityAnalysis">
        <!-- securityAnalysis -->
        <div class="securityAnalysisleft">
            <!-- <div class="examines"> -->
            <!-- <div class="examine" ref="ech1"></div> -->
            <!-- <div class="examine1"> -->
            <!-- <div>审查时间:</div>
          <div>审查时间:</div>
          <div>问题保安员人数:</div>
          <div>问题保安员人数:</div>
          <div>问题保安员比例:</div>
          <div>问题保安员比例:</div> -->
      <!-- <div v-for="(item, index) in examine1" :key="index">
            <!-- <div v-for="(item, index) in examine1" :key="index">
            {{ item.title }}<br />{{ item.value }}
          </div>
        </div> -->
      <!-- 保安员审查情况统计
            <!-- 保安员审查情况统计
        <div>饼图</div> -->
      <!-- </div> -->
      <div class="examines" ref="ech1">
        <!-- 保安员审查情况统计
            <!-- </div> -->
            <div class="examines"
                 ref="ech1">
                <!-- 保安员审查情况统计
        <div>饼图</div> -->
      </div>
      <div class="certificate" ref="ech2">
        <!-- 保安员持证情况统计
            </div>
            <div class="certificate"
                 ref="ech2">
                <!-- 保安员持证情况统计
        <div>饼图</div> -->
      </div>
      <!-- <div class="czbut"></div> -->
    </div>
    <div class="securityAnalysiscenter">
      <div class="examination" ref="ech3">
        <!-- 保安员考试情况统计
            </div>
            <!-- <div class="czbut"></div> -->
        </div>
        <div class="securityAnalysiscenter">
            <div class="examination"
                 ref="ech3">
                <!-- 保安员考试情况统计
        <div>堆叠面积图</div> -->
      </div>
      <div class="dispatchUnit" ref="ech4">
        <!-- 派遣服务单位统计
            </div>
            <div class="dispatchUnit"
                 ref="ech4">
                <!-- 派遣服务单位统计
        <div>柱状图</div> -->
      </div>
    </div>
    <div class="securityAnalysisright">
      <div class="dispatchSecurity" ref="ech5">
        <!-- 保安派遣情况统计
            </div>
        </div>
        <div class="securityAnalysisright">
            <div class="dispatchSecurity"
                 ref="ech5">
                <!-- 保安派遣情况统计
        <div>饼图</div> -->
      </div>
      <div class="socialSecurity" ref="ech6">
        <!-- 社保缴纳情况统计
            </div>
            <div class="socialSecurity"
                 ref="ech6">
                <!-- 社保缴纳情况统计
        <div>饼图</div> -->
      </div>
    </div>
    <div>
      <el-dialog
        width="90%"
        :title="titles"
        append-to-body
        :visible.sync="dialogVisible"
        top="9vh"
      >
        <situation
          :card="{ deptid: deptid, jurisdiction: jurisdiction }"
          v-if="sees == 1"
        >
          <!-- 保安员审查情况统计 -->
        </situation>
            </div>
        </div>
        <div>
            <el-dialog width="90%"
                       :title="titles"
                       append-to-body
                       :visible.sync="dialogVisible"
                       top="9vh">
                <situation :card="{ deptid: deptid, jurisdiction: jurisdiction }"
                           v-if="sees == 1">
                    <!-- 保安员审查情况统计 -->
                </situation>
        <certificate
          :card="{ deptid: deptid, jurisdiction: jurisdiction }"
          v-if="sees == 2"
        >
          <!-- 保安员持证情况统计 -->
        </certificate>
        <examination
          :card="{ deptid: deptid, jurisdiction: jurisdiction }"
          v-if="sees == 3"
        >
          <!-- 保安员考试情况统计 -->
        </examination>
        <dispatch
          :card="{ deptId: deptid, jurisdiction: jurisdiction }"
          v-if="sees == 4"
        >
          <!-- 派遣服务单位 注意deptId  I为大写 -->
        </dispatch>
        <assignment
          :card="{ deptid: deptid, jurisdiction: jurisdiction }"
          v-if="sees == 5"
        >
          <!-- 保安派遣情况 -->
        </assignment>
        <socialSecurity
          :card="{ deptid: deptid, jurisdiction: jurisdiction }"
          v-if="sees == 6"
        >
          <!-- 社保缴纳情况 -->
        </socialSecurity>
      </el-dialog>
                <certificate :card="{ deptid: deptid, jurisdiction: jurisdiction }"
                             v-if="sees == 2">
                    <!-- 保安员持证情况统计 -->
                </certificate>
                <examination :card="{ deptid: deptid, jurisdiction: jurisdiction }"
                             v-if="sees == 3">
                    <!-- 保安员考试情况统计 -->
                </examination>
                <dispatch :card="{ deptId: deptid, jurisdiction: jurisdiction }"
                          v-if="sees == 4">
                    <!-- 派遣服务单位 注意deptId  I为大写 -->
                </dispatch>
                <assignment :card="{ deptid: deptid, jurisdiction: jurisdiction }"
                            v-if="sees == 5">
                    <!-- 保安派遣情况 -->
                </assignment>
                <socialSecurity :card="{ deptid: deptid, jurisdiction: jurisdiction }"
                                v-if="sees == 6">
                    <!-- 社保缴纳情况 -->
                </socialSecurity>
            </el-dialog>
        </div>
    </div>
  </div>
</template>
<script>
import {
  getinformationselectExtype, //保安员审查情况统计
  getinformationselectHold, //保安员持证
  getinformationselectDis, //派遣服务单位
  getinformationstatistics, //保安员考试情况统计
  getinformationselectDisp, //保安派遣情况
  getinformationselectSoil, //社保缴纳情况统计
    getinformationselectExtype, //保安员审查情况统计
    getinformationselectHold, //保安员持证
    getinformationselectDis, //派遣服务单位
    getinformationstatistics, //保安员考试情况统计
    getinformationselectDisp, //保安派遣情况
    getinformationselectSoil, //社保缴纳情况统计
} from "@/api/securityAnalysis/securityAnalysis";
import { mapState } from "vuex";
import { getRoleDetail } from "@/api/system/role";
@@ -116,821 +108,773 @@
import assignment from "./child/assignment.vue";
import socialSecurity from "./child/socialSecurity.vue";
export default {
  components: {
    certificate,
    examination,
    situation,
    dispatch,
    assignment,
    socialSecurity,
  },
  data() {
    return {
      EC1: "", //保安员审查情况统计 // 饼图
      EC2: "", //保安员持证情况统计 // 饼图
      EC3: "", //保安员考试情况统计 // 堆叠面积图
      EC4: "", //派遣服务单位统计 // 柱状图
      EC5: "", //保安派遣情况统计 // 饼图
      EC6: "", //社保缴纳情况统计 // 饼图
      deptid: "",
      jurisdiction: "",
    components: {
        certificate,
        examination,
        situation,
        dispatch,
        assignment,
        socialSecurity,
    },
    data () {
        return {
            EC1: "", //保安员审查情况统计 // 饼图
            EC2: "", //保安员持证情况统计 // 饼图
            EC3: "", //保安员考试情况统计 // 堆叠面积图
            EC4: "", //派遣服务单位统计 // 柱状图
            EC5: "", //保安派遣情况统计 // 饼图
            EC6: "", //社保缴纳情况统计 // 饼图
            deptid: "",
            jurisdiction: "",
      examine1: [],
            examine1: [],
      dialogVisible: false,
      titles: "",
            dialogVisible: false,
            titles: "",
      // czdata: [],
      sees: "",
    };
  },
  computed: {
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
    ids1() {
      let ids1 = [];
      this.selectionList1.forEach((ele) => {
        ids1.push(ele.id);
      });
      return ids1.join(",");
    },
    ids2() {
      let ids2 = [];
      this.selectionList2.forEach((ele) => {
        ids2.push(ele.id);
      });
      return ids2.join(",");
    },
  },
  watch: {
    dialogVisible() {
      if (this.dialogVisible == false && this.sees == "1") {
        this.getEC1();
      }
      if (this.dialogVisible == false && this.sees == "2") {
        this.getEC2();
      }
      if (this.dialogVisible == false && this.sees == "3") {
        this.getEC3();
      }
      if (this.dialogVisible == false && this.sees == "4") {
        this.getEC4();
      }
      if (this.dialogVisible == false && this.sees == "5") {
        this.getEC5();
      }
      if (this.dialogVisible == false && this.sees == "6") {
        this.getEC6();
      }
    },
  },
  methods: {
    creatOurEcharts() {
      this.EC1 = echarts.init(this.$refs.ech1);
      this.EC2 = echarts.init(this.$refs.ech2);
      this.EC3 = echarts.init(this.$refs.ech3);
      this.EC4 = echarts.init(this.$refs.ech4);
      this.EC5 = echarts.init(this.$refs.ech5);
      this.EC6 = echarts.init(this.$refs.ech6);
      this.biginOUREC();
    },
    changedata(a, ok, no, okmsg, nomsg) {
      var d = [];
      if (a.length != 0) {
        var yes = 0,
          not = 0;
        for (var k in a) {
          yes += a[k][ok];
          not += a[k][no];
        }
        d = [
          {
            value: yes,
            name: okmsg,
          },
          {
            value: not,
            name: nomsg,
          },
        ];
      } else {
        d = [
          {
            value: 0,
            name: okmsg,
          },
          {
            value: 0,
            name: nomsg,
          },
        ];
      }
      // console.log(d, ok, no);
      return d;
    },
    getTime() {
      var data = new Date();
      var time = data.toLocaleString().slice(0, 9);
      return time;
    },
    GetPercent(num, total) {
      num = parseFloat(num);
      total = parseFloat(total);
      if (isNaN(num) || isNaN(total)) {
        return "-";
      }
      return total <= 0
        ? "0%"
        : Math.round((num / total) * 10000) / 100.0 + "%";
    },
    gettoolbox(title, titles, id) {
      var that = this;
      return {
        show: true,
        itemSize: 25,
        top: 20,
        right: 20,
        feature: {
          myTool1: {
            show: true,
            title: title,
            icon: "image://img/table.png",
            onclick: function () {
              that.dialogVisible = true;
              that.sees = id;
              that.titles = titles;
            },
          },
        },
      };
    },
    getEC1() {
      var that = this;
      getinformationselectExtype(this.deptid, this.jurisdiction)
        .then((res) => {
          var a = res.data.data;
          var b = that.changedata(a, "zc", "bzc", "情况正常", "情况异常");
          that.setEC1(b);
        })
        .catch((res) => {
          var b = that.changedata([], "zc", "bzc", "情况正常", "情况异常");
          that.setEC1(b);
        });
    },
    setEC1(d) {
      // console.log(d, 1);
      this.examine1 = [
        {
          title: "审查时间:",
          value: this.getTime(),
        },
        {
          title: "问题保安员人数:",
          value: d[1].value + "人",
        },
        {
          title: "问题保安员比例:",
          value: this.GetPercent(+d[1].value, +d[0].value + +d[1].value),
        },
      ];
      var option, data;
      // if (d) {
      data = d;
      // } else {
      //   data = [
      //     { value: 1048, name: "搜索引擎" },
      //     { value: 735, name: "直接访问" },
      //     { value: 580, name: "邮件营销" },
      //     { value: 484, name: "联盟广告" },
      //     { value: 300, name: "视频广告" },
      //   ];
      // }
      // console.log(data);
      option = {
        title: {
          text: "保安员审查情况统计",
          // subtext: "纯属虚构",
          top: 25,
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          // orient: "vertical",
          // left: "left",
          x: "center",
          y: "90%",
        },
        toolbox: this.gettoolbox("审查情况查询", "保安员审查情况明细", 1),
        // grid: {
        //   // left: "3%",
        //   right: "5%",
        //   // bottom: "3%",
        //   // containLabel: true,
        // },
        series: [
          {
            // name: "访问来源",
            type: "pie",
            radius: "50%",
            data: data,
            // data: [
            //   { value: 1, name: "在逃人员" },
            //   { value: 3, name: "吸毒人员" },
            //   { value: 10, name: "刑释解教人员" },
            //   { value: 5, name: "社会闲散青少年" },
            //   { value: 11, name: "艾滋病人" },
            //   { value: 26, name: "其他人员" },
            // ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
            label: {
              // alignTo: "edge",
              formatter: "{name|{b}}\n({d}%)",
              // minMargin: 5,
              // edgeDistance: 10,
              // lineHeight: 15,
              rich: {
                time: {
                  fontSize: 10,
                  color: "#999",
                },
              },
            },
          },
        ],
      };
      this.EC1.setOption(option);
    },
    getEC2() {
      var that = this;
      getinformationselectHold(this.deptid, this.jurisdiction)
        .then((res) => {
          var a = res.data.data;
          // console.log(a, "持证");
          var b = that.changedata(a, "cz", "wcz", "持证", "未持证");
          that.setEC2(b);
          // var datas = [];
          // for (var k in a) {
          //   let b = "";
          //   let c = [];
          //   if (a[k].cz >= 1) {
          //     b = {
          //       czname: a[k].czname.split(","),
          //       czptime: a[k].czptime.split(","),
          //     };
          //     // datas.push(a[k]);
          //     // console.log(b, 123);
          //     if (b.czname.length > 1) {
          //       for (var n in b.czname) {
          //         c.push({
          //           czname: b.czname[n],
          //           czptime: b.czptime[n] == 0 ? "" : b.czptime[n],
          //           tpye: "持证",
          //         });
          //       }
          //     } else {
          //       c = [
          //         {
          //           czname: b.czname[0],
          //           czptime: b.czptime[0] == 0 ? "" : b.czptime[0],
          //           tpye: "持证",
          //         },
          //       ];
          //     }
          //     // console.log(c, 132456);
          //     datas.push(...c);
          //   }
          //   if (a[k].wcz >= 1) {
          //     b = {
          //       wczname: a[k].wczname.split(","),
          //       wczptime: a[k].wczptime.split(","),
          //     };
          //     console.log(b, 123);
          //   }
          // }
          // // that.czdata = [...datas, ...datas];
          // that.czdata = datas;
        })
        .catch((res) => {
          var b = that.changedata([], "cz", "wcz", "持证", "未持证");
          that.setEC2(b);
        });
    },
    setEC2(data) {
      var option;
      var that = this;
      // console.log(data, "持证");
      option = {
        title: {
          text: "保安员持证情况统计",
          // subtext: "纯属虚构",
          top: 25,
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          // orient: "vertical",
          // left: "left", x: "center",
          x: "center",
          y: "83%",
        },
        toolbox: this.gettoolbox("持证情况查询", "保安员持证情况明细", 2),
        series: [
          {
            // name: "访问来源",
            type: "pie",
            radius: "50%",
            data: data,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
            label: {
              // alignTo: "edge",
              formatter: "{name|{b}}\n({d}%)",
              // minMargin: 5,
              // edgeDistance: 10,
              // lineHeight: 15,
              rich: {
                time: {
                  fontSize: 10,
                  color: "#999",
                },
              },
            },
          },
        ],
      };
      this.EC2.setOption(option);
    },
    getEC3() {
      var that = this;
      getinformationstatistics(this.deptid, this.jurisdiction).then((res) => {
        var a = res.data.data;
        // console.log(a, 22222222222222222222);
        // var a = res.data.data,
        //   s = [],
        //   l = [];
        // console.log(a); // 0 :理论 1:实操
        // for (var k in a[0]) {
        //   l.push(a[0][k]);
        //   s.push(a[1][k]);
        // }
        var l = a.llcj;
        var s = a.sccj;
        this.setEC3(s, l);
      });
    },
    setEC3(s, l) {
      var xd = [],
        sd = [],
        ld = [],
        that = this;
      for (var i = 0; i < 100; i++) {
        xd.push(i + "分");
      }
      // console.log(sd);
      var option = {
        title: {
          text: "保安员考试情况统计",
          left: "center",
          top: 20,
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            label: {
              backgroundColor: "#6a7985",
            },
          },
          // formatter(params) {
          //   console.log(params);
          //   var str = "";
          //   for (var x in params) {
          //     str += params[x].axisValue + ":" + params[x].data + "/n";
          //   }
          //   return str;
          // },
          formatter:
            "<span>实操成绩</span>({b0}) :  {c0}<span>人</span><br /><span>理论成绩</span>({b1}) :  {c1}<span>人</span>",
        },
        toolbox: this.gettoolbox("考试情况查询", "保安员考试情况明细", 3),
        legend: {
          data: ["实操成绩", "理论成绩"],
        },
        // toolbox: {
        //   feature: {
        //     saveAsImage: {},
        //   },
        // },
        grid: {
          left: "3%",
          right: "5%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: [
          {
            type: "category",
            boundaryGap: false,
            // data: ["0~60分", "60~80分", "80~90分", "90~100分"],
            data: xd,
          },
        ],
        yAxis: [
          {
            type: "value",
          },
        ],
        series: [
          {
            name: "实操成绩",
            type: "line",
            stack: "总量",
            areaStyle: {},
            emphasis: {
              focus: "series",
            },
            // data: [1, 2, 3, 1],
            // data: [
            //   1, 0, 0, 0, 3, 2, 1, 0, 4, 0, 5, 0, 4, 0, 0, 9, 7, 0, 2, 0, 5, 0,
            //   0, 0, 7, 9, 0, 0, 7, 0, 5, 0, 7, 1, 0, 9, 2, 0, 0, 0, 3, 0, 0, 0,
            //   7, 9, 0, 0, 7, 0, 5, 0, 7, 24, 2, 9, 7, 37, 0, 3, 5, 0, 0, 0, 7,
            //   9, 1, 0, 7, 0, 5, 4, 2, 0, 0, 9, 7, 35, 0, 0, 3, 0, 0, 12, 7, 9,
            //   0, 0, 7, 0, 2, 0, 7, 0, 0, 9, 7, 0, 0, 1,
            // ],
            data: s,
          },
          {
            name: "理论成绩",
            type: "line",
            stack: "总量",
            areaStyle: {},
            emphasis: {
              focus: "series",
            },
            // data: [
            //   4, 0, 5, 0, 7, 3, 2, 9, 7, 1, 0, 3, 5, 0, 9, 7, 0, 2, 0, 0, 7, 0,
            //   2, 0, 7, 0, 0, 9, 5, 0, 0, 0, 7, 9, 0, 0, 7, 0, 5, 0, 7, 1, 0, 9,
            //   2, 0, 0, 50, 3, 0, 30, 0, 7, 9, 0, 20, 7, 40, 0, 0, 0, 7, 9, 1, 0,
            //   7, 0, 5, 4, 2, 0, 0, 9, 7, 35, 0, 0, 3, 0, 0, 12, 7, 9, 0, 7, 0,
            //   0, 11, 0, 0, 0, 3, 2, 1, 0, 4, 0, 5, 0, 3,
            // ],
            data: l,
          },
        ],
      };
      this.EC3.setOption(option);
    },
    getEC4() {
      var date = new Date();
      var nowYear = date.getFullYear();
      var that = this;
      getinformationselectDis(this.deptid, this.jurisdiction).then((res) => {
        var a = res.data,
          d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        var setNum = (start, end, i) => {
          // console.log(start, end, i);
          for (let a = +start - 1; a < +end; a++) {
            ++d[a];
          }
            // czdata: [],
            sees: "",
        };
        for (var k = 0; k < a.length; k++) {
          // console.log(a[k], k);
          var overYear = a[k].end_time.slice(0, 4);
          var overMout = a[k].end_time.slice(5, 7);
          var bigYear = a[k].start_time.slice(0, 4);
          var bigMout = a[k].start_time.slice(5, 7);
          if (overYear > nowYear) {
            if (bigYear < nowYear) {
              setNum(1, 12, k);
            } else if (bigYear == nowYear) {
              setNum(+bigMout, 12, k);
    },
    computed: {
        ...mapState({
            userInfo: (state) => state.user.userInfo,
        }),
        ids1 () {
            let ids1 = [];
            this.selectionList1.forEach((ele) => {
                ids1.push(ele.id);
            });
            return ids1.join(",");
        },
        ids2 () {
            let ids2 = [];
            this.selectionList2.forEach((ele) => {
                ids2.push(ele.id);
            });
            return ids2.join(",");
        },
    },
    watch: {
        dialogVisible () {
            if (this.dialogVisible == false && this.sees == "1") {
                this.getEC1();
            }
          } else if (overYear == nowYear) {
            if (bigYear < nowYear) {
              setNum(1, +overMout, k);
            } else if (bigYear == nowYear) {
              setNum(+bigMout, +overMout, k);
            if (this.dialogVisible == false && this.sees == "2") {
                this.getEC2();
            }
          }
        }
        // console.log(d, "派遣服务单位");
        // console.log(a, 123456);
        // for (var k in a) {
        //   d.push(a[k]);
        // }
        // console.log(d);
        that.setEC4(d);
      });
            if (this.dialogVisible == false && this.sees == "3") {
                this.getEC3();
            }
            if (this.dialogVisible == false && this.sees == "4") {
                this.getEC4();
            }
            if (this.dialogVisible == false && this.sees == "5") {
                this.getEC5();
            }
            if (this.dialogVisible == false && this.sees == "6") {
                this.getEC6();
            }
        },
    },
    setEC4(data) {
      var xxd = [
        "1月",
        "2月",
        "3月",
        "4月",
        "5月",
        "6月",
        "7月",
        "8月",
        "9月",
        "10月",
        "11月",
        "12月",
      ];
      var date = new Date();
      var d = date.getFullYear();
      // console.log(d);
      var option = {
        title: {
          text: "派遣服务单位统计",
          top: 20,
          left: "center",
    methods: {
        creatOurEcharts () {
            this.EC1 = echarts.init(this.$refs.ech1);
            this.EC2 = echarts.init(this.$refs.ech2);
            this.EC3 = echarts.init(this.$refs.ech3);
            this.EC4 = echarts.init(this.$refs.ech4);
            this.EC5 = echarts.init(this.$refs.ech5);
            this.EC6 = echarts.init(this.$refs.ech6);
            this.biginOUREC();
        },
        xAxis: {
          type: "category",
          data: xxd,
          // data: xd,
        changedata (a, ok, no, okmsg, nomsg) {
            var d = [];
            if (a.length != 0) {
                var yes = 0,
                    not = 0;
                for (var k in a) {
                    yes += a[k][ok];
                    not += a[k][no];
                }
                d = [
                    {
                        value: yes,
                        name: okmsg,
                    },
                    {
                        value: not,
                        name: nomsg,
                    },
                ];
            } else {
                d = [
                    {
                        value: 0,
                        name: okmsg,
                    },
                    {
                        value: 0,
                        name: nomsg,
                    },
                ];
            }
            // console.log(d, ok, no);
            return d;
        },
        toolbox: this.gettoolbox("派遣单位查询", "派遣服务单位明细", 4),
        yAxis: {
          type: "value",
        getTime () {
            var data = new Date();
            var time = data.toLocaleString().slice(0, 9);
            return time;
        },
        tooltip: {
          trigger: "item",
          formatter: d + "年{b} : {c} 个",
        GetPercent (num, total) {
            num = parseFloat(num);
            total = parseFloat(total);
            if (isNaN(num) || isNaN(total)) {
                return "-";
            }
            return total <= 0
                ? "0%"
                : Math.round((num / total) * 10000) / 100.0 + "%";
        },
        series: [
          {
            // data: dd,
            data: data,
            type: "bar",
          },
        ],
      };
      this.EC4.setOption(option);
    },
    getEC5() {
      var that = this;
      getinformationselectDisp(this.deptid, this.jurisdiction)
        .then((res) => {
          var a = res.data.data;
          // console.log(a, "111111");
          var b = that.changedata(a, "pnum", "wpnum", "已派遣", "未派遣");
          that.setEC5(b);
        })
        .catch((res) => {
          var b = that.changedata([], "pnum", "wpnum", "已派遣", "未派遣");
          that.setEC5(b);
        });
    },
    setEC5(d) {
      var option;
      option = {
        title: {
          text: "保安派遣情况统计",
          // subtext: "纯属虚构",
          top: 25,
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        toolbox: this.gettoolbox("派遣情况查询", "保安员派遣情况明细", 5),
        legend: {
          // orient: "vertical",
          // left: "left",
          x: "center",
          y: "90%",
        },
        series: [
          {
            // name: "访问来源",
            type: "pie",
            radius: "50%",
            // data: d,
            data: d,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
            label: {
              // alignTo: "edge",
              formatter: "{b}\n({d}%)",
            },
          },
        ],
      };
      this.EC5.setOption(option);
    },
    getEC6() {
      var that = this;
      getinformationselectSoil(this.deptid, this.jurisdiction)
        .then((res) => {
          var a = res.data.data;
          var b = that.changedata(
            a,
            "numj",
            "nmuwj",
            "已缴纳社保",
            "未缴纳社保"
          );
          that.setEC6(b);
        })
        .catch((res) => {
          var b = that.changedata(
            [],
            "numj",
            "nmuwj",
            "已缴纳社保",
            "未缴纳社保"
          );
          that.setEC6(b);
        });
    },
    setEC6(d) {
      var option;
      option = {
        title: {
          text: "社保缴纳情况统计",
          // subtext: "纯属虚构",
          top: 25,
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        toolbox: this.gettoolbox("社保缴纳查询", "保安员社保缴纳明细", 6),
        legend: {
          // orient: "vertical",
          // left: "left",
          x: "center",
          y: "83%",
        },
        series: [
          {
            // name: "访问来源",
            type: "pie",
            radius: "50%",
            data: d,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
            label: {
              // alignTo: "edge",
              formatter: "{name|{b}}\n({d}%)",
              // minMargin: 5,
              // edgeDistance: 10,
              // lineHeight: 15,
              rich: {
                time: {
                  fontSize: 10,
                  color: "#999",
        gettoolbox (title, titles, id) {
            var that = this;
            return {
                show: true,
                itemSize: 25,
                top: 20,
                right: 20,
                feature: {
                    myTool1: {
                        show: true,
                        title: title,
                        icon: "image://img/table.png",
                        onclick: function () {
                            that.dialogVisible = true;
                            that.sees = id;
                            that.titles = titles;
                        },
                    },
                },
              },
            },
          },
        ],
      };
            };
        },
        getEC1 () {
            var that = this;
            getinformationselectExtype(this.deptid, this.jurisdiction)
                .then((res) => {
                    var a = res.data.data;
                    var b = that.changedata(a, "zc", "bzc", "情况正常", "情况异常");
                    console.log(b, 456)
                    that.setEC1(b);
                })
                .catch((res) => {
                    var b = that.changedata([], "zc", "bzc", "情况正常", "情况异常");
                    that.setEC1(b);
                });
        },
        setEC1 (d) {
            // console.log(d, 1);
            this.examine1 = [
                {
                    title: "审查时间:",
                    value: this.getTime(),
                },
                {
                    title: "问题保安员人数:",
                    value: d[1].value + "人",
                },
                {
                    title: "问题保安员比例:",
                    value: this.GetPercent(+d[1].value, +d[0].value + +d[1].value),
                },
            ];
            var option, data;
            // if (d) {
            data = d;
            // } else {
            //   data = [
            //     { value: 1048, name: "搜索引擎" },
            //     { value: 735, name: "直接访问" },
            //     { value: 580, name: "邮件营销" },
            //     { value: 484, name: "联盟广告" },
            //     { value: 300, name: "视频广告" },
            //   ];
            // }
            // console.log(data);
            option = {
                title: {
                    text: "保安员审查情况统计",
                    // subtext: "纯属虚构",
                    top: 25,
                    left: "center",
                },
                tooltip: {
                    trigger: "item",
                },
                legend: {
                    // orient: "vertical",
                    // left: "left",
                    x: "center",
                    y: "90%",
                },
                toolbox: this.gettoolbox("审查情况查询", "保安员审查情况明细", 1),
                // grid: {
                //   // left: "3%",
                //   right: "5%",
                //   // bottom: "3%",
                //   // containLabel: true,
                // },
                series: [
                    {
                        // name: "访问来源",
                        type: "pie",
                        radius: "50%",
                        data: data,
                        // data: [
                        //   { value: 1, name: "在逃人员" },
                        //   { value: 3, name: "吸毒人员" },
                        //   { value: 10, name: "刑释解教人员" },
                        //   { value: 5, name: "社会闲散青少年" },
                        //   { value: 11, name: "艾滋病人" },
                        //   { value: 26, name: "其他人员" },
                        // ],
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: "rgba(0, 0, 0, 0.5)",
                            },
                        },
                        label: {
                            // alignTo: "edge",
                            formatter: "{name|{b}}\n({d}%)",
                            // minMargin: 5,
                            // edgeDistance: 10,
                            // lineHeight: 15,
                            rich: {
                                time: {
                                    fontSize: 10,
                                    color: "#999",
                                },
                            },
                        },
                    },
                ],
            };
      this.EC6.setOption(option);
    },
    biginOUREC() {
      this.getEC1();
      this.getEC2();
      this.getEC3();
      this.getEC4();
      this.getEC5();
      this.getEC6();
      // this.setEC1();
      // this.setEC2();
      // this.setEC3();
      // this.setEC4();
      // this.setEC5();
      // this.setEC6();
    },
  },
  mounted() {
    this.$nextTick(() => {
      var roleIds = this.userInfo.role_id.split(",");
      // console.log(this.userInfo);
      // this.deptid = this.userInfo.role_id;
      roleIds.forEach((roleId) => {
        getRoleDetail(roleId).then((res) => {
          var roleAlias = res.data.data.roleAlias;
          var roleName = res.data.data.roleName;
            this.EC1.setOption(option);
        },
        getEC2 () {
            var that = this;
            getinformationselectHold(this.deptid, this.jurisdiction)
                .then((res) => {
                    var a = res.data.data;
                    // console.log(a, "持证");
                    var b = that.changedata(a, "cz", "wcz", "持证", "未持证");
                    that.setEC2(b);
                    // var datas = [];
                    // for (var k in a) {
                    //   let b = "";
                    //   let c = [];
                    //   if (a[k].cz >= 1) {
                    //     b = {
                    //       czname: a[k].czname.split(","),
                    //       czptime: a[k].czptime.split(","),
                    //     };
                    //     // datas.push(a[k]);
                    //     // console.log(b, 123);
                    //     if (b.czname.length > 1) {
                    //       for (var n in b.czname) {
                    //         c.push({
                    //           czname: b.czname[n],
                    //           czptime: b.czptime[n] == 0 ? "" : b.czptime[n],
                    //           tpye: "持证",
                    //         });
                    //       }
                    //     } else {
                    //       c = [
                    //         {
                    //           czname: b.czname[0],
                    //           czptime: b.czptime[0] == 0 ? "" : b.czptime[0],
                    //           tpye: "持证",
                    //         },
                    //       ];
                    //     }
                    //     // console.log(c, 132456);
                    //     datas.push(...c);
                    //   }
                    //   if (a[k].wcz >= 1) {
                    //     b = {
                    //       wczname: a[k].wczname.split(","),
                    //       wczptime: a[k].wczptime.split(","),
                    //     };
                    //     console.log(b, 123);
                    //   }
                    // }
                    // // that.czdata = [...datas, ...datas];
                    // that.czdata = datas;
                })
                .catch((res) => {
                    var b = that.changedata([], "cz", "wcz", "持证", "未持证");
                    that.setEC2(b);
                });
        },
        setEC2 (data) {
            var option;
            var that = this;
            // console.log(data, "持证");
            option = {
                title: {
                    text: "保安员持证情况统计",
                    // subtext: "纯属虚构",
                    top: 25,
                    left: "center",
                },
                tooltip: {
                    trigger: "item",
                },
                legend: {
                    // orient: "vertical",
                    // left: "left", x: "center",
                    x: "center",
                    y: "83%",
                },
                toolbox: this.gettoolbox("持证情况查询", "保安员持证情况明细", 2),
                series: [
                    {
                        // name: "访问来源",
                        type: "pie",
                        radius: "50%",
                        data: data,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: "rgba(0, 0, 0, 0.5)",
                            },
                        },
                        label: {
                            // alignTo: "edge",
                            formatter: "{name|{b}}\n({d}%)",
                            // minMargin: 5,
                            // edgeDistance: 10,
                            // lineHeight: 15,
                            rich: {
                                time: {
                                    fontSize: 10,
                                    color: "#999",
                                },
                            },
                        },
                    },
                ],
            };
          // console.log(roleName);
          // console.log(res.data.data);
          // console.log(roleAlias);
          if (roleName == "超级管理员" || roleName == "公安管理员") {
            this.deptid = "";
            this.jurisdiction = this.userInfo.jurisdiction;
          } else if (roleName == "保安公司管理员") {
            this.deptid = this.userInfo.dept_id;
            this.jurisdiction = "";
          }
          this.creatOurEcharts();
            this.EC2.setOption(option);
        },
        getEC3 () {
            getinformationstatistics(this.deptid, this.jurisdiction).then((res) => {
                var a = res.data.data;
                var obj = [{ value: a[1], name: '已通过' }, { value: a[2], name: '未通过' }]
                this.setEC3(obj);
            });
        },
        setEC3 (d) {
            var option, data;
            data = d;
            option = {
                title: {
                    text: "保安员考试情况统计",
                    left: "center",
                    top: 20,
                },
                tooltip: {
                    trigger: "item",
                },
                legend: {
                    // orient: "vertical",
                    // left: "left",
                    x: "center",
                    y: "90%",
                },
                toolbox: this.gettoolbox("考试情况查询", "保安员考试情况明细", 3),
                // grid: {
                //   // left: "3%",
                //   right: "5%",
                //   // bottom: "3%",
                //   // containLabel: true,
                // },
                series: [
                    {
                        // name: "访问来源",
                        type: "pie",
                        radius: "50%",
                        data: data,
                        // data: [
                        //   { value: 1, name: "在逃人员" },
                        //   { value: 3, name: "吸毒人员" },
                        //   { value: 10, name: "刑释解教人员" },
                        //   { value: 5, name: "社会闲散青少年" },
                        //   { value: 11, name: "艾滋病人" },
                        //   { value: 26, name: "其他人员" },
                        // ],
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: "rgba(0, 0, 0, 0.5)",
                            },
                        },
                        label: {
                            // alignTo: "edge",
                            formatter: "{name|{b}}\n({d}%)",
                            // minMargin: 5,
                            // edgeDistance: 10,
                            // lineHeight: 15,
                            rich: {
                                time: {
                                    fontSize: 10,
                                    color: "#999",
                                },
                            },
                        },
                    },
                ],
            };
            this.EC3.setOption(option);
        },
        getEC4 () {
            var date = new Date();
            var nowYear = date.getFullYear();
            var that = this;
            getinformationselectDis(this.deptid, this.jurisdiction).then((res) => {
                var a = res.data,
                    d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
                var setNum = (start, end, i) => {
                    // console.log(start, end, i);
                    for (let a = +start - 1; a < +end; a++) {
                        ++d[a];
                    }
                };
                for (var k = 0; k < a.length; k++) {
                    // console.log(a[k], k);
                    var overYear = a[k].end_time.slice(0, 4);
                    var overMout = a[k].end_time.slice(5, 7);
                    var bigYear = a[k].start_time.slice(0, 4);
                    var bigMout = a[k].start_time.slice(5, 7);
                    if (overYear > nowYear) {
                        if (bigYear < nowYear) {
                            setNum(1, 12, k);
                        } else if (bigYear == nowYear) {
                            setNum(+bigMout, 12, k);
                        }
                    } else if (overYear == nowYear) {
                        if (bigYear < nowYear) {
                            setNum(1, +overMout, k);
                        } else if (bigYear == nowYear) {
                            setNum(+bigMout, +overMout, k);
                        }
                    }
                }
                // console.log(d, "派遣服务单位");
                // console.log(a, 123456);
                // for (var k in a) {
                //   d.push(a[k]);
                // }
                // console.log(d);
                that.setEC4(d);
            });
        },
        setEC4 (data) {
            var xxd = [
                "1月",
                "2月",
                "3月",
                "4月",
                "5月",
                "6月",
                "7月",
                "8月",
                "9月",
                "10月",
                "11月",
                "12月",
            ];
            var date = new Date();
            var d = date.getFullYear();
            // console.log(d);
            var option = {
                title: {
                    text: "派遣服务单位统计",
                    top: 20,
                    left: "center",
                },
                xAxis: {
                    type: "category",
                    data: xxd,
                    // data: xd,
                },
                toolbox: this.gettoolbox("派遣单位查询", "派遣服务单位明细", 4),
                yAxis: {
                    type: "value",
                },
                tooltip: {
                    trigger: "item",
                    formatter: d + "年{b} : {c} 个",
                },
                series: [
                    {
                        // data: dd,
                        data: data,
                        type: "bar",
                    },
                ],
            };
            this.EC4.setOption(option);
        },
        getEC5 () {
            var that = this;
            getinformationselectDisp(this.deptid, this.jurisdiction)
                .then((res) => {
                    var a = res.data.data;
                    // console.log(a, "111111");
                    var b = that.changedata(a, "pnum", "wpnum", "已派遣", "未派遣");
                    that.setEC5(b);
                })
                .catch((res) => {
                    var b = that.changedata([], "pnum", "wpnum", "已派遣", "未派遣");
                    that.setEC5(b);
                });
        },
        setEC5 (d) {
            var option;
            option = {
                title: {
                    text: "保安派遣情况统计",
                    // subtext: "纯属虚构",
                    top: 25,
                    left: "center",
                },
                tooltip: {
                    trigger: "item",
                },
                toolbox: this.gettoolbox("派遣情况查询", "保安员派遣情况明细", 5),
                legend: {
                    // orient: "vertical",
                    // left: "left",
                    x: "center",
                    y: "90%",
                },
                series: [
                    {
                        // name: "访问来源",
                        type: "pie",
                        radius: "50%",
                        // data: d,
                        data: d,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: "rgba(0, 0, 0, 0.5)",
                            },
                        },
                        label: {
                            // alignTo: "edge",
                            formatter: "{b}\n({d}%)",
                        },
                    },
                ],
            };
            this.EC5.setOption(option);
        },
        getEC6 () {
            var that = this;
            getinformationselectSoil(this.deptid, this.jurisdiction)
                .then((res) => {
                    var a = res.data.data;
                    var b = that.changedata(
                        a,
                        "numj",
                        "nmuwj",
                        "已缴纳社保",
                        "未缴纳社保"
                    );
                    that.setEC6(b);
                })
                .catch((res) => {
                    var b = that.changedata(
                        [],
                        "numj",
                        "nmuwj",
                        "已缴纳社保",
                        "未缴纳社保"
                    );
                    that.setEC6(b);
                });
        },
        setEC6 (d) {
            var option;
            option = {
                title: {
                    text: "社保缴纳情况统计",
                    // subtext: "纯属虚构",
                    top: 25,
                    left: "center",
                },
                tooltip: {
                    trigger: "item",
                },
                toolbox: this.gettoolbox("社保缴纳查询", "保安员社保缴纳明细", 6),
                legend: {
                    // orient: "vertical",
                    // left: "left",
                    x: "center",
                    y: "83%",
                },
                series: [
                    {
                        // name: "访问来源",
                        type: "pie",
                        radius: "50%",
                        data: d,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: "rgba(0, 0, 0, 0.5)",
                            },
                        },
                        label: {
                            // alignTo: "edge",
                            formatter: "{name|{b}}\n({d}%)",
                            // minMargin: 5,
                            // edgeDistance: 10,
                            // lineHeight: 15,
                            rich: {
                                time: {
                                    fontSize: 10,
                                    color: "#999",
                                },
                            },
                        },
                    },
                ],
            };
            this.EC6.setOption(option);
        },
        biginOUREC () {
            this.getEC1();
            this.getEC2();
            this.getEC3();
            this.getEC4();
            this.getEC5();
            this.getEC6();
            // this.setEC1();
            // this.setEC2();
            // this.setEC3();
            // this.setEC4();
            // this.setEC5();
            // this.setEC6();
        },
    },
    mounted () {
        this.$nextTick(() => {
            var roleIds = this.userInfo.role_id.split(",");
            // console.log(this.userInfo);
            // this.deptid = this.userInfo.role_id;
            roleIds.forEach((roleId) => {
                getRoleDetail(roleId).then((res) => {
                    var roleAlias = res.data.data.roleAlias;
                    var roleName = res.data.data.roleName;
                    // console.log(roleName);
                    // console.log(res.data.data);
                    // console.log(roleAlias);
                    if (roleName == "超级管理员" || roleName == "公安管理员") {
                        this.deptid = "";
                        this.jurisdiction = this.userInfo.jurisdiction;
                    } else if (roleName == "保安公司管理员") {
                        this.deptid = this.userInfo.dept_id;
                        this.jurisdiction = "";
                    }
                    this.creatOurEcharts();
                });
            });
        });
      });
    });
  },
    },
};
</script>
<style lang="scss">
$widths: 20%;
.securityAnalysis {
  width: 100%;
  height: 100%;
  // border: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-sizing: border-box;
  .securityAnalysisleft,
  .securityAnalysiscenter,
  .securityAnalysisright {
    // border: 1px solid #000;
    width: 29%;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    // border: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-direction: column;
  }
  .securityAnalysiscenter {
    width: 40% !important;
  }
  .examines,
  .certificate,
  .examination,
  .dispatchUnit,
  .dispatchSecurity,
  .socialSecurity {
    width: 100%;
    height: 49%;
    // border: 1px solid #000;
    box-sizing: border-box;
    background-color: #fff;
  }
  // .examines {
  //   width: 100%;
  //   height: 49%;
  //   display: flex;
  //   align-items: center;
  //   background-color: #fff;
  // }
  // .examine {
  //   width: 100%;
  //   height: 100%;
  // }
  // .examine1 {
  //   width: 200px;
  //   div {
  //     margin-bottom: 10px;
  //   }
  // }
  // .securityAnalysisleft {
  //   width: $widths;
  // }
  // .securityAnalysiscenter {
  //   width: $widths;
  // }
  // .securityAnalysisright {
  //   width: $widths;
  // }
    .securityAnalysisleft,
    .securityAnalysiscenter,
    .securityAnalysisright {
        // border: 1px solid #000;
        width: 29%;
        height: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-around;
        flex-direction: column;
    }
    .securityAnalysiscenter {
        width: 40% !important;
    }
    .examines,
    .certificate,
    .examination,
    .dispatchUnit,
    .dispatchSecurity,
    .socialSecurity {
        width: 100%;
        height: 49%;
        // border: 1px solid #000;
        box-sizing: border-box;
        background-color: #fff;
    }
    // .examines {
    //   width: 100%;
    //   height: 49%;
    //   display: flex;
    //   align-items: center;
    //   background-color: #fff;
    // }
    // .examine {
    //   width: 100%;
    //   height: 100%;
    // }
    // .examine1 {
    //   width: 200px;
    //   div {
    //     margin-bottom: 10px;
    //   }
    // }
    // .securityAnalysisleft {
    //   width: $widths;
    // }
    // .securityAnalysiscenter {
    //   width: $widths;
    // }
    // .securityAnalysisright {
    //   width: $widths;
    // }
}
</style>
</style>