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