item-list.vue 37 KB

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