AuditForm.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <a-modal
  3. :title="modalTitle"
  4. :width="800"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. class="ant-modal2"
  8. @cancel="handleCancel"
  9. >
  10. <a-form :form="form">
  11. <a-form-item v-show="false" >
  12. <a-input v-decorator="['id']" type="hidden"/>
  13. </a-form-item>
  14. <row-list :col="1">
  15. <row-item>
  16. <a-form-item
  17. label="备注"
  18. :labelCol="BaseTool.Constant.labelCol2"
  19. :wrapperCol="BaseTool.Constant.wrapperCol2"
  20. >
  21. <a-radio-group v-decorator="['status', {initialValue: status, rules: [{required: true, message: '审核人不能为空'}]}]">
  22. <a-radio-button :value="status">
  23. 通过
  24. </a-radio-button>
  25. <a-radio-button :value="4">
  26. 拒绝
  27. </a-radio-button>
  28. </a-radio-group>
  29. </a-form-item>
  30. </row-item>
  31. <row-item>
  32. <a-form-item
  33. label="备注"
  34. :labelCol="BaseTool.Constant.labelCol2"
  35. :wrapperCol="BaseTool.Constant.wrapperCol2"
  36. >
  37. <a-textarea
  38. :rows="4"
  39. v-decorator="['advice']"/>
  40. </a-form-item>
  41. </row-item>
  42. </row-list>
  43. </a-form>
  44. <template slot="footer">
  45. <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
  46. </template>
  47. </a-modal>
  48. </template>
  49. <script>
  50. import pick from 'lodash.pick'
  51. import { checkSbUnused } from '@/api/idle-assets/idle-assets'
  52. export default {
  53. name: 'BaseRepairApplicationForm',
  54. data () {
  55. return {
  56. confirmLoading: false,
  57. modalTitle: null,
  58. form: this.$form.createForm(this),
  59. visible: false,
  60. status: 0,
  61. // 下拉框map
  62. model: null
  63. }
  64. },
  65. components: {
  66. },
  67. props: {
  68. },
  69. created () {
  70. // 下拉框map
  71. },
  72. methods: {
  73. base (record) {
  74. this.visible = true
  75. this.model = record
  76. this.status = record.status === 1 ? 2 : 3
  77. // 如果是空标识添加
  78. this.modalTitle = '审核'
  79. const { form: { setFieldsValue } } = this
  80. // 日期处理
  81. this.$nextTick(() => {
  82. setFieldsValue(Object.assign(pick(record, [
  83. 'id'
  84. ])))
  85. })
  86. },
  87. save () {
  88. const { form: { validateFieldsAndScroll } } = this
  89. this.confirmLoading = true
  90. validateFieldsAndScroll((errors, values) => {
  91. if (errors) {
  92. this.confirmLoading = false
  93. return
  94. }
  95. // 日期处理
  96. checkSbUnused(values)
  97. .then(() => {
  98. this.handleCancel(values)
  99. }).catch(() => {
  100. this.confirmLoading = false
  101. })
  102. })
  103. },
  104. handleCancel (values) {
  105. this.visible = false
  106. this.confirmLoading = false
  107. this.status = 0
  108. this.model = null
  109. this.form.resetFields()
  110. if (this.BaseTool.Object.isNotBlank(values)) {
  111. this.$emit('ok')
  112. }
  113. }
  114. }
  115. }
  116. </script>