changeRecordModal.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <a-modal
  3. centered
  4. :footer="null"
  5. :maskClosable="false"
  6. title="变更记录"
  7. v-model="isShow"
  8. @cancel="isShow=false"
  9. width="50%">
  10. <a-collapse :activeKey="['1']">
  11. <a-collapse-panel key="1" header="记录基本信息">
  12. <a-descriptions size="small" :column="1">
  13. <a-descriptions-item label="产品编码">
  14. {{ detailData&&detailData.product.code || '--' }}
  15. </a-descriptions-item>
  16. <a-descriptions-item label="产品名称">
  17. {{ detailData&&detailData.product.name || '--' }}
  18. </a-descriptions-item>
  19. </a-descriptions>
  20. </a-collapse-panel>
  21. </a-collapse>
  22. <a-spin :spinning="spinning" tip="Loading..." style="margin-top:10px;">
  23. <s-table
  24. class="sTable fixPagination"
  25. ref="table"
  26. size="small"
  27. :rowKey="(record) => record.id"
  28. :columns="columns"
  29. :data="loadData"
  30. :scroll="{ y: 500 }"
  31. :style="{ height: '300px' }"
  32. :showPagination="false"
  33. :defaultLoadData="false"
  34. bordered>
  35. </s-table>
  36. </a-spin>
  37. </a-modal>
  38. </template>
  39. <script>
  40. import { STable } from '@/components'
  41. import { stackPlaceListHistory } from '@/api/product'
  42. export default {
  43. name: 'ChangeRecordModal',
  44. components: { STable },
  45. props: {
  46. openModal: {
  47. type: Boolean,
  48. default: false
  49. },
  50. detailData: {
  51. type: Object,
  52. default: function () {
  53. return null
  54. }
  55. }
  56. },
  57. data () {
  58. return {
  59. spinning: false,
  60. isShow: this.openModal,
  61. columns: [
  62. { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
  63. { title: '变更时间', dataIndex: 'updateDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  64. { title: '变更人', dataIndex: 'creatorName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  65. { title: '货位编号-变更前', dataIndex: 'oldStackPlaceCode', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
  66. { title: '货位编号-变更后', dataIndex: 'newStackPlaceCode', width: '25%', align: 'center', customRender: function (text) { return text || '--' } }
  67. ],
  68. // 加载数据方法 必须为 Promise 对象
  69. loadData: parameter => {
  70. this.spinning = true
  71. delete parameter.tableId
  72. delete parameter.index
  73. return stackPlaceListHistory({ productSn: this.detailData.product.productSn, newWarehouseSn: this.detailData.warehouseSn }).then(res => {
  74. let data
  75. if (res.status == 200) {
  76. data = res.data
  77. const no = 0
  78. for (var i = 0; i < data.length; i++) {
  79. data[i].no = no + i + 1
  80. }
  81. this.disabled = false
  82. }
  83. this.spinning = false
  84. return data
  85. })
  86. }
  87. }
  88. },
  89. watch: {
  90. openModal (nVal, oVal) {
  91. this.isShow = nVal
  92. },
  93. isShow (nVal, oVal) {
  94. if (!nVal) {
  95. this.$emit('close')
  96. this.$refs.table.clearTable()
  97. } else {
  98. this.$nextTick(() => {
  99. this.$refs.table.refresh()
  100. })
  101. }
  102. }
  103. }
  104. }
  105. </script>
  106. <style>
  107. </style>