item-list.vue 31 KB

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