index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <search @search="reload" ref="searchRef"> </search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table ref="table" :columns="columns" :datasource="datasource" cache-key="workOrderTable">
  7. <template v-slot:totalCount="{ row }">
  8. {{ row.totalCount }} {{ row.measuringUnit }}
  9. </template>
  10. <template v-slot:totalPackage="{ row }">
  11. {{ row.totalPackage }}
  12. </template>
  13. <template v-slot:totalWeight="{ row }">
  14. {{ row.totalWeight }} {{ row.weightUnit }}
  15. </template>
  16. <template v-slot:approvalStatus="{ row }">
  17. <span :class="{ 'ele-text-danger': row.approvalStatus == 2 }">
  18. {{ statusFormatter(row.approvalStatus) }}
  19. </span>
  20. </template>
  21. <template v-slot:action="{ row }">
  22. <el-link type="primary" :underline="false" @click="details(row)">
  23. 详情
  24. </el-link>
  25. </template>
  26. </ele-pro-table>
  27. </el-card>
  28. <tgDetails ref="tgDetailsRefs"></tgDetails>
  29. </div>
  30. </template>
  31. <script>
  32. import { getList } from '@/api/warehousing/index.js';
  33. import search from './components/search.vue';
  34. import tgDetails from './components/tgDetails.vue'
  35. export default {
  36. components: {
  37. search,
  38. tgDetails
  39. },
  40. data() {
  41. return {
  42. loading: false,
  43. statusOpt: [
  44. { label: '未提交', value: 0 },
  45. { label: '审核中', value: 1 },
  46. { label: '审核通过', value: 2 },
  47. { label: '审核不通过', value: 3 },
  48. ]
  49. };
  50. },
  51. computed: {
  52. // 表格列配置
  53. columns() {
  54. return [
  55. {
  56. columnKey: 'index',
  57. label: '序号',
  58. type: 'index',
  59. width: 55,
  60. align: 'center',
  61. showOverflowTooltip: true,
  62. fixed: 'left'
  63. },
  64. {
  65. prop: 'workOrderCode',
  66. label: '工单编码',
  67. align: 'center',
  68. minWidth: 110
  69. },
  70. {
  71. prop: 'warehouseName',
  72. label: '仓库名称 ',
  73. align: 'center'
  74. },
  75. {
  76. prop: 'categoryLevelName',
  77. label: '物品分类名称',
  78. align: 'center'
  79. },
  80. {
  81. prop: 'categoryName',
  82. label: '物品名称',
  83. align: 'center'
  84. },
  85. {
  86. slot: 'totalCount',
  87. label: '总数量',
  88. align: 'center'
  89. },
  90. {
  91. slot: 'totalPackage',
  92. label: '总包装',
  93. align: 'center'
  94. },
  95. {
  96. slot: 'totalWeight',
  97. label: '总重量',
  98. align: 'center'
  99. },
  100. {
  101. prop: 'approvalUserName',
  102. label: '审核人',
  103. align: 'center'
  104. },
  105. {
  106. prop: 'createTime',
  107. label: '创建时间',
  108. align: 'center',
  109. showOverflowTooltip: true,
  110. minWidth: 110
  111. },
  112. {
  113. slot: 'approvalStatus',
  114. label: '状态',
  115. align: 'center',
  116. },
  117. {
  118. columnKey: 'action',
  119. label: '操作',
  120. width: 120,
  121. align: 'center',
  122. resizable: false,
  123. fixed: 'right',
  124. slot: 'action',
  125. showOverflowTooltip: true
  126. }
  127. ];
  128. },
  129. },
  130. created() {
  131. },
  132. methods: {
  133. statusFormatter(status) {
  134. const obj = this.statusOpt.find((i) => i.value == status);
  135. return obj && obj.label;
  136. },
  137. /* 表格数据源 */
  138. datasource({ page, limit, where }) {
  139. return getList({
  140. pageNum: page,
  141. size: limit,
  142. ...where
  143. });
  144. },
  145. details(row) {
  146. this.$refs.tgDetailsRefs.open(row)
  147. },
  148. /* 刷新表格 */
  149. reload(where) {
  150. this.$nextTick(() => {
  151. this.$refs.table.reload({ page: 1, where });
  152. });
  153. }
  154. }
  155. };
  156. </script>
  157. <style lang="scss" scoped></style>