保安服务企业管理项目备份
liuyg
2021-09-24 c4e67a8942e514b65ab41bb19781d50576c15725
src/views/securityEquipment/gun.vue
@@ -1,32 +1,34 @@
<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>
@@ -34,6 +36,7 @@
import { getdata, adddata, update, remove } from "@/api/gun/gun";
export default {
  props: ["fromDeptId"],
  data() {
    return {
      loading: true,
@@ -50,10 +53,13 @@
        tip: false,
        searchSize: "mini",
        searchMenuSpan: 6,
        height: 627,
        height: 583,
        index: true,
        menuWidth: 160,
        align: "center",
        border: true,
        selection: true,
        labelWidth:110,
        column: column,
      },
    };
@@ -84,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);
@@ -114,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);
@@ -178,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,