index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <productSearch @search="reload" ref="searchRef" >
  5. </productSearch>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. row-key="id"
  12. cache-key="pickKey"
  13. :selection.sync="selection"
  14. autoAmendPage
  15. :parse-data="parseData"
  16. @update:selection="handleSelectionChange"
  17. >
  18. <template v-slot:toolbar>
  19. <el-button
  20. type="primary"
  21. size="mini"
  22. @click="handSelfPick"
  23. >自建处置单</el-button
  24. >
  25. </template>
  26. <template v-slot:formedNum="{ row }">
  27. {{ row.notFormedNum || 0 }} / {{ row.formedNum || 0 }}
  28. </template>
  29. <template v-slot:weight="{ row }">
  30. {{ row.weight || 0 }} / {{ row.weightUnit }}
  31. </template>
  32. <template v-slot:action="{ row }">
  33. <el-button type="text" size="mini" @click="handDetailed(row)"
  34. >详情</el-button
  35. >
  36. </template>
  37. </ele-pro-table>
  38. </el-card>
  39. <!-- <addPick v-if="addPickShow" @close="close"></addPick>
  40. <selfBuildPick v-if="selfBuildPickShow" @close="close"></selfBuildPick>
  41. <detailed
  42. @detailedClose="detailedClose"
  43. v-if="detailedShow"
  44. :detailedObj="detailedObj"
  45. ></detailed>
  46. <selfDetailed
  47. @detailedClose="detailedClose"
  48. v-if="selfDetailedShow"
  49. :detailedObj="detailedObj"
  50. ></selfDetailed> -->
  51. </div>
  52. </template>
  53. <script>
  54. import { getPage, returnPage } from '@/api/byProduct/index';
  55. import productSearch from './components/product-search.vue';
  56. // import addPick from './components/addPick.vue';
  57. // import selfBuildPick from './components/selfBuildPick.vue';
  58. // import detailed from '@/views/produce/components/picking/detailed.vue';
  59. // import selfDetailed from './components/selfDetailed.vue';
  60. export default {
  61. components: {
  62. productSearch
  63. // addPick,
  64. // selfBuildPick,
  65. // detailed,
  66. // selfDetailed
  67. },
  68. data() {
  69. return {
  70. // 加载状态
  71. loading: false,
  72. selection: [],
  73. addPickShow: false,
  74. selfBuildPickShow: false,
  75. detailedShow: false,
  76. detailedObj: null,
  77. selfDetailedShow: false,
  78. statusList: ['未领料', '领料中', '已出库', '已驳回']
  79. };
  80. },
  81. computed: {
  82. columns() {
  83. return [
  84. {
  85. prop: 'code',
  86. label: '处置单号',
  87. align: 'left',
  88. },
  89. {
  90. prop: 'workOrderCode',
  91. label: '工单编码',
  92. align: 'center'
  93. },
  94. {
  95. prop: 'taskName',
  96. label: '工序',
  97. align: 'center'
  98. },
  99. {
  100. prop: 'categoryCode',
  101. label: '物品编码',
  102. align: 'center'
  103. },
  104. {
  105. prop: 'categoryName',
  106. label: '物品名称',
  107. align: 'center'
  108. },
  109. {
  110. prop: 'formedNum',
  111. slot: 'formedNum',
  112. label: '不合格品/合格品数量',
  113. align: 'center',
  114. width: 140,
  115. },
  116. {
  117. prop: 'weight',
  118. slot: 'weight',
  119. label: '重量',
  120. align: 'center',
  121. width: 140,
  122. },
  123. {
  124. prop: 'executorName',
  125. label: '处置人',
  126. align: 'center',
  127. width: 95,
  128. },
  129. {
  130. prop: 'createTime',
  131. label: '创建时间',
  132. align: 'center',
  133. width: 95,
  134. },
  135. {
  136. prop: '',
  137. label: '操作',
  138. width: 80,
  139. align: 'center',
  140. resizable: false,
  141. fixed: 'right',
  142. slot: 'action'
  143. }
  144. ];
  145. }
  146. },
  147. created() {},
  148. methods: {
  149. /* 表格数据源 */
  150. async datasource({ page, limit, where }) {
  151. let parma = {
  152. ...where,
  153. pageNum: page,
  154. size: limit
  155. };
  156. let res = await getPage(parma);
  157. return res;
  158. },
  159. /* 数据转为树形结构 */
  160. parseData(data) {
  161. return {
  162. ...data,
  163. list: this.$util.toTreeData({
  164. data: data.list,
  165. count: data.total,
  166. idField: 'id',
  167. parentIdField: 'parentId'
  168. })
  169. };
  170. },
  171. handPick() {
  172. this.addPickShow = true;
  173. },
  174. close(val) {
  175. if (val) {
  176. this.reload();
  177. }
  178. this.addPickShow = false;
  179. this.selfBuildPickShow = false;
  180. },
  181. handSelfPick() {
  182. this.selfBuildPickShow = true;
  183. },
  184. selfClose(val) {
  185. if (val) {
  186. this.reload();
  187. }
  188. this.selfBuildPickShow = false;
  189. },
  190. handDetailed(row) {
  191. this.detailedObj = JSON.stringify(row);
  192. if (row.type == 1) {
  193. this.selfDetailedShow = true;
  194. } else {
  195. this.detailedShow = true;
  196. }
  197. },
  198. detailedClose() {
  199. this.detailedShow = false;
  200. this.selfDetailedShow = false;
  201. },
  202. handleSelectionChange(data) {
  203. let ids = [];
  204. ids = data.map((item) => item.id);
  205. this.$emit('selectionChange', ids);
  206. },
  207. /* 刷新表格 */
  208. reload(where = {}) {
  209. this.$refs.table.reload({ page: 1, where });
  210. }
  211. }
  212. };
  213. </script>