liuyg
2022-02-16 19e0b728e8cd41f9ddcd62eea6c15ebf769d9977
src/views/qualificationExamination/qualificationExamination.vue
@@ -17,6 +17,7 @@
      :permission="permissionList"
      v-model="form"
      ref="crud"
      :search.sync="search"
      @row-update="rowUpdates"
      @row-save="rowSave"
      @row-del="rowDel"
@@ -40,28 +41,46 @@
          >导出
        </el-button>
      </template>
      <template slot-scope="{ type, size, row }" slot="menu">
        <el-button
          :type="type"
          :size="size"
          icon="el-icon-edit"
          :disabled="row.examinationType != 1"
          @click="handleAuditDesc(row)"
          >审查异常备注
        </el-button>
      </template>
    </avue-crud>
    <el-dialog
      title="审查异常备注"
      append-to-body
      :visible.sync="dialogAudit"
      width="900px"
      @close="closeDialog"
    >
      <avue-form
        ref="formAudit"
        v-model="audit"
        :option="optionAuditDesc"
        @reset-change="emptytChange"
        @submit="submitAudit"
      ></avue-form>
    </el-dialog>
  </basic-container>
</template>
<script>
// import {
//   getList,
//   getDetail,
//   adddata,
//   update,
//   remove,
// } from "@/api/regulatoryInformation/regulatoryInformation";
import { mapGetters } from "vuex";
import { datasing } from "./dataqualificationExamination";
// import { getList } from "@/api/qualificationExamination/qualificationExamination";
import { getListSecurity } from "@/api/system/user";
import { getListSecurity, updateUser } from "@/api/system/user";
import Qs from "qs";
import { getToken } from "@/util/auth";
export default {
  data() {
    return {
      sort: {},
      search: {},
      form: {},
      query: {},
      loading: true,
@@ -71,6 +90,35 @@
        total: 0,
        ...this.$store.state.control.changePageSize,
      },
      id: "",
      batchAudit: {},
      dialogAudit: false,
      optionAuditDesc: {
        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: "审核明细",
            span: 24,
            type: "textarea",
            prop: "emails",
          },
        ],
      },
      selectionList: [],
      option: {
        // 操作栏多余按钮去除
@@ -78,10 +126,9 @@
        editBtn: false,
        addBtn: false,
        selection: true,
        menu: false,
        menu: true,
        menuWidth: 150,
        searchShowBtn: false,
        align: "center",
        height: "auto",
        calcHeight: 30,
@@ -92,23 +139,20 @@
        viewBtn: true,
        dialogClickModal: false,
        ...this.$store.state.control.clearOtherBut,
        column: [
          {
            label: "保安姓名",
            prop: "realName",
            search: true,
            width: 82,
            searchSpan: 4,
            //     hide: true,
            //     editDisplay: false,
            //     addDisplay: false
          },
          {
            label: "保安公司",
            label: "企业名称",
            prop: "deptName",
            minWidth: 160,
            minWidth: 110,
            overHidden: true,
            search: true,
            searchSpan: 5,
          },
          {
            label: "性别",
@@ -138,7 +182,6 @@
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            searchValue: [this.getStartTime(), this.getEndTime()],
            searchRange: true,
            searchSpan: 6,
            searchLabelWidth: 80,
@@ -155,52 +198,16 @@
              },
            ],
          },
          // {
          //   label: "性别",
          //   prop: "sexName",
          //   width: 56,
          //   // type: "select",
          //   // labelWidth: 120,
          //   // // display: false,
          //   // dicData: dic,
          //   // // props: {
          //   // //   label: "label",
          //   // //   value: "value",
          //   // // },
          //   // searchSpan: 5,
          //   // search: true,
          //   // width: 120,
          // },
          {
            label: "身份证号",
            prop: "cardid",
            width: 165,
            // type: "select",
            // labelWidth: 120,
            // // display: false,
            // dicData: dic,
            // // props: {
            // //   label: "label",
            // //   value: "value",
            // // },
            width: 139,
            searchSpan: 4,
            search: true,
            // width: 120,
          },
          // {
          //   label: "保安员证",
          //   prop: "certificate",
          //   // labelWidth: 120,
          //   // display: false,
          // },
          {
            label: "年龄",
            prop: "age",
            width: 65,
            // display: false,
            // labelWidth: 120,
            // width: 200,
          },
          {
            label: "出生日期",
@@ -208,9 +215,6 @@
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            // display: false,
            // labelWidth: 120,
            // width: 200,
          },
          {
            label: "保安员证编号",
@@ -222,26 +226,17 @@
          {
            label: "联系方式",
            prop: "phone",
            // display: false,
            // labelWidth: 120,
            // width: 200,
          },
          // {
          //   label: "所属角色",
          //   prop: "roleName",
          //   // display: false,
          //   overHidden: true,
          //   // width: 200,
          //   // labelWidth: 120,
          //   // overHidden: true,
          // },
          {
            label: "审查状态",
            prop: "examinationType",
            // overHidden: true,
            sortable: true,
            type: "select",
            dicData: [
              {
                label: "全部",
                value: "2",
              },
              {
                label: "正常",
                value: "0",
@@ -251,94 +246,38 @@
                value: "1",
              },
            ],
            // type: "date",
            // format: "yyyy-MM-dd",
            // valueFormat: "yyyy-MM-dd",
            // mock: {
            //   type: "datetime",
            //   labelWidth: 120,
            //   format: "yyyy-MM-dd",
            // },
            search: true,
            searchSpan: 4,
            // // display: false,
            // width: 180,
          },
          {
            label: "审查明细",
            prop: "examinationMx",
            sortable: true,
            // labelWidth: 120,
            // display: false,
            overHidden: true,
          },
          // {
          //   label: "审查结果",
          //   prop: "results",
          //   // labelWidth: 120,
          //   // display: false,
          // },
          {
            label: "审查时间",
            prop: "reviewTime",
            // labelWidth: 120,
            // display: false,
            hide: true,
            prop: "auditTime",
            // hide: true,
          },
          // {
          //   label: "是否在职",
          //   prop: "status",
          //   // labelWidth: 120,
          //   // display: false,
          // },
          {
            label: "审查异常备注",
            prop: "emails",
          },
        ],
        // group: [
        //   {
        //     label: "详细信息",
        //     prop: "baseInfo",
        //     icon: "el-icon-user-solid",
        //     column: [
        //       {
        //         label: "公司名称",
        //         prop: "enterprisename",
        //         display: false,
        //       },
        //     ],
        //   },
        //   {
        //     label: "详细信息",
        //     prop: "detailInfo",
        //     icon: "el-icon-s-order",
        //     column: [],
        //   },
        //   {
        //     label: "职责信息",
        //     prop: "dutyInfo",
        //     icon: "el-icon-s-custom",
        //     column: [],
        //   },
        // ],
      },
      data: [
        // {
        //   deptid: "江西众泰保安公司",
        //   punishtype: 2,
        //   punishreason: "非法施工",
        //   punishresult: "没收全部非法所得财产,并罚款3W元",
        //   punishtime: "2021-01-01",
        //   punisnum: 110110110120,
        // },
      ],
      data: [],
    };
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    permissionList() {
      return {
        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),
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(null, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
      };
    },
    ids() {
@@ -349,143 +288,85 @@
      return ids.join(",");
    },
  },
  created() {
    this.search["examinationType"] = "1";
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    //证书批量审核
    handleAuditDesc(row) {
      console.log(row, 123);
      this.id = row.id;
      this.dialogAudit = true;
    },
    //审查异常备注提交
    submitAudit(row, done, loading) {
      var that = this;
      const data = {
        id: this.id,
        emails: row.emails,
      };
      //提交申请
      updateUser(data).then(
        () => {
          this.onLoad(this.page);
          that.$refs.formAudit.resetFields();
          that.dialogAudit = false;
          this.$message({
            type: "success",
            message: "操作成功",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    //导出
    handleExport() {
      this.$confirm("是否导出审查信息?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          //获取查询条件
          // console.log(this.userInfo, 456);
          // console.log(this.query, 456);
          // return;
          var data = {
            cardid: this.query.cardid,
            realName: this.query.realName,
            securitynumber: this.query.securitynumber,
            status: this.query.status,
            endTime: this.query.endTime,
            startTime: this.query.startTime,
            jurisdiction: this.userInfo.jurisdiction,
          };
          //导出
          // if (
          //   this.userInfo.role_name == "保安公司管理员" ||
          //   this.userInfo.role_name == "保安"
          // ) {
          //   //如果是保安公司管理员
          //   data["deptId"] = this.userInfo.dept_id;
          // }
          // if (this.userInfo.role_name == "培训公司管理员") {
          //   //如果是培训公司管理员
          //   data["trainUnitId"] = this.userInfo.dept_id;
          // }
          // data["examType"] = 2;
          //序列号url形式,用&拼接
          data = Qs.stringify(data);
          window.open(`/api/blade-user/export-security?` + data);
        })
        .catch((action) => {
          // this.$message({
          //   type: 'info',
          //   message: action === 'cancel'
          //     ? '放弃保存并离开页面'
          //     : '停留在当前页面'
          // })
        });
    },
    getStartTime() {
      if (
        this.$route.query.startTime != undefined &&
        this.$route.query.startTime != null &&
        this.$route.query.startTime != ""
      ) {
        return this.$route.query.startTime;
      }
      return "";
    },
    getEndTime() {
      if (
        this.$route.query.endTime != undefined &&
        this.$route.query.endTime != null &&
        this.$route.query.endTime != ""
      ) {
        return this.$route.query.endTime;
      }
      return "";
    },
    rowSave(row, done, loading) {
      adddata(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
      }).then(() => {
        //获取查询条件
        const { releaseTimeRange } = this.search;
        if (releaseTimeRange) {
          this.search["startTime"] = releaseTimeRange[0];
          this.search["endTime"] = releaseTimeRange[1];
        }
      );
        var data = {
          cardid: this.search.cardid,
          realName: this.search.realName,
          securitynumber: this.search.securitynumber,
          endTime: this.search.endTime,
          deptName: this.search.deptName,
          startTime: this.search.startTime,
          examinationType: this.search.examinationType,
          jurisdiction: this.userInfo.jurisdiction,
        };
        data["status"] = 1;
        //序列号url形式,用&拼接
        data = Qs.stringify(data);
        window.open(
          `/api/blade-user/export-security?${
            this.website.tokenHeader
          }=${getToken()}&` + data
        );
      });
    },
    rowUpdates(row, index, done, loading) {
      // console.log(42342);
      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: "操作成功!",
          });
        });
    },
    // beforeOpen(done, type) {
    //   if (["edit", "view"].includes(type)) {
    //     getDetail(this.form.id).then((res) => {
    //       this.form = res.data.data;
    //     });
    //   }
    //   done();
    // },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      params["startTime"] = params.releaseTimeRange[0];
      params["endTime"] = params.releaseTimeRange[1];
      // params["startTime"] = params.releaseTimeRange[0];
      // params["endTime"] = params.releaseTimeRange[1];
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
@@ -520,14 +401,27 @@
      this.onLoad(this.page, this.sort);
    },
    onLoad(page, params = {}) {
      // this.loading = false;
      params = this.search;
      params = Object.assign(params, this.sort);
      this.loading = true;
      // this.loading = true;
      params["status"] = 1;
      let values = {
        ...params,
      };
      const { releaseTimeRange } = this.search;
      if (releaseTimeRange) {
        values = {
          ...params,
          startTime: releaseTimeRange[0],
          endTime: releaseTimeRange[1],
          ...this.query,
        };
        values.releaseTimeRange = null;
      }
      getListSecurity(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
        Object.assign(values, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
@@ -550,47 +444,13 @@
          d[k]["age"] = this.getyears() - sfz;
        }
        this.data = d;
        this.$store.commit("setWindowSizeHeightAdd");
        // this.data = data.records;
        // console.log(this.data);
        this.$store.commit("setWindowSizeHeightAdd");
        this.loading = false;
        // this.selectionClear();
      });
    },
    // onLoad(page, params = {}) {
    //   // this.loading = false;
    //   this.loading = true;
    //   //   getListJSON().then((res) => {
    //   //   axios
    //   //     .get(
    //   //       "../../api/qualificationExamination/signQualificationExamination.json"
    //   //     )
    //   //     .then((res) => {
    //   // page.currentPage,
    //   // page.pageSize,
    //   // Object.assign(params, this.query)
    //   if (datasing) {
    //     var res = datasing;
    //     console.log(res, "signQualificationExamination");
    //     const data = res.data;
    //     // this.page.total = data.total;
    //     var d = data.records;
    //     for (var k in d) {
    //       d[k].examination_mx = "正常";
    //       d[k].examination_type = "正常";
    //       d[k]["carid"] = "370111198807051124";
    //       d[k]["certificate"] = "拥有";
    //       d[k]["reviewTime"] = "2021-02-21";
    //       d[k]["results"] = "通过";
    //       d[k]["onjob"] = "是";
    //     }
    //     this.data = d;
    //     this.loading = false;
    //   }
    //   // this.selectionClear();
    //   // });
    // },
    // 行单击
    handleRowClick(row) {
      // delete (row["name"]);