feedbackDialog.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <el-dialog
  3. title="反馈信息"
  4. v-model="formOpen"
  5. width="500px"
  6. append-to-body
  7. draggable
  8. @close="cancel"
  9. :close-on-click-modal = "false"
  10. >
  11. <el-form ref="dictRef" :model="form" label-width="100">
  12. <el-form-item label="驳回原因:">
  13. <el-input
  14. v-model="form.feedbackContent"
  15. type="textarea"
  16. maxlength="200"
  17. show-word-limit
  18. style="width: 100%"
  19. />
  20. </el-form-item>
  21. </el-form>
  22. <template #footer>
  23. <div class="dialog-footer">
  24. <el-button
  25. type="primary"
  26. icon="Finished"
  27. size="small"
  28. @click="submitForm"
  29. >确 定</el-button
  30. >
  31. <el-button @click="cancel" icon="close">取 消</el-button>
  32. </div>
  33. </template>
  34. </el-dialog>
  35. </template>
  36. <script setup>
  37. import { ref } from "vue";
  38. const { proxy } = getCurrentInstance();
  39. const props = defineProps({
  40. verify: {
  41. type: Function,
  42. default: () => {},
  43. },
  44. });
  45. const { verify } = toRefs(props);
  46. const currentMonth = ref(proxy.moment().format("YYYY-MM-01"));
  47. const formOpen = ref(false);
  48. const form = ref({});
  49. function submitForm() {
  50. if (form.value.feedbackContent === "" || form.value.feedbackContent == null) {
  51. proxy.$modal.msgError("请填写驳回原因");
  52. return;
  53. }
  54. proxy.$modal
  55. .confirm("确认审核么?")
  56. .then((_) => {
  57. verify.value(form.value);
  58. cancel();
  59. })
  60. .catch((_) => {
  61. proxy.$modal.msg("取消驳回");
  62. });
  63. }
  64. function cancel() {
  65. formOpen.value = false;
  66. reset();
  67. }
  68. function open(options) {
  69. formOpen.value = true;
  70. form.value = options;
  71. }
  72. function reset() {
  73. form.value = {};
  74. }
  75. // 暴露给父组件的方法
  76. defineExpose({
  77. open,
  78. });
  79. </script>