item-list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. <template>
  2. <div class="itemList">
  3. <!-- 数据表格 -->
  4. <item-search
  5. @search="reload"
  6. ref="refSeavch"
  7. :type="type"
  8. @handledime="handledime"
  9. ></item-search>
  10. <ele-pro-table
  11. ref="table"
  12. class="table"
  13. :columns="columns"
  14. :datasource="datasource"
  15. height="calc(100vh - 325px)"
  16. full-height="calc(100vh - 116px)"
  17. tool-class="ele-toolbar-form"
  18. :pageSize="20"
  19. @select="selectChange"
  20. @select-all="changeSelectAll"
  21. @columns-change="handleColumnChange"
  22. :cache-key="cacheKeyUrl"
  23. >
  24. <!-- 表头工具栏 -->
  25. <template v-slot:toolbar="{ row }">
  26. <el-button
  27. v-if="selectedDime == 3"
  28. size="small"
  29. :disabled="checkRadioData.length == 0"
  30. icon="el-icon-set-up"
  31. class="ele-btn-icon"
  32. @click="allPrinting()"
  33. >
  34. 打印条码
  35. </el-button>
  36. <!-- <el-button
  37. v-if="selectedDime == 2 || selectedDime == 3"
  38. size="small"
  39. :disabled="checkRadioData.length == 0"
  40. icon="el-icon-set-up"
  41. class="ele-btn-icon"
  42. @click="showAllot()"
  43. >
  44. 调拨
  45. </el-button> -->
  46. </template>
  47. <template v-slot:result="{ row }">
  48. <span>{{ qualityResults[row.result] }}</span>
  49. </template>
  50. <template v-slot:status="{ row }">
  51. <span>{{ qualityStatus[row.status] }}</span>
  52. </template>
  53. <!-- -->
  54. <!-- 物品名称 -->
  55. <template v-slot:categoryName="{ row }">
  56. <el-link type="primary" @click="details(row)">
  57. {{ row.categoryName }}
  58. </el-link>
  59. </template>
  60. <!-- 批次号 -->
  61. <template v-slot:batchNo="{ row }">
  62. <el-popover placement="right-start" width="800" trigger="hover">
  63. <el-table :data="row.outInBatchDetailsVOList">
  64. <el-table-column
  65. width="150"
  66. property="bizNo"
  67. label="入库单号"
  68. ></el-table-column>
  69. <el-table-column
  70. width="100"
  71. property="bizType"
  72. label="入库场景"
  73. ></el-table-column>
  74. <el-table-column
  75. width="120"
  76. property="count"
  77. label="入库数量"
  78. ></el-table-column>
  79. <el-table-column
  80. width="80"
  81. property="measuringUnit"
  82. label="计量单位"
  83. ></el-table-column>
  84. <el-table-column
  85. width="100"
  86. property="packageCount"
  87. label="包装数量"
  88. ></el-table-column>
  89. <el-table-column
  90. width="80"
  91. property="packingUnit"
  92. label="包装单位"
  93. ></el-table-column>
  94. <el-table-column
  95. width="330"
  96. property="position"
  97. label="库位"
  98. ></el-table-column>
  99. <el-table-column
  100. width="160"
  101. property="createTime"
  102. label="入库时间"
  103. ></el-table-column>
  104. </el-table>
  105. <span slot="reference"> {{ row.batchNo }}</span>
  106. </el-popover>
  107. </template>
  108. <!-- 最小包装单元 -->
  109. <template v-slot:minPackingCount="{ row }">
  110. <span v-if="row.minPackingCount">
  111. {{ row.minPackingCount }}
  112. {{ row.measuringUnit }}/{{ row.minUnit }}
  113. </span>
  114. </template>
  115. <!-- 库存保质期 -->
  116. <template v-slot:expirationDate="{ row }">
  117. <span v-if="row.expirationDate">
  118. {{ row.expirationDate ? row.expirationDate : '-' }}
  119. {{
  120. row.expirationDateUnit == 'year'
  121. ? '年'
  122. : row.expirationDateUnit == 'month'
  123. ? '月'
  124. : '日'
  125. }}
  126. </span>
  127. </template>
  128. <!-- 质检状态 -->
  129. <template v-slot:qualityStatus="{ row }">
  130. <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
  131. >已检</span
  132. >
  133. <span v-else-if="row.qualityStatus == 1">已检</span>
  134. <span v-else-if="row.qualityStatus == 0">未检</span>
  135. <span v-else>-</span>
  136. </template>
  137. <!-- 质检结果 -->
  138. <template v-slot:qualityResult="{ row }">
  139. <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
  140. >合格</span
  141. >
  142. <span v-else-if="row.qualityResult == 1">不合格</span>
  143. <span v-else-if="row.qualityResult == 3">让步接收</span>
  144. <span v-else>-</span>
  145. </template>
  146. </ele-pro-table>
  147. <print :openBarCode.sync="openWindows" :config="config"></print>
  148. <!-- <print ref="printRef" :dimension="selectedDime"></print> -->
  149. <!-- <printSr ref="printSrRef" :dimension="selectedDime"></printSr>
  150. <printTg ref="printTgRef" :dimension="selectedDime"></printTg> -->
  151. <allot ref="allotRef" :dimension="selectedDime"></allot>
  152. </div>
  153. </template>
  154. <script>
  155. import print from '@/components/print/indexMultiple.vue';
  156. import allot from './allot.vue';
  157. // import print from './print.vue';
  158. // import printSr from './printSr.vue';
  159. // import printTg from './printTg.vue';
  160. import ItemSearch from './item-search.vue';
  161. // import {
  162. // getUserPage,
  163. // removePersonnel,
  164. // unbindLoginName
  165. // } from '@/api/system/organization';
  166. import {
  167. pageeLedgerMain,
  168. removeItem,
  169. getWarehouseList
  170. } from '@/api/classifyManage/itemInformation';
  171. import barCode from '@/api/main/barCode';
  172. import storageApi from '@/api/warehouseManagement';
  173. import { getBatchDetails } from '@/api/classifyManage/index';
  174. import tabMixins from '@/mixins/tableColumnsMixin';
  175. import { qualityStatus, qualityResults } from '@/utils/dict/index';
  176. export default {
  177. mixins: [tabMixins],
  178. components: { ItemSearch, print, allot },
  179. props: {
  180. // 机构id
  181. organizationId: [Number, String],
  182. // 全部机构
  183. organizationList: Array,
  184. current: {
  185. type: Object,
  186. default: () => ({})
  187. },
  188. type: {
  189. type: String,
  190. default: ''
  191. }
  192. },
  193. data() {
  194. return {
  195. qualityStatus,
  196. qualityResults,
  197. config: [],
  198. openWindows: false,
  199. newColumns: [],
  200. checkRadioData: [],
  201. searchForm: {
  202. dimension: '1'
  203. },
  204. selectedDime: '1',
  205. diffCacheKeyUrl:
  206. 'eos-439decaa-warehouseManagement-stockLedger-products',
  207. cacheKeyUrl: 'eos-439decaa-warehouseManagement-stockLedger-products2', //默认查询key值
  208. columnsVersion: 1
  209. };
  210. },
  211. created() {
  212. this.getFieldModel();
  213. },
  214. computed: {
  215. // 表格列配置
  216. columns() {
  217. // 当columnsVersion变化时会重新计算
  218. const version = this.columnsVersion;
  219. // selectedDime 1物品维度 2批次维度 3包装维度 4物料维度
  220. let arr = [
  221. this.selectedDime == 3
  222. ? {
  223. width: 45,
  224. type: 'selection',
  225. columnKey: 'selection',
  226. align: 'center'
  227. }
  228. : '',
  229. {
  230. columnKey: 'index',
  231. type: 'index',
  232. width: 50,
  233. align: 'center',
  234. label: '序号',
  235. showOverflowTooltip: true,
  236. fixed: 'left'
  237. },
  238. this.selectedDime != 1
  239. ? {
  240. prop: 'batchNo',
  241. label: '批次号',
  242. align: 'center'
  243. }
  244. : '',
  245. {
  246. prop: 'categoryCode',
  247. label: '物品编码',
  248. align: 'center',
  249. showOverflowTooltip: true
  250. },
  251. {
  252. slot: 'categoryName',
  253. prop: 'categoryName',
  254. label: '物品名称',
  255. align: 'center',
  256. showOverflowTooltip: true,
  257. minWidth: 200
  258. },
  259. this.selectedDime != 1
  260. ? {
  261. prop: 'inventoryCycle',
  262. label: '存货周期(天)',
  263. align: 'center',
  264. width: 120,
  265. showOverflowTooltip: true
  266. }
  267. : '',
  268. {
  269. prop: 'brandNum',
  270. label: '牌号',
  271. align: 'center',
  272. showOverflowTooltip: true
  273. },
  274. {
  275. prop: 'categoryModel',
  276. label: '型号',
  277. align: 'center',
  278. showOverflowTooltip: true
  279. },
  280. {
  281. prop: 'specification',
  282. label: '规格',
  283. align: 'center',
  284. showOverflowTooltip: true
  285. },
  286. this.selectedDime == 2
  287. ? {
  288. prop: 'supplierName',
  289. label: '供应商',
  290. showOverflowTooltip: true,
  291. width: 130,
  292. align: 'center'
  293. }
  294. : '',
  295. {
  296. prop: 'level',
  297. label: '级别',
  298. showOverflowTooltip: true
  299. },
  300. {
  301. prop: 'measureQuantity',
  302. label: '计量数量',
  303. sortable: 'custom',
  304. showOverflowTooltip: true,
  305. width: 130,
  306. align: 'center'
  307. },
  308. // {
  309. // prop: 'supplierName',
  310. // label: '供应商',
  311. // showOverflowTooltip: true,
  312. // width: 130,
  313. // align: 'center'
  314. // },
  315. {
  316. prop: 'measureUnit',
  317. label: '计量单位',
  318. align: 'center'
  319. },
  320. {
  321. prop: 'weight',
  322. label: '重量',
  323. showOverflowTooltip: true
  324. },
  325. {
  326. prop: 'weightUnit',
  327. label: '重量单位',
  328. showOverflowTooltip: true
  329. },
  330. this.selectedDime == 1
  331. ? {
  332. prop: 'secureInventory',
  333. label: '安全库存',
  334. showOverflowTooltip: true
  335. }
  336. : '',
  337. this.selectedDime == 1
  338. ? {
  339. prop: 'minInventory',
  340. label: '最小库存',
  341. showOverflowTooltip: true
  342. }
  343. : '',
  344. this.selectedDime == 1
  345. ? {
  346. prop: 'maxInventory',
  347. label: '最大库存',
  348. showOverflowTooltip: true
  349. }
  350. : '',
  351. this.selectedDime == 3
  352. ? {
  353. prop: 'packageNo',
  354. label: '包装编码',
  355. showOverflowTooltip: true
  356. }
  357. : '',
  358. this.selectedDime == 3
  359. ? {
  360. prop: 'packingQuantity',
  361. label: '包装数量 ',
  362. showOverflowTooltip: true
  363. }
  364. : '',
  365. this.selectedDime == 3
  366. ? {
  367. prop: 'packingUnit',
  368. label: '包装单位 ',
  369. showOverflowTooltip: true
  370. }
  371. : '',
  372. this.selectedDime == 3
  373. ? {
  374. prop: 'result',
  375. slot: 'result',
  376. label: '质检结果',
  377. showOverflowTooltip: true
  378. }
  379. : '',
  380. this.selectedDime == 3
  381. ? {
  382. prop: 'status',
  383. slot: 'status',
  384. label: '质检状态',
  385. showOverflowTooltip: true
  386. }
  387. : '',
  388. this.selectedDime == 3
  389. ? {
  390. prop: 'warehouseName',
  391. label: '仓库 ',
  392. showOverflowTooltip: true
  393. }
  394. : '',
  395. this.selectedDime == 3
  396. ? {
  397. prop: 'areaName',
  398. label: '货区 ',
  399. showOverflowTooltip: true
  400. }
  401. : '',
  402. this.selectedDime == 3
  403. ? {
  404. prop: 'goodsAllocationName',
  405. label: '货架',
  406. showOverflowTooltip: true
  407. }
  408. : '',
  409. this.selectedDime == 3
  410. ? {
  411. prop: 'goodsShelfName',
  412. label: '货位',
  413. showOverflowTooltip: true
  414. }
  415. : '',
  416. this.selectedDime == 3
  417. ? {
  418. prop: 'productionDate',
  419. label: '生产日期',
  420. showOverflowTooltip: true
  421. }
  422. : '',
  423. this.selectedDime == 3
  424. ? {
  425. prop: 'purchaseDate',
  426. label: '采购日期',
  427. showOverflowTooltip: true
  428. }
  429. : '',
  430. this.selectedDime == 3 || this.selectedDime == 4
  431. ? {
  432. prop: 'barcodes',
  433. label: '发货条码 ',
  434. showOverflowTooltip: true
  435. }
  436. : '',
  437. this.selectedDime == 3 || this.selectedDime == 4
  438. ? {
  439. prop: 'clientCode',
  440. label: '客户代号',
  441. showOverflowTooltip: true
  442. }
  443. : '',
  444. this.selectedDime == 3 || this.selectedDime == 4
  445. ? {
  446. prop: 'engrave',
  447. label: '刻码 ',
  448. showOverflowTooltip: true
  449. }
  450. : '',
  451. this.selectedDime == 3 || this.selectedDime == 4
  452. ? {
  453. prop: 'materielDesignation',
  454. label: '物料代号',
  455. width: 120,
  456. showOverflowTooltip: true
  457. }
  458. : '',
  459. // {
  460. // prop: 'supplierName',
  461. // label: '供应商',
  462. // width: 120,
  463. // showOverflowTooltip: true
  464. // },
  465. {
  466. prop: 'supplierCode',
  467. label: '供应商代号',
  468. width: 120,
  469. showOverflowTooltip: true
  470. },
  471. this.selectedDime != 1
  472. ? {
  473. prop: 'provenance',
  474. label: '产地',
  475. showOverflowTooltip: true
  476. }
  477. : '',
  478. {
  479. prop: 'unitPrice',
  480. label: '单价',
  481. showOverflowTooltip: true
  482. }
  483. ];
  484. if (this.selectedDime == 1) {
  485. return arr.filter((item) => item != '').concat(this.newColumns);
  486. } else {
  487. return arr.filter((item) => item != '');
  488. }
  489. },
  490. clientEnvironmentId() {
  491. return this.$store.state.user.info.clientEnvironmentId;
  492. }
  493. },
  494. methods: {
  495. getFieldModel() {
  496. storageApi.fieldModel({ relevance: 't_main_category' }).then((res) => {
  497. let newRes = res.map((m) => {
  498. return {
  499. prop: 'extField.' + m.prop,
  500. label: m.label,
  501. align: 'center',
  502. showOverflowTooltip: true
  503. };
  504. });
  505. this.newColumns = [...newRes];
  506. });
  507. },
  508. // 调拨
  509. showAllot() {
  510. this.$refs.allotRef.open(this.checkRadioData);
  511. },
  512. // 全选
  513. changeSelectAll(arr) {
  514. console.log(arr);
  515. if (arr.length != 0) {
  516. this.checkRadioData = arr;
  517. } else {
  518. this.checkRadioData = [];
  519. }
  520. },
  521. selectChange(selection, row) {
  522. if (selection.length != 0) {
  523. this.checkRadioData = selection;
  524. } else {
  525. this.checkRadioData = [];
  526. }
  527. },
  528. allPrinting() {
  529. if (this.checkRadioData?.length > 0) {
  530. let params = this.checkRadioData.map((m) => {
  531. return {
  532. bizId: m.id,
  533. qrcodeType: 6
  534. };
  535. });
  536. barCode.batchBarPrint(params).then((res) => {
  537. console.log('--------res---------------');
  538. console.log(res);
  539. this.config = [];
  540. res.map((item, index) => {
  541. let obj = {
  542. putType: item.putType,
  543. sizeWide: item.sizeWide,
  544. sizeLong: item.sizeLong,
  545. value: this.checkRadioData[index].packageNo + '/6',
  546. useModeList: item.useModeList
  547. };
  548. obj.useModeList = obj.useModeList.sort((a, b) => {
  549. return a.barAvg.substr(4) - b.barAvg.substr(4);
  550. });
  551. this.config.push(obj);
  552. });
  553. console.log('this.config--------', this.config);
  554. this.openWindows = true;
  555. });
  556. } else {
  557. return this.$message.warning('请选择要打印的数据!');
  558. }
  559. // if (this.clientEnvironmentId == 2) {
  560. // this.$refs.printSrRef.open(this.checkRadioData);
  561. // } else if (this.clientEnvironmentId == 3) {
  562. // this.$refs.printTgRef.open(this.checkRadioData);
  563. // } else {
  564. // this.$refs.printRef.open(this.checkRadioData);
  565. // }
  566. },
  567. handledime(val) {
  568. console.log(val, 'val');
  569. this.selectedDime = val;
  570. this.reload();
  571. //每次切换维度查询列表配置信息,固定列配置 val 1 为物品维度,2 为批次维度,3 为包装维度。如果val值发生变化。请适配之前的维度
  572. this.cacheKeyUrl = this.diffCacheKeyUrl + val;
  573. this.getTabColumns();
  574. },
  575. /* 表格数据源 */
  576. datasource({ page, limit, where, order }) {
  577. console.log('this.selectedDime-----------', this.selectedDime);
  578. const dimension = this.$refs.refSeavch.dimension;
  579. console.log('this.dimension-----------', dimension);
  580. const treeId = this.$parent.$parent.$parent.current.id;
  581. if (dimension == 1) {
  582. // 物品维度
  583. const data = storageApi.getProductList({
  584. ...where,
  585. ...order,
  586. pageNum: page,
  587. size: limit
  588. });
  589. return data;
  590. } else if (dimension == 2) {
  591. // 批次维度
  592. const params = {
  593. categoryLevelId: treeId,
  594. ...where,
  595. ...order
  596. };
  597. const data = storageApi.getBatchList({
  598. ...params,
  599. pageNum: page,
  600. size: limit
  601. });
  602. return data;
  603. } else if (dimension == 4) {
  604. // 物料维度
  605. const params = {
  606. categoryLevelId: treeId,
  607. ...where,
  608. ...order
  609. };
  610. const data = storageApi.getMaterialList({
  611. ...params,
  612. pageNum: page,
  613. size: limit
  614. });
  615. return data;
  616. } else {
  617. // 包装维度
  618. let params = {};
  619. if (this.type === 'products') {
  620. params = {
  621. categoryLevelId: treeId,
  622. ...where,
  623. ...order
  624. };
  625. } else {
  626. console.log('this.current----', this.current.data);
  627. params = {
  628. warehouseId:
  629. this.current.data?.level == 0 ? this.current.data.id : '',
  630. warehouseAreaId:
  631. this.current.data?.level == 1 ? this.current.data.id : '',
  632. warehouseAreaGoodsId:
  633. this.current.data?.level == 2 ? this.current.data.id : '',
  634. warehouseAreaGoodsShelvesId:
  635. this.current.data?.level == 3 ? this.current.data.id : '',
  636. ...where,
  637. ...order
  638. };
  639. }
  640. const data = storageApi.getPackingList({
  641. ...params,
  642. pageNum: page,
  643. size: limit
  644. });
  645. return data;
  646. }
  647. },
  648. /* 刷新表格 */
  649. reload(where) {
  650. this.$nextTick(() => {
  651. console.log('this.current----', this.current);
  652. let params = {};
  653. if (this.type === 'products') {
  654. params = {
  655. ...where,
  656. categoryLevelId: this.current.data?.id || this.current?.id
  657. };
  658. } else {
  659. params = {
  660. ...where,
  661. warehouseId:
  662. this.current.data?.level == 0 ? this.current.data.id : '',
  663. warehouseAreaId:
  664. this.current.data?.level == 1 ? this.current.data.id : '',
  665. warehouseAreaGoodsId:
  666. this.current.data?.level == 2 ? this.current.data.id : ''
  667. };
  668. }
  669. this.$refs.table.reload({
  670. pageNum: 1,
  671. where: params
  672. });
  673. });
  674. },
  675. details(row) {
  676. const key = Date.now();
  677. this.$store.commit('stockManagement/CLEAR_BASEINFO');
  678. this.$store.commit('stockManagement/CHANGE_BASEINFO', {
  679. key,
  680. value: row
  681. });
  682. const url =
  683. this.$refs.refSeavch.dimension == 1
  684. ? '/warehouseManagement/stockLedger/allBatchDetails'
  685. : '/warehouseManagement/stockLedger/batchDetails';
  686. this.$router.push({
  687. path: url,
  688. query: {
  689. key,
  690. dimension: this.$refs.refSeavch.dimension,
  691. // id: this.$refs.refSeavch.dimension != 3 ? row.id : row.categoryId,
  692. id: row.categoryId,
  693. assetId: row.assetId,
  694. batchNo: row.batchNo,
  695. categoryCode: row.categoryCode
  696. }
  697. });
  698. }
  699. },
  700. watch: {
  701. // 监听机构id变化
  702. current: {
  703. handler() {
  704. this.reload();
  705. }
  706. },
  707. type: {
  708. handler() {
  709. if (this.type === 'warehouse') {
  710. this.selectedDime = '3';
  711. } else {
  712. this.selectedDime = '1';
  713. }
  714. this.reload();
  715. }
  716. }
  717. }
  718. };
  719. </script>