src/views/securityUnit/selfRecruitedSecurityGuard.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
@@ -94,7 +94,7 @@
  getdata,
  adddata,
  update,
  remove,
  remove
} from "@/api/securityUnit/securityUnit";
import { mapGetters } from "vuex";
import { getToken } from "@/util/auth";
@@ -115,18 +115,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, //保安单位基本信息
@@ -135,7 +135,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      treeData: [],
@@ -151,16 +151,16 @@
          column: [
            {
              label: "自定义项",
              prop: "label",
            },
          ],
              prop: "label"
            }
          ]
        },
        props: {
          labelText: "标题",
          label: "title",
          value: "id",
          children: "children",
        },
          children: "children"
        }
      },
      forms: false,
      data0: {},
@@ -197,10 +197,10 @@
              {
                required: true,
                message: "请选择企业名称",
                trigger: "click",
              },
                trigger: "click"
              }
            ],
            overHidden: true,
            overHidden: true
          },
          {
            label: "所属辖区",
@@ -212,67 +212,67 @@
            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: "联系人",
            prop: "contacts",
            labelWidth: 110,
            hide: false,
            hide: false
          },
          {
            label: "联系电话",
            prop: "contactscell",
            labelWidth: 110,
            hide: false,
            hide: false
          },
          {
            label: "保安人数",
            labelWidth: 110,
            prop: "znum",
            searchSpan: 4,
            addDisabled:false,
            addDisplay:false,
            editDisabled:false,
            editDisplay:false,
            viewDisabled:false,
            viewDisplay:false,
            searchLabelWidth: 100,
            addDisabled: false,
            addDisplay: false,
            editDisabled: false,
            editDisplay: false,
            viewDisabled: false,
            viewDisplay: false,
            searchLabelWidth: 100
          },
          {
            label: "派遣人数",
            labelWidth: 110,
            prop: "pnum",
            addDisabled:false,
            addDisplay:false,
            editDisabled:false,
            editDisplay:false,
            viewDisabled:false,
            viewDisplay:false,
            addDisabled: false,
            addDisplay: false,
            editDisabled: false,
            editDisplay: false,
            viewDisabled: false,
            viewDisplay: false,
            searchSpan: 4,
            searchLabelWidth: 100,
            searchLabelWidth: 100
          },
          {
            label: "持证人数",
            labelWidth: 110,
            prop: "cnum",
            addDisabled:false,
            addDisplay:false,
            editDisabled:false,
            editDisplay:false,
            viewDisabled:false,
            viewDisplay:false,
            addDisabled: false,
            addDisplay: false,
            editDisabled: false,
            editDisplay: false,
            viewDisabled: false,
            viewDisplay: false,
            searchSpan: 4,
            searchLabelWidth: 100,
            searchLabelWidth: 100
          },
          {
            label: "企业属性",
@@ -283,22 +283,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: 110,
            // search: true,
            hide: true,
            hide: true
          },
          {
            label: "注册时间",
@@ -325,14 +325,14 @@
              {
                required: true,
                message: "请选择注册时间",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "服务区域",
            labelWidth: 110,
            prop: "fregion",
            prop: "fregion"
          },
          {
            label: "服务时间",
@@ -340,7 +340,7 @@
            prop: "ftime",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd"
          },
          {
            label: "登记机关",
@@ -349,17 +349,16 @@
            labelWidth: 110,
            // width: 88,
            overHidden: true,
            hide: true,
          },
        ],
      },
            hide: true
          }
        ]
      }
    };
  },
  created() {
    const column = this.findObject(this.option.column, "stats");
    column.value = "0";
    if(this.userInfo.role_name=="培训公司管理员"){
    if (this.userInfo.role_name == "培训公司管理员") {
      column.editDisabled = true;
      column.addDisabled = true;
    }
@@ -368,18 +367,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() {
@@ -392,10 +394,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) {
@@ -409,11 +412,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();
@@ -421,7 +424,7 @@
        } else {
          this.$message({
            message: "操作失败",
            type: "warning",
            type: "warning"
          });
          done();
        }
@@ -445,11 +448,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -459,7 +462,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          console.log(row);
@@ -469,7 +472,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -486,12 +489,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();
          });
        })
@@ -499,11 +502,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);
@@ -513,7 +516,7 @@
      var data = JSON.stringify(row);
      this.$router.push({
        path: "/securityUnitChild",
        query: { data: data },
        query: { data: data }
      });
    },
    //跳转到附近列表页面
@@ -522,8 +525,8 @@
        path: `/resource/attachCopy`,
        query: {
          deptId: row.departmentid,
          enterprisename: row.enterprisename,
        },
          enterprisename: row.enterprisename
        }
      });
    },
    onLoad(page, params = {}) {
@@ -539,15 +542,16 @@
        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;
      });
    },
    }
  },
  watch: {
    haveID() {
@@ -563,9 +567,9 @@
    },
    havedata() {
      console.log(this.havedata, "qqqqq");
    },
    }
  },
  mounted() {},
  mounted() {}
};
</script>