index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <pick-search @search="reload" ref="searchRef"> </pick-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. row-key="id"
  11. cache-key="pickKey"
  12. :selection.sync="selection"
  13. autoAmendPage
  14. :parse-data="parseData"
  15. >
  16. </ele-pro-table>
  17. </el-card>
  18. </div>
  19. </template>
  20. <script>
  21. import { getPage } from '@/api/pick/pickApply';
  22. import pickSearch from './components/pick-search.vue';
  23. export default {
  24. components: {
  25. pickSearch
  26. },
  27. data() {
  28. return {
  29. // 加载状态
  30. loading: false,
  31. selection: []
  32. };
  33. },
  34. computed: {
  35. columns() {
  36. return [
  37. {
  38. prop: 'code',
  39. label: '领料单编号',
  40. align: 'center'
  41. },
  42. {
  43. prop: 'joinWorkOrderCode',
  44. label: '关联工单编号',
  45. align: 'center'
  46. },
  47. {
  48. prop: 'joinWarehouseName',
  49. label: '关联仓库名称',
  50. align: 'center'
  51. },
  52. {
  53. prop: 'joinWarehouseName',
  54. label: '关联仓库名称',
  55. align: 'center'
  56. },
  57. {
  58. prop: 'joinReviewerName',
  59. label: '关联审核人',
  60. align: 'center'
  61. },
  62. {
  63. prop: 'executorName',
  64. label: '领料人',
  65. align: 'center'
  66. },
  67. {
  68. prop: 'createTime',
  69. label: '领料时间',
  70. align: 'center'
  71. },
  72. {
  73. prop: 'status',
  74. slot: 'status',
  75. label: '状态',
  76. align: 'center'
  77. },
  78. {
  79. prop: '',
  80. label: '操作',
  81. width: 80,
  82. align: 'center',
  83. resizable: false,
  84. fixed: 'right',
  85. slot: 'action'
  86. }
  87. ];
  88. }
  89. },
  90. created() {},
  91. methods: {
  92. /* 表格数据源 */
  93. async datasource({ page, limit, where }) {
  94. let res = await getPage({
  95. ...where,
  96. pageNum: page,
  97. size: limit
  98. });
  99. return res;
  100. },
  101. /* 数据转为树形结构 */
  102. parseData(data) {
  103. return {
  104. ...data,
  105. list: this.$util.toTreeData({
  106. data: data.list,
  107. count: data.total,
  108. idField: 'id',
  109. parentIdField: 'parentId'
  110. })
  111. };
  112. },
  113. /* 数据转为树形结构 */
  114. createSuccess() {
  115. this.reload();
  116. },
  117. handleCreate() {
  118. this.$refs.createRef.open(0);
  119. },
  120. // 发布工单
  121. handleOrderPublish(type, row) {
  122. this.$router.push({
  123. path: '/produceOrder/report',
  124. query: {
  125. type,
  126. id: row.id
  127. }
  128. });
  129. },
  130. /* 刷新表格 */
  131. reload(where = {}) {
  132. this.$refs.table.reload({ page: 1, where });
  133. }
  134. }
  135. };
  136. </script>