shuishen
2021-09-03 2d50c51214f0ced8c992a415c72ea33b519fff59
src/views/statisticalQueryManagement/securityGuardDetail.vue
New file
@@ -0,0 +1,315 @@
<template>
  <basic-container>
    <avue-crud
      :option="tableOption"
      :table-loading="loading"
      :data="data"
      ref="crud"
      v-model="form"
      :permission="permissionList"
      :page.sync="page"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @row-click="handleRowClick"
    >
    </avue-crud>
  </basic-container>
</template>
<script>
import { mapGetters } from "vuex";
import { pageSecurity } from "../../api/statisticalQueryManagement/statisticalQueryManagement";
export default {
  name: "保安员明细",
  data() {
    return {
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      query: {},
      value1: "",
      value2: "",
      tableData: [
        // {
        //   company: "江西省永安保安服务有限公司",
        //   subOffice: "南昌市公安局",
        //   timeStart: "2020-07-14",
        //   timeEnd: "2021-06-30",
        //   customerName: "南昌市幼儿园",
        //   num: "7",
        //   // status: "正在服务",
        //   bz: ""
        // },
        // {
        //   company: "南昌市赣水保安服务有限公司",
        //   subOffice: "东湖分局",
        //   timeStart: "2020-01-23",
        //   timeEnd: "2020-12-31",
        //   customerName: "南昌市第一人民医院",
        //   num: "32",
        //   // status: "已完成",
        //   bz: ""
        // },
        // {
        //   company: "江西中业兴达保安服务有限公司",
        //   subOffice: "西湖分局",
        //   timeStart: "2020-03-16",
        //   timeEnd: "2021-7-29",
        //   customerName: "南昌市动物园",
        //   num: "12",
        //   // status: "未下单",
        //   bz: ""
        // }
      ],
      tablePage: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      tableOption: {
        excelBtn: true,
        delBtn: false,
        editBtn: false,
        addBtn: false,
        selection: true,
        menu: false,
        // dateBtn: true,
        align: "center",
        height: "auto",
        calcHeight: 30,
        tip: false,
        searchShowBtn: false,
        searchShow: true,
        searchMenuSpan: 6,
        index: true,
        viewBtn: true,
        dialogClickModal: false,
        column: [
          {
            label: "保安姓名",
            prop: "realName",
            search: true,
            searchSpan: 4,
            display: false
          },
          {
            label: "性别",
            prop: "sex",
            type: "select",
            // search: true,
            searchSpan: 4,
            searchLabelWidth: 50,
            dicData: [
              {
                label: "女",
                value: 2
              },
              {
                label: "男",
                value: 1
              }
            ],
            slot: true,
            display: false
          },
          {
            label: "保安公司",
            prop: "deptName",
            width: 300,
            // search: true,
            // searchSpan: 4,
            overHidden: true,
            slot: true,
            display: false
          },
          {
            label: "保安证编号",
            prop: "securitynumber",
            display: false,
            searchSpan: 5,
            searchLabelWidth: 110,
            width: 180
            // search: true,
          },
          {
            label: "身份证号",
            prop: "cardid",
            slot: true,
            display: false,
            width: 180
          },
          {
            label: "联系方式",
            prop: "phone",
            slot: true,
            display: false,
            width: 180
          },
          // {
          //   label: "联系地址",
          //   prop: "address",
          //   slot: true,
          //   display: false,
          //   hide: true
          // },
          {
            label: "入职时间",
            prop: "rtime",
            slot: true,
            display: false,
            width: 180
          },
          // {
          //   label: "所属角色",
          //   prop: "roleName",
          //   slot: true,
          //   display: false,
          //   width: 78,
          //   hide: true
          // },
          // {
          //   label: "所属辖区",
          //   prop: "jurisdiction",
          //   // multiple: true,
          //   minWidth: 60,
          //   type: "tree",
          //   dicUrl: "/api/jurisdiction/lazy-tree?parentId=0",
          //   props: {
          //     label: "title",
          //     value: "id",
          //   },
          //   checkStrictly: true,
          //   slot: true,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择所属辖区",
          //       trigger: "click",
          //     },
          //   ],
          // },
          {
            label: "是否在职",
            prop: "status",
            type: "select",
            search: true,
            searchSpan: 4,
            dicData: [
              {
                label: "否",
                value: 2
              },
              {
                label: "是",
                value: 1
              }
            ],
            slot: true,
            display: false,
          },
          {
            label: "是否持证",
            prop: "hold",
            type: "select",
            search: true,
            searchSpan: 4,
            dicData: [
              {
                label: "是",
                value: "0"
              },
              {
                label: "否",
                value: "1"
              },
              {
                label: "已吊销",
                value: "2"
              }
            ],
            slot: true,
            display: false,
          }
        ]
      },
      typeValue: "0",
      servicesList: [],
      companyName: "",
      loading: true
    };
  },
  computed: {
    ...mapGetters(["permission"]),
    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)
      };
    }
  },
  methods: {
    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 = {}) {
      this.loading = true;
      let param = {};
      param["realName"] = params["realName"] || "";
      param["status"] = params["status"] || "";
      param["deptId"] = this.deptid;
      param["hold"] = params["hold"] || "";
      param["current"] = page.currentPage;
      param["size"] = page.pageSize;
      pageSecurity(param).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
      });
    },
    getLocationParams() {
      let url = window.location.href;
      let urlArr = url.split("?")[1].split("&");
      var object = new Object();
      for (var i = 0; i < urlArr.length; i++) {
        let mm = urlArr[i].split("=");
        object[decodeURIComponent(mm[0])] = decodeURIComponent(mm[1]);
      }
      this.deptid = object["departmentid"] || "";
      this.query = { deptid: this.deptid };
      this.onLoad(this.page, this.query);
      //   this.onLoad(this.page, this.query);
    }
  },
  mounted() {
    this.getLocationParams();
  }
};
</script>