index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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. ],
  159. inventoryDimensionOp: [{
  160. code: '1',
  161. label: '物品维度'
  162. },
  163. {
  164. code: '2',
  165. label: '批次维度'
  166. },
  167. {
  168. code: '3',
  169. label: '包装维度'
  170. }],
  171. stutusOptions: {
  172. 0: '未提交',
  173. 1: '审核中',
  174. 2: '已完成',
  175. 3: '已驳回'
  176. },
  177. // 表格列配置
  178. columns: [
  179. {
  180. columnKey: 'index',
  181. label: '序号',
  182. type: 'index',
  183. width: 55,
  184. align: 'center',
  185. showOverflowTooltip: true,
  186. fixed: 'left'
  187. },
  188. {
  189. width: 45,
  190. type: 'selection',
  191. columnKey: 'selection',
  192. reserveSelection: true,
  193. align: 'center',
  194. fixed: 'left'
  195. },
  196. {
  197. prop: 'name',
  198. label: '调拨名称',
  199. align: 'center',
  200. showOverflowTooltip: true,
  201. minWidth: 110
  202. },
  203. {
  204. slot: 'allotCode',
  205. prop: 'allotCode',
  206. label: '调拨单号',
  207. align: 'center',
  208. showOverflowTooltip: true,
  209. minWidth: 180
  210. },
  211. {
  212. prop: 'type',
  213. label: '调拨类型',
  214. align: 'center',
  215. showOverflowTooltip: true,
  216. minWidth: 110,
  217. formatter: (row, column, cellValue) => {
  218. return this.allocationType.filter(
  219. (item) => item.code == row.type
  220. )[0].label;
  221. }
  222. },
  223. {
  224. prop: 'isReconciliation',
  225. label: '对账状态',
  226. align: 'center',
  227. showOverflowTooltip: true,
  228. minWidth: 110,
  229. formatter: (_row, _column, cellValue) => {
  230. return this.isReconciliationOp.find(item => item.value == cellValue)?.label || '';
  231. }
  232. },
  233. {
  234. prop: 'saleOrderNos',
  235. label: '销售订单号',
  236. align: 'center',
  237. showOverflowTooltip: true,
  238. minWidth: 110
  239. },
  240. {
  241. prop: 'customerNames',
  242. label: '客户',
  243. align: 'center',
  244. showOverflowTooltip: true,
  245. minWidth: 110
  246. },
  247. {
  248. prop: 'inventoryDimension',
  249. label: '列表维度',
  250. align: 'center',
  251. showOverflowTooltip: true,
  252. minWidth: 110,
  253. formatter: (row, column, cellValue) => {
  254. return this.inventoryDimensionOp.filter(
  255. (item) => item.code == row.inventoryDimension
  256. )[0].label;
  257. }
  258. },
  259. {
  260. prop: 'categoryName',
  261. label: '物品名称',
  262. align: 'center',
  263. showOverflowTooltip: true,
  264. minWidth: 110
  265. },
  266. {
  267. prop: 'categoryCode',
  268. label: '物品编码',
  269. align: 'center',
  270. showOverflowTooltip: true,
  271. minWidth: 110
  272. },
  273. {
  274. prop: 'colorKey',
  275. label: '颜色',
  276. align: 'center',
  277. minWidth: 130,
  278. showOverflowTooltip: true,
  279. },
  280. {
  281. prop: 'sourceWarehouse',
  282. label: '来源仓库',
  283. align: 'center',
  284. showOverflowTooltip: true,
  285. minWidth: 110
  286. },
  287. {
  288. prop: 'targetWarehouse',
  289. label: '目标仓库',
  290. align: 'center',
  291. showOverflowTooltip: true,
  292. minWidth: 110
  293. },
  294. {
  295. prop: 'allotName',
  296. label: '调拨人',
  297. align: 'center',
  298. showOverflowTooltip: true,
  299. minWidth: 110
  300. },
  301. {
  302. prop: 'createTime',
  303. label: '调拨时间',
  304. align: 'center',
  305. showOverflowTooltip: true,
  306. minWidth: 110
  307. },
  308. {
  309. prop: 'status',
  310. label: '状态',
  311. align: 'center',
  312. showOverflowTooltip: true,
  313. formatter: (row, column, cellValue) => {
  314. return this.stutusOptions[row.status];
  315. }
  316. },
  317. {
  318. columnKey: 'action',
  319. label: '操作',
  320. width: 200,
  321. align: 'center',
  322. slot: 'action',
  323. showOverflowTooltip: true
  324. }
  325. ],
  326. // 加载状态
  327. loading: false,
  328. // 选中的行
  329. selection: []
  330. };
  331. },
  332. computed: {},
  333. created() {
  334. this.getCompanyInfo();
  335. },
  336. methods: {
  337. //新增编辑
  338. handleAddOrEditAccount(type, row) {
  339. this.addAccountDialogFlag = true;
  340. this.$nextTick(() => {
  341. this.$refs.accountDialogRef.open(type, row);
  342. });
  343. },
  344. // 生成对账单
  345. handleGenerateStatement(type) {
  346. if (this.selection.length == 0) {
  347. this.$message.warning('请选择要生成对账单的记录');
  348. return;
  349. }
  350. // 检查选中的记录状态是否为2
  351. const invalidRecords = this.selection.filter(item => item.status != 2);
  352. if (invalidRecords.length > 0) {
  353. this.$message.warning('请选择已完成的调拨单生成对账单');
  354. return;
  355. }
  356. // 检查选中的列表维度是否包含物品维度
  357. const dimensionRecords = this.selection.filter(item => item.inventoryDimension == 1);
  358. if (dimensionRecords.length > 0) {
  359. this.$message.warning('请选择批次维度或包装维度调拨单生成对账单');
  360. return;
  361. }
  362. this.generateStatementFlag = true;
  363. this.$nextTick(() => {
  364. this.$refs.generateStatementRef.open(type, this.selection);
  365. });
  366. },
  367. getCompanyInfo() {
  368. enterprisePage({
  369. pageNum: 1,
  370. size: 200
  371. }).then((res) => {
  372. if (res.list?.length > 0) {
  373. this.groupName = res.list[0].name;
  374. }
  375. });
  376. },
  377. printExlHT() {
  378. console.log('selection', this.selection)
  379. if (this.selection.length == 0) {
  380. this.$message.warning('请选择要打印的记录');
  381. return;
  382. }
  383. this.$refs.printTemplateHTRef.open(this.selection[0]);
  384. },
  385. printExl() {
  386. console.log('selection', this.selection)
  387. if (this.selection.length == 0) {
  388. this.$message.warning('请选择要打印的记录');
  389. return;
  390. }
  391. this.$refs.printTemplateBsRef.open(this.selection[0]);
  392. },
  393. printExl2() {
  394. console.log('selection', this.selection)
  395. if (this.selection.length == 0) {
  396. this.$message.warning('请选择要打印的记录');
  397. return;
  398. }
  399. this.$refs.printTemplateBsCarRef.open(this.selection[0]);
  400. },
  401. // 删除
  402. async deleted(row) {
  403. const data = await storageApi.deleteAllot([row.id]);
  404. if (data.code == '0') {
  405. this.$message.success('删除成功!');
  406. this.reload();
  407. }
  408. },
  409. // 提交
  410. submit(row) {
  411. this.saveLoading = true;
  412. storageApi
  413. .submitAllot({
  414. id: row.id,
  415. enterVerifyUserId: row.sourceWarehouseUserId,
  416. outVerifyUserId: row.targetWarehouseUserId
  417. })
  418. .then(() => {
  419. this.saveLoading = false;
  420. this.$message({
  421. type: 'success',
  422. message: '提交成功'
  423. });
  424. this.reload();
  425. }).catch(() => {
  426. this.saveLoading = false;
  427. });
  428. },
  429. // 修改
  430. edit(row) {
  431. this.$router.push({
  432. path: '/warehouseManagement/inventoryAllocation/add',
  433. query: { isEdit: true, id: row.id }
  434. });
  435. },
  436. // 新建
  437. add() {
  438. this.$router.push({
  439. path: '/warehouseManagement/inventoryAllocation/add'
  440. });
  441. },
  442. /* 表格数据源 */
  443. datasource({ page, limit, where }) {
  444. const params = Object.assign({}, where);
  445. if (params.time?.length) {
  446. params.startTime = params.time[0];
  447. params.endTime = params.time[1];
  448. }
  449. delete params.time;
  450. return storageApi.getAllotApplyPage({
  451. pageNum: page,
  452. size: limit,
  453. ...params
  454. });
  455. },
  456. /* 刷新表格 */
  457. reload(where) {
  458. this.$refs.table.reload({ page: 1, where });
  459. },
  460. // 详情
  461. goDetail(row) {
  462. this.$router.push({
  463. path: '/warehouseManagement/inventoryAllocation/details',
  464. query: { id: row.id }
  465. });
  466. }
  467. }
  468. };
  469. </script>
  470. <style lang="scss" scoped>
  471. #inventoryAllocation_index {
  472. height: calc(100vh - 96px);
  473. width: 100%;
  474. padding: 10px;
  475. box-sizing: border-box;
  476. // element-ui样式穿透
  477. :deep(.el-card) {
  478. height: 100%;
  479. .el-card__body {
  480. height: 100%;
  481. box-sizing: border-box;
  482. display: flex;
  483. flex-direction: column;
  484. .ele-pro-table {
  485. flex: 1;
  486. display: flex;
  487. flex-direction: column;
  488. .el-table {
  489. flex: 1;
  490. // display: flex;
  491. // flex-direction: column;
  492. // .el-table__body-wrapper {
  493. // flex: 1;
  494. // }
  495. }
  496. }
  497. }
  498. .el-form-item {
  499. margin-bottom: 5px !important;
  500. }
  501. }
  502. }
  503. </style>