index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <inventory-search @search="reload"> </inventory-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. cache-key="systemRoleTable"
  11. >
  12. <template v-slot:toolbar>
  13. <el-button icon="el-icon-plus" type="primary" @click="add"
  14. >新建</el-button
  15. >
  16. </template>
  17. <!-- <template v-slot:code="{ row }">
  18. <el-link type="primary" @click="goDetail(row)">{{
  19. row.code
  20. }}</el-link>
  21. </template> -->
  22. <template v-slot:action="{ row }">
  23. <el-link
  24. v-if="row.status == 0"
  25. type="primary"
  26. :underline="false"
  27. icon="el-icon-view"
  28. @click="submit(row)"
  29. >
  30. 提交
  31. </el-link>
  32. <el-link
  33. v-if="row.status == 0"
  34. type="primary"
  35. :underline="false"
  36. icon="el-icon-view"
  37. @click="edit(row)"
  38. >
  39. 修改
  40. </el-link>
  41. <el-popconfirm
  42. v-if="row.status == 0"
  43. style="margin-left: 10px"
  44. confirm-button-text="确认"
  45. cancel-button-text="取消"
  46. title="是否确认删除?"
  47. @confirm="deleted(row)"
  48. >
  49. <el-link
  50. slot="reference"
  51. type="primary"
  52. :underline="false"
  53. icon="el-icon-delete"
  54. >
  55. 删除
  56. </el-link>
  57. </el-popconfirm>
  58. </template>
  59. </ele-pro-table>
  60. </el-card>
  61. </div>
  62. </template>
  63. <script>
  64. import { allocationType } from '@/utils/dict/warehouse';
  65. import storageApi from '@/api/warehouseManagement/index.js';
  66. import InventorySearch from './components/inventory-search.vue';
  67. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  68. import { pageRoles } from '@/api/system/role';
  69. export default {
  70. components: {
  71. InventorySearch
  72. },
  73. data() {
  74. return {
  75. allocationType,
  76. stutusOptions: {
  77. 0: '未提交',
  78. 1: '审核中',
  79. 2: '已完成'
  80. },
  81. // 表格列配置
  82. columns: [
  83. {
  84. columnKey: 'index',
  85. label: '序号',
  86. type: 'index',
  87. width: 55,
  88. align: 'center',
  89. showOverflowTooltip: true,
  90. fixed: 'left'
  91. },
  92. {
  93. prop: 'name',
  94. label: '拣货名称',
  95. align: 'center',
  96. showOverflowTooltip: true,
  97. minWidth: 110
  98. },
  99. {
  100. prop: 'code',
  101. slot: 'code',
  102. label: '拣货编码',
  103. align: 'center',
  104. showOverflowTooltip: true,
  105. minWidth: 110
  106. },
  107. {
  108. prop: 'sourceNo',
  109. label: '领料单号',
  110. align: 'center',
  111. showOverflowTooltip: true,
  112. minWidth: 110
  113. },
  114. {
  115. prop: 'outInNo',
  116. label: '出库单号',
  117. align: 'center',
  118. showOverflowTooltip: true,
  119. minWidth: 110
  120. },
  121. {
  122. prop: 'warehouseName',
  123. label: '仓库名称',
  124. align: 'center',
  125. showOverflowTooltip: true,
  126. minWidth: 110
  127. },
  128. {
  129. prop: 'createName',
  130. label: '拣货人',
  131. align: 'center',
  132. showOverflowTooltip: true,
  133. minWidth: 110
  134. },
  135. {
  136. prop: 'createTime',
  137. label: '创建时间',
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. minWidth: 110
  141. },
  142. {
  143. prop: 'status',
  144. label: '状态',
  145. align: 'center',
  146. showOverflowTooltip: true,
  147. formatter: (row, column, cellValue) => {
  148. return ['拣货中', '拣货完成', '已出库'][row.status];
  149. }
  150. },
  151. {
  152. columnKey: 'action',
  153. label: '操作',
  154. width: 300,
  155. align: 'center',
  156. slot: 'action',
  157. showOverflowTooltip: true
  158. }
  159. ],
  160. // 加载状态
  161. loading: false
  162. };
  163. },
  164. computed: {},
  165. methods: {
  166. // 删除
  167. async deleted(row) {
  168. const data = await storageApi.deletePickgoods([row.id]);
  169. if (data.code == '0') {
  170. this.$message.success('删除成功!');
  171. this.reload();
  172. }
  173. },
  174. // 提交
  175. submit(row) {
  176. if (row.info.length === row.list.length) {
  177. storageApi
  178. .updatePickgoods({
  179. id: row.id,
  180. code: row.code,
  181. name: row.name,
  182. sourceNo: row.sourceNo,
  183. warehouseId: row.info[0].warehouseId,
  184. warehouseName: row.info[0].warehouseName,
  185. status: 2, // 出库
  186. info: row.info
  187. })
  188. .then(() => {
  189. this.$message({
  190. type: 'success',
  191. message: '提交成功'
  192. });
  193. this.reload();
  194. });
  195. } else {
  196. this.$message.error('请完善当前拣货单的库存信息');
  197. }
  198. },
  199. // 修改
  200. edit(row) {
  201. this.$router.push({
  202. path: '/warehouseManagement/picking/add',
  203. query: { type: '修改', id: row.id }
  204. });
  205. },
  206. // 新建
  207. add() {
  208. this.$router.push({
  209. path: '/warehouseManagement/picking/add',
  210. query: { type: '新增' }
  211. });
  212. },
  213. /* 表格数据源 */
  214. datasource({ page, limit, where }) {
  215. return storageApi.getPickgoodsList({
  216. pageNum: page,
  217. size: limit,
  218. ...where
  219. });
  220. },
  221. /* 刷新表格 */
  222. reload(where) {
  223. this.$refs.table.reload({ page: 1, where });
  224. },
  225. // 详情
  226. goDetail(row) {
  227. this.$router.push({
  228. path: '/warehouseManagement/picking/add',
  229. query: { type: '详情', id: row.id }
  230. });
  231. }
  232. }
  233. };
  234. </script>
  235. <style lang="scss" scoped></style>