index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <byProductSearch @search="reload" ref="searchRef"> </byProductSearch>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. row-key="id"
  11. cache-key="by_product_list"
  12. :selection.sync="selection"
  13. autoAmendPage
  14. :parse-data="parseData"
  15. @update:selection="handleSelectionChange"
  16. :height="tableHeight"
  17. @fullscreen-change="fullscreenChange"
  18. >
  19. <template v-slot:toolbar>
  20. <el-button type="primary" size="mini" @click="handByProd"
  21. >新建回收单</el-button
  22. >
  23. </template>
  24. <template v-slot:formedNum="{ row }">
  25. {{ row.notFormedNum || 0 }} / {{ row.formedNum || 0 }}
  26. </template>
  27. <template v-slot:weight="{ row }">
  28. {{ row.weight || 0 }} / {{ row.weightUnit }}
  29. </template>
  30. <template v-slot:action="{ row }">
  31. <!-- <el-button type="text" size="mini">详情</el-button> -->
  32. <el-button type="text" size="mini" @click="disopseProduct(row)"
  33. >处置</el-button
  34. >
  35. </template>
  36. </ele-pro-table>
  37. </el-card>
  38. <addByProduct v-if="addByProductShow" @close="close"></addByProduct>
  39. <el-dialog
  40. title="仓库处置"
  41. :visible.sync="visible"
  42. v-if="visible"
  43. :before-close="handleClose"
  44. :close-on-click-modal="false"
  45. :close-on-press-escape="false"
  46. append-to-body
  47. width="500px"
  48. >
  49. <el-form size="mini" :model="form" label-width="96px">
  50. <el-form-item label="仓库" prop="warehouseList">
  51. <el-select
  52. v-model="form.warehouseId"
  53. filterable
  54. placeholder="请选择仓库"
  55. >
  56. <el-option
  57. v-for="item in warehouseList"
  58. :label="item.name"
  59. :value="item.id"
  60. :key="item.id"
  61. >
  62. </el-option>
  63. </el-select>
  64. </el-form-item>
  65. </el-form>
  66. <template slot="footer">
  67. <el-button size="mini" @click="visible = false">取 消</el-button>
  68. <el-button size="mini" type="primary" @click="warehouseSave"
  69. >保 存</el-button
  70. >
  71. </template>
  72. </el-dialog>
  73. </div>
  74. </template>
  75. <script>
  76. import { getPage } from '@/api/byProduct/index';
  77. import byProductSearch from './components/byProduct-search.vue';
  78. import addByProduct from './components/addByProduct.vue';
  79. export default {
  80. components: {
  81. byProductSearch,
  82. addByProduct
  83. },
  84. data() {
  85. return {
  86. // 加载状态
  87. loading: false,
  88. selection: [],
  89. addByProductShow: false,
  90. visible: false,
  91. warehouseList: [],
  92. form: {
  93. warehouseId: ''
  94. },
  95. tableHeight: 'calc(100vh - 300px)'
  96. };
  97. },
  98. computed: {
  99. columns() {
  100. return [
  101. {
  102. columnKey: 'index',
  103. label: '序号',
  104. type: 'index',
  105. width: 55,
  106. align: 'center',
  107. showOverflowTooltip: true,
  108. fixed: 'left'
  109. },
  110. {
  111. prop: 'code',
  112. label: '回收单号',
  113. align: 'left',
  114. width: '300',
  115. showOverflowTooltip: true
  116. },
  117. {
  118. prop: 'workOrderCode',
  119. label: '工单编码',
  120. align: 'center',
  121. showOverflowTooltip: true
  122. },
  123. {
  124. prop: 'taskName',
  125. label: '工序',
  126. align: 'center',
  127. showOverflowTooltip: true
  128. },
  129. {
  130. prop: 'categoryCode',
  131. label: '物品编码',
  132. align: 'center',
  133. showOverflowTooltip: true
  134. },
  135. {
  136. prop: 'categoryName',
  137. label: '物品名称',
  138. align: 'center',
  139. showOverflowTooltip: true
  140. },
  141. {
  142. prop: 'formedNum',
  143. slot: 'formedNum',
  144. label: '不合格品/合格品数量',
  145. align: 'center',
  146. width: 140
  147. },
  148. {
  149. prop: 'weight',
  150. slot: 'weight',
  151. label: '重量',
  152. align: 'center',
  153. width: 140
  154. },
  155. {
  156. prop: 'executorName',
  157. label: '回收人',
  158. align: 'center',
  159. width: 95
  160. },
  161. {
  162. prop: 'createTime',
  163. label: '创建时间',
  164. align: 'center',
  165. width: 95,
  166. showOverflowTooltip: true
  167. },
  168. {
  169. prop: '',
  170. label: '操作',
  171. width: 80,
  172. align: 'center',
  173. resizable: false,
  174. fixed: 'right',
  175. slot: 'action'
  176. }
  177. ];
  178. }
  179. },
  180. created() {},
  181. methods: {
  182. /* 表格数据源 */
  183. async datasource({ page, limit, where }) {
  184. let parma = {
  185. ...where,
  186. pageNum: page,
  187. size: limit
  188. };
  189. let res = await getPage(parma);
  190. return res;
  191. },
  192. /* 数据转为树形结构 */
  193. parseData(data) {
  194. return {
  195. ...data,
  196. list: this.$util.toTreeData({
  197. data: data.list,
  198. count: data.total,
  199. idField: 'id',
  200. parentIdField: 'parentId'
  201. })
  202. };
  203. },
  204. handleSelectionChange(data) {
  205. console.log(data);
  206. },
  207. /* 刷新表格 */
  208. reload(where = {}) {
  209. this.$refs.table.reload({ page: 1, where });
  210. },
  211. handleClose() {
  212. this.visible = false;
  213. },
  214. warehouseSave() {
  215. this.visible = false;
  216. },
  217. disopseProduct(item) {
  218. this.visible = true;
  219. },
  220. handByProd() {
  221. this.addByProductShow = true;
  222. },
  223. close(val) {
  224. if (val) {
  225. this.reload();
  226. }
  227. this.addByProductShow = false;
  228. },
  229. fullscreenChange(fullscreen) {
  230. if (fullscreen) {
  231. this.tableHeight = 'calc(100vh - 120px)';
  232. } else {
  233. this.tableHeight = 'calc(100vh - 300px)';
  234. }
  235. }
  236. }
  237. };
  238. </script>