dispatchModal.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <a-modal
  3. centered
  4. :footer="null"
  5. :maskClosable="false"
  6. title="关联单据"
  7. v-model="isShow"
  8. @cancel="handleCommonCancel"
  9. width="70%">
  10. <a-spin :spinning="spinning" tip="Loading...">
  11. <div v-if="detailData">
  12. <a-descriptions :column="{ xs: 2, sm: 3, md: 2}">
  13. <a-descriptions-item label="收款单号">{{ detailData&&detailData.bookNo || '--' }}</a-descriptions-item>
  14. <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
  15. <a-descriptions-item label="收款事由">{{ detailData&&detailData.bookReason || '--' }}</a-descriptions-item>
  16. <a-descriptions-item label="状态">{{ detailData&&detailData.statusDictValue || '--' }}</a-descriptions-item>
  17. </a-descriptions>
  18. </div>
  19. <s-table
  20. class="sTable fixPagination"
  21. ref="table"
  22. size="small"
  23. :rowKey="(record) => record.id"
  24. :columns="columns"
  25. :data="loadData"
  26. :scroll="{ y: 500 }"
  27. :showPagination="false"
  28. :defaultLoadData="true"
  29. bordered>
  30. </s-table>
  31. <div class="btn-box" style="text-align:center;padding-top:20px;">
  32. <a-button @click="handleCommonCancel">关闭</a-button>
  33. </div>
  34. </a-spin>
  35. </a-modal>
  36. </template>
  37. <script>
  38. import { commonMixin } from '@/utils/mixin'
  39. import { STable } from '@/components'
  40. import { querySettleReceiptFinanceBookList } from '@/api/financeBook.js'
  41. export default {
  42. name: 'DispatchModal',
  43. components: { STable },
  44. mixins: [commonMixin],
  45. props: {
  46. openModal: {
  47. type: Boolean,
  48. default: false
  49. },
  50. itemSn: {
  51. type: [Number, String],
  52. default: ''
  53. }
  54. },
  55. data () {
  56. return {
  57. spinning: false,
  58. isShow: this.openModal,
  59. detailData: null,
  60. columns: [
  61. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  62. { title: '单据类型', dataIndex: 'bizTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  63. { title: '单据号', dataIndex: 'bizNo', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  64. { title: '客户名称', dataIndex: 'buyerName', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  65. { title: '收货客户名称', dataIndex: 'receiverName', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  66. { title: '发货编号', dataIndex: 'sendNo', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  67. { title: '产品款数', dataIndex: 'totalCategory', align: 'center', width: '8%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  68. { title: '产品数量', dataIndex: 'totalQty', align: 'center', width: '8%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  69. { title: '总售价', dataIndex: 'totalAmount', align: 'right', width: '8%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  70. { title: '业务状态', dataIndex: 'billStatusDictValue', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
  71. { title: '财务状态', dataIndex: 'financialStatusDictValue', align: 'center', width: '8%', customRender: function (text) { return (text == 0 || text) ? text : '--' } }
  72. ],
  73. // 加载数据方法 必须为 Promise 对象
  74. loadData: parameter => {
  75. const params = Object.assign(parameter, { bookSn: this.itemSn })
  76. return querySettleReceiptFinanceBookList(params).then(res => {
  77. let data
  78. if (res.status == 200) {
  79. data = res.data
  80. for (var i = 0; i < data.length; i++) {
  81. data[i].no = i + 1
  82. const cons = data[i].bizType == 'DISPATCH' ? {
  83. buyerName: data[i].dispatchBill.buyerName,
  84. receiverName: data[i].dispatchBill.receiverName,
  85. sendNo: data[i].dispatchBill.sendNo,
  86. totalCategory: data[i].dispatchBill.totalCategory,
  87. totalQty: data[i].dispatchBill.totalQty,
  88. totalAmount: data[i].dispatchBill.totalAmount,
  89. billStatusDictValue: data[i].dispatchBill.billStatusDictValue,
  90. financialStatusDictValue: data[i].dispatchBill.financialStatusDictValue,
  91. dispatchBillSn: data[i].dispatchBill.dispatchBillSn,
  92. salesBillSn: data[i].dispatchBill.salesBillSn
  93. } : {
  94. buyerName: data[i].allocateBill.targetName,
  95. receiverName: data[i].allocateBill.receiverName,
  96. sendNo: data[i].allocateBill.sendNo,
  97. totalCategory: data[i].allocateBill.totalCategory,
  98. totalQty: data[i].allocateBill.totalQty,
  99. totalAmount: data[i].allocateBill.totalPrice,
  100. billStatusDictValue: data[i].allocateBill.stateDictValue,
  101. allocateNo: data[i].allocateBill.allocateNo,
  102. allocateSn: data[i].allocateBill.allocateSn
  103. }
  104. data[i] = Object.assign(data[i], cons)
  105. }
  106. }
  107. return data
  108. })
  109. }
  110. }
  111. },
  112. methods: {
  113. handleCommonCancel () {
  114. this.$emit('close')
  115. this.$refs.table.clearTable()
  116. this.detailData = null
  117. },
  118. setDetail (data) {
  119. this.detailData = data
  120. }
  121. },
  122. watch: {
  123. openModal (nVal, oVal) {
  124. this.isShow = nVal
  125. },
  126. isShow (nVal, oVal) {
  127. if (!nVal) {
  128. this.handleCommonCancel()
  129. } else {
  130. this.$nextTick(() => {
  131. this.$refs.table.refresh(true)
  132. })
  133. }
  134. }
  135. }
  136. }
  137. </script>
  138. <style>
  139. </style>