index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <return-search @search="reload" ref="searchRef"> </return-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. row-key="id"
  11. cache-key="returnKey"
  12. :selection.sync="selection"
  13. >
  14. <template v-slot:toolbar>
  15. <el-button type="primary" size="mini" @click="handleReturn"
  16. >新建</el-button
  17. >
  18. </template>
  19. <template v-slot:type="{ row }">
  20. <el-tag
  21. :type="
  22. row.type == '0' ? 'danger' : row.type == '1' ? '' : 'success'
  23. "
  24. effect="dark"
  25. >{{
  26. row.type == '0'
  27. ? '未领料'
  28. : row.type == '1'
  29. ? '领料中'
  30. : row.type == '2'
  31. ? '已出库'
  32. : ''
  33. }}</el-tag
  34. >
  35. </template>
  36. <template v-slot:action="{ row }">
  37. <el-button type="text" size="mini" @click="handDetailed(row)"
  38. >详情</el-button
  39. >
  40. </template>
  41. </ele-pro-table>
  42. </el-card>
  43. <returnPop v-if="returnShow" @close="close"></returnPop>
  44. </div>
  45. </template>
  46. <script>
  47. import { returnPage } from '@/api/materialReturn/index.js';
  48. import returnSearch from './components/return-search.vue';
  49. import returnPop from './components/returnPop.vue';
  50. export default {
  51. components: {
  52. returnSearch,
  53. returnPop
  54. },
  55. data() {
  56. return {
  57. // 加载状态
  58. loading: false,
  59. selection: [],
  60. returnShow: false
  61. };
  62. },
  63. computed: {
  64. columns() {
  65. return [
  66. {
  67. prop: 'code',
  68. label: '退料单编号',
  69. align: 'center'
  70. },
  71. {
  72. prop: 'name',
  73. label: '退料单名称',
  74. align: 'center'
  75. },
  76. {
  77. prop: 'scene',
  78. label: '退料场景',
  79. align: 'center'
  80. },
  81. {
  82. prop: 'executorName',
  83. label: '退料人',
  84. align: 'center'
  85. },
  86. {
  87. prop: 'executorTime',
  88. label: '退料时间',
  89. align: 'center'
  90. },
  91. {
  92. prop: 'type',
  93. slot: 'type',
  94. label: '退料类型',
  95. align: 'center'
  96. },
  97. {
  98. prop: '',
  99. label: '操作',
  100. width: 80,
  101. align: 'center',
  102. resizable: false,
  103. fixed: 'right',
  104. slot: 'action'
  105. }
  106. ];
  107. }
  108. },
  109. created() {},
  110. methods: {
  111. /* 表格数据源 */
  112. async datasource({ page, limit, where }) {
  113. let res = await returnPage({
  114. ...where,
  115. pageNum: page,
  116. size: limit
  117. });
  118. return res;
  119. },
  120. handleReturn() {
  121. this.returnShow = true;
  122. },
  123. close(val) {
  124. if (val) {
  125. this.reload()
  126. }
  127. this.returnShow = false;
  128. },
  129. /* 刷新表格 */
  130. reload(where = {}) {
  131. this.$refs.table.reload({ page: 1, where });
  132. }
  133. }
  134. };
  135. </script>