index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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 v-if="$hasPermission('wms:inventoryAllocation:print1')" :disabled="selection.length > 1" icon="el-icon-download" type="primary" @click="printExl"
  20. >打印送货单</el-button
  21. >
  22. <el-button v-if="$hasPermission('wms:inventoryAllocation:print2')" :disabled="selection.length > 1" icon="el-icon-download" type="primary" @click="printExl2"
  23. >打印送货单带车</el-button
  24. >
  25. <el-button v-if="$hasPermission('wms:inventoryAllocation:statement')" :disabled="selection.length == 0" type="primary" @click="handleGenerateStatement('add')"
  26. >生成对账单</el-button
  27. >
  28. </template>
  29. <!-- 单号链接 -->
  30. <template v-slot:allotCode="{ row }">
  31. <el-link type="primary" @click="goDetail(row)">
  32. {{ row.allotCode }}
  33. </el-link>
  34. </template>
  35. <template v-slot:action="{ row }">
  36. <el-link
  37. v-if="(row.status == 0 || row.status == 3) && row.type == 2"
  38. type="primary"
  39. :underline="false"
  40. icon="el-icon-view"
  41. :disabled="saveLoading"
  42. @click="submit(row)"
  43. >
  44. 提交
  45. </el-link>
  46. <el-link
  47. v-if="row.status == 0 || row.status == 3"
  48. type="primary"
  49. :underline="false"
  50. icon="el-icon-view"
  51. @click="edit(row)"
  52. >
  53. 修改
  54. </el-link>
  55. <!-- <el-link
  56. type="primary"
  57. :underline="false"
  58. icon="el-icon-view"
  59. @click="goDetail(row)"
  60. >
  61. 详情
  62. </el-link> -->
  63. <el-link
  64. v-if="row.status == 0 || row.status == 3"
  65. type="primary"
  66. :underline="false"
  67. icon="el-icon-delete"
  68. @click="deleted(row)"
  69. >
  70. 删除
  71. </el-link>
  72. </template>
  73. </ele-pro-table>
  74. </el-card>
  75. <!-- 打印弹窗 -->
  76. <printTemplateBs :groupName="groupName" ref="printTemplateBsRef"></printTemplateBs>
  77. <printTemplateBsCar :groupName="groupName" ref="printTemplateBsCarRef"></printTemplateBsCar>
  78. <add-account-dialog
  79. v-if="addAccountDialogFlag"
  80. :addAccountDialogFlag.sync="addAccountDialogFlag"
  81. ref="accountDialogRef"
  82. @done="reload"
  83. ></add-account-dialog>
  84. <generateStatement
  85. v-if="generateStatementFlag"
  86. :generateStatementFlag.sync="generateStatementFlag"
  87. ref="generateStatementRef"
  88. @done="reload"
  89. ></generateStatement>
  90. </div>
  91. </template>
  92. <script>
  93. import { allocationType } from '@/utils/dict/warehouse';
  94. import storageApi from '@/api/warehouseManagement/index.js';
  95. import InventorySearch from './components/inventory-search.vue';
  96. import printTemplateBs from './components/print-template-bs.vue';
  97. import printTemplateBsCar from './components/print-template-bs-car.vue';
  98. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  99. import { pageRoles } from '@/api/system/role';
  100. import { enterprisePage } from '@/api/bpm/index.js';
  101. import addAccountDialog from './accountstatement/addAccountDialog.vue';
  102. import generateStatement from './accountstatement/generateStatement.vue';
  103. export default {
  104. components: {
  105. addAccountDialog,
  106. InventorySearch,
  107. printTemplateBs,
  108. printTemplateBsCar,
  109. generateStatement
  110. },
  111. data() {
  112. return {
  113. addAccountDialogFlag: false,
  114. generateStatementFlag: false,
  115. allocationType,
  116. groupName: '',
  117. saveLoading: false,
  118. inventoryDimensionOp: [{
  119. code: '1',
  120. label: '物品维度'
  121. },
  122. {
  123. code: '2',
  124. label: '批次维度'
  125. },
  126. {
  127. code: '3',
  128. label: '包装维度'
  129. }],
  130. stutusOptions: {
  131. 0: '未提交',
  132. 1: '审核中',
  133. 2: '已完成',
  134. 3: '已驳回'
  135. },
  136. // 表格列配置
  137. columns: [
  138. {
  139. columnKey: 'index',
  140. label: '序号',
  141. type: 'index',
  142. width: 55,
  143. align: 'center',
  144. showOverflowTooltip: true,
  145. fixed: 'left'
  146. },
  147. {
  148. width: 45,
  149. type: 'selection',
  150. columnKey: 'selection',
  151. align: 'center',
  152. fixed: 'left'
  153. },
  154. {
  155. prop: 'name',
  156. label: '调拨名称',
  157. align: 'center',
  158. showOverflowTooltip: true,
  159. minWidth: 110
  160. },
  161. {
  162. slot: 'allotCode',
  163. prop: 'allotCode',
  164. label: '调拨单号',
  165. align: 'center',
  166. showOverflowTooltip: true,
  167. minWidth: 180
  168. },
  169. {
  170. prop: 'type',
  171. label: '调拨类型',
  172. align: 'center',
  173. showOverflowTooltip: true,
  174. minWidth: 110,
  175. formatter: (row, column, cellValue) => {
  176. return this.allocationType.filter(
  177. (item) => item.code == row.type
  178. )[0].label;
  179. }
  180. },
  181. {
  182. prop: 'saleOrderNos',
  183. label: '销售订单号',
  184. align: 'center',
  185. showOverflowTooltip: true,
  186. minWidth: 110
  187. },
  188. {
  189. prop: 'customerNames',
  190. label: '客户',
  191. align: 'center',
  192. showOverflowTooltip: true,
  193. minWidth: 110
  194. },
  195. {
  196. prop: 'inventoryDimension',
  197. label: '列表维度',
  198. align: 'center',
  199. showOverflowTooltip: true,
  200. minWidth: 110,
  201. formatter: (row, column, cellValue) => {
  202. return this.inventoryDimensionOp.filter(
  203. (item) => item.code == row.inventoryDimension
  204. )[0].label;
  205. }
  206. },
  207. {
  208. prop: 'categoryName',
  209. label: '物品名称',
  210. align: 'center',
  211. showOverflowTooltip: true,
  212. minWidth: 110
  213. },
  214. {
  215. prop: 'categoryCode',
  216. label: '物品编码',
  217. align: 'center',
  218. showOverflowTooltip: true,
  219. minWidth: 110
  220. },
  221. {
  222. prop: 'sourceWarehouse',
  223. label: '来源仓库',
  224. align: 'center',
  225. showOverflowTooltip: true,
  226. minWidth: 110
  227. },
  228. {
  229. prop: 'targetWarehouse',
  230. label: '目标仓库',
  231. align: 'center',
  232. showOverflowTooltip: true,
  233. minWidth: 110
  234. },
  235. {
  236. prop: 'allotName',
  237. label: '调拨人',
  238. align: 'center',
  239. showOverflowTooltip: true,
  240. minWidth: 110
  241. },
  242. {
  243. prop: 'createTime',
  244. label: '调拨时间',
  245. align: 'center',
  246. showOverflowTooltip: true,
  247. minWidth: 110
  248. },
  249. {
  250. prop: 'status',
  251. label: '状态',
  252. align: 'center',
  253. showOverflowTooltip: true,
  254. formatter: (row, column, cellValue) => {
  255. return this.stutusOptions[row.status];
  256. }
  257. },
  258. {
  259. columnKey: 'action',
  260. label: '操作',
  261. width: 200,
  262. align: 'center',
  263. slot: 'action',
  264. showOverflowTooltip: true
  265. }
  266. ],
  267. // 加载状态
  268. loading: false,
  269. // 选中的行
  270. selection: []
  271. };
  272. },
  273. computed: {},
  274. created() {
  275. this.getCompanyInfo();
  276. },
  277. methods: {
  278. //新增编辑
  279. handleAddOrEditAccount(type, row) {
  280. this.addAccountDialogFlag = true;
  281. this.$nextTick(() => {
  282. this.$refs.accountDialogRef.open(type, row);
  283. });
  284. },
  285. // 生成对账单
  286. handleGenerateStatement(type) {
  287. if (this.selection.length == 0) {
  288. this.$message.warning('请选择要生成对账单的记录');
  289. return;
  290. }
  291. // 检查选中的记录状态是否为2
  292. const invalidRecords = this.selection.filter(item => item.status != 2);
  293. if (invalidRecords.length > 0) {
  294. this.$message.warning('请选择已完成的调拨单生成对账单');
  295. return;
  296. }
  297. // 检查选中的列表维度是否包含物品维度
  298. const dimensionRecords = this.selection.filter(item => item.inventoryDimension == 1);
  299. if (dimensionRecords.length > 0) {
  300. this.$message.warning('请选择批次维度或包装维度调拨单生成对账单');
  301. return;
  302. }
  303. this.generateStatementFlag = true;
  304. this.$nextTick(() => {
  305. this.$refs.generateStatementRef.open(type, this.selection);
  306. });
  307. },
  308. getCompanyInfo() {
  309. enterprisePage({
  310. pageNum: 1,
  311. size: 200
  312. }).then((res) => {
  313. if (res.list?.length > 0) {
  314. this.groupName = res.list[0].name;
  315. }
  316. });
  317. },
  318. printExl() {
  319. console.log('selection', this.selection)
  320. if (this.selection.length == 0) {
  321. this.$message.warning('请选择要打印的记录');
  322. return;
  323. }
  324. this.$refs.printTemplateBsRef.open(this.selection[0]);
  325. },
  326. printExl2() {
  327. console.log('selection', this.selection)
  328. if (this.selection.length == 0) {
  329. this.$message.warning('请选择要打印的记录');
  330. return;
  331. }
  332. this.$refs.printTemplateBsCarRef.open(this.selection[0]);
  333. },
  334. // 删除
  335. async deleted(row) {
  336. const data = await storageApi.deleteAllot([row.id]);
  337. if (data.code == '0') {
  338. this.$message.success('删除成功!');
  339. this.reload();
  340. }
  341. },
  342. // 提交
  343. submit(row) {
  344. this.saveLoading = true;
  345. storageApi
  346. .submitAllot({
  347. id: row.id,
  348. enterVerifyUserId: row.sourceWarehouseUserId,
  349. outVerifyUserId: row.targetWarehouseUserId
  350. })
  351. .then(() => {
  352. this.saveLoading = false;
  353. this.$message({
  354. type: 'success',
  355. message: '提交成功'
  356. });
  357. this.reload();
  358. }).catch(() => {
  359. this.saveLoading = false;
  360. });
  361. },
  362. // 修改
  363. edit(row) {
  364. this.$router.push({
  365. path: '/warehouseManagement/inventoryAllocation/add',
  366. query: { isEdit: true, id: row.id }
  367. });
  368. },
  369. // 新建
  370. add() {
  371. this.$router.push({
  372. path: '/warehouseManagement/inventoryAllocation/add'
  373. });
  374. },
  375. /* 表格数据源 */
  376. datasource({ page, limit, where }) {
  377. return storageApi.getAllotApplyPage({
  378. pageNum: page,
  379. size: limit,
  380. ...where
  381. });
  382. },
  383. /* 刷新表格 */
  384. reload(where) {
  385. this.$refs.table.reload({ page: 1, where });
  386. },
  387. // 详情
  388. goDetail(row) {
  389. this.$router.push({
  390. path: '/warehouseManagement/inventoryAllocation/details',
  391. query: { id: row.id }
  392. });
  393. }
  394. }
  395. };
  396. </script>
  397. <style lang="scss" scoped>
  398. #inventoryAllocation_index {
  399. height: calc(100vh - 96px);
  400. width: 100%;
  401. padding: 10px;
  402. box-sizing: border-box;
  403. // element-ui样式穿透
  404. :deep(.el-card) {
  405. height: 100%;
  406. .el-card__body {
  407. height: 100%;
  408. box-sizing: border-box;
  409. display: flex;
  410. flex-direction: column;
  411. .ele-pro-table {
  412. flex: 1;
  413. display: flex;
  414. flex-direction: column;
  415. .el-table {
  416. flex: 1;
  417. // display: flex;
  418. // flex-direction: column;
  419. // .el-table__body-wrapper {
  420. // flex: 1;
  421. // }
  422. }
  423. }
  424. }
  425. .el-form-item {
  426. margin-bottom: 5px !important;
  427. }
  428. }
  429. }
  430. </style>