Administrator
2022-01-08 e6a7936ce29f3dfe54d7635352c4fc4185150fc4
智能分析统计新增登录统计
2 files modified
2 files added
654 ■■■■■ changed files
src/api/loginRecord/loginRecord.js 25 ●●●●● patch | view | raw | blame | history
src/api/securityAnalysis/securityAnalysis.js 11 ●●●●● patch | view | raw | blame | history
src/views/securityAnalysis/child/loginRecord.vue 204 ●●●●● patch | view | raw | blame | history
src/views/securityAnalysis/index.vue 414 ●●●●● patch | view | raw | blame | history
src/api/loginRecord/loginRecord.js
New file
@@ -0,0 +1,25 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
    return request({
        url: '/api/loginRecord/page',
        method: 'get',
        params: {
            current,
            size,
            ...params
        }
    })
}
export const getInformationLoginPage = (current, size, params) => {
    return request({
        url: '/api/loginRecord/getInformationLoginPage',
        method: 'get',
        params: {
            current,
            size,
            ...params
        }
    })
}
src/api/securityAnalysis/securityAnalysis.js
@@ -112,4 +112,15 @@
            size,
        }
    })
}
export const getLoginDataStatistics = (jurisdiction) => {
    return request({
        url: '/api/loginRecord/getLoginDataStatistics',
        method: 'get',
        params: {
            jurisdiction: jurisdiction,
        }
    })
}
src/views/securityAnalysis/child/loginRecord.vue
New file
@@ -0,0 +1,204 @@
<template>
  <div
    :class="[
      'certificateTJ',
      $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
    ]"
  >
    <avue-crud
      :option="option"
      :data="data"
      :page.sync="page"
      :table-loading="loading"
      @on-load="onLoad(page)"
      @search-change="searchChange"
      @search-reset="searchReset"
      @refresh-change="refreshChange"
    >
    </avue-crud>
  </div>
</template>
<script>
import { getInformationLoginPage } from "@/api/loginRecord/loginRecord"; // 保安员
export default {
  props: ["card"],
  data() {
    return {
      securityid: "",
      ExperienceVisible: false,
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
      },
      query: {},
      data: [],
      option: {
        addBtn: false,
        searchShowBtn: false,
        columnBtn: false,
        menu: false,
        height: "auto",
        widtd: "auto",
        border: true,
        stripe: true,
        index: true,
        ...this.$store.state.control.clearOtherBut,
        align: "center",
        column: [
          {
            label: "登录时间",
            prop: "releaseTimeRange",
            type: "datetime",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            searchRange: true,
            hide: true,
            search: true,
            searchSpan: 7,
            rules: [
              {
                required: true,
                message: "请输入登录时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "企业名称",
            prop: "deptName",
            disabled: true,
            overHidden: true,
            searchSpan: 5,
            search: true,
          },
          {
            label: "所属辖区",
            prop: "jurisdictionName",
            type: "select",
            dicData: [
              {
                label: "男",
                value: 1,
              },
              {
                label: "女",
                value: 2,
              },
              {
                label: "未知",
                value: 3,
              },
            ],
            display: false,
          },
          {
            label: "企业属性",
            prop: "stats",
            display: false,
            minWidth: 90,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stats",
            props: {
              label: "dictValue",
              value: "dictKey",
            },
            type: "select",
            rules: [
              {
                required: true,
                message: "请选择企业属性",
                trigger: "blur",
              },
            ],
          },
          {
            label: "最近一次登录时间",
            prop: "createTime",
            minWidth: 100,
            display: false,
          },
          {
            label: "登录次数",
            prop: "num",
            disabled: false,
          },
          {
            label: "是否有登录",
            prop: "types",
            search: true,
            disabled: false,
            searchLabelWidth:110,
            type: "select",
            searchSpan: 5,
            hide:true,
            dicData: [
              {
                label: "全部",
                value: 3,
              },
              {
                label: "是",
                value: 2,
              },
              {
                label: "否",
                value: 1,
              },
            ],
          },
        ],
      },
    };
  },
  methods: {
    onLoad(page, params = {}) {
      if (this.card.jurisdiction == 1372091709474910209) {
        this.card.jurisdiction = "";
      }
      const { releaseTimeRange } = this.query;
      let values = {
        ...params,
      };
      if (releaseTimeRange) {
        values = {
          ...this.card,
          ...params,
          startTime: releaseTimeRange[0],
          endTime: releaseTimeRange[1],
          ...this.query,
        };
        values.releaseTimeRange = null;
      }
      getInformationLoginPage(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        this.data = data.records;
        this.page.total = data.total;
        this.loading = false;
      });
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.refreshChange();
      done();
    },
    searchReset() {
      this.query = {};
      this.page.currentPage = 1;
      this.refreshChange();
    },
  },
};
</script>
<style scoped>
</style>
src/views/securityAnalysis/index.vue
@@ -2,26 +2,23 @@
  <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">
            {{ item.title }}<br />{{ item.value }}
          </div>
        </div> -->
      <!-- 保安员审查情况统计
        <div>饼图</div> -->
      <!-- </div> -->
      <div class="examines" ref="ech1">
      <div class="examinesBtn" v-if="examineBtnVisiable">
        <el-radio-group v-model="tabPosition" style="margin-bottom: 30px" size="small" @change="handleClick">
          <el-radio-button label="1">保安员审查情况统计</el-radio-button>
          <el-radio-button label="2">企业登录预警情况统计</el-radio-button>
        </el-radio-group>
      </div>
        <div id="ech1" class="examines"  ref="ech1" style="visibility:visible;z-index:666">
        </div>
        <div id="ech1s" class="examiness"  ref="ech1s" style="visibility:hidden;z-index:333">
        </div>
        <!-- 保安员审查情况统计
        <div>饼图</div> -->
      </div>
      <div class="certificate" ref="ech2">
        <!-- 保安员持证情况统计
        <div>饼图</div> -->
