Administrator
2022-01-19 07f3df4bdaea6c4e90439a60362e3f99da073413
src/views/statisticalQueryManagement/securityGuardStatistics.vue
@@ -1,28 +1,71 @@
<template>
  <basic-container>
    <avue-crud
      :option="tableOption"
      :data="tableData"
      :page.sync="tablePage"
       :table-loading="loading"
      :permission="permissionList"
      :before-open="beforeOpen"
      @date-change="dateChange"
      @row-click="handleRowClick"
      class="rowClick"
  <div>
    <basic-container class="witerFontColorInput">
      <avue-crud
        :option="tableOption"
        :table-loading="loading"
        :data="tableData"
        :page.sync="page"
        :permission="permissionList"
        ref="crud"
        :search.sync="search"
        @search-change="searchChange"
        @search-reset="searchReset"
        @current-change="currentChange"
        @size-change="sizeChange"
        @refresh-change="refreshChange"
        @on-load="onLoad"
        @cell-click="handleRowClick"
        class="rowClick"
      >
      <template slot="menuLeft">
      <el-button
              type="warning"
              size="small"
              plain
              icon="el-icon-download"
              @click="handleExportSecurityStatisInfo"
              >导出
            </el-button>
      </template>
      </avue-crud>
    </basic-container>
    <el-dialog
      class="tongji-class"
      :title="dialogTitle"
      append-to-body
      :visible.sync="dialogShow"
      v-if="dialogShow"
    >
    </avue-crud>
  </basic-container>
      <companyDetails :fwdeptId="fwdeptId"></companyDetails>
    </el-dialog>
  </div>
