index.vue 16 KB

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