item-list.vue 25 KB

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