TransferApproveForm.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <a-modal
  3. :title="modalTitle"
  4. :width="600"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. @cancel="handleCancel"
  8. >
  9. <a-form :form="form">
  10. <row-list :col="1">
  11. <row-item>
  12. <a-form-item
  13. label="驳回原因"
  14. :labelCol="BaseTool.Constant.labelCol2"
  15. :wrapperCol="BaseTool.Constant.wrapperCol2"
  16. >
  17. <a-textarea
  18. :rows="4"
  19. v-decorator="['repairDispatchRemark', {rules: [{required: true, message: '驳回原因不能为空'}]}]"
  20. placeholder="请填写驳回原因"/>
  21. </a-form-item>
  22. </row-item>
  23. </row-list>
  24. </a-form>
  25. <template slot="footer">
  26. <a-button :loading="confirmLoading" type="primary" @click="save()">确认驳回</a-button>
  27. </template>
  28. </a-modal>
  29. </template>
  30. <script>
  31. import { transferReject } from '@/api/repair/application-form'
  32. export default {
  33. name: 'TransferApproveForm',
  34. data () {
  35. return {
  36. confirmLoading: false,
  37. modalTitle: null,
  38. form: this.$form.createForm(this),
  39. visible: false,
  40. record: {}
  41. }
  42. },
  43. methods: {
  44. base (record, type) {
  45. this.visible = true
  46. this.modalTitle = '转派审批驳回'
  47. this.record = record
  48. this.$nextTick(() => {
  49. this.form.resetFields()
  50. })
  51. },
  52. save () {
  53. const { form: { validateFieldsAndScroll } } = this
  54. this.confirmLoading = true
  55. validateFieldsAndScroll((errors, values) => {
  56. if (errors) {
  57. this.confirmLoading = false
  58. return
  59. }
  60. values.id = this.record.id
  61. transferReject(values)
  62. .then(() => {
  63. this.$message.success('已驳回转派申请')
  64. this.handleCancel(values)
  65. }).catch(() => {
  66. this.confirmLoading = false
  67. })
  68. })
  69. },
  70. handleCancel (values) {
  71. this.visible = false
  72. this.confirmLoading = false
  73. this.form.resetFields()
  74. if (this.BaseTool.Object.isNotBlank(values)) {
  75. this.$emit('ok')
  76. }
  77. }
  78. }
  79. }
  80. </script>