Administrator
2022-06-10 189ec04530dde0796d01ff10106092c2e6f37db7
制证接口新增
1 files modified
2 files added
1012 ■■■■■ changed files
src/api/securityapplyRecord/securityapplyRecord.js 93 ●●●●● patch | view | raw | blame | history
src/api/system/user.js 8 ●●●●● patch | view | raw | blame | history
src/views/securityapplyRecord/securityapplyRecord.vue 911 ●●●●● patch | view | raw | blame | history
src/api/securityapplyRecord/securityapplyRecord.js
New file
@@ -0,0 +1,93 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
    return request({
        url: '/api/securityApply/page',
        method: 'get',
        params: {
            current,
            size,
            ...params
        }
    })
}
export const detail = (id) => {
    return request({
        url: '/api/securityApply/detail',
        method: 'get',
        params: {
            id,
        }
    })
}
export const remove = (ids) => {
    return request({
        url: '/api/securityApply/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}
export const submit = (row) => {
    return request({
        url: '/api/securityApply/submit',
        method: 'post',
        data: row
    })
}
export const add = (row) => {
    return request({
        url: '/api/securityApply/save',
        method: 'post',
        data: row
    })
}
export const update = (row) => {
    return request({
        url: '/api/securityApply/update',
        method: 'post',
        data: row
    })
}
export const audit = (row) => {
    return request({
        url: '/api/securityApply/audit',
        method: 'post',
        data: row
    })
}
export const batchAudit = (row) => {
    return request({
        url: '/api/securityApply/batchAudit',
        method: 'post',
        data: row
    })
}
export const securityApply = (row) => {
    return request({
        url: '/api/securityApply/securityApply',
        method: 'post',
        data: row
    })
}
export const batchAccreditation = (row) => {
    return request({
        url: '/api/securityApply/batchAccreditation',
        method: 'post',
        data: row
    })
}
src/api/system/user.js
@@ -137,4 +137,12 @@
            roleIds,
        }
    })
}
export const updatePaperTime = (row) => {
    return request({
        url: '/api/blade-user/updatePaperTime',
        method: 'post',
        data: row
    })
}
src/views/securityapplyRecord/securityapplyRecord.vue
New file
@@ -0,0 +1,911 @@
<template>
  <basic-container
    :class="[
      'desk1',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      ref="crud"
      @row-del="rowDel"
      v-model="form"
      :permission="permissionList"
      :search.sync="questionBankSearch"
      @row-update="rowUpdate"
      @row-save="rowSave"
      :before-open="beforeOpen"
      @filter="filterChange"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template slot="menuLeft">
        <el-button
          type="danger"
          size="small"
          icon="el-icon-delete"
          v-if="permission.securityapplyRecord_delete"
          plain
          @click="handleDelete"
          >删 除
        </el-button>
        <el-button
          type="warning"
          size="small"
          plain
          icon="el-icon-download"
          v-if="permission.securityapplyRecord_export"
          @click="handleExport"
          >导出
        </el-button>
        <el-button
          type="primary"
          size="small"
          plain
          v-if="permission.securityapplyRecord_batch_audit || check"
          icon="el-icon-collection-tag"
          @click="handleSecurityAudit"
          >批量审批
        </el-button>
        <span>
          <Legend :datas="datalistLIU"></Legend>
        </span>
        <!-- v-if="permission.notice_delete" -->
      </template>
      <template slot-scope="{ row }" slot="category">
        <el-tag>{{ row.categoryName }}</el-tag>
      </template>
      <template slot-scope="{ type, size, row }" slot="menu">
        <el-button
          :type="type"
          :size="size"
          v-if="permission.securityapplyRecord_audit"
          icon="el-icon-folder-checked"
          @click="handleAudit(row)"
          >审核
        </el-button>
      </template>
      <template slot-scope="{ row }" slot="auditStatus">
        <el-tag class="dtype">
          {{
            row.auditStatus == 3
              ? "待审核"
              : row.auditStatus == 1
              ? "审核通过"
              : "审核不通过"
          }}
          <i class="zc" v-if="row.auditStatus == 1"></i>
          <i class="yj" v-if="row.auditStatus == 2"></i>
          <i class="gz" v-if="row.auditStatus == 3"></i>
        </el-tag>
      </template>
      <template slot-scope="{ row }" slot="deptName">
        <el-tag>{{ row.deptName }}</el-tag>
      </template>
      <template slot-scope="{ row }" slot="sex">
        <el-tag>{{
          row.sex == "1" ? "男" : row.sex == "2" ? "女" : ""
        }}</el-tag>
      </template>
    </avue-crud>
    <el-dialog
      title="证书申请审核"
      :visible.sync="dialogFormVisible"
      modal-append-to-body="false"
      append-to-body="true"
      :close-on-click-model="true"
    >
      <avue-form
        ref="formAudit"
        v-model="Audit"
        :option="optionAudit"
        @reset-change="emptytChange"
        @submit="submit"
      ></avue-form>
    </el-dialog>
    <el-dialog
      title="批量审批"
      append-to-body
      :visible.sync="dialogBatchAudit"
      width="900px"
      @close="closeDialog"
    >
      <avue-form
        ref="formBatchAudit"
        v-model="batchAudit"
        :option="optionBatchAudit"
        @reset-change="emptytChange"
        @submit="submitBatchAudit"
      ></avue-form>
    </el-dialog>
  </basic-container>
