src/views/securityEquipment/car.vue
@@ -1,65 +1,65 @@
<template>
  <basic-container>
    <div
      :class="[
        'equipments',
        $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
      ]"
  <basic-container
    :class="[
      'equipments',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      v-if="visible"
      :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"
    >
      <avue-crud
        v-if="visible"
        :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>
        <el-button
          type="success"
          size="small"
          plain
          icon="el-icon-upload2"
          @click="handleImport"
          >批量导入
        </el-button>
      </template>
    </avue-crud>
    <el-dialog
      title="车辆导入"
      append-to-body
      :visible.sync="excelBox"
      width="555px"
    >
      <avue-form
        :option="excelOption"
        v-model="excelForm"
        :upload-after="uploadAfter"
      >
        <template slot="menuLeft">
          <el-button
            type="danger"
            size="small"
            plain
            icon="el-icon-delete"
            @click="handleDelete"
            >删 除
          </el-button>
          <el-button
            type="success"
            size="small"
            plain
            icon="el-icon-upload2"
            @click="handleImport"
            >批量导入
        <template slot="excelTemplate">
          <el-button type="primary" @click="handleTemplate">
            点击下载<i class="el-icon-download el-icon--right"></i>
          </el-button>
        </template>
      </avue-crud>
      <el-dialog
        title="车辆导入"
        append-to-body
        :visible.sync="excelBox"
        width="555px"
      >
        <avue-form
          :option="excelOption"
          v-model="excelForm"
          :upload-after="uploadAfter"
        >
          <template slot="excelTemplate">
            <el-button type="primary" @click="handleTemplate">
              点击下载<i class="el-icon-download el-icon--right"></i>
            </el-button>
          </template>
        </avue-form>
      </el-dialog>
    </div>
      </avue-form>
    </el-dialog>
  </basic-container>
</template>
@@ -70,19 +70,6 @@
import { getToken } from "@/util/auth";
export default {
  props: ["fromDeptId", "windowHeight"],
  watch: {
    windowHeight() {
      if (!this.windowHeight) {
        return;
      }
      this.option.height = this.windowHeight - 320;
      this.visible = false;
      this.$nextTick(() => {
        this.visible = true;
        this.refreshChange();
      });
    },
  },
  data() {
    return {
      visible: true,
@@ -101,18 +88,18 @@
            loadText: "文件上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
              res: "data"
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/car/import-car?deptId=" + this.deptIds,
            action: "/api/car/import-car?deptId=" + this.deptIds
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
            span: 24
          }
        ]
      },
      loading: true,
@@ -120,7 +107,7 @@
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        total: 0
      },
      query: {},
      data: [],
@@ -137,22 +124,23 @@
        selection: true,
        labelWidth: 110,
        column: column,
        ...this.$store.state.control.clearOtherBut,
        ...this.$store.state.control.clearOtherBut
      },
      useifid: 266,
      useifid: 266
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    }
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
    this.deptIds = this.userInfo.dept_id;
  },
  created() {
@@ -170,7 +158,7 @@
      //查询保安单位信息(包含子级)
      const column = this.findObject(this.option.column, "deptId");
      column.addDisplay = true;
       column.editDisplay = true;
      column.editDisplay = true;
      // column.search = false;
      //默认全部展开
      column.defaultExpandAll = true;
@@ -204,10 +192,9 @@
      done();
    },
    handleTemplate() {
      window.open(`/api/car/export-template-car?${
            this.website.tokenHeader
          }=${getToken()}`
        );
      window.open(
        `/api/car/export-template-car?${this.website.tokenHeader}=${getToken()}`
      );
    },
    sizeChange(val) {
      this.page1.currentPage = 1;
@@ -232,11 +219,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -268,11 +255,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -282,7 +269,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -291,7 +278,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -306,7 +293,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -315,7 +302,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crudrec.toggleSelection();
        });
@@ -361,7 +348,10 @@
        params["jurisdiction"] = that.userInfo.jurisdiction;
      }
      //保安公司进入
      if (this.userInfo.role_name == "保安公司管理员" || this.userInfo.role_name == "分公司管理员") {
      if (
        this.userInfo.role_name == "保安公司管理员" ||
        this.userInfo.role_name == "分公司管理员"
      ) {
        params["deptId"] = that.userInfo.dept_id;
        //导入action 修改
        const importColumn = that.findObject(
@@ -376,10 +366,10 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        data.records.forEach((item) => {
        data.records.forEach(item => {
          if (item.numberType == -1) {
            item.numberType = null;
          }
@@ -388,11 +378,12 @@
          }
        });
        this.data = data.records;
        console.log(this.data);
        this.$store.commit("setWindowSizeHeightAdd");
        // console.log(this.data);
        this.loading = false;
      });
    },
  },
    }
  }
};
</script>
@@ -411,4 +402,4 @@
// .el-tag--light {
//   padding: 0 !important;
// }
</style>
</style>