materialTable.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div>
  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. height="calc(86vh - 230px)"
  12. >
  13. <template v-slot:action="{ row }">
  14. <el-link type="primary" :underline="false" @click="goToDetail(row)">
  15. 详情
  16. </el-link>
  17. </template>
  18. <template v-slot:code="{ row }">
  19. <el-link type="primary" @click="goToDetail(row)">{{
  20. row.code
  21. }}</el-link>
  22. </template>
  23. </ele-pro-table>
  24. <detailed
  25. @detailedClose="detailedClose"
  26. v-if="detailedShow && detailedObj"
  27. :detailedObj="detailedObj"
  28. ></detailed>
  29. <selfDetailed
  30. @detailedClose="detailedClose"
  31. v-if="selfDetailedShow && detailedObj"
  32. :detailedObj="detailedObj"
  33. ></selfDetailed>
  34. </div>
  35. </template>
  36. <script>
  37. import dictMixins from '@/mixins/dictMixins';
  38. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  39. import { batchRecordPage } from '@/api/pickorder/index';
  40. import detailed from '@/views/produce/components/picking/detailed.vue';
  41. import selfDetailed from '@/views/pick/pickApply/components/selfDetailed.vue';
  42. import { getDetails } from '@/api/pick/pickApply';
  43. export default {
  44. mixins: [dictMixins, tableColumnsMixin],
  45. components: { detailed, selfDetailed },
  46. props: {
  47. tableQuery: {
  48. type: Object,
  49. default: () => {
  50. return {};
  51. }
  52. }
  53. },
  54. data() {
  55. return {
  56. columns: [
  57. {
  58. width: 50,
  59. type: 'index',
  60. columnKey: 'index',
  61. align: 'center',
  62. label: '序号'
  63. },
  64. {
  65. prop: 'code',
  66. label: '领料单编号',
  67. align: 'center',
  68. minWidth: 110,
  69. showOverflowTooltip: true,
  70. slot: 'code'
  71. },
  72. {
  73. prop: 'workOrderCode',
  74. label: '关联工单编号',
  75. align: 'center',
  76. showOverflowTooltip: true,
  77. minWidth: 150
  78. },
  79. {
  80. prop: 'warehouseName',
  81. label: '领料仓库名称',
  82. align: 'center',
  83. showOverflowTooltip: true,
  84. minWidth: 150
  85. },
  86. {
  87. prop: 'createUserName',
  88. label: '领料人',
  89. align: 'center',
  90. showOverflowTooltip: true,
  91. minWidth: 150
  92. },
  93. {
  94. prop: 'createTime',
  95. label: '领料时间',
  96. align: 'center',
  97. showOverflowTooltip: true,
  98. minWidth: 150
  99. },
  100. {
  101. prop: 'status',
  102. label: '状态',
  103. align: 'center',
  104. showOverflowTooltip: true,
  105. minWidth: 150,
  106. formatter: (row) => {
  107. switch (row.status) {
  108. case 0:
  109. return '未领料';
  110. case 1:
  111. return '已领料';
  112. case 2:
  113. return '已出库';
  114. case 3:
  115. return '部分出库';
  116. default:
  117. return '';
  118. }
  119. }
  120. },
  121. {
  122. label: '操作',
  123. columnKey: 'action',
  124. slot: 'action',
  125. showOverflowTooltip: true,
  126. minWidth: 110,
  127. align: 'center',
  128. fixed: 'right'
  129. }
  130. ],
  131. cacheKeyUrl: 'mes-259231040-material-table',
  132. detailedShow: false,
  133. selfDetailedShow: false,
  134. detailedObj: null
  135. };
  136. },
  137. computed: {
  138. seekList() {
  139. return [
  140. {
  141. label: '工单编码:',
  142. value: 'workOrderCode',
  143. type: 'input',
  144. placeholder: '请输入'
  145. },
  146. {
  147. label: '领料编码:',
  148. value: 'pickOrderCode',
  149. type: 'input',
  150. placeholder: '请输入'
  151. },
  152. {
  153. label: '领料名称:',
  154. value: 'pickOrderName',
  155. type: 'input',
  156. placeholder: '请输入'
  157. }
  158. ];
  159. }
  160. },
  161. methods: {
  162. // 刷新表格
  163. reload(where = {}) {
  164. this.$refs.table.reload({
  165. where,
  166. ...this.tableQuery
  167. });
  168. },
  169. /* 表格数据源 */
  170. datasource({ page, limit, where, order }) {
  171. // 参数
  172. const body = {
  173. ...where,
  174. ...order,
  175. pageNum: page,
  176. size: limit,
  177. ...this.tableQuery
  178. };
  179. return batchRecordPage(body);
  180. },
  181. search(where) {
  182. this.reload(where);
  183. },
  184. async goToDetail(row) {
  185. const res = await getDetails(row.id);
  186. this.detailedObj = JSON.stringify(res);
  187. this.$nextTick(() => {
  188. if (this.detailedObj.type == 1) {
  189. this.selfDetailedShow = true;
  190. } else {
  191. this.detailedShow = true;
  192. }
  193. });
  194. },
  195. detailedClose() {
  196. this.detailedShow = false;
  197. this.selfDetailedShow = false;
  198. }
  199. }
  200. };
  201. </script>
  202. <style></style>