liuyg
2021-09-25 aab7ba71765b91c568d606744b3376c2798dd969
权限  保安公司管理员
13 files modified
841 ■■■■■ changed files
src/page/login/codelogin.vue 2 ●●● patch | view | raw | blame | history
src/views/dispatch/dispatch.vue 21 ●●●● patch | view | raw | blame | history
src/views/dispatch/dispatchChildoperable.vue 13 ●●●●● patch | view | raw | blame | history
src/views/recruitmentManagement/data.js 4 ●●●● patch | view | raw | blame | history
src/views/recruitmentManagement/index.vue 24 ●●●●● patch | view | raw | blame | history
src/views/securityEquipment/car.js 16 ●●●● patch | view | raw | blame | history
src/views/securityEquipment/car.vue 64 ●●●● patch | view | raw | blame | history
src/views/securityEquipment/equipments.js 6 ●●●●● patch | view | raw | blame | history
src/views/securityEquipment/equipments.vue 80 ●●●●● patch | view | raw | blame | history
src/views/securityEquipment/gun.js 12 ●●●●● patch | view | raw | blame | history
src/views/securityEquipment/gun.vue 61 ●●●● patch | view | raw | blame | history
src/views/securityGuard/securityGuard.vue 4 ●●●● patch | view | raw | blame | history
src/views/zc/zc.vue 534 ●●●● patch | view | raw | blame | history
src/page/login/codelogin.vue
@@ -305,7 +305,7 @@
      this.$refs.loginForm.validate((valid) => {
        if (valid) {
          this.refreshCode(this.loginForm);
          this.message("dahsiofhiusa");
          // this.message("dahsiofhiusa");
          return Promise.reject(new Error("注册成功,待审核"));
        }
      });
