index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div id="inventoryAllocation_index">
  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. height="calc(100vh-300px)"
  10. :pageSize="20"
  11. :datasource="datasource"
  12. cache-key="systemRoleTable"
  13. :selection.sync="selection"
  14. >
  15. <template v-slot:toolbar>
  16. <el-button icon="el-icon-plus" type="primary" @click="add"
  17. >新建</el-button
  18. >
  19. <!-- <el-button :disabled="selection.length > 1" icon="el-icon-download" type="primary" @click="printExl"
  20. >打印送货单</el-button
  21. > -->
  22. <!-- v-if="$hasPermission('wms:inventoryAllocation:print1')" -->
  23. <!-- <el-button :disabled="selection.length > 1" icon="el-icon-download" type="primary" @click="printExl2"
  24. >打印送货单</el-button
  25. > -->
  26. <!-- v-if="$hasPermission('wms:inventoryAllocation:print2')" -->
  27. </template>
  28. <!-- 单号链接 -->
  29. <template v-slot:allotCode="{ row }">
  30. <el-link type="primary" @click="goDetail(row)">
  31. {{ row.allotCode }}
  32. </el-link>
  33. </template>
  34. <template v-slot:action="{ row }">
  35. <el-link
  36. v-if="row.status == 0 && row.type == 2"
  37. type="primary"
  38. :underline="false"
  39. icon="el-icon-view"
  40. @click="submit(row)"
  41. >
  42. 提交
  43. </el-link>
  44. <el-link
  45. v-if="row.status == 0"
  46. type="primary"
  47. :underline="false"
  48. icon="el-icon-view"
  49. @click="edit(row)"
  50. >
  51. 修改
  52. </el-link>
  53. <!-- <el-link
  54. type="primary"
  55. :underline="false"
  56. icon="el-icon-view"
  57. @click="goDetail(row)"
  58. >
  59. 详情
  60. </el-link> -->
  61. <el-link
  62. v-if="row.status == 0"
  63. type="primary"
  64. :underline="false"
  65. icon="el-icon-delete"
  66. @click="deleted(row)"
  67. >
  68. 删除
  69. </el-link>
  70. </template>
  71. </ele-pro-table>
  72. </el-card>
  73. <!-- 打印弹窗 -->
  74. <printTemplateBs ref="printTemplateBsRef"></printTemplateBs>
  75. <printTemplateBsCar ref="printTemplateBsCarRef"></printTemplateBsCar>
  76. </div>
  77. </template>
  78. <script>
  79. import { allocationType } from '@/utils/dict/warehouse';
  80. import storageApi from '@/api/warehouseManagement/index.js';
  81. import InventorySearch from './components/inventory-search.vue';
  82. import printTemplateBs from './components/print-template-bs.vue';
  83. import printTemplateBsCar from './components/print-template-bs-car.vue';
  84. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  85. import { pageRoles } from '@/api/system/role';
  86. export default {
  87. components: {
  88. InventorySearch,
  89. printTemplateBs,
  90. printTemplateBsCar
  91. },
  92. data() {
  93. return {
  94. allocationType,
  95. stutusOptions: {
  96. 0: '未提交',
  97. 1: '审核中',
  98. 2: '已完成'
  99. },
  100. // 表格列配置
  101. columns: [
  102. {
  103. columnKey: 'index',
  104. label: '序号',
  105. type: 'index',
  106. width: 55,
  107. align: 'center',
  108. showOverflowTooltip: true,
  109. fixed: 'left'
  110. },
  111. {
  112. width: 45,
  113. type: 'selection',
  114. columnKey: 'selection',
  115. align: 'center',
  116. fixed: 'left'
  117. },
  118. {
  119. prop: 'name',
  120. label: '调拨名称',
  121. align: 'center',
  122. showOverflowTooltip: true,
  123. minWidth: 110
  124. },
  125. {
  126. slot: 'allotCode',
  127. prop: 'allotCode',
  128. label: '调拨单号',
  129. align: 'center',
  130. showOverflowTooltip: true,
  131. minWidth: 180
  132. },
  133. {
  134. prop: 'type',
  135. label: '调拨类型',
  136. align: 'center',
  137. showOverflowTooltip: true,
  138. minWidth: 110,
  139. formatter: (row, column, cellValue) => {
  140. return this.allocationType.filter(
  141. (item) => item.code == row.type
  142. )[0].label;
  143. }
  144. },
  145. {
  146. prop: 'categoryName',
  147. label: '物品名称',
  148. align: 'center',
  149. showOverflowTooltip: true,
  150. minWidth: 110
  151. },
  152. {
  153. prop: 'categoryCode',
  154. label: '物品编码',
  155. align: 'center',
  156. showOverflowTooltip: true,
  157. minWidth: 110
  158. },
  159. {
  160. prop: 'sourceWarehouse',
  161. label: '来源仓库',
  162. align: 'center',
  163. showOverflowTooltip: true,
  164. minWidth: 110
  165. },
  166. {
  167. prop: 'targetWarehouse',
  168. label: '目标仓库',
  169. align: 'center',
  170. showOverflowTooltip: true,
  171. minWidth: 110
  172. },
  173. {
  174. prop: 'allotName',
  175. label: '调拨人',
  176. align: 'center',
  177. showOverflowTooltip: true,
  178. minWidth: 110
  179. },
  180. {
  181. prop: 'createTime',
  182. label: '调拨时间',
  183. align: 'center',
  184. showOverflowTooltip: true,
  185. minWidth: 110
  186. },
  187. {
  188. prop: 'status',
  189. label: '状态',
  190. align: 'center',
  191. showOverflowTooltip: true,
  192. formatter: (row, column, cellValue) => {
  193. return this.stutusOptions[row.status];
  194. }
  195. },
  196. {
  197. columnKey: 'action',
  198. label: '操作',
  199. width: 200,
  200. align: 'center',
  201. slot: 'action',
  202. showOverflowTooltip: true
  203. }
  204. ],
  205. // 加载状态
  206. loading: false,
  207. // 选中的行
  208. selection: []
  209. };
  210. },
  211. computed: {},
  212. methods: {
  213. printExl() {
  214. console.log('selection', this.selection)
  215. if (this.selection.length == 0) {
  216. this.$message.warning('请选择要打印的记录');
  217. return;
  218. }
  219. this.$refs.printTemplateBsRef.open(this.selection[0]);
  220. },
  221. printExl2() {
  222. console.log('selection', this.selection)
  223. if (this.selection.length == 0) {
  224. this.$message.warning('请选择要打印的记录');
  225. return;
  226. }
  227. this.$refs.printTemplateBsCarRef.open(this.selection[0]);
  228. },
  229. // 删除
  230. async deleted(row) {
  231. const data = await storageApi.deleteAllot([row.id]);
  232. if (data.code == '0') {
  233. this.$message.success('删除成功!');
  234. this.reload();
  235. }
  236. },
  237. // 提交
  238. submit(row) {
  239. storageApi
  240. .submitAllot({
  241. id: row.id,
  242. enterVerifyUserId: row.sourceWarehouseUserId,
  243. outVerifyUserId: row.targetWarehouseUserId
  244. })
  245. .then(() => {
  246. this.$message({
  247. type: 'success',
  248. message: '提交成功'
  249. });
  250. this.reload();
  251. });
  252. },
  253. // 修改
  254. edit(row) {
  255. this.$router.push({
  256. path: '/warehouseManagement/inventoryAllocation/add',
  257. query: { isEdit: true, id: row.id }
  258. });
  259. },
  260. // 新建
  261. add() {
  262. this.$router.push({
  263. path: '/warehouseManagement/inventoryAllocation/add'
  264. });
  265. },
  266. /* 表格数据源 */
  267. datasource({ page, limit, where }) {
  268. return storageApi.getAllotApplyPage({
  269. pageNum: page,
  270. size: limit,
  271. ...where
  272. });
  273. },
  274. /* 刷新表格 */
  275. reload(where) {
  276. this.$refs.table.reload({ page: 1, where });
  277. },
  278. // 详情
  279. goDetail(row) {
  280. this.$router.push({
  281. path: '/warehouseManagement/inventoryAllocation/details',
  282. query: { id: row.id }
  283. });
  284. }
  285. }
  286. };
  287. </script>
  288. <style lang="scss" scoped>
  289. #inventoryAllocation_index {
  290. height: calc(100vh - 96px);
  291. width: 100%;
  292. padding: 10px;
  293. box-sizing: border-box;
  294. // element-ui样式穿透
  295. :deep(.el-card) {
  296. height: 100%;
  297. .el-card__body {
  298. height: 100%;
  299. box-sizing: border-box;
  300. display: flex;
  301. flex-direction: column;
  302. .ele-pro-table {
  303. flex: 1;
  304. display: flex;
  305. flex-direction: column;
  306. .el-table {
  307. flex: 1;
  308. // display: flex;
  309. // flex-direction: column;
  310. // .el-table__body-wrapper {
  311. // flex: 1;
  312. // }
  313. }
  314. }
  315. }
  316. .el-form-item {
  317. margin-bottom: 5px !important;
  318. }
  319. }
  320. }
  321. </style>