printModal.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <a-modal v-model="opened" :title="title" centered :maskClosable="false" :footer="null" @cancel="cancel" width="50%">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-form-model id="chooseCustom-form" ref="ruleForm" :model="form"
  5. :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  6. <a-form-model-item label="收款单号:" prop="no"> <span>{{form.no}}{{form.printStatus=='UNABLE_PRINT'?'(暂不打印)':form.printStatus=='CANCEL_PRINT'?'(取消打印)':''}}</span>
  7. </a-form-model-item>
  8. <a-form-model-item label="付款方:" prop="payerName"> <span>{{form.payerName}}</span>
  9. </a-form-model-item>
  10. <a-form-model-item label="收款打印:" prop="printStatus">
  11. <a-radio-group v-model="form.printStatus">
  12. <a-radio value="NO_PRINT">
  13. 允许打印
  14. </a-radio>
  15. <a-radio value="CANCEL_PRINT">
  16. 取消打印
  17. </a-radio>
  18. </a-radio-group>
  19. </a-form-model-item>
  20. <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top: 50px;">
  21. <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
  22. <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定
  23. </a-button>
  24. </a-form-model-item>
  25. </a-form-model>
  26. </a-spin>
  27. </a-modal>
  28. </template>
  29. <script>
  30. import {
  31. updateFinanceBookDetail
  32. } from '@/api/financeBook.js'
  33. export default {
  34. name: 'PrintModal',
  35. props: {
  36. show: [Boolean],
  37. info: {
  38. type: Object,
  39. default: () => {
  40. return null
  41. }
  42. }
  43. },
  44. data() {
  45. return {
  46. opened: this.show,
  47. spinning: false,
  48. title: '备注',
  49. confirmLoading: false,
  50. formItemLayout: {
  51. labelCol: {
  52. span: 6
  53. },
  54. wrapperCol: {
  55. span: 18
  56. }
  57. },
  58. form: {
  59. no: undefined,
  60. payerName: undefined,
  61. printStatus:'',
  62. id:'',
  63. type:undefined
  64. }
  65. }
  66. },
  67. methods: {
  68. // 保存
  69. handleSubmit() {
  70. const _this = this
  71. const ajax_form = {
  72. id:this.form.id,
  73. printStatus:this.form.printStatus
  74. }
  75. _this.spinning = true
  76. _this.confirmLoading = true
  77. updateFinanceBookDetail(ajax_form).then(res => {
  78. if (res.status == 200) {
  79. _this.$message.success(res.message)
  80. _this.cancel()
  81. _this.spinning = false
  82. } else {
  83. _this.spinning = false
  84. }
  85. _this.confirmLoading = false
  86. })
  87. },
  88. cancel() {
  89. this.opened = false
  90. this.$emit('cancel')
  91. this.$refs.ruleForm.resetFields()
  92. }
  93. },
  94. watch: {
  95. show(newValue, oldValue) {
  96. this.opened = newValue
  97. if (!newValue) {
  98. this.cancel();
  99. }else{
  100. this.form = this.info
  101. }
  102. }
  103. }
  104. }
  105. </script>