stockOutDetailModal.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. </div>
  46. </a-spin>
  47. </a-modal>
  48. </template>
  49. <script>
  50. import { STable } from '@/components'
  51. import { commonMixin } from '@/utils/mixin'
  52. import { salesStockoutDetail, exportStockout, exportGroupStockout } from '@/api/salesDetail'
  53. import { hdExportExcel } from '@/libs/exportExcel'
  54. export default {
  55. name: 'StockOutDetail',
  56. mixins: [commonMixin],
  57. components: { STable },
  58. props: {
  59. openModal: {
  60. type: Boolean,
  61. default: false
  62. },
  63. salesBillSn: {
  64. type: [Number, String],
  65. default: ''
  66. },
  67. detailData: {
  68. type: Object,
  69. default: function () {
  70. return null
  71. }
  72. }
  73. },
  74. data () {
  75. const _this = this
  76. return {
  77. spinning: false,
  78. isShow: this.openModal,
  79. disabled: false,
  80. exportLoading: false,
  81. exportClassifyLoading: false,
  82. // 加载数据方法 必须为 Promise 对象
  83. loadData: parameter => {
  84. this.spinning = true
  85. this.disabled = true
  86. delete parameter.tableId
  87. delete parameter.index
  88. return salesStockoutDetail({ isOos: 1, salesBillSn: this.salesBillSn }).then(res => {
  89. let data
  90. if (res.status == 200) {
  91. data = res.data
  92. const no = 0
  93. for (var i = 0; i < data.length; i++) {
  94. data[i].no = no + i + 1
  95. }
  96. this.disabled = false
  97. }
  98. this.spinning = false
  99. return data
  100. })
  101. }
  102. }
  103. },
  104. computed:{
  105. columns () {
  106. const _this = this
  107. const arr = [
  108. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  109. { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  110. { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  111. { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  112. { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  113. { title: '销售数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  114. // { title: '销售价', dataIndex: 'price', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  115. // { title: '销售金额', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  116. { title: '缺货数量', dataIndex: 'lackQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  117. { title: '缺货金额', dataIndex: 'lackAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  118. ]
  119. if (this.$hasPermissions('B_salesDetail_salesPrice')) { // 售价权限
  120. arr.splice(6, 0, { title: '销售价', dataIndex: 'price', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  121. arr.splice(7, 0, { title: '销售金额', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  122. }
  123. return arr
  124. }
  125. },
  126. methods: {
  127. handleExport () {
  128. const _this = this
  129. _this.exportLoading = true
  130. _this.disabled = true
  131. _this.spinning = true
  132. hdExportExcel(exportStockout, { isOos: 1, salesBillSn: _this.salesBillSn }, '销售单缺货产品导出', function () {
  133. _this.exportLoading = false
  134. _this.spinning = false
  135. _this.disabled = false
  136. })
  137. },
  138. handleClassifyExport () {
  139. const _this = this
  140. _this.exportClassifyLoading = true
  141. _this.disabled = true
  142. _this.spinning = true
  143. hdExportExcel(exportGroupStockout, { isOos: 1, salesBillSn: _this.salesBillSn }, '销售单缺货产品分类导出', function () {
  144. _this.exportClassifyLoading = false
  145. _this.spinning = false
  146. _this.disabled = false
  147. })
  148. }
  149. },
  150. watch: {
  151. openModal (nVal, oVal) {
  152. this.isShow = nVal
  153. },
  154. isShow (nVal, oVal) {
  155. if (!nVal) {
  156. this.$emit('close')
  157. this.$refs.table.clearTable()
  158. } else {
  159. this.$nextTick(() => {
  160. this.$refs.table.refresh()
  161. })
  162. }
  163. }
  164. }
  165. }
  166. </script>
  167. <style>
  168. </style>