materialTable.vue 5.2 KB

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