changeRecordModal.vue 2.9 KB

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