detailModal.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <a-modal
  3. centered
  4. class="inventoryQueryDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. :title="modalTit"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="960">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <!-- 基础信息 -->
  13. <a-card size="small" :bordered="false" class="purchaseReturnDetail-cont">
  14. <a-collapse :activeKey="['1']">
  15. <a-collapse-panel key="1" header="基础信息">
  16. <a-descriptions :column="3">
  17. <a-descriptions-item label="采购单号">{{ objItem&&objItem.purchaseBillNo || '--' }}</a-descriptions-item>
  18. </a-descriptions>
  19. </a-collapse-panel>
  20. </a-collapse>
  21. </a-card>
  22. <!-- 合计 -->
  23. <a-alert type="info" style="margin-bottom:10px" v-if="objItem">
  24. <div class="ftext" slot="message">
  25. 缺货总款数:<strong>{{ objItem.totalCategory || objItem.totalCategory==0 ? objItem.totalCategory : '--' }}</strong>;
  26. 缺货总数量:<strong>{{ objItem.totalQty || objItem.totalQty==0 ? objItem.totalQty : '--' }}</strong>;
  27. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  28. 缺货总售价:<strong>{{ objItem.totalAmount || objItem.totalAmount==0 ? toThousands(objItem.totalAmount) : '--' }}</strong>。
  29. </div>
  30. </div>
  31. </a-alert>
  32. <!-- 详情 -->
  33. <s-table
  34. class="sTable"
  35. ref="table"
  36. size="small"
  37. :rowKey="(record) => record.id"
  38. :columns="columns"
  39. :data="loadData"
  40. :scroll="{ y: 500 }"
  41. bordered>
  42. </s-table>
  43. <div class="btn-cont">
  44. <a-button id="inventoryQueryDetail-detail-modal-back" @click="isShow = false">返回列表</a-button>
  45. </div>
  46. </a-spin>
  47. </a-modal>
  48. </template>
  49. <script>
  50. import { commonMixin } from '@/utils/mixin'
  51. import { STable } from '@/components'
  52. import { outOfStockDetailList } from '@/api/oos'
  53. export default {
  54. name: 'DetailModal',
  55. components: { STable },
  56. mixins: [commonMixin],
  57. props: {
  58. openModal: { // 弹框显示状态
  59. type: Boolean,
  60. default: false
  61. },
  62. objItem: {
  63. type: Object,
  64. default: () => {
  65. return {}
  66. }
  67. }
  68. },
  69. computed: {
  70. modalTit () {
  71. return '详情'
  72. },
  73. columns () {
  74. const _this = this
  75. const arr = [
  76. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  77. { title: '产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
  78. { title: '产品名称', dataIndex: 'productName', width: '17%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  79. { title: '原厂编码', dataIndex: 'origCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  80. { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  81. { title: '缺货数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '单价', dataIndex: 'price', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  83. { title: '缺货金额', dataIndex: 'totalAmount', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  84. ]
  85. return arr
  86. }
  87. },
  88. data () {
  89. return {
  90. spinning: false,
  91. isShow: this.openModal, // 是否打开弹框
  92. // 加载数据方法 必须为 Promise 对象
  93. loadData: parameter => {
  94. this.disabled = true
  95. this.spinning = true
  96. return outOfStockDetailList(Object.assign(parameter, { purchaseBillSn: this.objItem && this.objItem.purchaseBillSn || '' })).then(res => {
  97. let data
  98. if (res.status == 200) {
  99. data = res.data
  100. const no = (data.pageNo - 1) * data.pageSize
  101. for (var i = 0; i < data.list.length; i++) {
  102. data.list[i].no = no + i + 1
  103. }
  104. this.disabled = false
  105. }
  106. this.spinning = false
  107. return data
  108. })
  109. },
  110. disabled: false // 查询、重置按钮是否可操作
  111. }
  112. },
  113. methods: {
  114. // 获取表格数据
  115. pageInit () {
  116. this.$refs.table.refresh()
  117. }
  118. },
  119. watch: {
  120. // 父页面传过来的弹框状态
  121. openModal (newValue, oldValue) {
  122. this.isShow = newValue
  123. },
  124. // 重定义的弹框状态
  125. isShow (newValue, oldValue) {
  126. if (!newValue) {
  127. this.$emit('close')
  128. this.$refs.table.clearTable()
  129. }
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="less">
  135. .inventoryQueryDetail-modal{
  136. .btn-cont {
  137. text-align: center;
  138. margin: 5px 0 10px;
  139. }
  140. }
  141. </style>