liuyg
2021-08-28 d09564dfe3b1a86f8059e13a26ba6ca0798c4101
保安  社保添加更改     保安单位情况智能分析
4 files modified
600 ■■■■■ changed files
src/api/securityAnalysis/securityAnalysis.js 26 ●●●● patch | view | raw | blame | history
src/api/social/social.js 14 ●●●●● patch | view | raw | blame | history
src/views/securityAnalysis/index.vue 405 ●●●●● patch | view | raw | blame | history
src/views/securityUnitChild/social.vue 155 ●●●● patch | view | raw | blame | history
src/api/securityAnalysis/securityAnalysis.js
@@ -1,7 +1,6 @@
import request from '@/router/axios';
export const getinformationselectExtype = (deptid) => { //保安员审查情况统计  只需要公司的deptid
    console.log(deptid)
export const getinformationselectExtype = (deptid, jurisdiction) => { //保安员审查情况统计  只需要公司的deptid
    return request({
        url: '/api/information/selectExtype',
@@ -9,63 +8,64 @@
        method: 'post',
        params: {
            deptid: deptid,
            jurisdiction: jurisdiction,
        }
    })
}
export const getinformationselectHold = (deptid) => { //保安员持证  只需要公司的deptid
    console.log(deptid)
export const getinformationselectHold = (deptid, jurisdiction) => { //保安员持证  只需要公司的deptid
    return request({
        url: '/api/information/selectHold',
        // url: 'http://192.168.0.109:81/information/selectExtype',
        method: 'post',
        params: {
            deptid: deptid,
            jurisdiction: jurisdiction,
        }
    })
}
export const getinformationselectDis = (deptid) => { //派遣服务单位  只需要公司的deptid
    console.log(deptid)
export const getinformationselectDis = (deptid, jurisdiction) => { //派遣服务单位  只需要公司的deptid
    return request({
        url: '/api/information/selectDis',
        url: '/api/information/queryYearKh',
        // url: 'http://192.168.0.109:81/information/selectExtype',
        method: 'post',
        params: {
            deptid: deptid,
            jurisdiction: jurisdiction,
        }
    })
}
export const getinformationselectDisp = (deptid) => { //保安派遣数量  只需要公司的deptid
    console.log(deptid)
export const getinformationselectDisp = (deptid, jurisdiction) => { //保安派遣数量  只需要公司的deptid
    return request({
        url: '/api/information/selectDisp',
        // url: 'http://192.168.0.109:81/information/selectExtype',
        method: 'post',
        params: {
            deptid: deptid,
            jurisdiction: jurisdiction,
        }
    })
}
export const getinformationselectSoil = (deptid) => { //社保缴纳情况统计  只需要公司的deptid
    console.log(deptid)
export const getinformationselectSoil = (deptid, jurisdiction) => { //社保缴纳情况统计  只需要公司的deptid
    return request({
        url: '/api/information/selectSoil',
        // url: 'http://192.168.0.109:81/information/selectExtype',
        method: 'post',
        params: {
            deptid: deptid,
            jurisdiction: jurisdiction,
        }
    })
}
export const getinformationstatistics = (deptid) => { //保安员考试情况统计  只需要公司的deptid
    console.log(deptid)
export const getinformationstatistics = (deptid, jurisdiction) => { //保安员考试情况统计  只需要公司的deptid
    return request({
        url: '/api/examScore/score-statistics',
        // url: 'http://192.168.0.109:81/information/selectExtype',
        method: 'get',
        params: {
            deptid: deptid,
            jurisdiction: jurisdiction,
        }
    })
}
src/api/social/social.js
@@ -1,5 +1,17 @@
import request from '@/router/axios';
export const getuseList = (id) => {
  return request({
    url: '/api/blade-user/detail',
    method: 'get',
    params: {
      id
    }
  })
}
export const getList = (current, size, params) => {
  return request({
    url: '/api/social/list',
@@ -34,7 +46,7 @@
export const add = (row) => {
  return request({
    url: '/api/social/submit',
    url: '/api/social/save',
    method: 'post',
    data: row
  })
src/views/securityAnalysis/index.vue
@@ -43,7 +43,8 @@
  getinformationselectDisp, //保安派遣数量
  getinformationselectSoil, //社保缴纳情况统计
} from "@/api/securityAnalysis/securityAnalysis";
import { lang } from "moment";
import { mapState } from "vuex";
import { getRoleDetail } from "@/api/system/role";
export default {
  data() {
    return {
@@ -53,8 +54,28 @@
      EC4: "", //派遣服务单位统计 // 柱状图
      EC5: "", //保安派遣情况统计 // 饼图
      EC6: "", //社保缴纳情况统计 // 饼图
      deptid: "1412222599212257282",
      deptid: "",
      jurisdiction: "",
    };
  },
  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(",");
    },
  },
  methods: {
    creatOurEcharts() {
@@ -66,24 +87,52 @@
      this.EC6 = echarts.init(this.$refs.ech6);
      this.biginOUREC();
    },
    getEC1() {
      var that = this;
      getinformationselectExtype(this.deptid).then((res) => {
        // console.log(res);
        var a = res.data.data[0];
        var d = [
    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: a.bzc,
            name: "审查情况正常",
            value: yes,
            name: okmsg,
          },
          {
            value: a.zc,
            name: "审查情况异常",
            value: not,
            name: nomsg,
          },
        ];
        that.setEC1(d);
      });
      } else {
        d = [
          {
            value: 0,
            name: okmsg,
          },
          {
            value: 0,
            name: nomsg,
          },
        ];
      }
      // console.log(d, ok, no);
      return d;
    },
    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) {
      var option, data;
@@ -103,6 +152,7 @@
        title: {
          text: "保安员审查情况统计",
          // subtext: "纯属虚构",
          top: 25,
          left: "center",
        },
        tooltip: {
@@ -135,6 +185,19 @@
                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",
                },
              },
            },
          },
        ],
      };
@@ -143,42 +206,24 @@
    },
    getEC2() {
      var that = this;
      getinformationselectHold(this.deptid).then((res) => {
        var a = res.data.data[0];
        console.log(res, "持证情况");
        var d = [
          {
            value: a.wcz,
            name: "未持证",
          },
          {
            value: a.cz,
            name: "持证",
          },
        ];
        that.setEC2(d);
      });
      getinformationselectHold(this.deptid, this.jurisdiction)
        .then((res) => {
          var a = res.data.data;
          var b = that.changedata(a, "cz", "wcz", "持证", "未持证");
          that.setEC2(b);
        })
        .catch((res) => {
          var b = that.changedata([], "cz", "wcz", "持证", "未持证");
          that.setEC1(b);
        });
    },
    setEC2(d) {
    setEC2(data) {
      var option;
      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: {
@@ -203,6 +248,19 @@
                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",
                },
              },
            },
          },
        ],
      };
