<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: { status: "REFUSED", remarks: "", type: "ACCOUNT", }, activeRow: {}, rules: { remarks: [ { required: true, message: "请填写驳回原因", trigger: "change" }, { min: 1, max: 20, message: "请输入1到100个字" }, ], }, }; }, 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; 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; this.$refs.form.validate((valid) => { if (valid) { this.$https( { method: "put", url: "audit/update", authType: this.backToken, }, // _this.$qs.stringify(params) params ) .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>