@@ -65,6 +62,13 @@
          <!-- 保安员审查情况统计 -->
        </situation>
        <loginRecord
          :card="{ jurisdiction: jurisdiction }"
          v-if="sees == 7"
        >
          <!-- 保安员审查情况统计 -->
        </loginRecord>
        <certificate
          :card="{ deptId: deptid, jurisdiction: jurisdiction }"
          v-if="sees == 2"
@@ -100,7 +104,6 @@
    </div>
  </div>
</template>
<script>
import {
  getinformationselectExtype, //保安员审查情况统计
@@ -111,13 +114,15 @@
  getinformationselectDisp, //保安派遣情况
  getAgeStatistics, //保安员年龄分布情况
  getinformationselectSoil, //社保缴纳情况统计
  getEducationStatistics
  getEducationStatistics,
  getLoginDataStatistics
} from "@/api/securityAnalysis/securityAnalysis";
import { mapState } from "vuex";
import { getRoleDetail } from "@/api/system/role";
import certificate from "./child/certificate.vue";
import examination from "./child/examination.vue";
import situation from "./child/situation.vue";
import loginRecord from "./child/loginRecord.vue";
import dispatch from "./child/dispatch.vue";
import assignment from "./child/assignment.vue";
import socialSecurity from "./child/socialSecurity.vue";
@@ -129,24 +134,26 @@
    dispatch,
    assignment,
    socialSecurity,
    loginRecord
  },
  data() {
    return {
      EC1: "", //保安员审查情况统计 // 饼图
      EC1s: "", //登录预警统计 // 饼图
      EC2: "", //保安员持证情况统计 // 饼图
      EC3: "", //保安员考试情况统计 // 堆叠面积图
      EC4: "", //派遣服务单位统计 // 柱状图
      EC5: "", //保安派遣情况统计 // 饼图
      EC6: "", //社保缴纳情况统计 // 饼图
      deptid: "",
      oneVisiable:true,
      examineBtnVisiable:true,
      jurisdiction: "",
      tabPosition: 1,
      examinetionTitle:"保安员审查情况统计",
      examine1: [],
      dialogVisible: false,
      titles: "",
      // czdata: [],
      sees: "",
      colors: ["#29C093", "#F34A4A"], //[正常,异常];
    };
@@ -173,7 +180,7 @@
  watch: {
    dialogVisible() {
      if (this.dialogVisible == false && this.sees == "1") {
        this.getEC1();
        this.getEC1(this.tabPosition);
      }
      if (this.dialogVisible == false && this.sees == "2") {
        this.getEC2();
@@ -193,8 +200,21 @@
    },
  },
  methods: {
    //tab 切换
    handleClick(val){
      if(val==1){
        document.getElementById("ech1").style.visibility = "visible";
        document.getElementById("ech1s").style.visibility = "hidden";
      }else{
        document.getElementById("ech1").style.visibility = "hidden";
        document.getElementById("ech1s").style.visibility = "visible";
      }
      this.tabPosition = val;
      this.getEC1(val);
    },
    creatOurEcharts() {
      this.EC1 = echarts.init(this.$refs.ech1);
      this.EC1s = echarts.init(this.$refs.ech1s);
      this.EC2 = echarts.init(this.$refs.ech2);
      this.EC3 = echarts.init(this.$refs.ech3);
      this.EC4 = echarts.init(this.$refs.ech4);
@@ -272,35 +292,6 @@
        },
      };
    },
    gettoolboxByExamine(title, titles, id) {
      var that = this;
      return {
        show: true,
        itemSize: 25,
        top: 20,
        right: 20,
        feature: {
          myTool1: {
            show: true,
            title: "点击查看详情",
            icon: "image://http://223.82.109.183:2080/img/table.png",
            onclick: function () {
              that.dialogVisible = true;
              that.sees = id;
              that.titles = titles;
            },
          },
          // myTool2: {
          //   show: true,
          //   title: "切换",
          //   icon: "image://http://223.82.109.183:2080/img/Switch.png",
          //   onclick: function () {
          //     that.titles = titles;
          //   },
          // },
        },
      };
    },
    setColor(d, color) {
      for (var k in d) {
        var itemStyle = {
@@ -311,9 +302,10 @@
      console.log(d);
      return d;
    },
    getEC1() {
    getEC1(tab) {
      var that = this;
      getinformationselectExtype(this.deptid, this.jurisdiction)
      if(tab==1){
        getinformationselectExtype(this.deptid, this.jurisdiction)
        .then((res) => {
          var a = res.data.data;
          var b = that.changedata(a, "zc", "bzc", "情况正常", "情况异常");
@@ -323,6 +315,23 @@
          var b = that.changedata([], "zc", "bzc", "情况正常", "情况异常");
          that.setEC1(b);
        });
      }
      if(tab==2){
        getLoginDataStatistics(this.jurisdiction).then((res)=>{
          var b = res.data.data;
          var data = [
            {
              value:b[0],
              name:"近7天登录企业数"
            },
            {
              value:b[1],
              name:"近7天未登录企业数"
            }
          ]
          that.setEC1s(data);
        })
      }
    },
    setEC1(d) {
      this.examine1 = [
@@ -343,7 +352,7 @@
      data = this.setColor(d, this.colors);
      option = {
        title: {
          text: "保安员审查情况统计",
          text: this.examinetionTitle,
          top: 25,
          left: "center",
        },
@@ -354,21 +363,13 @@
          x: "center",
          y: "90%",
        },
        toolbox: this.gettoolboxByExamine("审查情况查询", "保安员审查情况明细", 1),
        toolbox: this.gettoolbox("审查情况查询", "保安员审查情况明细", 1),
        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,
@@ -377,11 +378,7 @@
              },
            },
            label: {
              // alignTo: "edge",
              formatter: "{name|{b}}\n({d}%)",
              // minMargin: 5,
              // edgeDistance: 10,
              // lineHeight: 15,
              rich: {
                time: {
                  fontSize: 10,
@@ -395,55 +392,57 @@
      this.EC1.setOption(option);
    },
    //登录情况统计
    setEC1s(d) {
      var option,data;
      data = this.setColor(d, this.colors);
      option = {
        title: {
          text: "",
          top: 25,
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          x: "center",
          y: "90%",
        },
        toolbox: this.gettoolbox("登录情况查询", "企业登录情况明细", 7),
        series: [
          {
            type: "pie",
            radius: "50%",
            data: data,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
            label: {
              formatter: "{name|{b}}\n({d}%)",
              rich: {
                time: {
                  fontSize: 10,
                  color: "#999",
                },
              },
            },
          },
        ],
      };
      this.EC1s.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", "持证", "未持证");
@@ -486,11 +485,7 @@
              },
            },
            label: {
              // alignTo: "edge",
              formatter: "{name|{b}}\n({d}%)",
              // minMargin: 5,
              // edgeDistance: 10,
              // lineHeight: 15,
              rich: {
                time: {
                  fontSize: 10,
@@ -504,143 +499,14 @@
      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);
    //   });
    // },
    //后改
    getEC3() {
      getExamStatisInfo(this.deptid, this.jurisdiction).then((res) => {
        this.setEC3(res.data.data);
      });
    },
    //备份,误删
    // 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);
    // },
    //后改,考试数据统计
    //考试数据统计
    setEC3(data) {
      //获取年份
      // let year = new Date().getFullYear();
      // var timeData = [];
      // for (let index = 1; index < 13; index++) {
      //   timeData.push(year+"-"+ index );
      // }
      const seriesdata = [];
      data.forEach((item) => {
        if (item.type == 1) {
@@ -739,8 +605,6 @@
          }
        };
        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);
@@ -759,13 +623,6 @@
            }
          }
        }
        // console.log(d, "派遣服务单位");
        // console.log(a, 123456);
        // for (var k in a) {
        //   d.push(a[k]);
        // }
        // console.log(d);
        that.setEC4(d);
      });
    },
@@ -937,7 +794,7 @@
      this.EC6.setOption(option);
    },
    biginOUREC() {
      this.getEC1();
      this.getEC1(1);
      this.getEC2();
      this.getEC3();
      this.getEC4();
@@ -951,20 +808,22 @@
      // this.setEC6();
    },
  },
  created(){
    if(this.userInfo.role_name == "保安公司管理员" || this.userInfo.role_name == "分公司管理员"){
      this.examinetionTitle = "保安员审查情况统计";
      this.examineBtnVisiable = false;
    }else {
      this.examinetionTitle = "";
    }
  },
  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 != "保安公司管理员") {
          if (roleName != "保安公司管理员" && roleName != "分公司管理员") {
            this.deptid = "";
            this.jurisdiction = this.userInfo.jurisdiction;
          } else {
@@ -993,6 +852,7 @@
  .securityAnalysiscenter,
  .securityAnalysisright {
    // border: 1px solid #000;
    position: relative;
    width: 29%;
    height: 100%;
    box-sizing: border-box;
@@ -1004,8 +864,6 @@
  .securityAnalysiscenter {
    width: 40% !important;
  }
  .examines,
  .certificate,
  .examination,
  .dispatchUnit,
  .dispatchSecurity,
@@ -1016,6 +874,38 @@
    box-sizing: border-box;
    background-color: #fff;
  }
  .certificate{
    position: relative;
    width: 100%;
    height: 49%;
    top: 13.30rem;
    box-sizing: border-box;
    background-color: #fff;
  }
  .examinesBtn{
    position: absolute;
    top: 1.5rem;
    z-index: 999;
    left: 8rem;
  }
  .examines{
    position: absolute;
    top: 0.25rem;
    width: 100%;
    height: 49%;
    box-sizing: border-box;
    background-color: #fff;
  }
  .examiness{
    position: absolute;
    top: 0.25rem;
    width: 100%;
    height: 49%;
    box-sizing: border-box;
    background-color: #fff;
  }
  // .examines {
  //   width: 100%;
  //   height: 49%;