outbound3.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <header-title title="基本信息"></header-title>
  5. <el-form
  6. :model="formData"
  7. ref="formName"
  8. label-width="110px"
  9. :rules="rules"
  10. >
  11. <el-row :gutter="20">
  12. <el-col :span="6">
  13. <el-form-item label="出库场景" prop="bizType">
  14. <!-- <el-select
  15. filterable
  16. placeholder="请选择"
  17. v-model="formData.bizType"
  18. clearable
  19. @change="handleBizSceneChange"
  20. :disabled="!!(productList && productList.length)"
  21. >
  22. <el-option
  23. v-for="item in outputSceneState"
  24. :key="item.code"
  25. :value="item.code"
  26. :label="item.label"
  27. ></el-option>
  28. </el-select> -->
  29. <el-select
  30. filterable
  31. disabled
  32. placeholder="请选择"
  33. v-model="formData.bizType"
  34. clearable
  35. @change="handleBizSceneChange"
  36. >
  37. <el-option
  38. v-for="item in outputSceneState"
  39. :key="item.code"
  40. :value="item.code"
  41. :label="item.label"
  42. ></el-option>
  43. </el-select> </el-form-item
  44. ></el-col>
  45. <el-col :span="6">
  46. <el-form-item label="单据来源" prop="documentSource">
  47. <el-input
  48. placeholder="请选择"
  49. disabled
  50. v-model="formData.sourceBizNo"
  51. @click.native="openDocumentSourceDialog"
  52. >
  53. </el-input>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="6">
  57. <el-form-item label="出库物品类型" prop="extInfo.assetType">
  58. <el-select
  59. style="width: 100%"
  60. multiple
  61. disabled
  62. v-model="formData.extInfo.assetType"
  63. placeholder="请选择"
  64. >
  65. <el-option
  66. v-for="item in goodsLists"
  67. :key="item.id"
  68. :label="item.name"
  69. :value="item.id"
  70. >
  71. </el-option>
  72. </el-select>
  73. <!-- <el-select
  74. style="width: 100%"
  75. multiple
  76. :disabled="!!(productList && productList.length)"
  77. v-model="formData.extInfo.assetType"
  78. placeholder="请选择"
  79. >
  80. <el-option
  81. v-for="item in goodsLists"
  82. :key="item.id"
  83. :label="item.name"
  84. :value="item.id"
  85. >
  86. </el-option>
  87. </el-select> -->
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="6">
  91. <el-form-item label="出库登记人">
  92. <el-input
  93. placeholder="登记人"
  94. disabled
  95. v-model="formData.extInfo.createUserName"
  96. clearable /></el-form-item
  97. ></el-col>
  98. <el-col :span="6">
  99. <el-form-item label="领料人部门" prop="verifyDeptName">
  100. <selectTree
  101. ref="tree"
  102. class="form-ipt"
  103. size="medium"
  104. style="width: 100%"
  105. clearable
  106. :value="formData.extInfo.verifyDeptCode"
  107. :options="treeList"
  108. :props="{
  109. value: 'id',
  110. label: 'name',
  111. children: 'children'
  112. }"
  113. @getValue="auditorDeptClick"
  114. />
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="6">
  118. <el-form-item label="领料人" prop="fromId">
  119. <el-select
  120. v-model="formData.fromId"
  121. filterable
  122. placeholder="请选择领料人"
  123. >
  124. <el-option
  125. v-for="item in llrLsit"
  126. :key="item.id"
  127. :label="item.name"
  128. :value="item.id"
  129. @click.native="userSlected(item)"
  130. >
  131. </el-option>
  132. </el-select> </el-form-item
  133. ></el-col>
  134. <!-- <el-col :span="6">
  135. <el-form-item label="领料人联系方式" prop="fromUserPhone">
  136. <el-input
  137. placeholder="请输入"
  138. disabled
  139. v-model="formData.extInfo.fromUserPhone"
  140. clearable /></el-form-item
  141. ></el-col> -->
  142. <el-col :span="12">
  143. <el-form-item label="备注" prop="remark">
  144. <el-input
  145. v-model="formData.remark"
  146. placeholder="请详细说明"
  147. ></el-input>
  148. </el-form-item>
  149. </el-col>
  150. </el-row>
  151. </el-form>
  152. <div>
  153. <el-button
  154. style="margin-bottom: 20px; float: right; margin-right: 20px"
  155. type="primary"
  156. @click="addStock"
  157. >添加</el-button
  158. >
  159. </div>
  160. <div class="material">
  161. <div>
  162. <header-title title="物品清单"></header-title>
  163. <div class="mt10 form-table">
  164. <el-table
  165. ref="productListTable"
  166. :data="productList"
  167. tooltip-effect="dark"
  168. :max-height="300"
  169. :header-cell-style="rowClass"
  170. border
  171. >
  172. <el-table-column label="序号" type="index" width="50">
  173. </el-table-column>
  174. <el-table-column
  175. label="编码"
  176. prop="categoryCode"
  177. align="center"
  178. :show-overflow-tooltip="true"
  179. ></el-table-column>
  180. <el-table-column
  181. label="名称"
  182. align="center"
  183. prop="categoryName"
  184. :show-overflow-tooltip="true"
  185. ></el-table-column>
  186. <el-table-column
  187. v-if="clientEnvironmentId == 4"
  188. label="级别"
  189. prop="level"
  190. align="center"
  191. >
  192. </el-table-column>
  193. <el-table-column
  194. label="型号"
  195. align="center"
  196. prop="categoryModel"
  197. :show-overflow-tooltip="true"
  198. ></el-table-column>
  199. <el-table-column
  200. label="规格"
  201. align="center"
  202. prop="specification"
  203. :show-overflow-tooltip="true"
  204. ></el-table-column>
  205. <el-table-column
  206. label="牌号"
  207. align="center"
  208. prop="brandNum"
  209. :show-overflow-tooltip="true"
  210. ></el-table-column>
  211. <el-table-column
  212. v-for="(item, index) in newColumns"
  213. :label="item.label"
  214. :align="item.align"
  215. :prop="item.prop"
  216. :show-overflow-tooltip="item.showOverflowTooltip"
  217. ></el-table-column>
  218. <el-table-column
  219. label="批次号"
  220. prop="batchNo"
  221. align="center"
  222. :show-overflow-tooltip="true"
  223. >
  224. </el-table-column>
  225. <!-- <el-table-column
  226. label="最小包装单元"
  227. align="center"
  228. width="120"
  229. prop="minPackingQuantity"
  230. >
  231. <template slot-scope="{ row, $index }">
  232. {{ row.minPackingQuantity }} {{ row.measureUnit }} /{{
  233. row.packingUnit
  234. }}
  235. </template>
  236. </el-table-column>
  237. <el-table-column
  238. label="包装数量"
  239. prop="packingQuantity"
  240. align="center"
  241. >
  242. <template slot-scope="{ row, $index }">
  243. {{ row.packingQuantity }} {{ row.packingUnit }}
  244. </template>
  245. </el-table-column>
  246. <el-table-column
  247. label="计量数量"
  248. prop="measureQuantity"
  249. width="100"
  250. align="center"
  251. >
  252. </el-table-column>
  253. <el-table-column
  254. label="计量单位"
  255. prop="measureUnit"
  256. align="center"
  257. >
  258. <template slot-scope="{ row, $index }">
  259. <template>
  260. {{ row.measureUnit }}
  261. </template>
  262. </template>
  263. </el-table-column> -->
  264. <el-table-column
  265. label="包装数量"
  266. prop="packingQuantity"
  267. width="80"
  268. ></el-table-column>
  269. <el-table-column
  270. label="包装单位"
  271. prop="packingUnit"
  272. ></el-table-column>
  273. <el-table-column
  274. label="计量数量"
  275. prop="measureQuantity"
  276. :show-overflow-tooltip="true"
  277. ></el-table-column>
  278. <el-table-column
  279. label="计量单位"
  280. prop="measureUnit"
  281. ></el-table-column>
  282. <el-table-column
  283. label="重量"
  284. prop="weight"
  285. align="center"
  286. :show-overflow-tooltip="true"
  287. >
  288. </el-table-column>
  289. <el-table-column
  290. label="重量单位"
  291. prop="weightUnit"
  292. align="center"
  293. :show-overflow-tooltip="true"
  294. >
  295. </el-table-column>
  296. <el-table-column label="单价" prop="price" align="center">
  297. <template slot-scope="{ row }">
  298. <template>
  299. {{ row.price ? row.price : '-' + '元' }}/{{
  300. row.measureUnit
  301. }}
  302. </template>
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. label="金额"
  307. align="center"
  308. prop="contentImage"
  309. :show-overflow-tooltip="true"
  310. >
  311. <template slot-scope="{ row, $index }">
  312. {{ row.totalMoney ? row.totalMoney : 0 }}
  313. </template>
  314. </el-table-column>
  315. <el-table-column
  316. v-if="clientEnvironmentId == 4"
  317. label="采购原因"
  318. align="center"
  319. prop="purpose"
  320. :show-overflow-tooltip="true"
  321. ></el-table-column>
  322. <el-table-column
  323. label="仓库"
  324. prop="warehouseName"
  325. :show-overflow-tooltip="true"
  326. >
  327. </el-table-column>
  328. </el-table>
  329. </div>
  330. <header-title class="mt20" title="包装清单"></header-title>
  331. <div class="mt10 form-table">
  332. <el-table
  333. ref="showPackingListTable"
  334. :data="showPackingList"
  335. tooltip-effect="dark"
  336. :max-height="300"
  337. :row-class-name="tableRowClassName"
  338. :header-cell-style="rowClass"
  339. border
  340. v-el-table-infinite-scroll="pickingHandleScroll"
  341. >
  342. <el-table-column label="序号" type="index" width="50">
  343. </el-table-column>
  344. <el-table-column
  345. label="编码"
  346. prop="categoryCode"
  347. :show-overflow-tooltip="true"
  348. ></el-table-column>
  349. <el-table-column
  350. label="名称"
  351. prop="categoryName"
  352. :show-overflow-tooltip="true"
  353. ></el-table-column>
  354. <el-table-column
  355. label="批次号"
  356. prop="batchNo"
  357. :show-overflow-tooltip="true"
  358. ></el-table-column>
  359. <el-table-column
  360. label="发货条码"
  361. prop="barcodes"
  362. :show-overflow-tooltip="true"
  363. ></el-table-column>
  364. <el-table-column
  365. label="包装编码"
  366. prop="packageNo"
  367. :show-overflow-tooltip="true"
  368. ></el-table-column>
  369. <el-table-column
  370. label="包装数量"
  371. prop="packingQuantity"
  372. :show-overflow-tooltip="true"
  373. ></el-table-column>
  374. <el-table-column
  375. label="包装单位"
  376. prop="packingUnit"
  377. :show-overflow-tooltip="true"
  378. ></el-table-column>
  379. <el-table-column
  380. label="计量数量"
  381. prop="measureQuantity"
  382. :show-overflow-tooltip="true"
  383. ></el-table-column>
  384. <el-table-column
  385. label="计量单位"
  386. prop="measureUnit"
  387. :show-overflow-tooltip="true"
  388. ></el-table-column>
  389. <el-table-column
  390. label="物料代号"
  391. prop="materielDesignation"
  392. :show-overflow-tooltip="true"
  393. >
  394. </el-table-column>
  395. <el-table-column
  396. label="客户代号"
  397. prop="clientCode"
  398. :show-overflow-tooltip="true"
  399. >
  400. </el-table-column>
  401. <el-table-column
  402. label="刻码"
  403. prop="engrave"
  404. :show-overflow-tooltip="true"
  405. >
  406. </el-table-column>
  407. <el-table-column
  408. label="重量"
  409. prop="weight"
  410. :show-overflow-tooltip="true"
  411. >
  412. </el-table-column>
  413. <el-table-column
  414. label="重量单位"
  415. prop="weightUnit"
  416. :show-overflow-tooltip="true"
  417. >
  418. </el-table-column>
  419. <el-table-column
  420. label="质检结果"
  421. prop="result"
  422. :show-overflow-tooltip="true"
  423. >
  424. <template slot-scope="{ row }">
  425. <span>{{ qualityResults[row.result] }}</span>
  426. </template>
  427. </el-table-column>
  428. <el-table-column
  429. label="质检状态"
  430. prop="status"
  431. :show-overflow-tooltip="true"
  432. >
  433. <template slot-scope="{ row }">
  434. <span>{{ qualityStatus[row.status] }}</span>
  435. </template>
  436. </el-table-column>
  437. <el-table-column
  438. label="生产日期"
  439. prop="productionDate"
  440. :show-overflow-tooltip="true"
  441. >
  442. </el-table-column>
  443. <el-table-column
  444. label="采购日期"
  445. prop="purchaseDate"
  446. :show-overflow-tooltip="true"
  447. >
  448. </el-table-column>
  449. </el-table>
  450. </div>
  451. </div>
  452. <div class="mt20">
  453. <header-title class="mt20" title="物料明细"></header-title>
  454. <el-table
  455. ref="multipleTable"
  456. :data="showMaterialList"
  457. tooltip-effect="dark"
  458. :max-height="300"
  459. :row-class-name="tableRowClassName"
  460. :header-cell-style="rowClass"
  461. border
  462. style="width: 100%"
  463. stripe
  464. height="300px"
  465. v-el-table-infinite-scroll="materielHandleScroll"
  466. >
  467. <el-table-column label="序号" type="index" width="50">
  468. </el-table-column>
  469. <el-table-column
  470. label="编码"
  471. prop="categoryCode"
  472. :show-overflow-tooltip="true"
  473. ></el-table-column>
  474. <el-table-column
  475. label="名称"
  476. prop="categoryName"
  477. :show-overflow-tooltip="true"
  478. ></el-table-column>
  479. <el-table-column label="批次号" prop="batchNo"></el-table-column>
  480. <el-table-column
  481. label="物料编码"
  482. prop="materialCode"
  483. :show-overflow-tooltip="true"
  484. ></el-table-column>
  485. <el-table-column
  486. label="发货条码"
  487. prop="barcodes"
  488. :show-overflow-tooltip="true"
  489. ></el-table-column>
  490. <el-table-column
  491. label="计量数量"
  492. prop="minPackingQuantity"
  493. ></el-table-column>
  494. <el-table-column
  495. label="计量单位"
  496. prop="measureUnit"
  497. ></el-table-column>
  498. <el-table-column label="物料代号" prop="materielDesignation">
  499. </el-table-column>
  500. <el-table-column label="客户代号" prop="clientCode">
  501. </el-table-column>
  502. <el-table-column label="刻码" prop="engrave"> </el-table-column>
  503. <el-table-column width="100" label="重量" prop="weight">
  504. </el-table-column>
  505. <el-table-column label="重量单位" prop="weightUnit">
  506. </el-table-column>
  507. <el-table-column label="质检结果" prop="result" width="120">
  508. <template slot-scope="{ row }">
  509. <span>{{ qualityResults[row.result] }}</span>
  510. </template>
  511. </el-table-column>
  512. <el-table-column label="质检状态" prop="status" width="120">
  513. <template slot-scope="{ row }">
  514. <span>{{ qualityStatus[row.status] }}</span>
  515. </template>
  516. </el-table-column>
  517. </el-table>
  518. </div>
  519. </div>
  520. </el-card>
  521. <AssetsDialog
  522. ref="assetsDialogRef"
  523. :treeIds="formData.extInfo.assetType"
  524. @detailData="detailData"
  525. />
  526. </div>
  527. </template>
  528. <script>
  529. import storageApi from '@/api/warehouseManagement/index.js';
  530. import elTableInfiniteScroll from 'el-table-infinite-scroll';
  531. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  532. import { getTreeByGroup } from '@/api/classifyManage';
  533. import { outputSceneState } from '@/utils/dict/index';
  534. import selectTree from '@/components/selectTree';
  535. import AssetsDialog from './components/AssetsDialog.vue';
  536. import { deepClone } from '@/components/FormGenerator/utils/index';
  537. import { mapGetters } from 'vuex';
  538. export default {
  539. components: {
  540. selectTree,
  541. AssetsDialog
  542. },
  543. props: {
  544. form: { type: Object, default: {} },
  545. bizType: { type: Number, default: 1 },
  546. sourceBizNo: { type: String, default: '' },
  547. type: { type: String, default: '正常出库' },
  548. detailList: { type: Array, default: () => [] },
  549. saleProductList: { type: Array, default: () => [] },
  550. extractedList: { type: Array, default: () => [] },
  551. wwType: { type: Number, default: null }
  552. },
  553. directives: {
  554. 'el-table-infinite-scroll': elTableInfiniteScroll
  555. },
  556. data() {
  557. return {
  558. newColumns: [], // 动态表头
  559. goodsLists: [], // 商品列表
  560. qualityStatus: {
  561. 0: '未质检',
  562. 1: '已质检'
  563. }, // 质检状态 0未检 1已检
  564. qualityResults: {
  565. 1: '合格',
  566. 2: '不合格'
  567. }, // 质检结果 1合格 2不合格
  568. productList: [], // 产品列表
  569. showPackingList: [], // 展示的包装列表
  570. packingList: [], // 包装列表
  571. showMaterialList: [], // 展示物料列表
  572. materialList: [], // 物料列表
  573. extInfo: {}, // 扩展信息
  574. pageSize: 20,
  575. pickingPageNum: 1,
  576. materielPageNum: 1,
  577. dimension: '3',
  578. outputSceneState,
  579. treeList: [],
  580. formData: {
  581. extInfo: {
  582. assetType: [], //物品类型id
  583. assetTypeName: '', //物品类型名称
  584. deptCode: '', //部门code
  585. deptName: '', //部门名称
  586. verifyDeptCode: '', //审核部门编码
  587. verifyDeptName: '', //审核部门名称
  588. deliveryName: '', //送货人名称
  589. fromUserPhone: '', //送货人电话
  590. sourceBizNo: '', //销售订单
  591. urgent: '', //紧急状态
  592. supplierId: '', //供应商ID
  593. supplierName: '', //供应商名称
  594. createUserName: '', //创建人名字
  595. contentImage: [] //图片数组
  596. },
  597. fromId: '', //领料人
  598. fromUser: '', //送货人
  599. bizType: '', //物品类型
  600. verifyId: '', //审核人Id
  601. verifyName: '', //审核人名称
  602. createUserId: '',
  603. remark: ''
  604. },
  605. rules: {
  606. bizType: {
  607. required: true,
  608. message: '请选择出库场景',
  609. trigger: 'change'
  610. },
  611. fromId: {
  612. required: true,
  613. message: '请选择领料人',
  614. trigger: 'change'
  615. }
  616. },
  617. llrLsit: []
  618. };
  619. },
  620. computed: {
  621. ...mapGetters(['user']),
  622. clientEnvironmentId() {
  623. return this.$store.state.user.info.clientEnvironmentId;
  624. }
  625. },
  626. created() {
  627. this.getFieldModel();
  628. this.getListItems();
  629. this.initDeptData().then(() => {
  630. this.initFormData();
  631. });
  632. },
  633. methods: {
  634. // 获取动态表头
  635. getFieldModel() {
  636. storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  637. let newRes = res.map((m) => {
  638. return {
  639. prop: 'extField.' + m.prop,
  640. label: m.label,
  641. align: 'center',
  642. showOverflowTooltip: true
  643. };
  644. });
  645. this.newColumns = [...newRes];
  646. });
  647. },
  648. userSlected(data) {
  649. this.formData.fromId = data.id;
  650. this.formData.fromUser = data.name;
  651. this.formData.fromUserPhone = data.phone;
  652. },
  653. openDocumentSourceDialog() {
  654. console.log('打开单据来源弹窗');
  655. },
  656. clearDocumentSource() {
  657. console.log('清空');
  658. },
  659. pickingHandleScroll() {
  660. console.log('---------pickingHandleScroll------------');
  661. if (this.showPackingList.length < this.packingList.length) {
  662. if (this.packingList.length > this.pageSize) {
  663. this.pickingPageNum += 1;
  664. }
  665. this.pickingFetchData();
  666. }
  667. },
  668. pickingFetchData() {
  669. const start = (this.pickingPageNum - 1) * this.pageSize;
  670. const end = start + this.pageSize;
  671. this.showPackingList = this.showPackingList.concat(
  672. this.packingList.slice(start, end)
  673. );
  674. },
  675. materielHandleScroll() {
  676. console.log('---------materielHandleScroll------------');
  677. if (this.showMaterialList.length < this.materialList.length) {
  678. if (this.materialList.length > this.pageSize) {
  679. this.materielPageNum += 1;
  680. }
  681. this.materielFetchData();
  682. }
  683. },
  684. materielFetchData() {
  685. const start = (this.materielPageNum - 1) * this.pageSize;
  686. const end = start + this.pageSize;
  687. this.showMaterialList = this.showMaterialList.concat(
  688. this.materialList.slice(start, end)
  689. );
  690. console.log(this.showMaterialList);
  691. },
  692. // 获取物品列表
  693. async getListItems() {
  694. const { data } = await getTreeByGroup({ type: 2 });
  695. this.goodsLists = data;
  696. },
  697. // 打开单据来源弹窗
  698. openDocumentSourceDialog() {
  699. console.log('打开单据来源弹窗');
  700. },
  701. tableRowClassName({ row, rowIndex }) {
  702. console.log(row);
  703. if (row.result == 1) {
  704. return 'warning-row';
  705. } else {
  706. return '';
  707. }
  708. },
  709. detailData(data, dimension) {
  710. this.dimension = dimension;
  711. this.productList = data.map((productItem) => {
  712. return {
  713. ...productItem,
  714. outInDetailRecordRequestList:
  715. productItem.outInDetailRecordRequestList.map((packingItem) => {
  716. return {
  717. ...packingItem,
  718. workOrderId:
  719. this.type === '自选领用出库'
  720. ? this.form.detailList[0].workOrderId
  721. : '',
  722. pickOrderId:
  723. this.type === '自选领用出库'
  724. ? this.form.detailList[0].pickOrderId
  725. : '',
  726. taskId:
  727. this.type === '自选领用出库'
  728. ? this.form.detailList[0].taskId
  729. : '',
  730. categoryName: productItem.categoryName,
  731. categoryCode: productItem.categoryCode,
  732. materialDetailList: packingItem.materialDetailList.map(
  733. (materialItem) => {
  734. return {
  735. ...materialItem,
  736. categoryName: productItem.categoryName,
  737. categoryCode: productItem.categoryCode
  738. };
  739. }
  740. )
  741. };
  742. })
  743. };
  744. });
  745. // 获取包装维度数据
  746. const arr = [];
  747. for (const key in this.productList) {
  748. for (const k in this.productList[key].outInDetailRecordRequestList) {
  749. arr.push({
  750. ...this.productList[key].outInDetailRecordRequestList[k]
  751. });
  752. }
  753. }
  754. this.packingList = arr;
  755. // 获取物料维度数据
  756. let iArr = [];
  757. arr.forEach((item) => {
  758. item.materialDetailList.forEach((ele) => {
  759. iArr.push({ ...ele });
  760. });
  761. });
  762. this.materialList = iArr;
  763. this.formData.outInDetailList = this.productList;
  764. },
  765. async getReturnStorage() {
  766. return new Promise((resolve) => {
  767. console.log(this.formData);
  768. this.$refs.formName.validate(async (valid) => {
  769. console.log('valid', valid);
  770. if (valid) {
  771. if (!this.productList?.length) {
  772. return this.$message.error('请添加出库明细!');
  773. }
  774. let obj = deepClone({ ...this.formData, type: 2 });
  775. obj.extInfo.sourceBizNo = obj.sourceBizNo;
  776. obj.fromType = obj.type;
  777. // 处理物品类型assetType
  778. obj.extInfo.assetType = obj.extInfo.assetType.join(',');
  779. // 处理仓库id
  780. let warehouseId = [];
  781. let warehouseName = [];
  782. let warehouseIds = this.productList
  783. .map((item) => item.warehouseId)
  784. .flat();
  785. let warehouseNames = this.productList
  786. .map((item) => item.warehouseName)
  787. .flat();
  788. warehouseIds.forEach((item, index) => {
  789. if (!warehouseId.includes(item)) {
  790. warehouseId.push(item);
  791. warehouseName.push(warehouseNames[index]);
  792. }
  793. });
  794. obj.warehouseIds = warehouseId;
  795. obj.warehouseNames = warehouseName;
  796. console.log('2222', obj);
  797. let isPass = false;
  798. // 1按数量计费 2按重量计费
  799. if (this.form.pricingWay == 2) {
  800. if (this.materialList.length > 0) {
  801. // 判断物料
  802. isPass = this.materialCodeReqList.every(
  803. (item) => item.weight > 0
  804. );
  805. } else {
  806. // 判断包装重量是否全部大于0
  807. isPass = this.packingList.every((item) => item.weight > 0);
  808. }
  809. } else {
  810. isPass = true;
  811. }
  812. if (isPass) {
  813. resolve(obj);
  814. } else {
  815. this.$message.error('委外发货重量不能为空');
  816. }
  817. } else {
  818. this.$message.error('请选择领料人!');
  819. }
  820. });
  821. });
  822. },
  823. onClear() {
  824. this.formData.sourceBizNo = '';
  825. this.warehousingMaterialList = [];
  826. this.$refs.trees.valueTitle = '';
  827. this.formData.clientName = '';
  828. this.formData.clientUser = '';
  829. this.formData.clientPhone = '';
  830. this.$forceUpdate();
  831. },
  832. rowClass({ row, column, rowIndex, columnIndex }) {
  833. if (rowIndex === 1) {
  834. return {
  835. display: 'none',
  836. background: '#EEEEEE'
  837. };
  838. }
  839. return { background: '#0000' };
  840. },
  841. // 部门点击事件
  842. async auditorDeptClick(data) {
  843. console.log(data);
  844. this.formData.extInfo.verifyDeptCode = data?.id;
  845. this.formData.extInfo.verifyDeptName = data?.name;
  846. this.formData.verifyId = '';
  847. this.formData.verifyName = '';
  848. this.$refs.formName.validateField('verifyDeptName');
  849. if (data) {
  850. this.getStaffList(data);
  851. }
  852. },
  853. getStaffList(data) {
  854. return new Promise(async (resolve) => {
  855. let res = await warehouseDefinition.getUserPage({
  856. groupId: data.id,
  857. size: 9999,
  858. page: 1
  859. });
  860. this.llrLsit = res.list;
  861. resolve();
  862. });
  863. },
  864. // 初始化用户信息
  865. async initFormData() {
  866. // const res = await warehouseDefinition.tree();
  867. // let obj = res.find(
  868. // (item) =>
  869. // item.id ===
  870. // this.user.info.deptIds[this.user.info.deptIds.length - 1]
  871. // );
  872. // if (!obj) return;
  873. // this.formData.extInfo.deptCode = obj.id;
  874. // this.formData.extInfo.deptName = obj.name;
  875. // this.formData.extInfo.createUserName = this.user.info.name;
  876. // this.formData.createUserId = this.user.info.userId;
  877. // 物品类型
  878. this.formData.extInfo.assetType = Array.from(
  879. new Set(this.form.categoryLevelTopId.split(','))
  880. );
  881. // 出库类型
  882. this.formData.bizType = this.bizType;
  883. // 添加单据来源
  884. this.formData.sourceBizNo = this.sourceBizNo;
  885. // 将出库状态改成出库状态 2出库 1入库
  886. this.formData.type = 2;
  887. // 入库登记人
  888. this.formData.extInfo.createUserName = this.$store.state.user.info.name;
  889. this.formData.createUserId = this.$store.state.user.info.userId;
  890. // 生产相关逻辑
  891. if (this.detailList?.length > 0) {
  892. // 获取领料人列表
  893. this.getStaffList({ id: this.form.executorDeptId }).then(() => {
  894. // 获取领料人和领料部门
  895. this.formData.fromId = this.form.executorId;
  896. this.formData.fromUser = this.form.executorName;
  897. this.formData.extInfo.verifyDeptCode = this.form.executorDeptId;
  898. this.formData.extInfo.verifyDeptName = this.form.executorDeptName;
  899. });
  900. let pData = {
  901. type: '1',
  902. builders: this.detailList.map((item) => {
  903. return {
  904. categoryId: item.instanceId || item.categoryId,
  905. num: item.demandQuantity
  906. };
  907. })
  908. };
  909. let pData2 = {
  910. type: this.wwType,
  911. taskIds: this.extractedList.map((item) => item.taskId),
  912. workOrderIds: this.extractedList.map((item) => item.workOrderId)
  913. };
  914. storageApi
  915. .getHierarchyFifo(this.wwType == 3 ? pData2 : pData)
  916. .then((data) => {
  917. this.detailData(data, this.dimension);
  918. })
  919. .catch((err) => {
  920. console.log(err);
  921. });
  922. }
  923. // 销售相关逻辑
  924. if (this.saleProductList?.length > 0) {
  925. // 获取领料人列表
  926. this.getStaffList({ id: this.form.deptId }).then(() => {
  927. // 获取领料人和领料部门
  928. this.formData.fromId = this.form.makerId;
  929. this.formData.fromUser = this.form.makerName;
  930. this.formData.extInfo.verifyDeptCode = this.form.deptId;
  931. this.formData.extInfo.verifyDeptName = this.form.deptName;
  932. });
  933. let pData = {
  934. type: '1',
  935. builders: this.saleProductList.map((item) => {
  936. return {
  937. categoryId: item.productId,
  938. num: item.totalCount
  939. };
  940. })
  941. };
  942. let pData2 = {
  943. type: this.wwType,
  944. taskIds: this.extractedList.map((item) => item.taskId),
  945. workOrderIds: this.extractedList.map((item) => item.workOrderId)
  946. };
  947. storageApi
  948. .getHierarchyFifo(this.wwType == 3 ? pData2 : pData)
  949. .then((data) => {
  950. this.detailData(data, this.dimension);
  951. })
  952. .catch((err) => {
  953. console.log(err);
  954. });
  955. }
  956. },
  957. // 初始化部门数据
  958. initDeptData() {
  959. return new Promise(async (resolve) => {
  960. const res = await warehouseDefinition.tree();
  961. this.treeList = this.$util.toTreeData({
  962. data: res,
  963. idField: 'id',
  964. parentIdField: 'parentId'
  965. });
  966. this.$nextTick(() => {
  967. resolve();
  968. });
  969. });
  970. },
  971. addStock() {
  972. console.log(this.formData.extInfo.assetType);
  973. if (
  974. !(
  975. this.formData.extInfo.assetType &&
  976. this.formData.extInfo.assetType.length > 0
  977. )
  978. )
  979. return this.$message.error('请选择出库产品类型');
  980. if (!this.formData.bizType && this.formData.bizType !== 0)
  981. return this.$message.error('请选择出库场景');
  982. this.$refs.assetsDialogRef.open();
  983. },
  984. handleBizSceneChange() {
  985. if (this.formData.extInfo.assetType == 7) {
  986. this.formData.extInfo.sourceBizNo = '';
  987. }
  988. this.formData.sourceBizNo = '';
  989. }
  990. },
  991. watch: {
  992. packingList: {
  993. handler(newVal) {
  994. console.log('包装列表', newVal);
  995. console.log('当前包装列表加载页数', this.pickingPageNum);
  996. this.showPackingList = newVal.slice(
  997. 0,
  998. this.pageSize * (this.pickingPageNum > 0 ? this.pickingPageNum : 1)
  999. );
  1000. },
  1001. deep: true
  1002. },
  1003. materialList: {
  1004. handler(newVal) {
  1005. console.log('物料列表', newVal);
  1006. console.log('当前物料列表加载页数', this.materielPageNum);
  1007. this.showMaterialList = newVal.slice(
  1008. 0,
  1009. this.pageSize *
  1010. (this.materielPageNum > 0 ? this.materielPageNum : 1)
  1011. );
  1012. },
  1013. deep: true
  1014. }
  1015. }
  1016. };
  1017. </script>
  1018. <style lang="scss" scoped>
  1019. ::v-deep .el-row {
  1020. display: flex;
  1021. flex-wrap: wrap;
  1022. }
  1023. ::v-deep.form-table {
  1024. .el-form-item {
  1025. margin-bottom: 0;
  1026. }
  1027. .el-input__inner {
  1028. padding: 0 10px;
  1029. }
  1030. }
  1031. .p20 {
  1032. padding: 20px;
  1033. }
  1034. .el-select,
  1035. .el-date-editor {
  1036. width: 100%;
  1037. }
  1038. .el-form-item {
  1039. margin-bottom: 22px;
  1040. }
  1041. .material {
  1042. margin-top: 20px;
  1043. .flex {
  1044. display: flex;
  1045. justify-content: space-between;
  1046. font-size: 14px;
  1047. align-items: center;
  1048. .red {
  1049. color: #ff4949;
  1050. }
  1051. }
  1052. }
  1053. .mt10 {
  1054. margin-top: 10px;
  1055. }
  1056. .mt20 {
  1057. margin-top: 20px;
  1058. }
  1059. .center {
  1060. text-align: center;
  1061. }
  1062. </style>