</template>
<script>
import FileSaver from "file-saver";
import XLSX from "xlsx";
import { mapGetters } from "vuex";
import { selectLi } from "../../api/statisticalQueryManagement/statisticalQueryManagement";
import {
  selectLi,
  dictionaryList
} from "../../api/statisticalQueryManagement/statisticalQueryManagement";
import { lazyTreeJu, lazyTrees } from "../../api/index/index";
import companyDetails from "./companyDetails";
import Qs from "qs";
import { getToken } from "@/util/auth";
export default {
  name: "业务情况统计",
  components: {
    companyDetails
  },
  data() {
    return {
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      search:{},
      query: {},
      value1: "",
      value2: "",
      tableData: [
@@ -63,15 +106,10 @@
        //   socialSecurity: "21535",
        // },
      ],
      tablePage: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      tableOption: {
        align: "center",
        viewBtn: true,
        excelBtn: true,
        // excelBtn: true,
        delBtn: false,
        editBtn: false,
        addBtn: false,
@@ -86,53 +124,69 @@
        searchShow: true,
        searchMenuSpan: 6,
        index: true,
        indexLabel:'序号',
        dialogClickModal: false,
        column: [
          {
            label: "公司名称",
            label: "企业名称",
            prop: "deptname",
            search: true,
            searchSpan: 4,
            width: 280,
            display: false
          },
          {
            label: "企业属性",
            prop: "stats",
            search: true,
            searchSpan: 4,
            display: false,
            type: "select",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dicData: []
          },
          {
            label: "所属辖区",
            prop: "jurname",
            searchSpan: 4,
            type: "select",
            type: "tree",
            props: {
              label: "label",
              value: "value",
              label: "title",
              value: "value"
            },
            // cascaderItem: ["city", "area"],
            // dicUrl:subofficeOptions,
            dicData: [
              {
                value: "0",
                label: "南昌市公安局",
              },
              {
                value: "2",
                label: "东湖分局",
              },
              {
                value: "3",
                label: "西湖分局",
              },
              {
                value: "4",
                label: "青云谱分局",
              },
              {
                value: "5",
                label: "青山湖分局",
              },
            ],
            search: true,
            rules: [
              {
                required: true,
                message: "请选择所属辖区",
                trigger: "blur"
              }
            ]
          },
          {
            label: "单位注册时间",
            prop: "releaseTimeRange",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            searchRange: true,
            searchSpan: 6,
            searchLabelWidth: 120,
            labelWidth:160,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            search: true,
            rules: [
              {
                required: true,
                message: "请选择单位注册时间",
                trigger: "blur",
              },
            ],
@@ -140,47 +194,55 @@
          {
            label: "保安员总数",
            prop: "num",
            display: false,
            display: false
          },
          {
            label: "持证上岗人数",
            prop: "cznum",
            display: false,
            display: false
          },
          {
            label: "未派遣人数",
            prop: "wpaiqnum",
            display: false,
            prop: "wpqnum",
            display: false
          },
          {
            label: "派遣人数",
            prop: "paiqnum",
            display: false,
            prop: "pqnum",
            display: false
          },
          {
            label: "已采集照片人数",
            prop: "ycjzpnum",
            display: false
          },
          {
            label: "未采集照片人数",
            prop: "wcaijnum",
            display: false,
            prop: "wcjzpnum",
            display: false
          },
          {
            label: "已采集指纹人数",
            prop: "ycjzwnum",
            display: false
          },
          {
            label: "资格审查异常人数",
            prop: "yicnum",
            display: false,
            width: 150,
            prop: "scycnum",
            display: false
          },
          // {
          //   label: "过考保安人数",
          //   prop: "pass",
          //   display: false,
          // },
          {
            label: "缴纳社保人数",
            prop: "sbnum",
            display: false,
          },
        ],
            prop: "jnsbnum",
            display: false
          }
        ]
      },
      companyName: "",
      loading:true,
      loading: true,
      dialogShow: false,
      dialogTitle: ""
    };
  },
  computed: {
@@ -190,53 +252,138 @@
        addBtn: this.vaildData(this.permission.post_add, false),
        viewBtn: this.vaildData(this.permission.post_view, false),
        delBtn: this.vaildData(this.permission.post_delete, false),
        editBtn: this.vaildData(this.permission.post_edit, false),
        editBtn: this.vaildData(this.permission.post_edit, false)
      };
    },
    }
  },
  methods: {
    // toCompanyDetails() {
    //   this.$router.push({ path: "/statisticalQueryManagement/companyDetails" });
    // },
    handleRowClick(row, event, column) {
      this.$router.push({ path: "/statisticalQueryManagement/companyDetails" });
    //保安员统计信息导出
    handleExportSecurityStatisInfo() {
      this.$confirm("是否导出保安员统计信息数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        //获取查询条件
        const { releaseTimeRange } = this.search;
        if (releaseTimeRange) {
          this.search["startTime"] = releaseTimeRange[0];
          this.search["endTime"] = releaseTimeRange[1];
        }
        var data = {
          jurisdiction: this.search.jurname,
          stats: this.search.stats,
          deptid: this.search.deptname,
          startTime: this.search.startTime,
          endTime: this.search.endTime,
        };
        // console.log(data,123);
        //序列号url形式,用&拼接
        data = Qs.stringify(data);
        window.open(
          `/api/information/export-security-statis-info?${
            this.website.tokenHeader
          }=${getToken()}&` + data
        );
      });
    },
    dateChange() {},
    getTableData() {
      selectLi({current: 1, size: 10 }).then(res => {
    getSubOfficeData() {
      lazyTrees().then(res => {
        if (res.data.code === 200) {
          this.tableData = res.data.data;
          this.loading = false;
          this.tableOption.column.forEach(item => {
            if (item.label == "所属辖区") {
              // let data = res.data.data;
              item.dicData = res.data.data;
            }
          });
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    getDictionaryList() {
      dictionaryList().then(res => {
        if (res.data.code === 200) {
          this.tableOption.column.forEach(item => {
            if (item.label == "企业属性") {
              item.dicData = res.data.data;
            }
          });
        }
      });
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
      this.onLoad(this.page, this.query);
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
      this.onLoad(this.page, this.query);
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      params = this.search;
      this.loading = true;
      let param = {};
      param["jurisdiction"] = params["jurname"] || "";
      param["deptid"] = params["deptname"] || "";
      param["stats"] = params["stats"] || "";
      param["current"] = page.currentPage;
      param["size"] = page.pageSize;
      const { releaseTimeRange } = this.query;
      let values = {
          ...param,
        };
        if (releaseTimeRange) {
          values = {
            ...param,
            startTime: releaseTimeRange[0],
            endTime: releaseTimeRange[1],
            ...this.query,
          };
          values.releaseTimeRange = null;
        }
      selectLi(values).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.tableData = data.records;
        this.loading = false;
      });
    },
    handleRowClick(row, column, cell, event) {
      if (column.label == "保安员总数") {
        this.dialogTitle = "保安员明细";
        this.fwdeptId = row.departmentid;
        this.dialogShow = true;
      } else {
        this.dialogShow = false;
      }
      // this.$router.push({
      //   path: "/statisticalQueryManagement/companyDetails?deptid=" + row.dept_id
      // });
    }
    // downExcel() {
    //   let et = XLSX.utils.table_to_book(document.getElementById("table"));
    //   let etout = XLSX.write(et, {
    //     bookType: "xlsx",
    //     bookSST: true,
    //     type: "array"
    //   });
    //   try {
    //     FileSaver.saveAs(
    //       new Blob([etout], {
    //         type: "application/octet-stream"
    //       }),
    //       `表.xlsx`
    //     ); //导出的文件名
    //   } catch (e) {
    //     console.log(e, etout);
    //   }
    //   return etout;
    // }
  },
  mounted() {
    this.getTableData();
  },
    this.getSubOfficeData();
    this.getDictionaryList();
  }
};
</script>
<style lang="scss" scoped>
/deep/ .rowClick .el-table__row:hover td{
<style lang="scss" scoped>
/deep/ .rowClick .el-table__row:hover td:nth-child(6) {
  cursor: pointer;
}
</style>