outbound2.vue 35 KB

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