materialTable.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div class="ele-body">
  3. <seek-page :seekList="seekList" @search="search"></seek-page>
  4. <ele-pro-table
  5. ref="table"
  6. row-key="id"
  7. :columns="columns"
  8. :datasource="datasource"
  9. :cache-key="cacheKeyUrl"
  10. autoAmendPage
  11. >
  12. </ele-pro-table>
  13. </div>
  14. </template>
  15. <script>
  16. import dictMixins from '@/mixins/dictMixins';
  17. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  18. import { batchRecordPage } from '@/api/pickorder/index';
  19. export default {
  20. mixins: [dictMixins, tableColumnsMixin],
  21. props: {
  22. tableQuery: {
  23. type: Object,
  24. default: () => {
  25. return {};
  26. }
  27. }
  28. },
  29. data() {
  30. return {
  31. columns: [
  32. {
  33. width: 50,
  34. type: 'index',
  35. columnKey: 'index',
  36. align: 'center',
  37. label: '序号'
  38. },
  39. {
  40. prop: 'code',
  41. label: '领料单编号',
  42. align: 'center',
  43. minWidth: 110,
  44. showOverflowTooltip: true
  45. },
  46. {
  47. prop: 'workOrderCode',
  48. label: '关联工单编号',
  49. align: 'center',
  50. showOverflowTooltip: true,
  51. minWidth: 150
  52. },
  53. {
  54. prop: 'warehouseName',
  55. label: '领料仓库名称',
  56. align: 'center',
  57. showOverflowTooltip: true,
  58. minWidth: 150
  59. },
  60. {
  61. prop: 'createUserName',
  62. label: '领料人',
  63. align: 'center',
  64. showOverflowTooltip: true,
  65. minWidth: 150
  66. },
  67. {
  68. prop: 'createTime',
  69. label: '领料时间',
  70. align: 'center',
  71. showOverflowTooltip: true,
  72. minWidth: 150
  73. },
  74. {
  75. prop: 'status',
  76. label: '状态',
  77. align: 'center',
  78. showOverflowTooltip: true,
  79. minWidth: 150,
  80. formatter: (row) => {
  81. switch (row.status) {
  82. case 0:
  83. return '未领料';
  84. case 1:
  85. return '已领料';
  86. case 2:
  87. return '已出库';
  88. case 3:
  89. return '部分出库';
  90. default:
  91. return '';
  92. }
  93. }
  94. }
  95. ],
  96. cacheKeyUrl: 'mes-259231040-material-table'
  97. };
  98. },
  99. computed: {
  100. seekList() {
  101. return [
  102. {
  103. label: '工单编码:',
  104. value: 'workOrderCode',
  105. type: 'input',
  106. placeholder: '请输入'
  107. },
  108. {
  109. label: '领料编码:',
  110. value: 'pickOrderCode',
  111. type: 'input',
  112. placeholder: '请输入'
  113. },
  114. {
  115. label: '领料名称:',
  116. value: 'pickOrderName',
  117. type: 'input',
  118. placeholder: '请输入'
  119. }
  120. ];
  121. }
  122. },
  123. methods: {
  124. // 刷新表格
  125. reload(where = {}) {
  126. this.$refs.table.reload({
  127. where,
  128. ...this.tableQuery
  129. });
  130. },
  131. /* 表格数据源 */
  132. datasource({ page, limit, where, order }) {
  133. // 参数
  134. const body = {
  135. ...where,
  136. ...order,
  137. pageNum: page,
  138. size: limit,
  139. ...this.tableQuery
  140. };
  141. return batchRecordPage(body);
  142. },
  143. search(where) {
  144. this.reload(where);
  145. }
  146. }
  147. };
  148. </script>
  149. <style></style>