item-list.vue 32 KB

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