detailModal.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <a-modal
  3. centered
  4. class="chainStockReportDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. :title="modalTit"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. :width="960">
  11. <!-- 合计 -->
  12. <a-alert type="info" style="margin-bottom:10px">
  13. <div class="ftext" slot="message">
  14. 现有库存总数量(个):<strong> {{ (currentStock && currentStock.totalQty) || 0 }} </strong>;
  15. 现有库存总成本(¥):<strong> {{ (currentStock && currentStock.totalCost) || 0 }} </strong>。
  16. </div>
  17. </a-alert>
  18. <!-- 详情 -->
  19. <s-table
  20. v-if="openModal"
  21. class="sTable"
  22. ref="table"
  23. size="small"
  24. :rowKey="(record) => record.id"
  25. :columns="columns"
  26. :data="loadData"
  27. bordered>
  28. <!-- 库存数量 -->
  29. <template slot="currentQty" slot-scope="text, record">
  30. {{ (Number(record.currentQty) + Number(record.freezeQty)) || 0 }}
  31. <span v-if="Number(record.freezeQty)">(冻结{{ record.freezeQty }})</span>
  32. </template>
  33. </s-table>
  34. <div class="btn-cont">
  35. <a-button id="chainStockReportDetail-detail-modal-back" @click="isShow = false">返回列表</a-button>
  36. </div>
  37. </a-modal>
  38. </template>
  39. <script>
  40. import { STable } from '@/components'
  41. import { reportStockDetailList, reportStockDetailCount } from '@/api/reportStock'
  42. export default {
  43. name: 'InventoryQueryDetailModal',
  44. components: { STable },
  45. props: {
  46. openModal: { // 弹框显示状态
  47. type: Boolean,
  48. default: false
  49. },
  50. productSn: {
  51. type: [Number, String],
  52. default: ''
  53. },
  54. stockSn: {
  55. type: [Number, String],
  56. default: ''
  57. }
  58. },
  59. computed: {
  60. modalTit () {
  61. return '详情'
  62. }
  63. },
  64. data () {
  65. return {
  66. isShow: this.openModal, // 是否打开弹框
  67. // 表头
  68. columns: [
  69. { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  70. { title: '产品名称', dataIndex: 'productEntity.name', width: '15%', align: 'left', ellipsis: true, customRender: function (text) { return text || '--' } },
  71. { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  72. { title: '入库时间', dataIndex: 'putTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  73. { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  74. { title: '仓位', dataIndex: 'warehouseLocationName', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  75. { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  76. { title: '库存数量', scopedSlots: { customRender: 'currentQty' }, width: '8%', align: 'center' },
  77. { title: '成本单价', dataIndex: 'putCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  78. ],
  79. // 加载数据方法 必须为 Promise 对象
  80. loadData: parameter => {
  81. const params = Object.assign(parameter, { productSn: this.productSn, stockSn: this.stockSn })
  82. return reportStockDetailList(params).then(res => {
  83. const data = res.data
  84. const no = (data.pageNo - 1) * data.pageSize
  85. for (var i = 0; i < data.list.length; i++) {
  86. data.list[i].no = no + i + 1
  87. }
  88. // 总计
  89. this.getCount(params)
  90. return data
  91. })
  92. },
  93. currentStock: null
  94. }
  95. },
  96. methods: {
  97. // 合计
  98. getCount (param) {
  99. reportStockDetailCount(param).then(res => {
  100. if (res.status == 200 && res.data) {
  101. this.currentStock = res.data
  102. } else {
  103. this.currentStock = null
  104. }
  105. })
  106. }
  107. },
  108. watch: {
  109. // 父页面传过来的弹框状态
  110. openModal (newValue, oldValue) {
  111. this.isShow = newValue
  112. },
  113. // 重定义的弹框状态
  114. isShow (newValue, oldValue) {
  115. if (!newValue) {
  116. this.$emit('close')
  117. }
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less">
  123. .chainStockReportDetail-modal{
  124. .btn-cont {
  125. text-align: center;
  126. margin: 10px 0 10px;
  127. }
  128. }
  129. </style>