item-list.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  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. <div class="upload">
  27. <el-button
  28. v-if="selectedDime == 3"
  29. size="small"
  30. :disabled="checkRadioData.length == 0"
  31. icon="el-icon-set-up"
  32. class="ele-btn-icon"
  33. @click="allPrinting()"
  34. >
  35. 打印条码
  36. </el-button>
  37. <!-- <el-upload
  38. v-if="!isLoading"
  39. :show-file-list="false"
  40. class="upload-demo"
  41. action=""
  42. :before-upload="beforeUpload"
  43. :on-success="successUpload"
  44. :on-error="errorUpload"
  45. >
  46. <slot>
  47. <el-button
  48. type="primary"
  49. size="small"
  50. plain
  51. icon="el-icon-upload2"
  52. >导入</el-button
  53. >
  54. </slot>
  55. </el-upload> -->
  56. <el-button
  57. type="primary"
  58. size="small"
  59. icon="el-icon-upload2"
  60. plain
  61. @click="uploadFile"
  62. >导入</el-button
  63. >
  64. <exportButton
  65. fileName="库存台账"
  66. apiUrl="/wms/statement/exportStockExcel"
  67. :params="params"
  68. v-if="selectedDime == 2"
  69. ></exportButton>
  70. </div>
  71. <!-- <el-button
  72. v-if="selectedDime == 2 || selectedDime == 3"
  73. size="small"
  74. :disabled="checkRadioData.length == 0"
  75. icon="el-icon-set-up"
  76. class="ele-btn-icon"
  77. @click="showAllot()"
  78. >
  79. 调拨
  80. </el-button> -->
  81. </template>
  82. <template v-slot:result="{ row }">
  83. <span>{{ qualityResults[row.result] }}</span>
  84. </template>
  85. <template v-slot:status="{ row }">
  86. <span>{{ qualityStatus[row.status] }}</span>
  87. </template>
  88. <!-- -->
  89. <!-- 物品名称 -->
  90. <template v-slot:categoryName="{ row }">
  91. <el-link type="primary" @click="details(row)">
  92. {{ row.categoryName }}
  93. </el-link>
  94. </template>
  95. <!-- 批次号 -->
  96. <template v-slot:batchNo="{ row }">
  97. <el-popover placement="right-start" width="800" trigger="hover">
  98. <el-table :data="row.outInBatchDetailsVOList">
  99. <el-table-column
  100. width="150"
  101. property="bizNo"
  102. label="入库单号"
  103. ></el-table-column>
  104. <el-table-column
  105. width="100"
  106. property="bizType"
  107. label="入库场景"
  108. ></el-table-column>
  109. <el-table-column
  110. width="120"
  111. property="count"
  112. label="入库数量"
  113. ></el-table-column>
  114. <el-table-column
  115. width="80"
  116. property="measuringUnit"
  117. label="计量单位"
  118. ></el-table-column>
  119. <el-table-column
  120. width="100"
  121. property="packageCount"
  122. label="包装数量"
  123. ></el-table-column>
  124. <el-table-column
  125. width="80"
  126. property="packingUnit"
  127. label="包装单位"
  128. ></el-table-column>
  129. <el-table-column
  130. width="330"
  131. property="position"
  132. label="库位"
  133. ></el-table-column>
  134. <el-table-column
  135. width="160"
  136. property="createTime"
  137. label="入库时间"
  138. ></el-table-column>
  139. </el-table>
  140. <span slot="reference"> {{ row.batchNo }}</span>
  141. </el-popover>
  142. </template>
  143. <template v-slot:QRCode="{ row }">
  144. <el-link type="primary" @click="openQRCode(row, 3)"> 查看 </el-link>
  145. </template>
  146. <!-- 最小包装单元 -->
  147. <template v-slot:minPackingCount="{ row }">
  148. <span v-if="row.minPackingCount">
  149. {{ row.minPackingCount }}
  150. {{ row.measuringUnit }}/{{ row.minUnit }}
  151. </span>
  152. </template>
  153. <!-- 库存保质期 -->
  154. <template v-slot:expirationDate="{ row }">
  155. <span v-if="row.expirationDate">
  156. {{ row.expirationDate ? row.expirationDate : '-' }}
  157. {{
  158. row.expirationDateUnit == 'year'
  159. ? '年'
  160. : row.expirationDateUnit == 'month'
  161. ? '月'
  162. : '日'
  163. }}
  164. </span>
  165. </template>
  166. <!-- 质检状态 -->
  167. <template v-slot:qualityStatus="{ row }">
  168. <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
  169. >已检</span
  170. >
  171. <span v-else-if="row.qualityStatus == 1">已检</span>
  172. <span v-else-if="row.qualityStatus == 0">未检</span>
  173. <span v-else>-</span>
  174. </template>
  175. <!-- 质检结果 -->
  176. <template v-slot:qualityResult="{ row }">
  177. <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
  178. >合格</span
  179. >
  180. <span v-else-if="row.qualityResult == 1">不合格</span>
  181. <span v-else-if="row.qualityResult == 3">让步接收</span>
  182. <span v-else>-</span>
  183. </template>
  184. </ele-pro-table>
  185. <print :openBarCode.sync="openWindows" :config="config"></print>
  186. <!-- <print ref="printRef" :dimension="selectedDime"></print> -->
  187. <!-- <printSr ref="printSrRef" :dimension="selectedDime"></printSr>
  188. <printTg ref="printTgRef" :dimension="selectedDime"></printTg> -->
  189. <allot ref="allotRef" :dimension="selectedDime"></allot>
  190. <!-- 导入错误弹框 -->
  191. <el-dialog
  192. title="导入失败"
  193. :visible.sync="exportErrorDioalogVisible"
  194. width="60%"
  195. >
  196. <el-table :data="errorData" style="width: 100%">
  197. <el-table-column label="名称" prop="name"> </el-table-column>
  198. <el-table-column label="型号" prop="modeType"> </el-table-column>
  199. <el-table-column label="编号" prop="codeNo"> </el-table-column>
  200. <el-table-column label="物料组" prop="code"> </el-table-column>
  201. <el-table-column label="失败原因" prop="remark"> </el-table-column>
  202. </el-table>
  203. <span slot="footer" class="dialog-footer">
  204. <el-button @click="exportErrorDioalogVisible = false">取 消</el-button>
  205. <el-button type="primary" @click="exportErrorDioalogVisible = false"
  206. >确 定</el-button
  207. >
  208. </span>
  209. </el-dialog>
  210. <printQRCode ref="printQRCodeRef"></printQRCode>
  211. <importDialog
  212. :defModule="moudleName"
  213. ref="importDialogRef"
  214. :fileUrl="'/wms/outintwo/importTemplate'"
  215. fileName="库存导入模板"
  216. @success="reload"
  217. />
  218. </div>
  219. </template>
  220. <script>
  221. import print from '@/components/print/indexMultiple.vue';
  222. import allot from './allot.vue';
  223. import importDialog from '@/components/upload/import-dialogNew.vue';
  224. // import print from './print.vue';
  225. // import printSr from './printSr.vue';
  226. // import printTg from './printTg.vue';
  227. import ItemSearch from './item-search.vue';
  228. // import {
  229. // getUserPage,
  230. // removePersonnel,
  231. // unbindLoginName
  232. // } from '@/api/system/organization';
  233. import {
  234. pageeLedgerMain,
  235. removeItem,
  236. getWarehouseList
  237. } from '@/api/classifyManage/itemInformation';
  238. import barCode from '@/api/main/barCode';
  239. import storageApi from '@/api/warehouseManagement';
  240. import { getBatchDetails } from '@/api/classifyManage/index';
  241. import tabMixins from '@/mixins/tableColumnsMixin';
  242. import { qualityStatus, qualityResults } from '@/utils/dict/index';
  243. import { parameterGetByCode } from '@/api/sys/index.js';
  244. import exportButton from '@/components/upload/exportButton.vue';
  245. import printQRCode from '@/views/warehouseManagement/stockManagement/components/printQRCode.vue';
  246. export default {
  247. mixins: [tabMixins],
  248. components: {
  249. ItemSearch,
  250. print,
  251. allot,
  252. importDialog,
  253. exportButton,
  254. printQRCode
  255. },
  256. props: {
  257. // 机构id
  258. organizationId: [Number, String],
  259. // 全部机构
  260. organizationList: Array,
  261. current: {
  262. type: Object,
  263. default: () => ({})
  264. },
  265. type: {
  266. type: String,
  267. default: ''
  268. }
  269. },
  270. data() {
  271. return {
  272. params: {},
  273. moudleName: 'stock',
  274. qualityStatus,
  275. qualityResults,
  276. config: [],
  277. openWindows: false,
  278. newColumns: [],
  279. checkRadioData: [],
  280. searchForm: {
  281. dimension: '1'
  282. },
  283. selectedDime: '2',
  284. diffCacheKeyUrl:
  285. 'eos-439decaa-warehouseManagement-stockLedger-products',
  286. cacheKeyUrl: 'eos-439decaa-warehouseManagement-stockLedger-products2', //默认查询key值
  287. columnsVersion: 1,
  288. isLoading: false,
  289. exportErrorDioalogVisible: false,
  290. errorData: [],
  291. isPrice: 1
  292. };
  293. },
  294. created() {
  295. this.getFieldModel();
  296. //仓库出入库是否显示金额(0:不显示 1:显示)
  297. parameterGetByCode({
  298. code: 'wms_price'
  299. }).then((res) => {
  300. this.isPrice = res.value;
  301. });
  302. },
  303. computed: {
  304. // 表格列配置
  305. columns() {
  306. // 当columnsVersion变化时会重新计算
  307. const version = this.columnsVersion;
  308. // selectedDime 1物品维度 2批次维度 3包装维度 4物料维度
  309. let arr = [
  310. this.selectedDime == 3
  311. ? {
  312. width: 45,
  313. type: 'selection',
  314. columnKey: 'selection',
  315. align: 'center'
  316. }
  317. : '',
  318. {
  319. columnKey: 'index',
  320. type: 'index',
  321. width: 50,
  322. align: 'center',
  323. label: '序号',
  324. showOverflowTooltip: true,
  325. fixed: 'left'
  326. },
  327. {
  328. width: 80,
  329. prop: 'QRCode',
  330. slot: 'QRCode',
  331. align: 'center',
  332. label: '二维码',
  333. showOverflowTooltip: true
  334. },
  335. this.selectedDime != 1
  336. ? {
  337. prop: 'batchNo',
  338. label: '批次号',
  339. align: 'center'
  340. }
  341. : '',
  342. {
  343. prop: 'categoryCode',
  344. label: '物品编码',
  345. align: 'center',
  346. showOverflowTooltip: true
  347. },
  348. {
  349. slot: 'categoryName',
  350. prop: 'categoryName',
  351. label: '物品名称',
  352. align: 'center',
  353. showOverflowTooltip: true,
  354. minWidth: 200
  355. },
  356. this.selectedDime != 1
  357. ? {
  358. prop: 'inventoryCycle',
  359. label: '存货周期(天)',
  360. align: 'center',
  361. width: 150,
  362. sortable: true,
  363. showOverflowTooltip: true
  364. }
  365. : '',
  366. {
  367. prop: 'brandNum',
  368. label: '牌号',
  369. align: 'center',
  370. showOverflowTooltip: true
  371. },
  372. {
  373. prop: 'categoryModel',
  374. label: '型号',
  375. align: 'center',
  376. showOverflowTooltip: true
  377. },
  378. {
  379. prop: 'specification',
  380. label: '规格',
  381. align: 'center',
  382. showOverflowTooltip: true
  383. },
  384. this.selectedDime == 2
  385. ? {
  386. prop: 'supplierName',
  387. label: '供应商',
  388. showOverflowTooltip: true,
  389. width: 130,
  390. align: 'center'
  391. }
  392. : '',
  393. {
  394. prop: 'level',
  395. label: '级别',
  396. showOverflowTooltip: true
  397. },
  398. {
  399. prop: 'measureQuantity',
  400. label: '计量数量',
  401. sortable: 'custom',
  402. showOverflowTooltip: true,
  403. width: 130,
  404. align: 'center'
  405. },
  406. // {
  407. // prop: 'supplierName',
  408. // label: '供应商',
  409. // showOverflowTooltip: true,
  410. // width: 130,
  411. // align: 'center'
  412. // },
  413. {
  414. prop: 'measureUnit',
  415. label: '计量单位',
  416. align: 'center'
  417. },
  418. {
  419. prop: 'weight',
  420. label: '重量',
  421. showOverflowTooltip: true
  422. },
  423. {
  424. prop: 'weightUnit',
  425. label: '重量单位',
  426. showOverflowTooltip: true
  427. },
  428. this.selectedDime == 1
  429. ? {
  430. prop: 'secureInventory',
  431. label: '安全库存',
  432. showOverflowTooltip: true
  433. }
  434. : '',
  435. this.selectedDime == 1
  436. ? {
  437. prop: 'minInventory',
  438. label: '最小库存',
  439. showOverflowTooltip: true
  440. }
  441. : '',
  442. this.selectedDime == 1
  443. ? {
  444. prop: 'maxInventory',
  445. label: '最大库存',
  446. showOverflowTooltip: true
  447. }
  448. : '',
  449. this.selectedDime == 3
  450. ? {
  451. prop: 'packageNo',
  452. label: '包装编码',
  453. showOverflowTooltip: true
  454. }
  455. : '',
  456. this.selectedDime == 3
  457. ? {
  458. prop: 'packingQuantity',
  459. label: '包装数量 ',
  460. showOverflowTooltip: true
  461. }
  462. : '',
  463. this.selectedDime == 3
  464. ? {
  465. prop: 'packingUnit',
  466. label: '包装单位 ',
  467. showOverflowTooltip: true
  468. }
  469. : '',
  470. this.selectedDime == 3
  471. ? {
  472. prop: 'result',
  473. slot: 'result',
  474. label: '质检结果',
  475. showOverflowTooltip: true
  476. }
  477. : '',
  478. this.selectedDime == 3
  479. ? {
  480. prop: 'status',
  481. slot: 'status',
  482. label: '质检状态',
  483. showOverflowTooltip: true
  484. }
  485. : '',
  486. this.selectedDime == 3 || this.selectedDime == 2
  487. ? {
  488. prop: 'warehouseName',
  489. label: '仓库名称',
  490. showOverflowTooltip: true
  491. }
  492. : '',
  493. this.selectedDime == 3
  494. ? {
  495. prop: 'areaName',
  496. label: '货区 ',
  497. showOverflowTooltip: true
  498. }
  499. : '',
  500. this.selectedDime == 3
  501. ? {
  502. prop: 'goodsAllocationName',
  503. label: '货架',
  504. showOverflowTooltip: true
  505. }
  506. : '',
  507. this.selectedDime == 3
  508. ? {
  509. prop: 'goodsShelfName',
  510. label: '货位',
  511. showOverflowTooltip: true
  512. }
  513. : '',
  514. this.selectedDime == 3
  515. ? {
  516. prop: 'productionDate',
  517. label: '生产日期',
  518. showOverflowTooltip: true
  519. }
  520. : '',
  521. this.selectedDime == 3
  522. ? {
  523. prop: 'purchaseDate',
  524. label: '采购日期',
  525. showOverflowTooltip: true
  526. }
  527. : '',
  528. this.selectedDime == 3 || this.selectedDime == 4
  529. ? {
  530. prop: 'barcodes',
  531. label: '发货条码 ',
  532. showOverflowTooltip: true
  533. }
  534. : '',
  535. this.selectedDime == 3 || this.selectedDime == 4
  536. ? {
  537. prop: 'clientCode',
  538. label: '客户代号',
  539. showOverflowTooltip: true
  540. }
  541. : '',
  542. this.selectedDime == 3 || this.selectedDime == 4
  543. ? {
  544. prop: 'engrave',
  545. label: '刻码 ',
  546. showOverflowTooltip: true
  547. }
  548. : '',
  549. this.selectedDime == 3 || this.selectedDime == 4
  550. ? {
  551. prop: 'materielDesignation',
  552. label: '物料代号',
  553. width: 120,
  554. showOverflowTooltip: true
  555. }
  556. : '',
  557. // {
  558. // prop: 'supplierName',
  559. // label: '供应商',
  560. // width: 120,
  561. // showOverflowTooltip: true
  562. // },
  563. {
  564. prop: 'supplierCode',
  565. label: '供应商代号',
  566. width: 120,
  567. showOverflowTooltip: true
  568. },
  569. this.selectedDime == 1
  570. ? {
  571. prop: 'provenance',
  572. label: '产地',
  573. showOverflowTooltip: true
  574. }
  575. : '',
  576. this.isPrice == 1
  577. ? {
  578. prop: 'unitPrice',
  579. label: '单价',
  580. showOverflowTooltip: true
  581. }
  582. : '',
  583. this.isPrice == 1
  584. ? {
  585. prop: 'totalMoney',
  586. label: '金额',
  587. showOverflowTooltip: true
  588. }
  589. : '',
  590. this.selectedDime == 2
  591. ? {
  592. prop: 'createTime',
  593. width: 120,
  594. label: '入库时间',
  595. showOverflowTooltip: true
  596. }
  597. : ''
  598. ];
  599. if (this.selectedDime == 1) {
  600. return arr.filter((item) => item != '').concat(this.newColumns);
  601. } else {
  602. return arr.filter((item) => item != '');
  603. }
  604. },
  605. clientEnvironmentId() {
  606. return this.$store.state.user.info.clientEnvironmentId;
  607. }
  608. },
  609. methods: {
  610. openQRCode(row, type) {
  611. this.$refs.printQRCodeRef.open(row, type);
  612. },
  613. getFieldModel() {
  614. storageApi.fieldModel({ relevance: 't_main_category' }).then((res) => {
  615. let newRes = res.map((m) => {
  616. return {
  617. prop: 'extField.' + m.prop,
  618. label: m.label,
  619. align: 'center',
  620. showOverflowTooltip: true
  621. };
  622. });
  623. this.newColumns = [...newRes];
  624. });
  625. },
  626. // 调拨
  627. showAllot() {
  628. this.$refs.allotRef.open(this.checkRadioData);
  629. },
  630. // 全选
  631. changeSelectAll(arr) {
  632. console.log(arr);
  633. if (arr.length != 0) {
  634. this.checkRadioData = arr;
  635. } else {
  636. this.checkRadioData = [];
  637. }
  638. },
  639. selectChange(selection, row) {
  640. if (selection.length != 0) {
  641. this.checkRadioData = selection;
  642. } else {
  643. this.checkRadioData = [];
  644. }
  645. },
  646. allPrinting() {
  647. if (this.checkRadioData?.length > 0) {
  648. let params = this.checkRadioData.map((m) => {
  649. return {
  650. bizId: m.id,
  651. qrcodeType: 6
  652. };
  653. });
  654. barCode.batchBarPrint(params).then((res) => {
  655. console.log('--------res---------------');
  656. console.log(res);
  657. this.config = [];
  658. res.map((item, index) => {
  659. let obj = {
  660. putType: item.putType,
  661. sizeWide: item.sizeWide,
  662. sizeLong: item.sizeLong,
  663. value: this.checkRadioData[index].packageNo + '/6',
  664. useModeList: item.useModeList
  665. };
  666. obj.useModeList = obj.useModeList.sort((a, b) => {
  667. return a.barAvg.substr(4) - b.barAvg.substr(4);
  668. });
  669. this.config.push(obj);
  670. });
  671. console.log('this.config--------', this.config);
  672. this.openWindows = true;
  673. });
  674. } else {
  675. return this.$message.warning('请选择要打印的数据!');
  676. }
  677. // if (this.clientEnvironmentId == 2) {
  678. // this.$refs.printSrRef.open(this.checkRadioData);
  679. // } else if (this.clientEnvironmentId == 3) {
  680. // this.$refs.printTgRef.open(this.checkRadioData);
  681. // } else {
  682. // this.$refs.printRef.open(this.checkRadioData);
  683. // }
  684. },
  685. handledime(val) {
  686. console.log(val, 'val');
  687. this.selectedDime = val;
  688. // this.reload();
  689. this.reload(this.$refs.refSeavch.params);
  690. //每次切换维度查询列表配置信息,固定列配置 val 1 为物品维度,2 为批次维度,3 为包装维度。如果val值发生变化。请适配之前的维度
  691. this.cacheKeyUrl = this.diffCacheKeyUrl + val;
  692. this.getTabColumns();
  693. },
  694. /* 表格数据源 */
  695. datasource({ page, limit, where, order }) {
  696. console.log('this.selectedDime-----------', this.selectedDime);
  697. const dimension = this.$refs.refSeavch.dimension;
  698. console.log('this.dimension-----------', dimension);
  699. const treeId = this.$parent.$parent.$parent.current.id;
  700. if (dimension == 1) {
  701. // 物品维度
  702. const data = storageApi.getProductList({
  703. ...where,
  704. ...order,
  705. pageNum: page,
  706. size: limit
  707. });
  708. return data;
  709. } else if (dimension == 2) {
  710. // 批次维度
  711. const params = {
  712. categoryLevelId: treeId,
  713. ...where,
  714. ...order
  715. };
  716. this.params = {
  717. ...params,
  718. pageNum: page,
  719. size: limit
  720. };
  721. console.log('this.params----', this.params);
  722. const data = storageApi.getBatchList(this.params);
  723. return data;
  724. } else if (dimension == 4) {
  725. // 物料维度
  726. const params = {
  727. categoryLevelId: treeId,
  728. ...where,
  729. ...order
  730. };
  731. const data = storageApi.getMaterialList({
  732. ...params,
  733. pageNum: page,
  734. size: limit
  735. });
  736. return data;
  737. } else {
  738. // 包装维度
  739. let params = {};
  740. if (this.type === 'products') {
  741. params = {
  742. categoryLevelId: treeId,
  743. ...where,
  744. ...order
  745. };
  746. } else {
  747. console.log('this.current----', this.current.data);
  748. params = {
  749. warehouseId:
  750. this.current.data?.level == 0 ? this.current.data.id : '',
  751. warehouseAreaId:
  752. this.current.data?.level == 1 ? this.current.data.id : '',
  753. warehouseAreaGoodsId:
  754. this.current.data?.level == 2 ? this.current.data.id : '',
  755. warehouseAreaGoodsShelvesId:
  756. this.current.data?.level == 3 ? this.current.data.id : '',
  757. ...where,
  758. ...order
  759. };
  760. }
  761. const data = storageApi.getPackingList({
  762. ...params,
  763. pageNum: page,
  764. size: limit
  765. });
  766. return data;
  767. }
  768. },
  769. /* 刷新表格 */
  770. reload(where) {
  771. this.$nextTick(() => {
  772. console.log('this.current----', this.current);
  773. let params = {};
  774. if (this.type === 'products') {
  775. params = {
  776. ...where,
  777. categoryLevelId: this.current.data?.id || this.current?.id
  778. };
  779. } else {
  780. params = {
  781. ...where,
  782. warehouseId:
  783. this.current.data?.level == 0 ? this.current.data.id : '',
  784. warehouseAreaId:
  785. this.current.data?.level == 1 ? this.current.data.id : '',
  786. warehouseAreaGoodsId:
  787. this.current.data?.level == 2 ? this.current.data.id : ''
  788. };
  789. }
  790. this.$refs.table.reload({
  791. pageNum: 1,
  792. where: params
  793. });
  794. });
  795. },
  796. details(row) {
  797. const key = Date.now();
  798. this.$store.commit('stockManagement/CLEAR_BASEINFO');
  799. this.$store.commit('stockManagement/CHANGE_BASEINFO', {
  800. key,
  801. value: row
  802. });
  803. const url =
  804. this.$refs.refSeavch.dimension == 1
  805. ? '/warehouseManagement/stockLedger/allBatchDetails'
  806. : '/warehouseManagement/stockLedger/batchDetails';
  807. this.$router.push({
  808. path: url,
  809. query: {
  810. key,
  811. dimension: this.$refs.refSeavch.dimension,
  812. // id: this.$refs.refSeavch.dimension != 3 ? row.id : row.categoryId,
  813. id: row.categoryId,
  814. assetId: row.assetId,
  815. batchNo: row.batchNo,
  816. categoryCode: row.categoryCode
  817. }
  818. });
  819. },
  820. beforeUpload(file) {
  821. if (file.size / 1024 / 1024 > this.size) {
  822. this.$message.error(`大小不能超过 ${this.size}MB`);
  823. return false;
  824. }
  825. if (this.limit > 0 && this.fileList.length === this.limit) {
  826. this.$message.error(`最多上传 ${this.limit}个文件`);
  827. return false;
  828. }
  829. let formData = new FormData();
  830. formData.append('file', file);
  831. this.isLoading = true;
  832. return importCategorySparePart(formData).then((res) => {
  833. if (res.data.length > 0) {
  834. this.exportErrorDioalogVisible = true;
  835. this.errorData = res.data;
  836. } else {
  837. this.$message.success('导入成功!');
  838. }
  839. this.isLoading = false;
  840. return false;
  841. });
  842. },
  843. successUpload(response) {
  844. this.isLoading = false;
  845. },
  846. errorUpload(response) {
  847. this.isLoading = false;
  848. },
  849. uploadFile() {
  850. this.$refs.importDialogRef.open();
  851. }
  852. },
  853. watch: {
  854. // 监听机构id变化
  855. current: {
  856. handler() {
  857. this.reload();
  858. }
  859. },
  860. type: {
  861. handler() {
  862. if (this.type === 'warehouse') {
  863. this.selectedDime = '3';
  864. } else {
  865. this.selectedDime = '1';
  866. }
  867. this.reload();
  868. }
  869. }
  870. }
  871. };
  872. </script>
  873. <style lang="scss" scoped>
  874. .upload {
  875. display: flex;
  876. width: 100%;
  877. margin-left: 10px;
  878. }
  879. </style>