Administrator
2022-05-06 6a7b5f379f8d3e8b6d004bdf347cf1e86f3efdaf
src/views/traincompany/index.vue
@@ -29,8 +29,19 @@
      @row-click="handleRowClick"
      @on-load="onLoad"
    >
      <template slot-scope="{ type, row }" slot="menu">
      <template slot="menuLeft">
        <el-button
          style="display:none"
          type="primary"
          size="small"
          plain
          icon="el-icon-folder-checked"
          @click="handleImport"
          >批量报名
        </el-button>
      </template>
      <template slot-scope="{ type, row }" slot="menu">
        <!-- <el-button
          :type="type"
          size="small"
          icon="el-icon-edit"
@@ -38,7 +49,7 @@
          :disabled="auditStatus"
          @click="handleTrainApply(row)"
          >报名
        </el-button>
        </el-button> -->
        <el-button
          :type="type"
          size="small"
@@ -63,6 +74,24 @@
        @submit="submit"
      ></avue-form>
    </el-dialog>
    <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>
  </basic-container>
</template>
@@ -85,9 +114,37 @@
  data() {
    return {
      form: {},
      excelBox: false,
      auditStatus: false,
      formTrainApply: {
        num: 0
      },
      deptIds:'',
      excelForm: {},
      excelOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "模板上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data"
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/trainingRegistration/import-trainingRegistration?deptId=" + this.deptIds
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24
          }
        ]
      },
      query: {},
      deptId: null,
@@ -255,6 +312,10 @@
      this.formTrainApply.num = this.formTrainApply.userId.length;
    }
  },
  mounted(){
    this.$store.commit("setWindowSizeHeightAdd");
    this.deptIds = this.userInfo.dept_id;
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
@@ -281,12 +342,22 @@
      "/api/blade-user/security-apply-tree?examType=2&deptId=" +
      this.userInfo.dept_id;
    this.getUserDetail();
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
    // this.getUserDetail();
  },
  methods: {
    handleImport() {
      this.excelBox = true;
    },
    handleTemplate() {
      window.open(`/api/trainingRegistration/export-template`);
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(column);
      this.excelBox = false;
      this.refreshChange();
      done();
    },
    //获取用户信息
    getUserDetail() {
      var that = this;
@@ -432,11 +503,11 @@
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
      // if (["edit", "view"].includes(type)) {
      //   getDetail(this.form.id).then(res => {
      //     this.form = res.data.data;
      //   });
      // }
      done();
    },
    searchReset() {