@@ -211,15 +269,19 @@
    },
    getEC3() {
      var that = this;
      getinformationstatistics(this.deptid).then((res) => {
        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]);
        }
      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);
      });
    },
@@ -230,7 +292,7 @@
      for (var i = 0; i < 100; i++) {
        xd.push(i + "分");
      }
      console.log(sd);
      // console.log(sd);
      var option = {
        title: {
          text: "保安员考试情况统计",
@@ -293,14 +355,14 @@
              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,
            // 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: "理论成绩",
@@ -310,14 +372,14 @@
            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,
            // 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,
          },
        ],
      };
@@ -325,38 +387,72 @@
      this.EC3.setOption(option);
    },
    getEC4() {
      var date = new Date();
      var nowYear = date.getFullYear();
      var that = this;
      getinformationselectDis(this.deptid).then((res) => {
        var a = res.data.data,
          xd = [],
          d = [];
        // console.log(a);
        for (var k in a) {
          xd.push(a[k].name);
          d.push(a[k].num);
      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);
            }
          }
        }
        that.setEC4(d, xd);
        console.log(d, "派遣服务单位");
        // console.log(a, 123456);
        // for (var k in a) {
        //   d.push(a[k]);
        // }
        // console.log(d);
        that.setEC4(d);
      });
    },
    setEC4(d, xd) {
    setEC4(data) {
      var xxd = [
          "一月",
          "二月",
          "三月",
          "四月",
          "五月",
          "六月",
          "七月",
          "八月",
          "九月",
          "十月",
          "一月",
          "二月",
        ],
        dd = [120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70];
        "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: {
@@ -369,11 +465,12 @@
        },
        tooltip: {
          trigger: "item",
          formatter: d + "年{b} : {c} 个",
        },
        series: [
          {
            data: dd,
            // data: d,
            // data: dd,
            data: data,
            type: "bar",
          },
        ],
@@ -382,18 +479,17 @@
    },
    getEC5() {
      var that = this;
      getinformationselectDisp(this.deptid).then((res) => {
        var a = res.data.data,
          d = [];
        // console.log(a);
        for (var k in a) {
          d.push({
            value: a[k].num,
            name: a[k].real_name,
          });
        }
        that.setEC5(d);
      });
      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.setEC1(b);
        });
    },
    setEC5(d) {
      var option;
@@ -402,6 +498,7 @@
        title: {
          text: "保安派遣情况统计",
          // subtext: "纯属虚构",
          top: 25,
          left: "center",
        },
        tooltip: {
@@ -419,22 +516,17 @@
            type: "pie",
            radius: "50%",
            // data: d,
            data: [
              {
                value: 4,
                name: "未派遣",
              },
              {
                value: 3,
                name: "已派遣",
              },
            ],
            data: d,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
            label: {
              // alignTo: "edge",
              formatter: "{b}\n({d}%)",
            },
          },
        ],
