dispatchModal.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. // 加载数据方法 必须为 Promise 对象
  61. loadData: parameter => {
  62. const params = Object.assign(parameter, { bookSn: this.itemSn })
  63. return querySettleReceiptFinanceBookList(params).then(res => {
  64. let data
  65. if (res.status == 200) {
  66. data = res.data
  67. for (var i = 0; i < data.length; i++) {
  68. data[i].no = i + 1
  69. const cons = data[i].bizType == 'DISPATCH' ? {
  70. buyerName: data[i].dispatchBill.buyerName,
  71. receiverName: data[i].dispatchBill.receiverName,
  72. sendNo: data[i].dispatchBill.sendNo,
  73. totalCategory: data[i].dispatchBill.totalCategory,
  74. totalQty: data[i].dispatchBill.totalQty,
  75. totalAmount: data[i].dispatchBill.totalAmount,
  76. billStatusDictValue: data[i].dispatchBill.billStatusDictValue,
  77. financialStatusDictValue: data[i].dispatchBill.financialStatusDictValue,
  78. dispatchBillSn: data[i].dispatchBill.dispatchBillSn,
  79. salesBillSn: data[i].dispatchBill.salesBillSn
  80. } : {
  81. buyerName: data[i].allocateBill.targetName,
  82. receiverName: data[i].allocateBill.receiverName,
  83. sendNo: data[i].allocateBill.sendNo,
  84. totalCategory: data[i].allocateBill.totalCategory,
  85. totalQty: data[i].allocateBill.totalQty,
  86. totalAmount: data[i].allocateBill.totalPrice,
  87. billStatusDictValue: data[i].allocateBill.stateDictValue,
  88. allocateNo: data[i].allocateBill.allocateNo,
  89. allocateSn: data[i].allocateBill.allocateSn
  90. }
  91. data[i] = Object.assign(data[i], cons)
  92. }
  93. }
  94. return data
  95. })
  96. }
  97. }
  98. },
  99. computed: {
  100. columns () {
  101. const arr = [
  102. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  103. { title: '单据类型', dataIndex: 'bizTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  104. { title: '单据号', dataIndex: 'bizNo', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  105. { title: '客户名称', dataIndex: 'buyerName', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  106. { title: '收货客户名称', dataIndex: 'receiverName', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  107. { title: '发货编号', dataIndex: 'sendNo', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  108. { title: '产品款数', dataIndex: 'totalCategory', align: 'center', width: '8%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  109. { title: '产品数量', dataIndex: 'totalQty', align: 'center', width: '8%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  110. { title: '业务状态', dataIndex: 'billStatusDictValue', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
  111. { title: '财务状态', dataIndex: 'financialStatusDictValue', align: 'center', width: '8%', customRender: function (text) { return (text == 0 || text) ? text : '--' } }
  112. ]
  113. if (this.$hasPermissions('B_glDispatch_salesPrice')) { // 价格权限
  114. arr.splice(8, 0, { title: '总售价', dataIndex: 'totalAmount', align: 'right', width: '8%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  115. }
  116. return arr
  117. }
  118. },
  119. methods: {
  120. handleCommonCancel () {
  121. this.$emit('close')
  122. this.$refs.table.clearTable()
  123. this.detailData = null
  124. this.$store.state.app.curActionPermission = ''
  125. },
  126. setDetail (data) {
  127. this.detailData = data
  128. }
  129. },
  130. watch: {
  131. openModal (nVal, oVal) {
  132. this.isShow = nVal
  133. },
  134. isShow (nVal, oVal) {
  135. if (!nVal) {
  136. this.handleCommonCancel()
  137. } else {
  138. this.$store.state.app.curActionPermission = 'B_glDispatch'
  139. this.$nextTick(() => {
  140. this.$refs.table.refresh(true)
  141. })
  142. }
  143. }
  144. }
  145. }
  146. </script>
  147. <style>
  148. </style>