detailModal.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. columns: [
  58. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  59. { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  60. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  61. { title: '入库数量(个)', dataIndex: 'putQty', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  62. { title: '入库成本(¥)', dataIndex: 'putCost', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  63. ],
  64. // 加载数据方法 必须为 Promise 对象
  65. loadData: parameter => {
  66. return stockPutDetailList(Object.assign(parameter, { sn: this.itemSn })).then(res => {
  67. const data = res.data
  68. const no = (data.pageNo - 1) * data.pageSize
  69. for (var i = 0; i < data.list.length; i++) {
  70. data.list[i].no = no + i + 1
  71. }
  72. this.disabled = false
  73. return data
  74. })
  75. }
  76. }
  77. },
  78. methods: {},
  79. watch: {
  80. // 父页面传过来的弹框状态
  81. openModal (newValue, oldValue) {
  82. this.isShow = newValue
  83. },
  84. // 重定义的弹框状态
  85. isShow (newValue, oldValue) {
  86. if (!newValue) {
  87. this.$emit('close')
  88. this.$refs.table.clearTable()
  89. }
  90. },
  91. itemSn (newValue, oldValue) {
  92. if (this.isShow && newValue) {
  93. const _this = this
  94. setTimeout(() => {
  95. _this.$refs.table.refresh(true)
  96. }, 200)
  97. }
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="less">
  103. .confirmationDetail-modal{
  104. .ant-modal-body {
  105. padding: 40px 40px 24px;
  106. }
  107. .btn-cont {
  108. text-align: center;
  109. margin: 5px 0 10px;
  110. }
  111. }
  112. </style>