src/views/securityUnit/securityTraining.vue
@@ -1,72 +1,72 @@
<template>
  <basic-container>
    <div
      :class="[
        'securityUnit',
        $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
      ]"
  <basic-container
    :class="[
      'securityUnit',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      :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
        :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="{ row }" slot="znum">
          <el-tag
            class="rowClickSelf"
            @click="rowClickSelf(row)"
            title="点击查看保安人员情况"
            >{{ row.znum }}</el-tag
          >
        </template>
      <!-- @row-click="rowClick" -->
      <template slot-scope="{ row }" slot="znum">
        <el-tag
          class="rowClickSelf"
          @click="rowClickSelf(row)"
          title="点击查看保安人员情况"
          >{{ row.znum }}</el-tag
        >
      </template>
        <template slot-scope="{ type, size, row }" slot="menu">
          <el-button
            icon="el-icon-s-custom"
            :size="size"
            :type="type"
            @click.stop="rowClick(row)"
            >查看
          </el-button>
          <el-button
            :size="size"
            :type="type"
            @click="handleUploadPage(row)"
            icon="el-icon-circle-check"
            >附件上传
          </el-button>
        </template>
        <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="handleImport1"
            >批量导入
          </el-button>
        </template>
      </avue-crud>
    </div>
      <template slot-scope="{ type, size, row }" slot="menu">
        <el-button
          icon="el-icon-s-custom"
          :size="size"
          :type="type"
          @click.stop="rowClick(row)"
          >查看
        </el-button>
        <el-button
          :size="size"
          :type="type"
          @click="handleUploadPage(row)"
          icon="el-icon-circle-check"
          >附件上传
        </el-button>
      </template>
      <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="handleImport1"
          >批量导入
        </el-button>
      </template>
    </avue-crud>
    <el-dialog
      title="保安单位导入"
      append-to-body
@@ -93,7 +93,7 @@
  getdata,
  adddata,
  update,
  remove,
  remove
} from "@/api/securityUnit/securityUnit";
import { mapGetters } from "vuex";
import { getToken } from "@/util/auth";
@@ -114,18 +114,18 @@
            loadText: "文件上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
              res: "data"
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/information/import-informaton",
            action: "/api/information/import-informaton"
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
            span: 24
          }
        ]
      },
      loading: true, //保安单位基本信息
      selectionList: [],
@@ -133,7 +133,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      treeData: [],
      treeOption: {
@@ -148,16 +148,16 @@
          column: [
            {
              label: "自定义项",
              prop: "label",
            },
          ],
              prop: "label"
            }
          ]
        },
        props: {
          labelText: "标题",
          label: "title",
          value: "id",
          children: "children",
        },
          children: "children"
        }
      },
      forms: false,
      noshehuibianma: 0,
