detailModal.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <a-modal
  3. centered
  4. class="bulkWarehousingOrder-basicInfo-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="详情"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. :width="960">
  11. <!-- <div style="padding: 0 12px;text-align: right;">
  12. <a-button id="bulkWarehousingOrderDetail-preview-btn" style="margin-right: 15px;">打印预览</a-button>
  13. <a-button type="primary" id="bulkWarehousingOrderDetail-print-btn">快速打印</a-button>
  14. </div> -->
  15. <!-- 基础信息 -->
  16. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  17. <a-collapse :activeKey="['1']">
  18. <a-collapse-panel key="1">
  19. <template slot="header">
  20. 基础信息
  21. </template>
  22. <a-descriptions :column="3">
  23. <a-descriptions-item label="供应商">{{ (productTotal&&productTotal.supplierName) || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="入库类型">{{ (productTotal&&productTotal.sparePartsTypeDictValue) || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="入库单号">{{ (productTotal&&productTotal.sparePartsNo) || '--' }}</a-descriptions-item>
  26. </a-descriptions>
  27. </a-collapse-panel>
  28. </a-collapse>
  29. </a-card>
  30. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  31. <!-- 总计 -->
  32. <a-alert type="info" showIcon style="margin-bottom:15px">
  33. <div slot="message">
  34. 入库数量 <strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
  35. 入库金额 <strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong>
  36. </div>
  37. </a-alert>
  38. <!-- 列表 -->
  39. <s-table
  40. class="sTable"
  41. ref="table"
  42. size="small"
  43. :rowKey="(record) => record.id"
  44. :columns="columns"
  45. :data="loadData"
  46. bordered>
  47. </s-table>
  48. </a-card>
  49. <div class="btn-cont">
  50. <a-button id="bulkWarehousingOrder-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">返回列表</a-button>
  51. </div>
  52. </a-modal>
  53. </template>
  54. <script>
  55. import { STable, VSelect } from '@/components'
  56. import { getOperationalPrecision } from '@/libs/tools.js'
  57. import { sparePartsDetailList, sparePartsPageCount } from '@/api/spareParts'
  58. export default {
  59. name: 'BulkWarehousingOrderDetailModal',
  60. components: { STable, VSelect },
  61. props: {
  62. openModal: { // 弹框显示状态
  63. type: Boolean,
  64. default: false
  65. },
  66. itemSn: {
  67. type: [Number, String],
  68. default: ''
  69. }
  70. },
  71. data () {
  72. return {
  73. isShow: this.openModal, // 是否打开弹框
  74. // 表头
  75. columns: [
  76. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  77. { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  78. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  79. { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  80. { title: '入库数量', dataIndex: 'productQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  81. { title: '入库单价', dataIndex: 'productCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '小计', dataIndex: 'subtotal', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
  83. ],
  84. // 加载数据方法 必须为 Promise 对象
  85. loadData: parameter => {
  86. return sparePartsDetailList(Object.assign(parameter, { sn: this.itemSn })).then(res => {
  87. const data = res.data
  88. const no = (data.pageNo - 1) * data.pageSize
  89. for (var i = 0; i < data.list.length; i++) {
  90. data.list[i].no = no + i + 1
  91. // 小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  92. data.list[i].subtotal = getOperationalPrecision(data.list[i].productCost || 0, data.list[i].productQty)
  93. }
  94. this.getDetailCount(Object.assign(parameter, { sn: this.itemSn }))
  95. return data
  96. })
  97. },
  98. productTotal: null // 合计
  99. }
  100. },
  101. methods: {
  102. // 返回列表
  103. handleBack () {
  104. this.$router.push({ path: '/purchasingManagement/bulkWarehousingOrder/list', query: { closeLastOldTab: true } })
  105. },
  106. // 合计
  107. getDetailCount (params) {
  108. sparePartsPageCount(params).then(res => {
  109. if (res.status == 200) {
  110. this.productTotal = res.data
  111. } else {
  112. this.productTotal = null
  113. }
  114. })
  115. }
  116. },
  117. watch: {
  118. // 父页面传过来的弹框状态
  119. openModal (newValue, oldValue) {
  120. this.isShow = newValue
  121. },
  122. // 重定义的弹框状态
  123. isShow (newValue, oldValue) {
  124. if (!newValue) {
  125. this.$emit('close')
  126. }
  127. },
  128. itemSn (newValue, oldValue) {
  129. if (this.isShow && newValue) {
  130. const _this = this
  131. setTimeout(() => {
  132. _this.$refs.table.refresh(true)
  133. }, 200)
  134. }
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="less">
  140. .bulkWarehousingOrder-basicInfo-modal{
  141. .ant-modal-body {
  142. padding: 10px 10px 20px;
  143. }
  144. .btn-cont {
  145. text-align: center;
  146. margin: 5px 0 10px;
  147. }
  148. }
  149. </style>