Administrator
2022-04-11 79d9fc857559982b00b68b2d709807bdc4cd286f
src/views/securityUnit/index.vue
@@ -1,45 +1,61 @@
<template>
  <div class="securityUnit">
    <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"
      @row-click="rowClick"
    >
      <template slot="menuLeft">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="small"
          plain
          @click.stop="rowSave"
          >新增</el-button
        >
      </template>
      <template slot="menuLeft">
        <el-button
          type="danger"
          size="small"
          plain
          icon="el-icon-delete"
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
    </avue-crud>
    <div class="lod" v-show="forms != -1">
      <div class="lod-in">
        <!-- <el-col class="trees" v-if="forms == 0">
  <basic-container>
    <div class="securityUnit">
      <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"
        @row-click="rowClick"
      >
        <template slot-scope="{ type, size, row }" slot="menu">
          <el-button
            :size="size"
            :type="type"
            @click="handleUploadPage(row)"
            icon="el-icon-circle-check"
            >附件上传
          </el-button>
        </template>
        <template slot="menuLeft">
          <el-button
            type="primary"
            icon="el-icon-plus"
            size="small"
            plain
            @click.stop="rowSave"
            >新增</el-button
          >
          <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="handleImport1"
            >批量导入
          </el-button>
        </template>
      </avue-crud>
      <div class="lod" v-show="forms != -1">
        <div class="lod-in">
          <!-- <el-col class="trees" v-if="forms == 0">
          <div class="box">
            <el-scrollbar>
              <basic-container>
@@ -52,45 +68,64 @@
            </el-scrollbar>
          </div>
        </el-col> -->
        <avue-form
          ref="form"
          v-model="obj0"
          :option="option0"
          v-if="forms == 0"
        >
          <template slot="menuForm">
            <el-button type="primary" @click="tip0">下一页</el-button>
            <el-button type="info" @click="tipover">取消</el-button>
          </template>
        </avue-form>
        <avue-form
          ref="form1"
          v-model="obj1"
          :option="option1"
          v-else-if="forms == 1"
        >
          <template slot="menuForm">
            <el-button type="primary" @click="tip1up1">上一页</el-button>
            <el-button type="primary" @click="tip1">下一页</el-button>
            <el-button type="info" @click="tipover">取消</el-button>
          </template>
        </avue-form>
        <avue-form
          ref="form2"
          v-model="obj2"
          :option="option2"
          v-else-if="forms == 2"
        >
          <template slot="menuForm">
            <el-button type="primary" @click="tip2up2">上一页</el-button>
            <el-button type="primary" @click="tip2">提交</el-button>
            <el-button type="info" @click="tipover">取消</el-button>
          </template>
        </avue-form>
          <avue-form
            ref="form"
            v-model="obj0"
            :option="option0"
            v-if="forms == 0"
          >
            <template slot="menuForm">
              <el-button type="primary" @click="tip0">下一页</el-button>
              <el-button type="info" @click="tipover">取消</el-button>
            </template>
          </avue-form>
          <avue-form
            ref="form1"
            v-model="obj1"
            :option="option1"
            v-else-if="forms == 1"
          >
            <template slot="menuForm">
              <el-button type="primary" @click="tip1up1">上一页</el-button>
              <el-button type="primary" @click="tip1">下一页</el-button>
              <el-button type="info" @click="tipover">取消</el-button>
            </template>
          </avue-form>
          <avue-form
            ref="form2"
            v-model="obj2"
            :option="option2"
            v-else-if="forms == 2"
          >
            <template slot="menuForm">
              <el-button type="primary" @click="tip2up2">上一页</el-button>
              <el-button type="primary" @click="tip2">提交</el-button>
              <el-button type="info" @click="tipover">取消</el-button>
            </template>
          </avue-form>
        </div>
      </div>
    </div>
  </div>
</template>
    <el-dialog
      title="保安单位导入"
      append-to-body
      :visible.sync="excelBox1"
      width="555px"
    >
      <avue-form
        :option="excelOption1"
        v-model="excelForm1"
        :upload-after="uploadAfter1"
      >
        <template slot="excelTemplate">
          <el-button type="primary" @click="handleTemplate1">
            点击下载<i class="el-icon-download el-icon--right"></i>
          </el-button>
        </template>
      </avue-form>
    </el-dialog>
  </basic-container>
</template>
<script>
import { column, column0, column1, column2 } from "./data";
@@ -103,17 +138,47 @@
  adddata2,
  getDeptLazyTree,
} from "@/api/securityUnit/securityUnit";
import { mapGetters } from "vuex";
export default {
  data() {
    var w = 160,
      s = 12;
    return {
      excelBox1: false,
      excelForm1: {},
      excelOption1: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "文件上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "文件上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/information/import-informaton",
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
      loading: true, //保安单位基本信息
      selectionList: [],
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
      },
      treeData: [],
@@ -212,20 +277,23 @@
      query: {},
      data: [],
      option: {
        index: true,
        addBtn: false,
        // card: true,
        tip: false,
        searchSize: "mini",
        searchMenuSpan: 6,
        height: 623,
        menuWidth: 160,
        height: 583,
        menuWidth: 220,
        align: "center",
        selection: true,
        column: column,
        ...this.$store.state.control.clearOtherBut,
      },
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
@@ -252,6 +320,19 @@
    },
  },
  methods: {
    handleImport1() {
      this.excelBox1 = true;
    },
    uploadAfter1(res, done, loading, column) {
      window.console.log(column);
      this.excelBox1 = false;
      // this.refreshChange();
      done();
    },
    handleTemplate1() {
      window.open(`/api/examSubjectChoices/export-template`);
    },
    // handleChangeTABS(column) {
    //   this.typeTABS = column;
    //   // this.$message.success(JSON.stringify(column));
@@ -331,7 +412,7 @@
      })
        .then(() => {
          console.log(row);
          return remove(row.creditcode);
          return remove(row.creditcode, row.departmentid);
        })
        .then(() => {
          this.onLoad(this.page);
@@ -355,8 +436,8 @@
        type: "warning",
      })
        .then(() => {
          // console.log(this.ids);
          return remove(this.ids);
          console.log(this.ids);
          // return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
@@ -381,7 +462,21 @@
        // params: { row: row.identificationnumber },
      });
    },
    //跳转到附近列表页面
    handleUploadPage(row) {
      this.$router.push({
        path: `/resource/attachCopy`,
        query: {
          deptId: row.departmentid,
          enterprisename: row.enterprisename,
        },
      });
    },
    onLoad(page, params = {}) {
      if (this.userInfo.role_id == "1414840172333842433") {
        console.log("是公安add jurisdiction");
        params["jurisdiction"] = this.userInfo.jurisdiction;
      }
      this.loading = true;
      getdata(
        page.currentPage,
@@ -421,7 +516,7 @@
          }
        }
      }
      // console.log(d);
      console.log(d);
      for (var k in d) {
        if (d[k] == "" || d[k] == undefined) {
          console.log(k);
@@ -506,10 +601,8 @@
      });
      var time = setTimeout(() => {
        this.onLoad(this.page, this.query);
        clearTimeout(time);
        time = null;
        console.log(this.data0, this.data1, this.data2, "已刷新");
      }, 500);
      console.log(this.data0, this.data1, this.data2);
      this.tipover();
    },
    tip1up1() {
@@ -618,4 +711,4 @@
.el-collapse {
  border-top: 1px solid transparent !important;
}
</style>
</style>