newPickingList.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. <template>
  2. <el-dialog
  3. :title="title"
  4. :visible.sync="visible"
  5. v-if="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. append-to-body
  10. width="75%"
  11. >
  12. <el-card shadow="never">
  13. <pickingListSearch
  14. @search="reload"
  15. ref="searchRef"
  16. @handledime="handledime"
  17. />
  18. <!-- <pickingSearch v-else @search="reload" ref="pickingRef" /> -->
  19. <ele-split-layout
  20. width="244px"
  21. allow-collapse
  22. :right-style="{ overflow: 'hidden' }"
  23. >
  24. <div class="ele-border-lighter split-layout-right-content">
  25. <AssetTree
  26. ref="assetTreeRef"
  27. :treeIds="treeIds"
  28. @handleNodeClick="handleNodeClick"
  29. @setRootId="setRootId"
  30. />
  31. </div>
  32. <!-- 表格 -->
  33. <template v-slot:content>
  34. <ele-pro-table
  35. :initLoad="false"
  36. ref="table"
  37. :columns="columns"
  38. :datasource="datasource"
  39. :selection.sync="selection"
  40. row-key="id"
  41. height="calc(100vh - 350px)"
  42. class="dict-table"
  43. :cache-key="tableKey"
  44. :row-style="rowStyle"
  45. :row-click-checked="true"
  46. :row-click-checked-intelligent="false"
  47. @update:selection="handleSelectionChange"
  48. >
  49. <template v-slot:toolbar>
  50. <el-alert
  51. type="info"
  52. :closable="false"
  53. class="ele-alert-border"
  54. style="width: 300px"
  55. >
  56. <i class="el-icon-info ele-text-info"></i>
  57. <span class="ele-text">
  58. <span>
  59. 已选择
  60. <b class="ele-text-info">{{ allSelection.length }}</b>
  61. 项数据<em></em>
  62. </span>
  63. </span>
  64. <el-link type="primary" :underline="false" @click="clearChoose">
  65. 清空
  66. </el-link>
  67. </el-alert>
  68. </template>
  69. <!-- <template v-slot:code="{ row }">
  70. {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
  71. </template> -->
  72. <template v-slot:runStatus="{ row }">
  73. {{ stateList[Number(row.runStatus)] }}
  74. </template>
  75. <template v-slot:vehicleLen="{ row }">
  76. {{ row.extInfo.vehicleLen || '-' }}
  77. {{ row.extInfo.wilde || '-' }} {{ row.extInfo.hight || '-' }}
  78. </template>
  79. <template v-slot:status="{ row }">
  80. <span
  81. :style="{ color: row.status == 0 ? '#157A2C' : '#FFA929' }"
  82. >{{
  83. row.status == 0 ? '空闲' : row.status == 1 ? '占用' : ''
  84. }}</span
  85. >
  86. </template>
  87. <template v-slot:packingCountBase="{ row }">
  88. {{ row.packingCountBase }} {{ row.minUnit }}
  89. </template>
  90. <template v-slot:measureQuantity="{ row }">
  91. {{ row.measureQuantity }} {{ row.measureUnit }}
  92. </template>
  93. <template v-slot:weight="{ row }">
  94. {{ row.weight }} {{ row.weightUnit }}
  95. </template>
  96. <!-- 库存保质期 -->
  97. <template v-slot:expirationDate="{ row }">
  98. <span v-if="row.expirationDate">
  99. {{ row.expirationDate ? row.expirationDate : '-' }}
  100. {{
  101. row.expirationDateUnit == 'year'
  102. ? '年'
  103. : row.expirationDateUnit == 'month'
  104. ? '月'
  105. : '日'
  106. }}
  107. </span>
  108. </template>
  109. <!-- 质检状态 -->
  110. <template v-slot:qualityStatus="{ row }">
  111. <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
  112. >已检</span
  113. >
  114. <span v-else-if="row.qualityStatus == 1">已检</span>
  115. <span v-else-if="row.qualityStatus == 0">未检</span>
  116. <span v-else>-</span>
  117. </template>
  118. <!-- 质检结果 -->
  119. <template v-slot:qualityResult="{ row }">
  120. <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
  121. >合格</span
  122. >
  123. <span v-else-if="row.qualityResult == 1">不合格</span>
  124. <span v-else-if="row.qualityResult == 3">让步接收</span>
  125. <span v-else>-</span>
  126. </template>
  127. </ele-pro-table>
  128. </template>
  129. </ele-split-layout>
  130. </el-card>
  131. <div class="btns">
  132. <el-button type="primary" size="small" @click="selected">选择</el-button>
  133. <el-button size="small" @click="handleClose">关闭</el-button>
  134. </div>
  135. </el-dialog>
  136. </template>
  137. <script>
  138. import AssetTree from '../../components/assetTree.vue';
  139. import pickingListSearch from './newPickingListSearch.vue';
  140. import pickingSearch from './pickingSearch.vue';
  141. import {
  142. pageeLedgerMain,
  143. assetPage,
  144. listInProduct
  145. } from '@/api/produce/workOrder';
  146. import storageApi from '@/api/warehouseManagement';
  147. // import { deepCopy } from '@/utils/util.js';
  148. import { getOutindetailtwo } from '@/api/produce/picking';
  149. export default {
  150. components: { AssetTree, pickingListSearch, pickingSearch },
  151. props: {
  152. isType: {
  153. type: String,
  154. default: '',
  155. required: true
  156. }
  157. },
  158. data() {
  159. return {
  160. visible: false,
  161. id: null,
  162. treeIds: null,
  163. categoryLevelId: null,
  164. rootCategoryLevelId: null,
  165. isCategory: true,
  166. stateList: [
  167. '启动',
  168. '空闲',
  169. '运行',
  170. '故障',
  171. '检修',
  172. '停机',
  173. '待料',
  174. '占用'
  175. ],
  176. selection: [],
  177. allSelection: [],
  178. temporaryList: [],
  179. // cloumsAll: [
  180. // {
  181. // width: 45,
  182. // type: 'selection',
  183. // columnKey: 'selection',
  184. // align: 'center',
  185. // reserveSelection: true
  186. // },
  187. // {
  188. // columnKey: 'index',
  189. // label: '序号',
  190. // type: 'index',
  191. // width: 50,
  192. // align: 'center'
  193. // },
  194. // {
  195. // prop: 'code',
  196. // label: '物品编码',
  197. // slot: 'code'
  198. // },
  199. // {
  200. // prop: 'codeNumber',
  201. // label: '编号',
  202. // showOverflowTooltip: true
  203. // },
  204. // {
  205. // prop: 'name',
  206. // label: '名称',
  207. // showOverflowTooltip: true
  208. // },
  209. // {
  210. // prop: 'brandNum',
  211. // label: '牌号',
  212. // showOverflowTooltip: true
  213. // },
  214. // {
  215. // prop: 'specification',
  216. // label: '规格',
  217. // showOverflowTooltip: true
  218. // },
  219. // {
  220. // prop: 'modelType',
  221. // label: '型号',
  222. // showOverflowTooltip: true
  223. // },
  224. // {
  225. // prop: 'batchNo',
  226. // label: '批次号',
  227. // align: 'center'
  228. // },
  229. // // {
  230. // // prop: 'manualBatchNo',
  231. // // label: '批次号',
  232. // // align: 'center'
  233. // // },
  234. // {
  235. // prop: 'availableCountBase',
  236. // label: '计量库存数量',
  237. // sortable: 'custom',
  238. // slot: 'availableCountBase',
  239. // showOverflowTooltip: true,
  240. // width: 130,
  241. // align: 'center'
  242. // },
  243. // ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
  244. // ? [
  245. // {
  246. // prop: 'packingCountBase',
  247. // label: '包装库存',
  248. // slot: 'packingCountBase',
  249. // showOverflowTooltip: true
  250. // }
  251. // ]
  252. // : []),
  253. // {
  254. // prop: 'weight',
  255. // label: '重量',
  256. // showOverflowTooltip: true,
  257. // slot: 'weight'
  258. // },
  259. // {
  260. // prop: 'expirationDate',
  261. // slot: 'expirationDate',
  262. // label: '库存保质期',
  263. // width: 100
  264. // },
  265. // {
  266. // prop: 'expirationTime',
  267. // label: '周期倒计时',
  268. // showOverflowTooltip: true,
  269. // width: 100
  270. // },
  271. // {
  272. // prop: 'qualityResult',
  273. // slot: 'qualityResult',
  274. // label: '质检结果',
  275. // showOverflowTooltip: true,
  276. // width: 100
  277. // },
  278. // {
  279. // prop: 'qualityStatus',
  280. // slot: 'qualityStatus',
  281. // label: '质检状态',
  282. // showOverflowTooltip: true,
  283. // width: 100
  284. // },
  285. // {
  286. // prop: 'pathName',
  287. // width: 230,
  288. // label: '仓库',
  289. // showOverflowTooltip: true
  290. // },
  291. // ...(this.rootCategoryLevelId == '4'
  292. // ? [
  293. // {
  294. // prop: 'workstationName',
  295. // label: '工位',
  296. // showOverflowTooltip: true
  297. // },
  298. // {
  299. // prop: 'runStatus',
  300. // label: '状态',
  301. // slot: 'runStatus',
  302. // showOverflowTooltip: true
  303. // }
  304. // ]
  305. // : []),
  306. // // ...(this.rootCategoryLevelId == '5'
  307. // // ? [
  308. // // {
  309. // // prop: 'dieHoleNum',
  310. // // label: '模孔数量',
  311. // // showOverflowTooltip: true
  312. // // },
  313. // // {
  314. // // prop: 'mandrelDiameter',
  315. // // label: '芯棒直径',
  316. // // showOverflowTooltip: true
  317. // // },
  318. // // {
  319. // // prop: 'shrinkEffictive',
  320. // // label: '收缩系数',
  321. // // showOverflowTooltip: true
  322. // // }
  323. // // ]
  324. // // : []),
  325. // // ...(this.rootCategoryLevelId == '7'
  326. // // ? [
  327. // // {
  328. // // prop: 'materialQuality',
  329. // // label: '材质',
  330. // // showOverflowTooltip: true
  331. // // },
  332. // // {
  333. // // prop: 'vehicleLen',
  334. // // label: '长宽高',
  335. // // slot: 'vehicleLen',
  336. // // showOverflowTooltip: true
  337. // // }
  338. // // ]
  339. // // : []),
  340. // ...(this.rootCategoryLevelId == '8'
  341. // ? [
  342. // {
  343. // prop: 'extInfo.slotNum',
  344. // label: '槽数',
  345. // showOverflowTooltip: true
  346. // }
  347. // ]
  348. // : []),
  349. // ...(this.rootCategoryLevelId == '11'
  350. // ? [
  351. // {
  352. // prop: 'status',
  353. // label: '状态',
  354. // slot: 'status',
  355. // showOverflowTooltip: true
  356. // },
  357. // {
  358. // prop: 'region',
  359. // label: '位置',
  360. // showOverflowTooltip: true
  361. // }
  362. // ]
  363. // : [])
  364. // ]
  365. cloumsAll: [
  366. {
  367. width: 45,
  368. type: 'selection',
  369. columnKey: 'selection',
  370. align: 'center',
  371. reserveSelection: true
  372. },
  373. {
  374. columnKey: 'index',
  375. label: '序号',
  376. type: 'index',
  377. width: 50,
  378. align: 'center'
  379. },
  380. {
  381. prop: 'categoryCode',
  382. label: '物品编码'
  383. },
  384. {
  385. prop: 'codeNumber',
  386. label: '编号',
  387. showOverflowTooltip: true
  388. },
  389. {
  390. prop: 'categoryName',
  391. label: '名称',
  392. showOverflowTooltip: true
  393. },
  394. {
  395. prop: 'brandNum',
  396. label: '牌号',
  397. showOverflowTooltip: true
  398. },
  399. {
  400. prop: 'specification',
  401. label: '规格',
  402. showOverflowTooltip: true
  403. },
  404. // {
  405. // prop: 'modelType',
  406. // label: '型号',
  407. // showOverflowTooltip: true
  408. // },
  409. {
  410. prop: 'categoryModel',
  411. label: '型号',
  412. align: 'center',
  413. showOverflowTooltip: true
  414. },
  415. {
  416. prop: 'batchNo',
  417. label: '批次号',
  418. align: 'center'
  419. },
  420. // {
  421. // prop: 'manualBatchNo',
  422. // label: '批次号',
  423. // align: 'center'
  424. // },
  425. {
  426. prop: 'measureQuantity',
  427. label: '计量库存数量',
  428. sortable: 'custom',
  429. slot: 'measureQuantity',
  430. showOverflowTooltip: true,
  431. width: 130,
  432. align: 'center'
  433. },
  434. ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
  435. ? [
  436. {
  437. prop: 'packingCountBase',
  438. label: '包装库存',
  439. slot: 'packingCountBase',
  440. showOverflowTooltip: true
  441. }
  442. ]
  443. : []),
  444. {
  445. prop: 'weight',
  446. label: '重量',
  447. showOverflowTooltip: true,
  448. slot: 'weight'
  449. },
  450. {
  451. prop: 'expirationDate',
  452. slot: 'expirationDate',
  453. label: '库存保质期',
  454. width: 100
  455. },
  456. {
  457. prop: 'expirationTime',
  458. label: '周期倒计时',
  459. showOverflowTooltip: true,
  460. width: 100
  461. },
  462. {
  463. prop: 'qualityResult',
  464. slot: 'qualityResult',
  465. label: '质检结果',
  466. showOverflowTooltip: true,
  467. width: 100
  468. },
  469. {
  470. prop: 'qualityStatus',
  471. slot: 'qualityStatus',
  472. label: '质检状态',
  473. showOverflowTooltip: true,
  474. width: 100
  475. },
  476. {
  477. prop: 'warehouseName',
  478. width: 230,
  479. label: '仓库',
  480. showOverflowTooltip: true
  481. },
  482. ...(this.rootCategoryLevelId == '4'
  483. ? [
  484. {
  485. prop: 'workstationName',
  486. label: '工位',
  487. showOverflowTooltip: true
  488. },
  489. {
  490. prop: 'runStatus',
  491. label: '状态',
  492. slot: 'runStatus',
  493. showOverflowTooltip: true
  494. }
  495. ]
  496. : []),
  497. // ...(this.rootCategoryLevelId == '5'
  498. // ? [
  499. // {
  500. // prop: 'dieHoleNum',
  501. // label: '模孔数量',
  502. // showOverflowTooltip: true
  503. // },
  504. // {
  505. // prop: 'mandrelDiameter',
  506. // label: '芯棒直径',
  507. // showOverflowTooltip: true
  508. // },
  509. // {
  510. // prop: 'shrinkEffictive',
  511. // label: '收缩系数',
  512. // showOverflowTooltip: true
  513. // }
  514. // ]
  515. // : []),
  516. // ...(this.rootCategoryLevelId == '7'
  517. // ? [
  518. // {
  519. // prop: 'materialQuality',
  520. // label: '材质',
  521. // showOverflowTooltip: true
  522. // },
  523. // {
  524. // prop: 'vehicleLen',
  525. // label: '长宽高',
  526. // slot: 'vehicleLen',
  527. // showOverflowTooltip: true
  528. // }
  529. // ]
  530. // : []),
  531. ...(this.rootCategoryLevelId == '8'
  532. ? [
  533. {
  534. prop: 'extInfo.slotNum',
  535. label: '槽数',
  536. showOverflowTooltip: true
  537. }
  538. ]
  539. : []),
  540. ...(this.rootCategoryLevelId == '11'
  541. ? [
  542. {
  543. prop: 'status',
  544. label: '状态',
  545. slot: 'status',
  546. showOverflowTooltip: true
  547. },
  548. {
  549. prop: 'region',
  550. label: '位置',
  551. showOverflowTooltip: true
  552. }
  553. ]
  554. : [])
  555. ]
  556. };
  557. },
  558. computed: {
  559. tableKey() {
  560. return `table-${this.rootCategoryLevelId}`;
  561. },
  562. // 表格列配置
  563. columns() {
  564. return this.cloumsAll;
  565. // return [
  566. // {
  567. // width: 45,
  568. // type: 'selection',
  569. // columnKey: 'selection',
  570. // align: 'center',
  571. // reserveSelection: true
  572. // },
  573. // {
  574. // columnKey: 'index',
  575. // label: '序号',
  576. // type: 'index',
  577. // width: 50,
  578. // align: 'center'
  579. // },
  580. // {
  581. // prop: 'code',
  582. // label: '物品编码',
  583. // slot: 'code'
  584. // },
  585. // {
  586. // prop: 'codeNumber',
  587. // label: '编号',
  588. // showOverflowTooltip: true
  589. // },
  590. // {
  591. // prop: 'name',
  592. // label: '名称',
  593. // showOverflowTooltip: true
  594. // },
  595. // {
  596. // prop: 'brandNum',
  597. // label: '牌号',
  598. // showOverflowTooltip: true
  599. // },
  600. // {
  601. // prop: 'specification',
  602. // label: '规格',
  603. // showOverflowTooltip: true
  604. // },
  605. // {
  606. // prop: 'modelType',
  607. // label: '型号',
  608. // showOverflowTooltip: true
  609. // },
  610. // {
  611. // prop: 'batchNo',
  612. // label: '批次号',
  613. // align: 'center'
  614. // },
  615. // // {
  616. // // prop: 'manualBatchNo',
  617. // // label: '批次号',
  618. // // align: 'center'
  619. // // },
  620. // {
  621. // prop: 'availableCountBase',
  622. // label: '计量库存数量',
  623. // sortable: 'custom',
  624. // slot: 'availableCountBase',
  625. // showOverflowTooltip: true,
  626. // width: 130,
  627. // align: 'center'
  628. // },
  629. // ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
  630. // ? [
  631. // {
  632. // prop: 'packingCountBase',
  633. // label: '包装库存',
  634. // slot: 'packingCountBase',
  635. // showOverflowTooltip: true
  636. // }
  637. // ]
  638. // : []),
  639. // {
  640. // prop: 'weight',
  641. // label: '重量',
  642. // showOverflowTooltip: true,
  643. // slot: 'weight'
  644. // },
  645. // {
  646. // prop: 'expirationDate',
  647. // slot: 'expirationDate',
  648. // label: '库存保质期',
  649. // width: 100
  650. // },
  651. // {
  652. // prop: 'expirationTime',
  653. // label: '周期倒计时',
  654. // showOverflowTooltip: true,
  655. // width: 100
  656. // },
  657. // {
  658. // prop: 'qualityResult',
  659. // slot: 'qualityResult',
  660. // label: '质检结果',
  661. // showOverflowTooltip: true,
  662. // width: 100
  663. // },
  664. // {
  665. // prop: 'qualityStatus',
  666. // slot: 'qualityStatus',
  667. // label: '质检状态',
  668. // showOverflowTooltip: true,
  669. // width: 100
  670. // },
  671. // {
  672. // prop: 'pathName',
  673. // width: 230,
  674. // label: '仓库',
  675. // showOverflowTooltip: true
  676. // },
  677. // ...(this.rootCategoryLevelId == '4'
  678. // ? [
  679. // {
  680. // prop: 'workstationName',
  681. // label: '工位',
  682. // showOverflowTooltip: true
  683. // },
  684. // {
  685. // prop: 'runStatus',
  686. // label: '状态',
  687. // slot: 'runStatus',
  688. // showOverflowTooltip: true
  689. // }
  690. // ]
  691. // : []),
  692. // // ...(this.rootCategoryLevelId == '5'
  693. // // ? [
  694. // // {
  695. // // prop: 'dieHoleNum',
  696. // // label: '模孔数量',
  697. // // showOverflowTooltip: true
  698. // // },
  699. // // {
  700. // // prop: 'mandrelDiameter',
  701. // // label: '芯棒直径',
  702. // // showOverflowTooltip: true
  703. // // },
  704. // // {
  705. // // prop: 'shrinkEffictive',
  706. // // label: '收缩系数',
  707. // // showOverflowTooltip: true
  708. // // }
  709. // // ]
  710. // // : []),
  711. // // ...(this.rootCategoryLevelId == '7'
  712. // // ? [
  713. // // {
  714. // // prop: 'materialQuality',
  715. // // label: '材质',
  716. // // showOverflowTooltip: true
  717. // // },
  718. // // {
  719. // // prop: 'vehicleLen',
  720. // // label: '长宽高',
  721. // // slot: 'vehicleLen',
  722. // // showOverflowTooltip: true
  723. // // }
  724. // // ]
  725. // // : []),
  726. // ...(this.rootCategoryLevelId == '8'
  727. // ? [
  728. // {
  729. // prop: 'extInfo.slotNum',
  730. // label: '槽数',
  731. // showOverflowTooltip: true
  732. // }
  733. // ]
  734. // : []),
  735. // ...(this.rootCategoryLevelId == '11'
  736. // ? [
  737. // {
  738. // prop: 'status',
  739. // label: '状态',
  740. // slot: 'status',
  741. // showOverflowTooltip: true
  742. // },
  743. // {
  744. // prop: 'region',
  745. // label: '位置',
  746. // showOverflowTooltip: true
  747. // }
  748. // ]
  749. // : [])
  750. // ];
  751. }
  752. },
  753. watch: {},
  754. methods: {
  755. /* 表格数据源 */
  756. async datasource({ page, where, limit }) {
  757. const dimension = this.$refs.searchRef.dimension;
  758. let URL;
  759. let param = {
  760. ...where,
  761. pageNum: page,
  762. size: limit,
  763. categoryLevelId: this.categoryLevelId
  764. };
  765. if (this.isType == 'pick') {
  766. if (dimension == 1) {
  767. URL = storageApi.getProductList;
  768. } else if (dimension == 2) {
  769. URL = storageApi.getBatchList;
  770. }
  771. // else if (dimension == 3) {
  772. // URL = storageApi.getPackingList;
  773. // }
  774. param.dimension = dimension;
  775. // param.dimension = 1;
  776. // param.dimension = dimension;
  777. // URL = pageeLedgerMain;
  778. // URL = getOutindetailtwo;
  779. } else if (this.isType == 'feed') {
  780. if ([4, 7, 14].includes(Number(this.rootCategoryLevelId))) {
  781. URL = assetPage;
  782. } else if (this.rootCategoryLevelId == 2) {
  783. param.workOrderId = this.id;
  784. delete param.taskId;
  785. delete param.categoryLevelId;
  786. URL = listInProduct;
  787. } else if (
  788. ![2, 4, 7, 14].includes(Number(this.rootCategoryLevelId))
  789. ) {
  790. URL = assetPage;
  791. }
  792. } else if (this.isType == 'job') {
  793. URL = assetPage;
  794. }
  795. const res = await URL(param);
  796. if (this.rootCategoryLevelId == '11') {
  797. let _res = res;
  798. console.log(res, 'res');
  799. let _list = [];
  800. _res.list.forEach((e) => {
  801. if (e.aridRegionList && e.aridRegionList.length != 0) {
  802. e.aridRegionList.map((i) => {
  803. let obj = {
  804. name: e.name,
  805. region: e.extInfo.region,
  806. rootCategoryLevelId: e.rootCategoryLevelId,
  807. ...i,
  808. instanceId: i.id
  809. };
  810. _list.push(obj);
  811. });
  812. }
  813. });
  814. res.list = _list;
  815. return res;
  816. } else {
  817. let _res = res;
  818. let _list = [];
  819. _list.push(
  820. ..._res.list.map((i) => {
  821. const warehouseId = i.pathIds && i.pathIds.split(',')[0];
  822. return {
  823. warehouseId,
  824. ...i,
  825. instanceId: i.id
  826. };
  827. })
  828. );
  829. res.list = _list;
  830. // if (this.isType == 'pick') {
  831. // this.columns = this.cloumsPick;
  832. // } else {
  833. // this.columns = this.cloumsAll
  834. // }
  835. return res;
  836. }
  837. },
  838. handleSelectionChange(data) {
  839. const selectionList = [];
  840. this.allSelection.forEach((item) => {
  841. if (item.warehouseIdList && item.warehouseIdList.length != 0) {
  842. selectionList.push({
  843. id: item.id,
  844. ids: item.warehouseIdList
  845. });
  846. }
  847. });
  848. this.allSelection = data;
  849. if (selectionList.length != 0) {
  850. selectionList.forEach((item) => {
  851. this.allSelection.forEach((it) => {
  852. if (item.id == it.id) {
  853. it.warehouseIdList = item.ids;
  854. }
  855. });
  856. });
  857. }
  858. this.allSelection.forEach((it) => {
  859. if (!it.warehouseIdList || it.warehouseIdList.length == 0) {
  860. if (it.warehouseId) {
  861. it.warehouseIdList = [];
  862. it.warehouseIdList.push(it.warehouseId);
  863. }
  864. }
  865. });
  866. // this.allSelection.forEach((item) => {
  867. // })
  868. console.log(this.allSelection, 'this.allSelection22');
  869. },
  870. /* 清空选择 */
  871. clearChoose() {
  872. this.allSelection = [];
  873. this.$refs.table.clearSelection();
  874. },
  875. rowStyle({ row }) {
  876. return this.selection.includes(row) ? { background: '#e6f7ff' } : null;
  877. },
  878. handleNodeClick(data) {
  879. console.log(data, 'handleNodeClick');
  880. this.isCategory = true;
  881. this.categoryLevelId = data.id;
  882. this.rootCategoryLevelId = data.rootCategoryLevelId;
  883. this.reload();
  884. },
  885. setRootId(data) {
  886. this.categoryLevelId = data.id;
  887. this.rootCategoryLevelId = data.rootCategoryLevelId;
  888. this.reload();
  889. },
  890. handledime() {
  891. this.reload(this.$refs.searchRef.where);
  892. },
  893. /* 刷新表格 */
  894. reload(where) {
  895. this.$nextTick(() => {
  896. this.isCategory = false;
  897. this.$refs.table.reload({ pageNum: 1, where: where });
  898. });
  899. },
  900. onDone() {
  901. this.$nextTick(() => {
  902. this.allSelection.forEach((item) => {
  903. this.$refs.table.toggleRowSelection(item, true);
  904. });
  905. });
  906. },
  907. open(id, item, t) {
  908. this.id = id;
  909. if (t) {
  910. this.title = t;
  911. } else {
  912. this.title = '领料列表';
  913. }
  914. if (this.isType == 'pick') {
  915. this.temporaryList = item.pickList || [];
  916. this.allSelection = item.pickList || [];
  917. this.visible = true;
  918. this.$nextTick(() => {
  919. this.allSelection.forEach((item) => {
  920. this.$refs.table.toggleRowSelection(item, true);
  921. });
  922. console.log(this.allSelection, 'this.allSelection');
  923. });
  924. } else if (this.isType == 'feed') {
  925. let feedList = [];
  926. feedList = [
  927. ...item.modelList,
  928. ...item.equipmentList,
  929. ...item.instanceList,
  930. ...item.aridRegionList,
  931. ...item.turnover,
  932. ...item.palletList,
  933. ...item.revolvingDiskList,
  934. ...item.semiProductList
  935. ];
  936. this.temporaryList = feedList || [];
  937. this.allSelection = feedList || [];
  938. this.visible = true;
  939. this.$nextTick(() => {
  940. feedList.forEach((item) => {
  941. this.$refs.table.toggleRowSelection(item, true);
  942. });
  943. });
  944. } else if (this.isType == 'job') {
  945. let feedList = [];
  946. feedList = [...item.turnover, ...item.equipmentList];
  947. this.temporaryList = feedList || [];
  948. this.allSelection = feedList || [];
  949. this.visible = true;
  950. this.$nextTick(() => {
  951. feedList.forEach((item) => {
  952. this.$refs.table.toggleRowSelection(item, true);
  953. });
  954. });
  955. }
  956. },
  957. handleClose() {
  958. this.clearChoose();
  959. this.temporaryList = [];
  960. this.allSelection = [];
  961. this.visible = false;
  962. },
  963. selected() {
  964. if (this.allSelection.length == 0) {
  965. this.$message.warning('请选择物料');
  966. return false;
  967. }
  968. if (this.temporaryList.length > 0) {
  969. // 使用Promise来“模拟”异步操作
  970. new Promise((resolve) => {
  971. if (this.temporaryList.length > 0) {
  972. this.temporaryList.forEach((item) => {
  973. this.allSelection.forEach((item2) => {
  974. if (item.id == item2.id && this.isType == 'pick') {
  975. this.$set(
  976. item2,
  977. 'demandQuantity',
  978. item.demandQuantity || null
  979. );
  980. } else if (item.id == item2.id && this.isType == 'feed') {
  981. this.$set(item2, 'feedQuantity', item.feedQuantity || null);
  982. }
  983. });
  984. });
  985. }
  986. this.allSelection.sort(
  987. (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId
  988. );
  989. resolve();
  990. }).then(() => {
  991. this.$emit('allSelection', this.id, this.allSelection);
  992. this.handleClose();
  993. });
  994. } else {
  995. console.log('456');
  996. this.allSelection.sort(
  997. (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId
  998. );
  999. this.$emit('allSelection', this.id, this.allSelection);
  1000. this.handleClose();
  1001. }
  1002. }
  1003. },
  1004. created() {
  1005. if (this.isType == 'pick') {
  1006. // this.treeIds = '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28';
  1007. this.treeIds =
  1008. '9, 23, 2, 1, 4, 14, 5, 8, 16, 13, 15, 6, 10, 22, 1777158952502956034';
  1009. // this.treeIds = '9, 1, 14, 5, 8, 13, 15, 6, 10, 22';
  1010. } else if (this.isType == 'feed') {
  1011. this.treeIds = '1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 26, 9, 23,28';
  1012. } else if (this.isType == 'job') {
  1013. this.treeIds = '4, 7';
  1014. }
  1015. }
  1016. };
  1017. </script>
  1018. <style lang="scss" scoped>
  1019. .tree_col {
  1020. border: 1px solid #eee;
  1021. padding: 10px 0;
  1022. box-sizing: border-box;
  1023. height: 500px;
  1024. overflow: auto;
  1025. }
  1026. .table_col {
  1027. padding-left: 10px;
  1028. ::v-deep .el-table th.el-table__cell {
  1029. background: #f2f2f2;
  1030. }
  1031. }
  1032. .pagination {
  1033. text-align: right;
  1034. padding: 10px 0;
  1035. }
  1036. .btns {
  1037. text-align: center;
  1038. padding: 10px 0;
  1039. }
  1040. .topsearch {
  1041. margin-bottom: 15px;
  1042. }
  1043. ::v-deep .is-checked {
  1044. background: #e6f7ff;
  1045. }
  1046. </style>