liuyg
2021-09-24 c4e67a8942e514b65ab41bb19781d50576c15725
src/views/securityEquipment/gun.vue
@@ -36,6 +36,7 @@
import { getdata, adddata, update, remove } from "@/api/gun/gun";
export default {
  props: ["fromDeptId"],
  data() {
    return {
      loading: true,
@@ -56,7 +57,9 @@
        index: true,
        menuWidth: 160,
        align: "center",
        border: true,
        selection: true,
        labelWidth:110,
        column: column,
      },
    };
@@ -87,8 +90,11 @@
      //   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;
      }
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -117,8 +123,11 @@
    },
    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;
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
@@ -181,6 +190,19 @@
    },
    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;
      } 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;
      }
      getdata(
        page.currentPage,
        page.pageSize,