auditModal.vue 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <ModalView ref="mv" cname="ElDialog" :viewProps="{
  3. customClass: 'myModal'
  4. }">
  5. <div style="flex: 1;">
  6. <el-form ref="uForm" :model="form" :rules="rules">
  7. <el-form-item label="审核状态" prop="auditStatus">
  8. <el-radio-group v-model="form.auditStatus">
  9. <el-radio :label="1">通过</el-radio>
  10. <el-radio :label="2">拒绝</el-radio>
  11. </el-radio-group>
  12. </el-form-item>
  13. <el-form-item label="审核备注" prop="auditReason">
  14. <el-input type="textarea" placeholder="请输入审核备注/拒绝理由,审核拒绝时必填" v-model="form.auditReason"></el-input>
  15. </el-form-item>
  16. </el-form>
  17. </div>
  18. <div slot="footer" class="dialog-footer">
  19. <el-button type="primary" @click="submitForm('uForm')">确 定</el-button>
  20. <el-button @click="resetForm('uForm')">取 消</el-button>
  21. </div>
  22. </ModalView>
  23. </template>
  24. <script>
  25. import ModalView from '@/components/ZModalView/index.vue';
  26. import { auditComment } from "@/api/system/comment";
  27. export default {
  28. components: {
  29. ModalView
  30. },
  31. data() {
  32. return {
  33. title: '审核',
  34. form: {},
  35. oForm: {},
  36. loading: false,
  37. }
  38. },
  39. computed: {
  40. rules() {
  41. return {
  42. auditStatus: [
  43. { required: true, message: '请选择审核状态', trigger: 'change' }
  44. ],
  45. auditReason: [
  46. { required: this.form.auditStatus === 2, message: '请输入拒绝理由', trigger: 'change' }
  47. ]
  48. }
  49. }
  50. },
  51. methods: {
  52. submitForm(formName) {
  53. this.$refs[formName].validate((valid) => {
  54. if (valid) {
  55. console.log(this.form);
  56. auditComment({
  57. ...this.form,
  58. commentId: this.oForm.id
  59. }).then(res => {
  60. this.$modal.msgSuccess("操作成功");
  61. this.resetForm('uForm');
  62. });
  63. } else {
  64. console.log('error submit!!');
  65. return false;
  66. }
  67. });
  68. },
  69. resetForm(formName) {
  70. this.$refs[formName].resetFields();
  71. this.close();
  72. },
  73. open(e) {
  74. if (e) {
  75. this.oForm = e;
  76. }
  77. console.log(this.oForm)
  78. this.$refs.mv.open(this.title);
  79. },
  80. // 关闭弹窗
  81. close() {
  82. this.$refs.mv.close();
  83. },
  84. }
  85. };
  86. </script>
  87. <style lang="scss" scoped>
  88. ::v-deep .myModal {
  89. .el-dialog__body {
  90. max-height: 70vh;
  91. overflow-y: auto;
  92. padding: 10px 20px;
  93. }
  94. }
  95. </style>