@@ -189,10 +189,10 @@
              {
                required: true,
                message: "请选择企业名称",
                trigger: "click",
              },
                trigger: "click"
              }
            ],
            overHidden: true,
            overHidden: true
          },
          {
            label: "所属辖区",
@@ -204,16 +204,16 @@
            dicUrl: "/api//jurisdiction/lazy-trees",
            props: {
              label: "title",
              value: "id",
              value: "id"
            },
            rules: [
              {
                required: false,
                message: "请选择所属辖区",
                trigger: "click",
              },
                trigger: "click"
              }
            ],
            overHidden: true,
            overHidden: true
          },
          {
            label: "法定代表人",
@@ -225,9 +225,9 @@
              {
                required: false,
                message: "请输入法定代表人",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "法定代表人电话",
@@ -239,21 +239,21 @@
              {
                required: false,
                message: "请输入法定代表人电话",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "联系人",
            prop: "contacts",
            labelWidth: 145,
            hide: true,
            hide: true
          },
          {
            label: "联系电话",
            prop: "contactscell",
            labelWidth: 145,
            hide: true,
            hide: true
          },
          {
            label: "保安人数",
@@ -266,7 +266,7 @@
            editDisplay: false,
            viewDisabled: false,
            viewDisplay: false,
            searchLabelWidth: 100,
            searchLabelWidth: 100
          },
          {
            label: "派遣人数",
@@ -279,7 +279,7 @@
            viewDisabled: false,
            viewDisplay: false,
            searchSpan: 4,
            searchLabelWidth: 100,
            searchLabelWidth: 100
          },
          {
            label: "持证人数",
@@ -292,7 +292,7 @@
            viewDisabled: false,
            viewDisplay: false,
            searchSpan: 4,
            searchLabelWidth: 100,
            searchLabelWidth: 100
          },
          {
            label: "企业属性",
@@ -303,22 +303,22 @@
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stats",
            props: {
              label: "dictValue",
              value: "dictKey",
              value: "dictKey"
            },
            rules: [
              {
                required: true,
                message: "请选择企业属性",
                trigger: "click",
              },
            ],
                trigger: "click"
              }
            ]
          },
          {
            label: "注册地址",
            prop: "address",
            labelWidth: 145,
            // search: true,
            hide: true,
            hide: true
          },
          {
            label: "注册时间",
@@ -345,22 +345,24 @@
              {
                required: false,
                message: "请选择注册时间",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
              label: "办公地址",
              prop: "industry",
              span: 12,
              labelWidth: 145,
              disabled: false,
              hide:true,
              rules: [{
                  required: false,
                  message: "请选择办公地址",
                  trigger: "blur",
              }, ],
            label: "办公地址",
            prop: "industry",
            span: 12,
            labelWidth: 145,
            disabled: false,
            hide: true,
            rules: [
              {
                required: false,
                message: "请选择办公地址",
                trigger: "blur"
              }
            ]
          },
          {
            label: "登记机关",
@@ -369,11 +371,11 @@
            labelWidth: 145,
            // width: 88,
            overHidden: true,
            hide: true,
          },
            hide: true
          }
        ],
        ...this.$store.state.control.clearOtherBut,
      },
        ...this.$store.state.control.clearOtherBut
      }
    };
  },
  created() {
@@ -381,7 +383,7 @@
    column.value = "1";
    column.editDisabled = true;
    column.addDisabled = true;
    if(this.userInfo.role_name == "administrator" ){
    if (this.userInfo.role_name == "administrator") {
      column.editDisabled = false;
      column.addDisabled = false;
    }
@@ -390,18 +392,21 @@
    ...mapGetters(["userInfo"]),
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.creditcode);
      });
      return ids.join(",");
    },
    }
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    rowClickSelf(val) {
      // console.log(val.departmentid);
      this.$router.push({
        path: "/securityGuardOnce/index",
        query: { departmentid: val.departmentid },
        query: { departmentid: val.departmentid }
      });
    },
    handleImport1() {
@@ -414,10 +419,11 @@
      done();
    },
    handleTemplate1() {
      window.open(`/api/examSubjectChoices/export-template?${
            this.website.tokenHeader
          }=${getToken()}&`
        );
      window.open(
        `/api/examSubjectChoices/export-template?${
          this.website.tokenHeader
        }=${getToken()}&`
      );
    },
    //保安单位基本信息
    sizeChange(val) {
@@ -434,11 +440,11 @@
    },
    rowSave(form, done, loading) {
      form["createUserId"] = this.userInfo.Id;
      adddata(form).then((res) => {
      adddata(form).then(res => {
        if (res.data.success) {
          this.$message({
            message: "操作成功",
            type: "success",
            type: "success"
          });
          this.refreshChange();
          done();
@@ -446,7 +452,7 @@
        } else {
          this.$message({
            message: "操作失败",
            type: "warning",
            type: "warning"
          });
          done();
        }
@@ -471,11 +477,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -485,7 +491,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          console.log(row);
@@ -495,7 +501,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -512,12 +518,12 @@
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
          type: "warning"
        }
      )
        .then(() => {
          // console.log(this.ids);
          return remove(this.ids, this.ids1).then((res) => {
          return remove(this.ids, this.ids1).then(res => {
            this.refreshChange();
          });
        })
@@ -525,11 +531,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crudrec.toggleSelection();
        })
        .catch((res) => {});
        .catch(res => {});
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
@@ -539,7 +545,7 @@
      var data = JSON.stringify(row);
      this.$router.push({
        path: "/securityUnitChild",
        query: { data: data },
        query: { data: data }
      });
    },
    //跳转到附近列表页面
@@ -548,8 +554,8 @@
        path: `/resource/attachCopy`,
        query: {
          deptId: row.departmentid,
          enterprisename: row.enterprisename,
        },
          enterprisename: row.enterprisename
        }
      });
    },
    onLoad(page, params = {}) {
@@ -563,18 +569,18 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        window.localStorage.setItem("danweidataS", JSON.stringify(this.data));
        console.log(this.data);
        this.$store.commit("setWindowSizeHeightAdd");
        // console.log(this.data);
        this.loading = false;
      });
    },
    }
  },
  mounted() {},
  mounted() {}
};
</script>