reject.vue 3.16 KB
Newer Older
xulili's avatar
xulili committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<template>
  <el-dialog
    custom-class="party-dialog"
    title="驳回原因"
    :visible.sync="dialogVisible"
    width="468px"
    :before-close="handleClose"
  >
    <div class="dialog-content">
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        label-width="80px"
        label-position="top"
        class="party-form"
      >
        <el-form-item label="请填写驳回原因" prop="remarks">
          <el-input
            v-model="form.remarks"
            placeholder="请填写"
            type="textarea"
          ></el-input>
        </el-form-item>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer btn-group">
      <el-button @click="handleClose()">取 消</el-button>
      <el-button type="primary" @click="handleSubmit()">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      form: {
xulili's avatar
xulili committed
39 40
        status: "REFUSED",
        remarks: "",
xulili's avatar
xulili committed
41
        type: "ACCOUNT",
xulili's avatar
xulili committed
42
      },
xulili's avatar
xulili committed
43
      activeRow: {},
xulili's avatar
xulili committed
44
      rules: {
xulili's avatar
xulili committed
45
        remarks: [
xulili's avatar
xulili committed
46
          { required: true, message: "请填写驳回原因", trigger: "change" },
47
          { min: 1, max: 100, message: "请输入1到100个字" },
xulili's avatar
xulili committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
        ],
      },
    };
  },
  mounted() {},
  methods: {
    // 弹窗关闭
    handleClose() {
      this.$confirm("确认关闭?")
        .then((_) => {
          this.handleReset();
        })
        .catch((_) => {});
    },
    handleReset() {
      this.dialogVisible = false;
      this.$refs.form.resetFields();
      this.form = {
        remarks: "",
        type: "ACCOUNT",
      };
    },
    // 提交
    handleSubmit() {
      // 校验用户输入值
      let _this = this;
xulili's avatar
xulili committed
74 75 76 77 78 79 80 81
      let params = {};
      params.id = this.activeRow.id;
      params.refItemId = this.activeRow.refItemId;
      params.status = this.form.status;
      params.type = this.form.type;
      let times = this.activeRow.level == "TBC" ? "first" : "second";
      params.level = this.activeRow.status;
      params[`${times}Remarks`] = this.form.remarks;
xulili's avatar
xulili committed
82 83 84 85 86 87 88 89
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$https(
            {
              method: "put",
              url: "audit/update",
              authType: this.backToken,
            },
xulili's avatar
xulili committed
90 91
            //  _this.$qs.stringify(params)
            params
xulili's avatar
xulili committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
          )
            .then((res) => {
              this.handleReset();
              if (res.status == 200) {
                if (res.data.resultCode == 200) {
                  this.$message({
                    type: "success",
                    message: res.data.message,
                  });
                  this.$emit("success", true);
                } else {
                  this.$message.error(res.data.message);
                }
              } else {
                this.$message.error(res.data);
              }
            })
            .catch((err) => {
              console.log(err);
            });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
.form-row {
  display: flex;
  justify-content: space-between;
}
</style>