liuyg
2021-09-25 aab7ba71765b91c568d606744b3376c2798dd969
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,