Administrator
2021-08-12 85e31ab46cfa76de986e6084e7e4dfda35ac98e6
src/views/traincompany/index.vue
@@ -30,14 +30,21 @@
    >
      <template slot-scope="{ type,row }" slot="menu">
                            <el-button
                            :type="type"
                            size="small"
                            icon="el-icon-edit"
                            @click="handleTrainApply(row)"
                            >报名
                            </el-button>
                        </template>
          <el-button
          :type="type"
          size="small"
          icon="el-icon-edit"
          @click="handleTrainApply(row)"
          >报名
          </el-button>
          <el-button
          :type="type"
          size="small"
          icon="el-icon-edit"
          @click="handleTrainApplyBatch(row)"
          >批量报名
          </el-button>
      </template>
    </avue-crud>
    <el-dialog
@@ -268,13 +275,45 @@
    })
  },
  methods: {
    handleTrainApply(row){
    //保安公司批量报名
    handleTrainApplyBatch(row){
      this.dialogDisable = true;
      this.optionTrainApply.column.trainingUnitId = row.departmentid;
      this.formTrainApply = {
        trainingUnitId: row.departmentid
      }
    },
    //未持证保安人员报名
    handleTrainApply(row,done,loading){
      row['userId'] = this.userInfo.user_id;
      row['trainingUnitId'] = row.departmentid;
      adddata(row).then(
        (res) => {
          // this.onLoad(this.page);
          if(res.data.data==201){
              this.$message({
                type: "warning",
                message:"已报名,不能重复报名",
              });
          }else if(res.data.data==201){
              this.$message({
                type: "warning",
                message:"报名失败",
              });
          }else{
              this.$message({
                type: "success",
                message:"报名成功",
              });
          }
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    //关闭窗口清除数据
    closeDialog(){
      this.$refs.formTrainApply.resetFields();