@@ -444,22 +536,28 @@
    },
    getEC6() {
      var that = this;
      getinformationselectSoil(this.deptid).then((res) => {
        var a = res.data.data[0];
        // console.log(a);
        var d = [
          {
            value: a.nmuwj,
            name: "未缴纳社保",
          },
          {
            value: a.numj,
            name: "已缴纳社保",
          },
        ];
        that.setEC6(d);
      });
      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.setEC1(b);
        });
    },
    setEC6(d) {
      var option;
@@ -468,6 +566,7 @@
        title: {
          text: "社保缴纳情况统计",
          // subtext: "纯属虚构",
          top: 25,
          left: "center",
        },
        tooltip: {
@@ -490,6 +589,19 @@
                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",
                },
              },
            },
          },
@@ -515,9 +627,28 @@
  },
  mounted() {
    this.$nextTick(() => {
      this.creatOurEcharts();
      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();
        });
      });
    });
    // console.log(echarts);
  },
};
</script>
src/views/securityUnitChild/social.vue
@@ -62,15 +62,24 @@
</template>
<script>
import { getList, getDetail, add, update, remove } from "@/api/social/social";
import {
  getuseList,
  getList,
  getDetail,
  add,
  update,
  remove,
} from "@/api/social/social";
import { mapGetters } from "vuex";
import { getToken } from "@/util/auth";
export default {
  props: ["deptid"],
  data() {
    var deptid = this.deptid;
    return {
      form: {},
      do: 0,
      form: { cardid: "" },
      query: {},
      loading: true,
      excelBox: false,
@@ -100,11 +109,18 @@
            width: 65,
            labelWidth: 110,
            change: (res) => {
              this.changes(res);
            },
            dicUrl: "/api/blade-user/page-security-unit?deptId=" + deptid,
            props: {
              label: "realName",
              value: "id",
            },
            search: true,
            searchLabelWidth: 45,
            searchSpan: 4,
            type: "select",
            rules: [
              {
                required: true,
@@ -117,7 +133,24 @@
            label: "性别",
            prop: "sex",
            width: 55,
            type: "select",
            dicData: [
              {
                label: "男",
                value: 1,
              },
              {
                label: "女",
                value: 2,
              },
              {
                label: "未知",
                value: 3,
              },
            ],
            labelWidth: 110,
            addDisabled: true,
            editDisabled: true,
            rules: [
              {
                required: true,
@@ -129,6 +162,8 @@
          {
            label: "民族",
            prop: "nation",
            addDisabled: true,
            editDisabled: true,
            width: 55,
            labelWidth: 110,
            rules: [
@@ -139,26 +174,30 @@
              },
            ],
          },
          {
            label: "出生日期",
            labelWidth: 110,
            width: 90,
            prop: "birthday",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请输入出生日期",
                trigger: "blur",
              },
            ],
          },
          // {
          //   label: "出生日期",
          //   labelWidth: 110,
          //   width: 90,
          //   // addDisabled: true,
          //   // editDisabled: true,
          //   prop: "birthday",
          //   type: "date",
          //   format: "yyyy-MM-dd",
          //   valueFormat: "yyyy-MM-dd",
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入出生日期",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          {
            label: "联系电话",
            prop: "telephone",
            labelWidth: 110,
            addDisabled: true,
            editDisabled: true,
            width: 98,
            rules: [
              {
@@ -172,6 +211,8 @@
            label: "身份证号",
            prop: "cardid",
            labelWidth: 110,
            addDisabled: true,
            editDisabled: true,
            width: 150,
            rules: [
              {
@@ -186,6 +227,8 @@
            prop: "residence",
            labelWidth: 110,
            overHidden: true,
            addDisabled: true,
            editDisabled: true,
            rules: [
              {
                required: true,
@@ -194,31 +237,35 @@
              },
            ],
          },
          {
            label: "居住地址  ",
            prop: "address",
            overHidden: true,
            labelWidth: 110,
            rules: [
              {
                required: true,
                message: "请输入居住地址  ",
                trigger: "blur",
              },
            ],
          },
          {
            label: "户籍性质",
            prop: "nature",
            labelWidth: 110,
            rules: [
              {
                required: true,
                message: "请输入户籍性质",
                trigger: "blur",
              },
            ],
          },
          // {
          //   label: "居住地址  ",
          //   prop: "address",
          //   overHidden: true,
          //   addDisabled: true,
          //   editDisabled: true,
          //   labelWidth: 110,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入居住地址  ",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          // {
          //   label: "户籍性质",
          //   prop: "nature",
          //   // addDisabled: true,
          //   // editDisabled: true,
          //   labelWidth: 110,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入户籍性质",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          {
            label: "个人缴费额",
            prop: "amount",
@@ -349,6 +396,22 @@
    },
  },
  methods: {
    changes(val) {
      this.do++;
      if (this.do >= 2) {
        getuseList(val.value).then((res) => {
          // console.log(res);
          var d = res.data.data;
          this.form.cardid = d.cardid;
          this.form.telephone = d.phone;
          this.form.residence = d.nativeplace;
          this.form.address = d.address;
          this.form.sex = d.sex;
          this.form.nation = d.nation;
          this.form.birthday = d.birthday;
        });
      }
    },
    rowSave(row, done, loading) {
      console.log(row);
      row.deptid = this.deptid;