</template>
<script>
import {
  getList,
  remove,
  update,
  add,
  detail,
  batchAccreditation,
  audit,
  batchAudit
} from "@/api/securityapplyRecord/securityapplyRecord";
import { getDept } from "@/api/system/dept";
import { mapGetters } from "vuex";
import { mapState } from "vuex";
import Qs from "qs";
import { getToken } from "@/util/auth";
import Legend from "@/components/liu-legend/Legend";
export default {
  components: {
    Legend
  },
  data() {
    return {
      datalistLIU: [
        {
          color: "#29C093",
          text: "审核通过"
        },
        {
          color: "#F34A4A",
          text: "审核不通过"
        },
        {
          color: "#F48F57",
          text: "待审核"
        }
      ],
      check: false,
      form: {},
      query: {},
      questionBankSearch: {},
      loading: true,
      deptCategory: "",
      deptId: "",
      permissionAdd: "",
      permissionDelete: "",
      permissionView: "",
      permissionEdit: "",
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize
      },
      Audit: {},
      dialogFormVisible: false,
      dialogBatchAudit: false,
      optionAudit: {
        height: "auto",
        calcHeight: 30,
        dialogWidth: 1000,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: false,
        addBtn: false,
        editBtn: false,
        selection: true,
        excelBtn: false,
        menuWidth: 230,
        dialogClickModal: false,
        ...this.$store.state.control.clearOtherBut,
        column: [
          {
            label: "审核状态",
            search: true,
            searchSpan: 5,
            span: 24,
            prop: "auditStatus",
            slot: true,
            editDisplay: false,
            addDisplay: false,
            type: "select",
            rules: [
              {
                required: true,
                message: "请选择审核类型",
                trigger: "blur"
              }
            ],
            dicData: [
              {
                label: "待审核",
                value: 3
              },
              {
                label: "审核通过",
                value: 1
              },
              {
                label: "审核不通过",
                value: 2
              }
            ]
          },
          {
            label: "审核明细",
            span: 24,
            type: "textarea",
            prop: "auditDetail"
          }
        ]
      },
      batchAudit: {
        number: 0
      },
      optionBatchAudit: {
        height: "auto",
        filterBtn: true,
        calcHeight: 30,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: true,
        selection: false,
        excelBtn: false,
        menuWidth: 380,
        dialogClickModal: false,
        ...this.$store.state.control.clearOtherBut,
        column: [
          {
            label: "所选保安人数",
            prop: "number",
            span: 24,
            value: 0,
            disabled: true,
            labelWidth: 110
          },
          {
            label: "审核状态",
            search: true,
            searchSpan: 5,
            span: 24,
            prop: "auditStatus",
            slot: true,
            editDisplay: false,
            addDisplay: false,
            type: "select",
            rules: [
              {
                required: true,
                message: "请选择审核类型",
                trigger: "blur"
              }
            ],
            dicData: [
              {
                label: "待审核",
                value: 3
              },
              {
                label: "审核通过",
                value: 1
              },
              {
                label: "审核不通过",
                value: 2
              }
            ]
          },
          {
            label: "审核明细",
            span: 24,
            type: "textarea",
            prop: "auditDetail"
          }
        ]
      },
      choiceList: [],
      selectionList: [],
      option: {
        height: "auto",
        filterBtn: true,
        calcHeight: 30,
        dialogWidth: 950,
        tip: true,
        reserveSelection: true,
        searchShow: true,
        searchMenuSpan: 6,
        align: "center",
        border: true,
        index: true,
        stripe: true,
        selection: true,
        excelBtn: false,
        addBtnText: "发布",
        addTitle: "发布",
        saveBtnText: "发布",
        menuWidth: 210,
        dialogClickModal: false,
        ...this.$store.state.control.clearOtherBut,
        searchIndex: 5, //收缩展示数量
        column: [
          {
            label: "申请时间",
            prop: "releaseTimeRange",
            type: "datetime",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            searchRange: true,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            search: true,
            searchSpan: 5,
            rules: [
              {
                required: true,
                message: "请输入申请时间",
                trigger: "blur"
              }
            ]
          },
          {
            label: "姓名",
            prop: "realName",
            search: true,
            searchSpan: 3,
            width: 100,
            disabled: true,
            searchLabelWidth: 50
            // display: false,
          },
          {
            label: "企业名称",
            searchLabelWidth: "90",
            prop: "deptName",
            slot: true,
            searchSpan: 5,
            search: true,
            disabled: true,
            overHidden: true,
            minWidth: 160
          },
          {
            label: "性别",
            prop: "sex",
            width: 80,
            type: "select",
            display: false
          },
          {
            label: "身份证号码",
            prop: "cardid",
            search: true,
            searchLabelWidth: 90,
            disabled: true,
            searchSpan: 5,
            width: 140
          },
          {
            label: "保安证编号",
            prop: "number",
            search: true,
            searchLabelWidth: 90,
            width: 110,
            searchSpan: 4,
            disabled: true,
            // hide: true,
          },
          {
            label: "保安员证图片",
            prop: "url",
            type: "upload",
            listType: "picture-img",
            disabled: true,
            labelWidth:100,
            width: 110
          },
          {
            label: "申请人",
            prop: "applyName",
            // search: true,
            searchLabelWidth: 90,
            minWidth: 80,
            // searchSpan: 4,
            addDisplay: false,
            editDisplay: false
            // hide: true,
          },
          {
            label: "申请时间",
            prop: "createTime",
            // search: true,
            searchLabelWidth: 90,
            width: 140,
            // searchSpan: 4,
            addDisplay: false,
            editDisplay: false
            // hide: true,
          },
          {
            label: "审核状态",
            prop: "auditStatus",
            type: "select",
            search: true,
            searchLabelWidth: 90,
            width: 110,
            searchSpan: 4,
            addDisplay: false,
            editDisplay: false,
            hide: false,
            display: false,
            dicData: [
              {
                label: "待审核",
                value: 3
              },
              {
                label: "审核通过",
                value: 1
              },
              {
                label: "审核不通过",
                value: 2
              }
            ]
          },
          {
            label: "审核明细",
            prop: "auditDetail",
            minWidth: 105,
            addDisplay: false,
            editDisplay: false,
            hide: false,
            display: false
          }
        ]
      },
      data: []
    };
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(
          this.permission.securityapplyRecord_view,
          false
        ),
        delBtn: this.vaildData(
          this.permission.securityapplyRecord_delete,
          false
        ),
        editBtn: this.vaildData(null, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    ...mapState({
      userInfo: state => state.user.userInfo
    })
  },
  mounted() {
    this.getDeptInfo(this.userInfo.dept_id);
    this.$store.commit("setWindowSizeHeightAdd");
  },
  created() {
  },
  methods: {
    //审核
    handleAudit(row) {
      this.dialogFormVisible = true;
      this.Audit = row;
    },
    //审核
    submit(row, done, loading) {
      const data = {
        id: row.id,
        auditStatus: row.auditStatus,
        auditDetail: row.auditDetail
      };
      audit(data).then(
        () => {
          this.dialogFormVisible = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    //证书批量审核
    handleSecurityAudit() {
      if (this.choiceList.length == 0) {
        this.$message({
          message: "未选择保安员",
          type: "warning"
        });
        return;
      }
      this.dialogBatchAudit = true;
      this.batchAudit.number = this.choiceList.length;
    },
    //批量审批
    submitBatchAudit(row, done, loading) {
      var that = this;
      let cho = this.choiceList;
      let str = "";
      for (let k in cho) {
        str += cho[k].id;
        if (k != cho.length - 1) {
          str += ",";
        }
      }
      const data = {
        ids: str,
        auditStatus: row.auditStatus,
        auditDetail: row.auditDetail
      };
      //提交申请
      batchAudit(data).then(
        () => {
          this.onLoad(this.page);
          that.$refs.formBatchAudit.resetFields();
          that.dialogBatchAudit = false;
          this.$message({
            type: "success",
            message: "操作成功"
          });
          //清除选项
          that.$refs.crud.toggleSelection();
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    //证书批量修改为已制证
    handleBatch() {
      if (this.choiceList.length === 0) {
        this.$message.warning("请勾选至少一位持证保安员");
        return;
      }
      this.$confirm("共选择人数" + this.choiceList.length + "人,确定已制证?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          let cho = this.choiceList;
          let str = "";
          for (let k in cho) {
            str += cho[k].id;
            if (k != cho.length - 1) {
              str += ",";
            }
          }
          const data = {
            ids: str,
            createUser: this.userInfo.user_id,
            type: 1
          };
          return batchAccreditation(data);
        })
        .then(() => {
          this.onLoad(this.page, this.questionBankSearch);
          this.$refs.crud.toggleSelection();
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        });
    },
    //获取当前用户部门信息
    getDeptInfo(deptId) {
      var that = this;
      getDept(deptId).then(res => {
        var deptCategory = res.data.data.deptCategory;
        deptCategory == 1
          ? (that.deptCategory = true)
          : (that.deptCategory = false);
      });
    },
    //跳转到附件列表页面
    handleUploadPage(row) {
      this.$router.push({
        path: `/resource/uploadNotice`,
        query: {
          deptId: row.deptId,
          noticeId: row.id
        }
      });
    },
    rowSave(row, done, loading) {
      if (this.deptCategory) {
        row.category = 1;
      } else {
        row.category = 2;
      }
      row["type"] = 1;
      row.deptId = this.deptId;
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      // if (this.deptCategory) {
      //   row.category = 1;
      // }else{
      //   row.category = 2;
      // }
      row.deptId = this.deptId;
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
      this.choiceList = [];
      for (let k in list) {
        this.choiceList.push({
          id: list[k].id
        });
      }
    },
    selectionClear() {
      this.selectionList = [];
      // this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page, this.questionBankSearch);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        detail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.questionBankSearch);
    },
    onLoad(page, params = {}) {
      params = this.questionBankSearch;
      this.deptId = JSON.parse(
        window.localStorage.getItem("saber-userInfo")
      ).content.dept_id;
      const { releaseTimeRange } = this.query;
      params["type"] = 1;
      if (this.userInfo.role_name == "保安公司管理员") {
        //如果是保安公司管理员
        params["deptId"] = this.userInfo.dept_id;
      }
      if (this.userInfo.role_name == "培训公司管理员") {
        //如果是培训公司管理员
        params["createUser"] = this.userInfo.Id;
      }
      if (this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "民警") {
        //如果是公安管理员
        params["jurisdiction"] = this.userInfo.jurisdiction;
      }
      let values = {
        ...params
      };
      if (releaseTimeRange) {
        values = {
          ...params,
          startTime: releaseTimeRange[0],
          endTime: releaseTimeRange[1],
          ...this.query
        };
        values.releaseTimeRange = null;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.selectionClear();
      });
    },
    //保安员证核查信息导出
    handleExport() {
      this.$confirm("是否导出保安员证核查信息数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        //获取查询条件
        const { releaseTimeRange } = this.questionBankSearch;
        if (releaseTimeRange) {
          this.questionBankSearch["startTime"] = releaseTimeRange[0];
          this.questionBankSearch["endTime"] = releaseTimeRange[1];
        }
        var data = {
          deptName: this.questionBankSearch.deptName,
          cardid: this.questionBankSearch.cardid,
          auditStatus: this.questionBankSearch.auditStatus,
          realName: this.questionBankSearch.realName,
          number: this.questionBankSearch.number,
          startTime: this.questionBankSearch.startTime,
          endTime: this.questionBankSearch.endTime,
        };
        //导出
        if (this.userInfo.role_name == "保安公司管理员") {
          //如果是保安公司管理员
          data["deptId"] = this.userInfo.dept_id;
        }
        if (this.userInfo.role_name == "培训公司管理员") {
          //如果是培训公司管理员
          data["createUser"] = this.userInfo.Id;
        }
        if (this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "民警") {
          //如果是公安管理员
          data["jurisdiction"] = this.userInfo.jurisdiction;
        }
        //序列号url形式,用&拼接
        data = Qs.stringify(data);
        window.open(
          `/api/securityapplyRecord/export-security-paper?${
            this.website.tokenHeader
          }=${getToken()}&` + data
        );
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.dtype {
  width: 100%;
  padding-left: 0px;
}
.dx {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 6px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #dfdfdf;
}
.zc {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #29c093;
}
.yj {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f34a4a;
}
.gz {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f48f57;
}
</style>