stockOutDetailModal.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <a-modal
  3. centered
  4. :footer="null"
  5. :maskClosable="false"
  6. title="销售单缺货明细"
  7. v-model="isShow"
  8. @cancel="isShow=false"
  9. width="50%">
  10. <a-descriptions size="small" :column="2">
  11. <a-descriptions-item label="销售单号">
  12. {{ detailData&&detailData.salesBillNo || '--' }}
  13. <span v-if="detailData&&detailData.salesBillNoSource">(原:{{ detailData&&detailData.salesBillNoSource || '--' }})</span>
  14. </a-descriptions-item>
  15. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  16. </a-descriptions>
  17. <a-spin :spinning="spinning" tip="Loading...">
  18. <s-table
  19. class="sTable fixPagination"
  20. ref="table"
  21. size="small"
  22. :rowKey="(record) => record.id"
  23. :columns="columns"
  24. :data="loadData"
  25. :scroll="{ y: 500 }"
  26. :showPagination="false"
  27. :defaultLoadData="false"
  28. bordered>
  29. </s-table>
  30. <div class="btn-cont" style="padding:20px 20px 0;text-align: center;">
  31. <!-- <a-button @click="isShow=false">关闭</a-button> -->
  32. <a-button
  33. class="button-warning"
  34. type="primary"
  35. @click="handleExport"
  36. :disabled="disabled"
  37. :loading="exportLoading"
  38. id="allocateBillList-export">导出Excel</a-button>
  39. <a-button
  40. style="margin-left: 5px"
  41. @click="handleClassifyExport"
  42. :disabled="disabled"
  43. :loading="exportClassifyLoading"
  44. id="allocateBillList-export">分类导出Excel</a-button>
  45. </a-button></div>
  46. </a-spin>
  47. </a-modal>
  48. </template>
  49. <script>
  50. import { STable } from '@/components'
  51. import { salesStockoutDetail, exportStockout, exportGroupStockout } from '@/api/salesDetail'
  52. import { hdExportExcel } from '@/libs/exportExcel'
  53. export default {
  54. name: 'StockOutDetail',
  55. components: { STable },
  56. props: {
  57. openModal: {
  58. type: Boolean,
  59. default: false
  60. },
  61. salesBillSn: {
  62. type: [Number, String],
  63. default: ''
  64. },
  65. detailData: {
  66. type: Object,
  67. default: function () {
  68. return null
  69. }
  70. }
  71. },
  72. data () {
  73. return {
  74. spinning: false,
  75. isShow: this.openModal,
  76. disabled: false,
  77. exportLoading: false,
  78. exportClassifyLoading: false,
  79. columns: [
  80. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  81. { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  82. { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  83. { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  84. { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  85. { title: '销售数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  86. { title: '销售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  87. { title: '销售金额', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  88. { title: '缺货数量', dataIndex: 'lackQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  89. { title: '缺货金额', dataIndex: 'lackAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  90. ],
  91. // 加载数据方法 必须为 Promise 对象
  92. loadData: parameter => {
  93. this.spinning = true
  94. this.disabled = true
  95. delete parameter.tableId
  96. delete parameter.index
  97. return salesStockoutDetail({ isOos: 1, salesBillSn: this.salesBillSn }).then(res => {
  98. let data
  99. if (res.status == 200) {
  100. data = res.data
  101. const no = 0
  102. for (var i = 0; i < data.length; i++) {
  103. data[i].no = no + i + 1
  104. }
  105. this.disabled = false
  106. }
  107. this.spinning = false
  108. return data
  109. })
  110. }
  111. }
  112. },
  113. methods: {
  114. handleExport () {
  115. const _this = this
  116. _this.exportLoading = true
  117. _this.disabled = true
  118. _this.spinning = true
  119. hdExportExcel(exportStockout, { salesBillSn: _this.salesBillSn }, '销售单缺货产品导出', function () {
  120. _this.exportLoading = false
  121. _this.spinning = false
  122. _this.disabled = false
  123. })
  124. },
  125. handleClassifyExport () {
  126. const _this = this
  127. _this.exportClassifyLoading = true
  128. _this.disabled = true
  129. _this.spinning = true
  130. hdExportExcel(exportGroupStockout, { isOos: 1, salesBillSn: _this.salesBillSn }, '销售单缺货产品分类导出', function () {
  131. _this.exportClassifyLoading = false
  132. _this.spinning = false
  133. _this.disabled = false
  134. })
  135. }
  136. },
  137. watch: {
  138. openModal (nVal, oVal) {
  139. this.isShow = nVal
  140. },
  141. isShow (nVal, oVal) {
  142. if (!nVal) {
  143. this.$emit('close')
  144. this.$refs.table.clearTable()
  145. } else {
  146. this.$nextTick(() => {
  147. this.$refs.table.refresh()
  148. })
  149. }
  150. }
  151. }
  152. }
  153. </script>
  154. <style>
  155. </style>