detailModal.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <a-modal
  3. centered
  4. class="confirmationDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="详情"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. :width="960">
  11. <div>
  12. <a-descriptions size="small" :column="3" style="margin-bottom: 10px;">
  13. <a-descriptions-item label="入库单号">{{ nowData&&nowData.stockPutNo || '--' }}</a-descriptions-item>
  14. <a-descriptions-item label="入库时间">{{ nowData&&nowData.putTime || '--' }}</a-descriptions-item>
  15. <a-descriptions-item label="入库类型">{{ nowData&&nowData.putBizTypeDictValue || '--' }}</a-descriptions-item>
  16. </a-descriptions>
  17. <s-table
  18. class="sTable"
  19. ref="table"
  20. size="small"
  21. :rowKey="(record) => record.stockPutSn"
  22. :columns="columns"
  23. :data="loadData"
  24. :defaultLoadData="false"
  25. bordered>
  26. </s-table>
  27. <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
  28. </div>
  29. </a-modal>
  30. </template>
  31. <script>
  32. import { STable } from '@/components'
  33. import { stockPutDetailList } from '@/api/stockPut'
  34. export default {
  35. name: 'ConfirmationDetailModal',
  36. components: { STable },
  37. props: {
  38. openModal: { // 弹框显示状态
  39. type: Boolean,
  40. default: false
  41. },
  42. itemSn: {
  43. type: [Number, String],
  44. default: ''
  45. },
  46. nowData: {
  47. type: Object,
  48. default: () => {
  49. return {}
  50. }
  51. }
  52. },
  53. data () {
  54. return {
  55. isShow: this.openModal, // 是否打开弹框
  56. detailsData: null, // 详情数据
  57. // 加载数据方法 必须为 Promise 对象
  58. loadData: parameter => {
  59. return stockPutDetailList(Object.assign(parameter, { sn: this.itemSn })).then(res => {
  60. let data
  61. if (res.status == 200) {
  62. data = res.data
  63. const no = (data.pageNo - 1) * data.pageSize
  64. for (var i = 0; i < data.list.length; i++) {
  65. data.list[i].no = no + i + 1
  66. }
  67. this.disabled = false
  68. }
  69. return data
  70. })
  71. }
  72. }
  73. },
  74. computed: {
  75. // 列表表头
  76. columns () {
  77. const arr = [
  78. { title: '序号', dataIndex: 'no', width: '7%', align: 'center' },
  79. { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  80. { title: '产品名称', dataIndex: 'productName', width: '45%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  81. { title: '入库数量(个)', dataIndex: 'putQty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  82. // { title: '入库成本(¥)', dataIndex: 'putCost',width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  83. ]
  84. if (this.$hasPermissions('B_isShowCost')) {
  85. arr.splice(4, 0, { title: '入库成本(¥)', dataIndex: 'putCost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  86. }
  87. return arr
  88. }
  89. },
  90. methods: {},
  91. watch: {
  92. // 父页面传过来的弹框状态
  93. openModal (newValue, oldValue) {
  94. this.isShow = newValue
  95. },
  96. // 重定义的弹框状态
  97. isShow (newValue, oldValue) {
  98. if (!newValue) {
  99. this.$emit('close')
  100. this.$refs.table.clearTable()
  101. }
  102. },
  103. itemSn (newValue, oldValue) {
  104. if (this.isShow && newValue) {
  105. const _this = this
  106. setTimeout(() => {
  107. _this.$refs.table.refresh(true)
  108. }, 200)
  109. }
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="less">
  115. .confirmationDetail-modal{
  116. .ant-modal-body {
  117. padding: 40px 40px 24px;
  118. }
  119. .btn-cont {
  120. text-align: center;
  121. margin: 5px 0 10px;
  122. }
  123. }
  124. </style>