保安服务企业管理项目备份
liuyg
2021-09-27 8c6cf205affbbc8ada74f00a7ca25ebca867e9ed
src/views/securityEquipment/gun.vue
@@ -1,39 +1,43 @@
<template>
  <div class="equipments">
    <avue-crud
      :option="option"
      :data="data"
      :page.sync="page"
      ref="crudrec"
      @on-load="onLoad"
      :table-loading="loading"
      @row-save="rowSave"
      @search-change="searchChange"
      @search-reset="searchReset"
      @row-update="rowUpdate"
      @row-del="rowDel"
      @selection-change="selectionChange"
      @refresh-change="refreshChange"
    >
      <template slot="menuLeft">
        <el-button
          type="danger"
          size="small"
          plain
          icon="el-icon-delete"
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
    </avue-crud>
  </div>
  <basic-container>
    <div class="equipments">
      <avue-crud
        :option="option"
        :data="data"
        :page.sync="page"
        ref="crudrec"
        @on-load="onLoad"
        :table-loading="loading"
        @row-save="rowSave"
        @search-change="searchChange"
        @search-reset="searchReset"
        @row-update="rowUpdate"
        @row-del="rowDel"
        @selection-change="selectionChange"
        @refresh-change="refreshChange"
      >
        <template slot="menuLeft">
          <el-button
            type="danger"
            size="small"
            plain
            icon="el-icon-delete"
            @click="handleDelete"
            >删 除
          </el-button>
        </template>
      </avue-crud>
    </div>
  </basic-container>
</template>
<script>
import { data, column } from "./gun";
import { getdata, adddata, update, remove } from "@/api/gun/gun";
import { mapGetters } from "vuex";
export default {
  props: ["fromDeptId"],
  data() {
    return {
      loading: true,
@@ -50,15 +54,20 @@
        tip: false,
        searchSize: "mini",
        searchMenuSpan: 6,
        height: 627,
        height: 583,
        index: true,
        menuWidth: 160,
        align: "center",
        border: true,
        selection: true,
        labelWidth: 110,
        column: column,
      },
      useifid: 266,
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
@@ -66,6 +75,24 @@
      });
      return ids.join(",");
    },
  },
  created() {
    var that = this;
    if (
      this.userInfo.role_name == "装备管理员" ||
      this.userInfo.role_name == "保安公司管理员"
    ) {
      this.useifid = this.userInfo.dept_id;
    }
    //公安局进入
    if (this.userInfo.role_name == "公安管理员") {
      that.option.column[5].dicUrl =
        "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
        that.userInfo.jurisdiction;
    } else {
      that.option.column[5].dicUrl =
        "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
    }
  },
  methods: {
    sizeChange(val) {
@@ -84,8 +111,14 @@
      //   var form = this.data[0];
      //   delete form.id;
      //   for (var k = 0; k < 13; k++) {
      form["deptId"] = form.tenantName;
      delete form.tenantName;
      // form["deptId"] = form.tenantName;
      // delete form.tenantName;
      if (this.fromDeptId != undefined) {
        form["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -114,8 +147,14 @@
    },
    rowUpdate(row, index, done, loading) {
      // console.log(row);
      row["deptId"] = row.tenantName;
      delete row.tenantName;
      // row["deptId"] = row.tenantName;
      // delete row.tenantName;
      if (this.fromDeptId != undefined) {
        row["deptId"] = this.fromDeptId;
      }
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
@@ -176,8 +215,52 @@
    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;
      var that = this;
      // console.log(params.deptId);
      if (this.fromDeptId != undefined) {
        params["deptId"] = this.fromDeptId;
        // 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.openDep("deptId");
      }
      //公安局进入
      if (this.userInfo.role_name == "公安管理员") {
        params["jurisdiction"] = that.userInfo.jurisdiction;
      }
      getdata(
        page.currentPage,
        page.pageSize,