src/views/dispatch/dispatch.vue
@@ -377,6 +377,8 @@
          },
        ],
      },
      useifid: 266,
    };
  },
  created() {
@@ -387,6 +389,7 @@
      deptColumn.editDisplay = false;
      deptColumn.viewDisplay = false;
      deptColumn.hide = true;
      this.useifid = this.userInfo.dept_id;
    }
  },
  computed: {
@@ -405,9 +408,9 @@
      });
      return ids1.join(",");
    },
        ...mapState({
    ...mapState({
      userInfo: (state) => state.user.userInfo,
        })
    }),
  },
  methods: {
    handleChangeTABS(column) {
@@ -436,7 +439,10 @@
      //   this.$message.success("页码" + val);
    },
    rowSave(form, done, loading) {
      form["deptId"] = this.userInfo.dept_id;
      // form["deptId"] = this.userInfo.dept_id;
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -464,6 +470,9 @@
      this.onLoad(this.page);
    },
    rowUpdate(row, index, done, loading) {
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
@@ -575,8 +584,10 @@
          ...this.query,
        };
      }
      console.log(values);
      if (this.useifid != 266) {
        values["deptId"] = this.useifid;
      }
      // console.log(values);
      getdata(
        page.currentPage,
src/views/dispatch/dispatchChildoperable.vue
@@ -275,6 +275,7 @@
          },
        ],
      },
      useifid: 266,
    };
  },
  created() {
@@ -282,6 +283,8 @@
      console.log("保安公司管理员登入");
      const deptColumn = this.findObject(this.option1.column, "deptId");
      deptColumn.search = false;
      deptColumn.hide = true;
      this.useifid = this.userInfo.dept_id;
    } else {
      const deptColumn = this.findObject(
        this.option1.column,
@@ -338,7 +341,9 @@
      //   const userColumn = this.findObject(this.option1.column, "userIds");
      //   userColumn.dicUrl = "/api/blade-user/page-security-units?deptId="+this.userInfo.dept_id;
      // }
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata1(form).then(
        (res) => {
          this.onLoad1(this.page1);
@@ -370,6 +375,9 @@
      //   const userColumn = this.findObject(this.option1.column, "userIds");
      //   userColumn.dicUrl = "/api/blade-user/page-security-units?deptId="+this.userInfo.dept_id;
      // }
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update1(row).then(
        () => {
          this.onLoad1(this.page1);
@@ -490,6 +498,9 @@
      } else {
        this.initData(1);
      }
      if (this.useifid != 266) {
        values["deptId"] = this.useifid;
      }
      getdata1(
        page.currentPage,
src/views/recruitmentManagement/data.js
@@ -62,8 +62,8 @@
            value: "id"
        },
        hide: true,
        // search: true,
        type: "select",
        search: true,
        type: "tree",
    },
    {
        label: "招聘岗位",
src/views/recruitmentManagement/index.vue
@@ -40,6 +40,7 @@
  remove,
} from "@/api/recruitmentManagement/recruitmentManagement";
import { mapGetters } from "vuex";
export default {
  data() {
    return {
@@ -65,9 +66,21 @@
        selection: true,
        column: column,
      },
      useifid: 266,
    };
  },
  created() {
    if (this.userInfo.role_name == "保安公司管理员") {
      this.useifid = this.userInfo.dept_id;
      const deptColumn = this.findObject(this.option.column, "deptId");
      deptColumn.search = false;
      deptColumn.hide = true;
      deptColumn.disabled = true;
      deptColumn.value = this.useifid;
    }
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
@@ -93,6 +106,9 @@
      //   var form = this.data[0];
      //   delete form.id;
      //   for (var k = 0; k < 13; k++) {
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -120,7 +136,9 @@
      this.onLoad(this.page);
    },
    rowUpdate(row, index, done, loading) {
      console.log(row);
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
@@ -183,6 +201,9 @@
    },
    onLoad(page, params = {}) {
      this.loading = true;
      if (this.useifid != 266) {
        params["deptId"] = this.useifid;
      }
      getdata(
        page.currentPage,
        page.pageSize,
@@ -192,7 +213,6 @@
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        console.log(this.data);
        this.loading = false;
      });
    },
src/views/securityEquipment/car.js
@@ -76,25 +76,25 @@
    {
        label: "所属保安公司",
        prop: "deptId",
        searchSpan: 6,
        searchLabelWidth: 110,
        rules: [{
            required: true,
            message: "请输入保安公司",
            message: "请输入所属保安公司",
            trigger: "blur"
        }],
        search: true,
        // addDisplay: true,
        // editDisplay: true,
        // viewDisplay: true,
        searchSpan: 4,
        searchLabelWidth: 110,
        hide: true,
        addDisplay: false,
        editDisplay: false,
        search: false,
        overHidden: true,
        // searchSpan: 4,
        dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
        props: {
            label: "title",
            value: "id"
        },
        type: "tree",
        width: 250,
    },
    {
        label: "责任人",
src/views/securityEquipment/car.vue
@@ -26,7 +26,7 @@
            >删 除
          </el-button>
          <el-button
            style="display:none"
            style="display: none"
            type="success"
            size="small"
            plain
@@ -61,7 +61,7 @@
<script>
import { data, column } from "./car";
import { getdata, adddata, update, remove } from "@/api/car/car";
import { mapGetters } from "vuex";
export default {
  props: ["fromDeptId"],
  data() {
@@ -114,12 +114,14 @@
        menuWidth: 160,
        align: "center",
        selection: true,
        labelWidth:110,
        labelWidth: 110,
        column: column,
      },
      useifid: 266,
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
@@ -127,6 +129,14 @@
      });
      return ids.join(",");
    },
  },
  created() {
    if (
      this.userInfo.role_name == "装备管理员" ||
      this.userInfo.role_name == "保安公司管理员"
    ) {
      this.useifid = this.userInfo.dept_id;
    }
  },
  methods: {
    handleImport() {
@@ -164,6 +174,9 @@
      if (this.fromDeptId != undefined) {
        form["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -196,6 +209,9 @@
      // delete row.tenantName;
      if (this.fromDeptId != undefined) {
        row["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update(row).then(
        () => {
@@ -257,20 +273,46 @@
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    closeDep(name) {
      for (let k in this.option.column) {
        if (this.option.column[k].prop == name) {
          this.option.column[k].search = false;
          this.option.column[k].hide = true;
          this.option.column[k].addDisplay = false;
          this.option.column[k].editDisplay = false;
        }
      }
    },
    openDep(name) {
      for (let k in this.option.column) {
        if (this.option.column[k].prop == name) {
          this.option.column[k].search = true;
          this.option.column[k].hide = false;
          this.option.column[k].addDisplay = true;
          this.option.column[k].editDisplay = true;
        }
      }
    },
    onLoad(page, params = {}) {
      this.loading = true;
      // console.log(params.deptId);
      if (this.fromDeptId != undefined) {
        params["deptId"] = this.fromDeptId;
        this.option.column[4].search = false;
        this.option.column[4].hide = true;
        this.option.column[4].addDisplay = false;
        this.option.column[4].editDisplay = false;
        // this.closeDep("deptId");
      } else if (this.useifid != 266) {
        console.log(123);
        params["deptId"] = this.useifid;
        // this.closeDep("deptId");
        // for (let k in this.option.column) {
        // if (this.option.column[k].prop == "deptId") {
        // this.option.column[4].search = false;
        // this.option.column[k].hide = true;
        // this.option.column[k].addDisplay = false;
        // this.option.column[k].editDisplay = false;
        // }
        // }
      } else {
        this.option.column[4].search = true;
        this.option.column[4].hide = false;
        this.option.column[4].addDisplay = true;
        this.option.column[4].editDisplay = true;
        this.openDep("deptId");
      }
      getdata(
        page.currentPage,
src/views/securityEquipment/equipments.js
@@ -56,8 +56,10 @@
        message: "请输入所属保安公司",
        trigger: "blur"
    }],
    hide: false,
    search: true,
    hide: true,
    addDisplay: false,
    editDisplay: false,
    search: false,
    overHidden: true,
    dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
    props: {
src/views/securityEquipment/equipments.vue
@@ -60,7 +60,7 @@
<script>
import { data, column } from "./equipments";
import { getdata, adddata, update, remove } from "@/api/equipments/equipments";
import { mapGetters } from "vuex";
export default {
  props: ["fromDeptId"],
  data() {
@@ -116,9 +116,12 @@
        column: column,
        labelWidth: 110,
      },
      useifid: 266,
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
@@ -126,6 +129,14 @@
      });
      return ids.join(",");
    },
  },
  created() {
    if (
      this.userInfo.role_name == "装备管理员" ||
      this.userInfo.role_name == "保安公司管理员"
    ) {
      this.useifid = this.userInfo.dept_id;
    }
  },
  methods: {
    handleImport() {
@@ -164,6 +175,9 @@
      if (this.fromDeptId != undefined) {
        form["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -197,6 +211,9 @@
      // console.log(row.deptId);
      if (this.fromDeptId != undefined) {
        row["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update(row).then(
        () => {
@@ -258,39 +275,48 @@
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    closeDep(name) {
      for (let k in this.option.column) {
        if (this.option.column[k].prop == name) {
          this.option.column[k].search = false;
          this.option.column[k].hide = true;
          this.option.column[k].addDisplay = false;
          this.option.column[k].editDisplay = false;
        }
      }
    },
    openDep(name) {
      for (let k in this.option.column) {
        if (this.option.column[k].prop == name) {
          this.option.column[k].search = true;
          this.option.column[k].hide = false;
          this.option.column[k].addDisplay = true;
          this.option.column[k].editDisplay = true;
        }
      }
    },
    onLoad(page, params = {}) {
      this.loading = true;
      // console.log(params.deptId);
      if (this.fromDeptId != undefined) {
        params["deptId"] = this.fromDeptId;
        for (let k in this.option.column) {
          if (this.option.column[k].prop == "deptId") {
            this.option.column[k].search = false;
            this.option.column[k].hide = true;
            this.option.column[k].addDisplay = false;
            this.option.column[k].editDisplay = false;
          }
        }
        // this.option.column[4].  = false;
        // this.option.column[6].search = false;
        // this.option.column[6].hide = true;
        // this.option.column[6].addDisplay = false;
        // this.option.column[6].editDisplay = false;
        // this.closeDep("deptId");
      } else if (this.useifid != 266) {
        console.log(123);
        params["deptId"] = this.useifid;
        // this.closeDep("deptId");
        // for (let k in this.option.column) {
        // if (this.option.column[k].prop == "deptId") {
        // this.option.column[4].search = false;
        // this.option.column[k].hide = true;
        // this.option.column[k].addDisplay = false;
        // this.option.column[k].editDisplay = false;
        // }
        // }
      } else {
        for (let k in this.option.column) {
          if (this.option.column[k].prop == "deptId") {
            this.option.column[k].search = true;
            this.option.column[k].hide = false;
            this.option.column[k].addDisplay = true;
            this.option.column[k].editDisplay = true;
          }
        }
        // this.option.column[4].search = true;
        //   this.option.column[6].search = true;
        // this.option.column[6].hide = false;
        // this.option.column[6].addDisplay = true;
        // this.option.column[6].editDisplay = true;
        this.openDep("deptId");
      }
      getdata(
        page.currentPage,
        page.pageSize,
src/views/securityEquipment/gun.js
@@ -68,23 +68,25 @@
{
    label: "所属保安公司",
    prop: "deptId",
    search: true,
    searchSpan: 4,
    searchSpan: 6,
    searchLabelWidth: 110,
    labelWidth: 160,
    rules: [{
        required: true,
        message: "请输入组织机构",
        message: "请输入所属保安公司",
        trigger: "blur"
    }],
    hide: true,
    addDisplay: false,
    editDisplay: false,
    search: false,
    overHidden: true,
    // searchSpan: 4,
    dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
    props: {
        label: "title",
        value: "id"
    },
    type: "tree",
    width: 250,
},
{
    label: "责任人",
src/views/securityEquipment/gun.vue
@@ -35,6 +35,7 @@
import { data, column } from "./gun";
import { getdata, adddata, update, remove } from "@/api/gun/gun";
import { mapGetters } from "vuex";
export default {
  props: ["fromDeptId"],
  data() {
@@ -59,12 +60,14 @@
        align: "center",
        border: true,
        selection: true,
        labelWidth:110,
        labelWidth: 110,
        column: column,
      },
      useifid: 266,
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
@@ -72,6 +75,14 @@
      });
      return ids.join(",");
    },
  },
  created() {
    if (
      this.userInfo.role_name == "装备管理员" ||
      this.userInfo.role_name == "保安公司管理员"
    ) {
      this.useifid = this.userInfo.dept_id;
    }
  },
  methods: {
    sizeChange(val) {
@@ -94,6 +105,9 @@
      // delete form.tenantName;
      if (this.fromDeptId != undefined) {
        form["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata(form).then(
        (res) => {
@@ -127,6 +141,9 @@
      // delete row.tenantName;
      if (this.fromDeptId != undefined) {
        row["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update(row).then(
        () => {
@@ -188,20 +205,46 @@
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    closeDep(name) {
      for (let k in this.option.column) {
        if (this.option.column[k].prop == name) {
          this.option.column[k].search = false;
          this.option.column[k].hide = true;
          this.option.column[k].addDisplay = false;
          this.option.column[k].editDisplay = false;
        }
      }
    },
    openDep(name) {
      for (let k in this.option.column) {
        if (this.option.column[k].prop == name) {
          this.option.column[k].search = true;
          this.option.column[k].hide = false;
          this.option.column[k].addDisplay = true;
          this.option.column[k].editDisplay = true;
        }
      }
    },
    onLoad(page, params = {}) {
      this.loading = true;
      // console.log(params.deptId);
      if (this.fromDeptId != undefined) {
        params["deptId"] = this.fromDeptId;
        this.option.column[5].search = false;
        this.option.column[5].hide = true;
        this.option.column[5].addDisplay = false;
        this.option.column[5].editDisplay = false;
        // this.closeDep("deptId");
      } else if (this.useifid != 266) {
        console.log(123);
        params["deptId"] = this.useifid;
        // this.closeDep("deptId");
        // for (let k in this.option.column) {
        // if (this.option.column[k].prop == "deptId") {
        // this.option.column[4].search = false;
        // this.option.column[k].hide = true;
        // this.option.column[k].addDisplay = false;
        // this.option.column[k].editDisplay = false;
        // }
        // }
      } else {
        this.option.column[5].search = true;
        this.option.column[5].hide = false;
        this.option.column[5].addDisplay = true;
        this.option.column[5].editDisplay = true;
        this.openDep("deptId");
      }
      getdata(
        page.currentPage,
src/views/securityGuard/securityGuard.vue
@@ -589,7 +589,7 @@
                },
                action: "/api/blade-resource/oss/endpoint/put-files",
                tip: "只能上传jpg/png个人头像,且不超过500kb",
                span: 10,
                span: 12,
                // row: true,
                prop: "avatar",
              },
@@ -607,7 +607,7 @@
                },
                action: "/api/blade-resource/oss/endpoint/put-files",
                tip: "只能上传jpg/png指纹信息,且不超过500kb",
                span: 10,
                span: 12,
                // row: true,
                prop: "fingerprint",
              },
src/views/zc/zc.vue
@@ -1,295 +1,327 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      :permission="permissionList"
      :before-open="beforeOpen"
      v-model="form"
      ref="crud"
      @row-update="rowUpdate"
      @row-save="rowSave"
      @row-del="rowDel"
      @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"
                   plain
                   v-if="permission.zc_delete"
                   @click="handleDelete">删 除
        <el-button
          type="danger"
          size="small"
          icon="el-icon-delete"
          plain
          v-if="permission.zc_delete"
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
    <template slot-scope="{row}" slot="type">
        <el-tag>{{row.type==='0'?'未审核':row.type==='1'?'审核通过':'审核未通过'}}</el-tag>
      <template slot-scope="{ row }" slot="type">
        <el-tag>{{
          row.type === "0"
            ? "未审核"
            : row.type === "1"
            ? "审核通过"
            : "审核未通过"
        }}</el-tag>
      </template>
      <template slot-scope="{row}"
                slot="roleName">
        <el-tag>{{row.roleName}}</el-tag>
      <template slot-scope="{ row }" slot="roleName">
        <el-tag>{{ row.roleName }}</el-tag>
      </template>
      <template slot-scope="scope" slot="menu">
        <el-button icon="el-icon-check" size="small"  @click.stop="handleEdit(scope.row,scope.index)">审核</el-button>
        <el-button
          icon="el-icon-check"
          size="small"
          @click.stop="handleEdit(scope.row, scope.index)"
          >审核</el-button
        >
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/zc/zc";
  import {getRoleTree} from "@/api/system/role";
  import {mapGetters} from "vuex";
import { getList, getDetail, add, update, remove } from "@/api/zc/zc";
import { getRoleTree } from "@/api/system/role";
import { mapGetters } from "vuex";
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 54,
          tip: false,
          searchShow: true,
          searchMenuSpan: 4,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          headerAlign: 'center',
          align: 'center',
          dialogClickModal: false,
          column: [
            {
              label: "账号",
              searchSpan:4,
              display: false,
              search: true,
              disabled:true,
              prop: "username",
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 54,
        tip: false,
        searchShow: true,
        searchMenuSpan: 4,
        border: true,
        index: true,
        viewBtn: true,
        selection: true,
        headerAlign: "center",
        align: "center",
        dialogClickModal: false,
        column: [
          {
            label: "账号",
            searchSpan: 4,
            display: false,
            search: true,
            disabled: true,
            prop: "username",
          },
          {
            label: "密码",
            hide: true,
            editDisplay: false,
            viewDisplay: false,
            prop: "password",
          },
          {
            label: "姓名",
            display: false,
            search: true,
            searchSpan: 4,
            disabled: true,
            prop: "sname",
          },
          {
            label: "身份证号",
            disabled: true,
            search: true,
            display: false,
            prop: "cardid",
          },
          {
            label: "部门",
            editDisplay: false,
            prop: "deptName",
          },
          {
            label: "角色",
            prop: "parentId",
            hide: true,
            dicData: [],
            type: "tree",
            props: {
              label: "title",
            },
            {
              label: "密码",
              hide: true,
              editDisplay: false,
              viewDisplay: false,
              prop: "password",
            },
            {
              label: "姓名",
              display: false,
              search: true,
              searchSpan:4,
              disabled:true,
              prop: "sname",
            },
            {
              label: "身份证号",
              disabled:true,
              search: true,
              display: false,
              prop: "cardid",
            },
            {
              label: "部门",
              editDisplay: false,
              prop: "deptName",
            },
            {
              label: "角色",
              prop: "parentId",
              hide: true,
              dicData: [],
              type: "tree",
              props: {
                label: "title"
          },
          {
            label: "审核状态",
            prop: "type",
            search: true,
            slot: true,
            searchSpan: 4,
            type: "select",
            dicData: [
              {
                label: "未审核",
                value: "0",
              },
            },
            {
              label: "审核状态",
              prop: "type",
              search: true,
              slot: true,
              searchSpan:4,
              type: "select",
              dicData: [
                {
                  label: "未审核",
                  value: "0"
                },
                {
                  label: "审核通过",
                  value: "1"
                },
                {
                  label: "审核不通过",
                  value: "2"
                }
              ],
            }
          ]
        },
        data: []
              {
                label: "审核通过",
                value: "1",
              },
              {
                label: "审核不通过",
                value: "2",
              },
            ],
          },
        ],
      },
      data: [],
    };
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.zc_add, false),
        viewBtn: this.vaildData(this.permission.zc_view, true),
        delBtn: this.vaildData(this.permission.zc_delete, false),
        editBtn: this.vaildData(this.permission.zc_edit, false),
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
         addBtn: this.vaildData(this.permission.zc_add, false),
          viewBtn: this.vaildData(this.permission.zc_view, true),
          delBtn: this.vaildData(this.permission.zc_delete, false),
          editBtn: this.vaildData(this.permission.zc_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    methods: {
      initData(){
        getRoleTree().then(res => {
          const column = this.findObject(this.option.column, "parentId");
          column.dicData = res.data.data;
        });
      },
      handleEdit (row, index) {
        this.initData();
        this.$refs.crud.rowEdit(row, index);
      },
      rowSave(row, done, loading) {
        add(row).then(() => {
  },
  methods: {
    initData(d) {
      getRoleTree().then((res) => {
        const column = this.findObject(this.option.column, "parentId");
        var k = res.data.data;
        var b = [];
        if (d == "保安公司管理员") {
          console.log(k);
          for (var n in k) {
            if (k[n].title == "保安" || k[n].title == "保安公司管理员") {
              b.push(k[n]);
            }
          }
          column.dicData = b;
        } else {
          column.dicData = k;
        }
      });
    },
    handleEdit(row, index) {
      this.initData(this.userInfo.role_name);
      this.$refs.crud.rowEdit(row, index);
    },
    rowSave(row, done, loading) {
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
            message: "操作成功!",
          });
          done();
        }, error => {
        },
        (error) => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
            message: "操作成功!",
          });
          done();
        }, error => {
        },
        (error) => {
          loading();
          console.log(error);
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
      },
      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.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      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) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
          this.$refs.crud.toggleSelection();
        });
    },
    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) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    },
  },
};
</script>
<style>
</style>