reject.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <a-modal v-model:visible="visible" title="驳回">
  3. <a-form ref="formRef" :label-col="labelCol" :model="formData" layout="horizontal">
  4. <a-form-item v-show="false">
  5. <a-input v-model:value="formData.id"></a-input>
  6. </a-form-item>
  7. <a-form-item
  8. label="驳回说明"
  9. name="endRemark"
  10. >
  11. <a-textarea v-model:value="formData.endRemark" placeholder="请输入驳回说明"
  12. :auto-size="{ minRows: 3, maxRows: 5 }"/>
  13. </a-form-item>
  14. </a-form>
  15. <template #footer>
  16. <a-spin :spinning="submitLoading">
  17. <a-button type="primary" @click="onsubmit(true)">驳回</a-button>
  18. </a-spin>
  19. </template>
  20. </a-modal>
  21. </template>
  22. <script setup>
  23. import {message} from 'ant-design-vue';
  24. import bizOrderApi from '@/api/biz/bizOrderApi'
  25. const emit = defineEmits({successful: null})
  26. const visible = ref(false);
  27. const submitLoading = ref(false)
  28. const labelCol = ref({span: 4})
  29. // 表单数据
  30. const formData = ref({})
  31. const showModal = (id) => {
  32. formData.value.id = id
  33. visible.value = true;
  34. };
  35. const onClose = () => {
  36. formData.value = {}
  37. visible.value = false
  38. };
  39. const onsubmit = (flag) => {
  40. if (flag === true) {
  41. if (!formData.value.endRemark) {
  42. message.error('驳回时,说明信息不能为空')
  43. return
  44. }
  45. }
  46. submitLoading.value = true
  47. formData.value.auditFlag = flag
  48. bizOrderApi.rejectOrder(formData.value).then(() => {
  49. onClose()
  50. emit('successful', null)
  51. }).finally(() => {
  52. submitLoading.value = false
  53. })
  54. }
  55. // 抛出函数
  56. defineExpose({
  57. showModal
  58. })
  59. </script>
  60. <style scoped>
  61. </style>