outbound.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519
  1. <template>
  2. <div>
  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-date-picker
  93. v-model="formData.storageTime"
  94. type="datetime"
  95. value-format="yyyy-MM-dd HH:mm:ss"
  96. placeholder="选择日期时间"
  97. >
  98. </el-date-picker></el-form-item
  99. ></el-col>
  100. <el-col :span="6">
  101. <el-form-item label="出库登记人">
  102. <el-input
  103. placeholder="登记人"
  104. disabled
  105. v-model="formData.extInfo.createUserName"
  106. clearable /></el-form-item
  107. ></el-col>
  108. <el-col :span="6">
  109. <el-form-item
  110. :label="this.bizType == 10 ? '申请人部门' : '领料人部门'"
  111. prop="extInfo.verifyDeptCode"
  112. >
  113. <selectTree
  114. ref="tree"
  115. class="form-ipt"
  116. size="medium"
  117. style="width: 100%"
  118. clearable
  119. :value="formData.extInfo.verifyDeptCode"
  120. :options="treeList"
  121. :props="{
  122. value: 'id',
  123. label: 'name',
  124. children: 'children'
  125. }"
  126. @getValue="auditorDeptClick"
  127. />
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="6">
  131. <el-form-item
  132. :label="this.bizType == 10 ? '申请人' : '领料人'"
  133. prop="fromId"
  134. >
  135. <el-select
  136. v-model="formData.fromId"
  137. filterable
  138. placeholder="请选择"
  139. >
  140. <el-option
  141. v-for="item in llrLsit"
  142. :key="item.id"
  143. :label="item.name"
  144. :value="item.id"
  145. @click.native="userSlected(item)"
  146. >
  147. </el-option>
  148. </el-select> </el-form-item
  149. ></el-col>
  150. <el-col :span="6">
  151. <el-form-item label="客户名称">
  152. <span>{{ formData.clientName }}</span>
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="12">
  156. <el-form-item label="备注" prop="remark">
  157. <el-input
  158. v-model="formData.remark"
  159. placeholder="请详细说明"
  160. ></el-input>
  161. </el-form-item>
  162. </el-col>
  163. </el-row>
  164. </el-form>
  165. <div>
  166. <el-button
  167. style="margin-bottom: 20px; float: right; margin-right: 20px"
  168. type="primary"
  169. @click="addStock"
  170. v-if="isEdit && !stockError"
  171. >添加</el-button
  172. >
  173. <el-popconfirm
  174. v-if="showLocked"
  175. style="margin-bottom: 20px; float: right; margin-right: 20px"
  176. class="ele-action"
  177. title="该单已锁库存,释放后无法还原?"
  178. @confirm="lockRelease"
  179. >
  180. <template v-slot:reference>
  181. <el-button type="primary" plain>释放锁库</el-button>
  182. </template>
  183. </el-popconfirm>
  184. </div>
  185. <div class="material">
  186. <div>
  187. <header-title title="出库物品清单"></header-title>
  188. <div class="mt10 form-table">
  189. <ele-pro-table
  190. ref="table"
  191. :columns="columns"
  192. :datasource="productList"
  193. height="300"
  194. full-height="calc(100vh - 116px)"
  195. tool-class="ele-toolbar-form"
  196. @columns-change="handleColumnChange"
  197. :cache-key="cacheKeyUrl"
  198. :needPage="false"
  199. >
  200. <!-- 单价列 -->
  201. <template v-if="isPrice == 1" v-slot:price="{ row }">
  202. {{ row.price ? row.price : ' ' + '元' }}/{{ row.measureUnit }}
  203. </template>
  204. <!-- 金额列 -->
  205. <template v-if="isPrice == 1" v-slot:totalMoney="{ row }">
  206. {{ row.totalMoney ? row.totalMoney : 0 }}
  207. </template>
  208. <!-- 操作列 -->
  209. <template v-if="isEdit" v-slot:action="{ row, $index }">
  210. <el-link type="danger" @click="deleteProductList(row, $index)"
  211. >删除</el-link
  212. >
  213. </template>
  214. </ele-pro-table>
  215. </div>
  216. <header-title class="mt20" title="包装清单"></header-title>
  217. <div class="mt10 form-table">
  218. <el-table
  219. ref="showPackingListTable"
  220. :data="showPackingList"
  221. tooltip-effect="dark"
  222. :max-height="300"
  223. :row-class-name="tableRowClassName"
  224. :header-cell-style="rowClass"
  225. border
  226. v-el-table-infinite-scroll="pickingHandleScroll"
  227. >
  228. <el-table-column label="序号" type="index" width="50">
  229. </el-table-column>
  230. <el-table-column
  231. label="编码"
  232. prop="categoryCode"
  233. :show-overflow-tooltip="true"
  234. ></el-table-column>
  235. <el-table-column
  236. label="名称"
  237. prop="categoryName"
  238. :show-overflow-tooltip="true"
  239. ></el-table-column>
  240. <el-table-column
  241. label="批次号"
  242. prop="batchNo"
  243. :show-overflow-tooltip="true"
  244. ></el-table-column>
  245. <el-table-column
  246. label="发货条码"
  247. prop="barcodes"
  248. :show-overflow-tooltip="true"
  249. ></el-table-column>
  250. <el-table-column
  251. label="包装编码"
  252. prop="packageNo"
  253. :show-overflow-tooltip="true"
  254. ></el-table-column>
  255. <el-table-column
  256. label="包装数量"
  257. prop="packingQuantity"
  258. :show-overflow-tooltip="true"
  259. ></el-table-column>
  260. <el-table-column
  261. label="单位"
  262. prop="packingUnit"
  263. :show-overflow-tooltip="true"
  264. ></el-table-column>
  265. <el-table-column
  266. label="计量数量"
  267. prop="measureQuantity"
  268. :show-overflow-tooltip="true"
  269. ></el-table-column>
  270. <el-table-column
  271. label="计量单位"
  272. prop="measureUnit"
  273. :show-overflow-tooltip="true"
  274. ></el-table-column>
  275. <el-table-column
  276. label="物料代号"
  277. prop="materielDesignation"
  278. :show-overflow-tooltip="true"
  279. >
  280. </el-table-column>
  281. <el-table-column
  282. label="客户代号"
  283. prop="clientCode"
  284. :show-overflow-tooltip="true"
  285. >
  286. </el-table-column>
  287. <el-table-column
  288. label="刻码"
  289. prop="engrave"
  290. :show-overflow-tooltip="true"
  291. >
  292. </el-table-column>
  293. <el-table-column
  294. label="重量"
  295. prop="weight"
  296. :show-overflow-tooltip="true"
  297. >
  298. </el-table-column>
  299. <el-table-column
  300. label="重量单位"
  301. prop="weightUnit"
  302. :show-overflow-tooltip="true"
  303. >
  304. </el-table-column>
  305. <el-table-column label="机型" prop="modelKey" width="200">
  306. </el-table-column>
  307. <el-table-column label="颜色" prop="colorKey" width="200">
  308. </el-table-column>
  309. <el-table-column
  310. label="质检结果"
  311. prop="result"
  312. :show-overflow-tooltip="true"
  313. >
  314. <template slot-scope="{ row }">
  315. <span>{{ qualityResults[row.result] }}</span>
  316. </template>
  317. </el-table-column>
  318. <el-table-column
  319. label="质检状态"
  320. prop="status"
  321. :show-overflow-tooltip="true"
  322. >
  323. <template slot-scope="{ row }">
  324. <span>{{ qualityStatus[row.status] }}</span>
  325. </template>
  326. </el-table-column>
  327. <el-table-column
  328. label="生产日期"
  329. prop="productionDate"
  330. :show-overflow-tooltip="true"
  331. >
  332. </el-table-column>
  333. <el-table-column
  334. label="采购日期"
  335. prop="purchaseDate"
  336. :show-overflow-tooltip="true"
  337. >
  338. </el-table-column>
  339. <el-table-column
  340. prop="supplierName"
  341. label="供应商"
  342. min-width="200"
  343. :show-overflow-tooltip="true"
  344. ></el-table-column>
  345. <el-table-column
  346. prop="supplierCode"
  347. label="供应商代号"
  348. min-width="200"
  349. :show-overflow-tooltip="true"
  350. ></el-table-column>
  351. </el-table>
  352. </div>
  353. </div>
  354. <!-- <div class="mt20">
  355. <header-title class="mt20" title="物料明细"></header-title>
  356. <el-table ref="multipleTable" :data="showMaterialList" tooltip-effect="dark" :max-height="300"
  357. :row-class-name="tableRowClassName" :header-cell-style="rowClass" border style="width: 100%" stripe
  358. height="300px" v-el-table-infinite-scroll="materielHandleScroll">
  359. <el-table-column label="序号" type="index" width="50">
  360. </el-table-column>
  361. <el-table-column label="编码" prop="categoryCode" :show-overflow-tooltip="true"></el-table-column>
  362. <el-table-column label="名称" prop="categoryName" :show-overflow-tooltip="true"></el-table-column>
  363. <el-table-column label="批次号" prop="batchNo"></el-table-column>
  364. <el-table-column label="物料编码" prop="materialCode" :show-overflow-tooltip="true"></el-table-column>
  365. <el-table-column label="发货条码" prop="barcodes" :show-overflow-tooltip="true"></el-table-column>
  366. <el-table-column label="计量数量" prop="minPackingQuantity"></el-table-column>
  367. <el-table-column label="计量单位" prop="measureUnit"></el-table-column>
  368. <el-table-column label="物料代号" prop="materielDesignation">
  369. </el-table-column>
  370. <el-table-column label="客户代号" prop="clientCode">
  371. </el-table-column>
  372. <el-table-column label="刻码" prop="engrave"> </el-table-column>
  373. <el-table-column width="100" label="重量" prop="weight">
  374. </el-table-column>
  375. <el-table-column label="重量单位" prop="weightUnit">
  376. </el-table-column>
  377. <el-table-column label="质检结果" prop="result" width="120">
  378. <template slot-scope="{ row }">
  379. <span>{{ qualityResults[row.result] }}</span>
  380. </template>
  381. </el-table-column>
  382. <el-table-column label="质检状态" prop="status" width="120">
  383. <template slot-scope="{ row }">
  384. <span>{{ qualityStatus[row.status] }}</span>
  385. </template>
  386. </el-table-column>
  387. </el-table>
  388. </div> -->
  389. </div>
  390. </el-card>
  391. <AssetsDialog
  392. ref="assetsDialogRef"
  393. :treeIds="formData.extInfo?.assetType"
  394. @detailData="detailData"
  395. :productLists="this.productList"
  396. />
  397. </div>
  398. </template>
  399. <script>
  400. import storageApi from '@/api/warehouseManagement/index.js';
  401. import elTableInfiniteScroll from 'el-table-infinite-scroll';
  402. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  403. import { getTreeByGroup } from '@/api/classifyManage';
  404. import {
  405. outputSceneState,
  406. qualityResults,
  407. qualityStatus
  408. } from '@/utils/dict/index';
  409. import selectTree from '@/components/selectTree';
  410. import AssetsDialog from './components/AssetsDialog.vue';
  411. import { deepClone } from '@/components/FormGenerator/utils/index';
  412. import { mapGetters } from 'vuex';
  413. import { parameterGetByCode } from '@/api/main/index.js';
  414. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  415. export default {
  416. mixins: [tableColumnsMixin],
  417. components: {
  418. selectTree,
  419. AssetsDialog
  420. },
  421. props: {
  422. form: { type: Object, default: {} },
  423. bizType: { type: Number, default: 1 },
  424. sourceBizNo: { type: String, default: '' },
  425. type: { type: String, default: '正常出库' },
  426. detailList: { type: Array, default: () => [] },
  427. saleProductList: { type: Array, default: () => [] },
  428. extractedList: { type: Array, default: () => [] },
  429. wwType: { type: Number, default: null },
  430. isEdit: { type: Boolean, default: true } //是否可编辑
  431. },
  432. directives: {
  433. 'el-table-infinite-scroll': elTableInfiniteScroll
  434. },
  435. data() {
  436. return {
  437. stockError: false,
  438. stockErrorMsg: '',
  439. cacheKeyUrl: '202605181721-wt-outbound-table',
  440. dColumns: [], // 动态表头
  441. goodsLists: [], // 商品列表
  442. productList: [], // 产品列表
  443. showPackingList: [], // 展示的包装列表
  444. packingList: [], // 包装列表
  445. showMaterialList: [], // 展示物料列表
  446. materialList: [], // 物料列表
  447. extInfo: {}, // 扩展信息
  448. pageSize: 20,
  449. pickingPageNum: 1,
  450. materielPageNum: 1,
  451. dimension: '3',
  452. outputSceneState,
  453. qualityStatus, // 质检状态
  454. qualityResults, // 质检结果
  455. treeList: [],
  456. formData: {
  457. storageTime: '',
  458. extInfo: {
  459. assetType: [], //物品类型id
  460. assetTypeName: '', //物品类型名称
  461. deptCode: '', //部门code
  462. deptName: '', //部门名称
  463. verifyDeptCode: '', //审核部门编码
  464. verifyDeptName: '', //审核部门名称
  465. deliveryName: '', //送货人名称
  466. fromUserPhone: '', //送货人电话
  467. sourceBizNo: '', //销售订单
  468. urgent: '', //紧急状态
  469. supplierId: '', //供应商ID
  470. supplierName: '', //供应商名称
  471. createUserName: '', //创建人名字
  472. contentImage: [] //图片数组
  473. },
  474. fromId: '', //领料人
  475. fromUser: '', //送货人
  476. bizType: '', //物品类型
  477. verifyId: '', //审核人Id
  478. verifyName: '', //审核人名称
  479. createUserId: '',
  480. remark: ''
  481. },
  482. rules: {
  483. bizType: {
  484. required: true,
  485. message: '请选择出库场景',
  486. trigger: 'change'
  487. },
  488. 'extInfo[verifyDeptCode]': {
  489. required: true,
  490. message: '请选择领料人部门',
  491. trigger: ['change', 'blur']
  492. },
  493. fromId: {
  494. required: true,
  495. message: '请选择',
  496. trigger: 'change'
  497. }
  498. },
  499. llrLsit: [],
  500. isPrice: 1,
  501. showLocked: false,
  502. tabMixinsInit: false
  503. };
  504. },
  505. computed: {
  506. ...mapGetters(['user']),
  507. clientEnvironmentId() {
  508. return this.$store.state.user.info.clientEnvironmentId;
  509. },
  510. // 出库物品清单表格列配置
  511. columns() {
  512. const columns = [
  513. {
  514. columnKey: 'index',
  515. label: '序号',
  516. type: 'index',
  517. width: 55,
  518. align: 'center',
  519. showOverflowTooltip: true,
  520. fixed: 'left'
  521. },
  522. {
  523. label: '编码',
  524. prop: 'categoryCode',
  525. align: 'center',
  526. width: 150,
  527. showOverflowTooltip: true
  528. },
  529. {
  530. label: '名称',
  531. prop: 'categoryName',
  532. align: 'center',
  533. width: 150,
  534. showOverflowTooltip: true
  535. }
  536. ];
  537. // 级别 - 仅 clientEnvironmentId == 4 时显示
  538. if (this.clientEnvironmentId == 4) {
  539. columns.push({
  540. label: '级别',
  541. prop: 'level',
  542. align: 'center'
  543. });
  544. }
  545. // 型号、规格、牌号
  546. columns.push(
  547. {
  548. label: '型号',
  549. prop: 'categoryModel',
  550. align: 'center',
  551. showOverflowTooltip: true
  552. },
  553. {
  554. label: '规格',
  555. prop: 'specification',
  556. align: 'center',
  557. showOverflowTooltip: true
  558. },
  559. {
  560. label: '牌号',
  561. prop: 'brandNum',
  562. align: 'center',
  563. showOverflowTooltip: true
  564. }
  565. );
  566. // 动态列
  567. this.dColumns.forEach((item) => {
  568. columns.push({
  569. label: item.label,
  570. prop: item.prop,
  571. width: 120,
  572. align: item.align,
  573. showOverflowTooltip: item.showOverflowTooltip
  574. });
  575. });
  576. // 批次号
  577. columns.push({
  578. label: '批次号',
  579. prop: 'batchNo',
  580. align: 'center',
  581. showOverflowTooltip: true
  582. });
  583. // 包装数量、单位
  584. columns.push(
  585. {
  586. label: '包装数量',
  587. prop: 'packingQuantity',
  588. width: 80
  589. },
  590. {
  591. label: '单位',
  592. prop: 'packingUnit'
  593. }
  594. );
  595. // 计量数量、计量单位
  596. columns.push(
  597. {
  598. label: '计量数量',
  599. prop: 'measureQuantity',
  600. showOverflowTooltip: true
  601. },
  602. {
  603. label: '计量单位',
  604. prop: 'measureUnit'
  605. }
  606. );
  607. // 重量、重量单位
  608. columns.push(
  609. {
  610. label: '重量',
  611. prop: 'weight',
  612. align: 'center',
  613. showOverflowTooltip: true
  614. },
  615. {
  616. label: '重量单位',
  617. prop: 'weightUnit',
  618. align: 'center',
  619. showOverflowTooltip: true
  620. }
  621. );
  622. // 机型、颜色、锁定数量、库存
  623. columns.push(
  624. {
  625. label: '机型',
  626. prop: 'modelKey',
  627. width: 150
  628. },
  629. {
  630. label: '颜色',
  631. prop: 'colorKey',
  632. width: 150
  633. },
  634. {
  635. label: '锁定数量',
  636. prop: 'lockQuantity',
  637. width: 100
  638. },
  639. {
  640. label: '库存',
  641. prop: 'stockNum',
  642. align: 'center',
  643. showOverflowTooltip: true
  644. }
  645. );
  646. // 单价 - 条件显示
  647. if (this.isPrice == 1) {
  648. columns.push({
  649. label: '单价',
  650. prop: 'price',
  651. align: 'center',
  652. slot: 'price'
  653. });
  654. }
  655. // 金额 - 条件显示
  656. if (this.isPrice == 1) {
  657. columns.push({
  658. label: '金额',
  659. prop: 'totalMoney',
  660. align: 'center',
  661. showOverflowTooltip: true,
  662. slot: 'totalMoney'
  663. });
  664. }
  665. // 采购原因 - 仅 clientEnvironmentId == 4 时显示
  666. if (this.clientEnvironmentId == 4) {
  667. columns.push({
  668. label: '采购原因',
  669. prop: 'purpose',
  670. align: 'center',
  671. showOverflowTooltip: true
  672. });
  673. }
  674. // 仓库、供应商、供应商代号
  675. columns.push(
  676. {
  677. label: '仓库',
  678. prop: 'warehouseName',
  679. width: 150,
  680. showOverflowTooltip: true
  681. },
  682. {
  683. label: '供应商',
  684. prop: 'supplierName',
  685. minWidth: 150,
  686. showOverflowTooltip: true
  687. },
  688. {
  689. label: '供应商代号',
  690. prop: 'supplierCode',
  691. minWidth: 150,
  692. showOverflowTooltip: true
  693. }
  694. );
  695. // 操作列 - 仅在可编辑时显示
  696. if (this.isEdit) {
  697. columns.push({
  698. label: '操作',
  699. width: 120,
  700. align: 'center',
  701. slot: 'action',
  702. fixed: 'right'
  703. });
  704. }
  705. return columns;
  706. }
  707. },
  708. async created() {
  709. //仓库出入库是否显示金额(0:不显示 1:显示)
  710. parameterGetByCode({
  711. code: 'wms_price'
  712. }).then((res) => {
  713. this.isPrice = res.value;
  714. });
  715. this.getFieldModel();
  716. this.getListItems();
  717. this.initDeptData().then(() => {
  718. this.initFormData();
  719. this.getNowFormatDate();
  720. });
  721. },
  722. methods: {
  723. checkLock() {
  724. storageApi.isLocked(this.formData.sourceBizNo).then((res) => {
  725. console.log(res, 'isLocked-res');
  726. this.showLocked = res;
  727. });
  728. },
  729. lockRelease() {
  730. storageApi
  731. .lockOrderRelease(this.formData.sourceBizNo)
  732. .then((res) => {
  733. console.log(res, 'lockOrderRelease-res');
  734. this.$message({
  735. message: '释放成功',
  736. type: 'success'
  737. });
  738. })
  739. .catch(() => {});
  740. },
  741. // 获取当前时间函数
  742. getNowDate() {
  743. let date = new Date(),
  744. obj = {
  745. year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
  746. month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  747. strDate: date.getDate(), // 获取当前日(1-31)
  748. hour: date.getHours(), //获取当前小时(0 ~ 23)
  749. minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
  750. second: date.getSeconds() //获取当前秒数(0 ~ 59)
  751. };
  752. Object.keys(obj).forEach((key) => {
  753. if (obj[key] < 10) obj[key] = `0${obj[key]}`;
  754. });
  755. return obj;
  756. },
  757. // 赋值入库时间
  758. getNowFormatDate() {
  759. const obj = this.getNowDate();
  760. const defaultTime = '00:00:00';
  761. const currentTime = `${obj.hour}:${obj.minute}:${obj.second}`;
  762. this.formData.storageTime = `${obj.year}-${obj.month}-${obj.strDate} ${currentTime}`;
  763. },
  764. // 获取动态表头
  765. getFieldModel() {
  766. storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  767. let newRes = res.map((m) => {
  768. return {
  769. prop: 'extField.' + m.prop,
  770. label: m.label,
  771. align: 'center',
  772. showOverflowTooltip: true
  773. };
  774. });
  775. this.dColumns = [...newRes];
  776. this.getColumns();
  777. });
  778. },
  779. userSlected(data) {
  780. this.formData.fromId = data.id;
  781. this.formData.fromUser = data.name;
  782. this.formData.fromUserPhone = data.phone;
  783. },
  784. openDocumentSourceDialog() {
  785. console.log('打开单据来源弹窗');
  786. },
  787. clearDocumentSource() {
  788. console.log('清空');
  789. },
  790. pickingHandleScroll() {
  791. console.log('---------pickingHandleScroll------------');
  792. if (this.showPackingList.length < this.packingList.length) {
  793. if (this.packingList.length > this.pageSize) {
  794. this.pickingPageNum += 1;
  795. }
  796. this.pickingFetchData();
  797. }
  798. },
  799. pickingFetchData() {
  800. const start = (this.pickingPageNum - 1) * this.pageSize;
  801. const end = start + this.pageSize;
  802. this.showPackingList = this.showPackingList.concat(
  803. this.packingList.slice(start, end)
  804. );
  805. },
  806. materielHandleScroll() {
  807. console.log('---------materielHandleScroll------------');
  808. if (this.showMaterialList.length < this.materialList.length) {
  809. if (this.materialList.length > this.pageSize) {
  810. this.materielPageNum += 1;
  811. }
  812. this.materielFetchData();
  813. }
  814. },
  815. materielFetchData() {
  816. const start = (this.materielPageNum - 1) * this.pageSize;
  817. const end = start + this.pageSize;
  818. this.showMaterialList = this.showMaterialList.concat(
  819. this.materialList.slice(start, end)
  820. );
  821. console.log(this.showMaterialList);
  822. },
  823. // 获取物品列表
  824. async getListItems() {
  825. const { data } = await getTreeByGroup({});
  826. this.goodsLists = data;
  827. },
  828. // 打开单据来源弹窗
  829. openDocumentSourceDialog() {
  830. console.log('打开单据来源弹窗');
  831. },
  832. tableRowClassName({ row, rowIndex }) {
  833. console.log(row);
  834. // 结果 0=默认,1=合格,2=不合格
  835. if (row.result == 1) {
  836. return 'warning-row';
  837. } else {
  838. return '';
  839. }
  840. },
  841. detailData(data, dimension) {
  842. this.dimension = dimension;
  843. const mergedData = [...(this.formData.outInDetailList || []), ...data];
  844. this.formData.outInDetailList = mergedData;
  845. this.productList = data.map((productItem) => {
  846. return {
  847. ...productItem,
  848. suspendBatchNo: productItem.batchNo || '',
  849. outInDetailRecordRequestList:
  850. productItem.outInDetailRecordRequestList.map((packingItem) => {
  851. return {
  852. ...packingItem,
  853. workOrderId:
  854. this.type === '自选领用出库'
  855. ? this.form.detailList[0].workOrderId
  856. : '',
  857. pickOrderId:
  858. this.type === '自选领用出库'
  859. ? this.form.detailList[0].pickOrderId
  860. : '',
  861. taskId:
  862. this.type === '自选领用出库'
  863. ? this.form.detailList[0].taskId
  864. : '',
  865. categoryName: productItem.categoryName,
  866. categoryCode: productItem.categoryCode,
  867. supplierCode: productItem.supplierCode,
  868. supplierName: productItem.supplierName,
  869. materialDetailList: packingItem.materialDetailList.map(
  870. (materialItem) => {
  871. return {
  872. ...materialItem,
  873. categoryName: productItem.categoryName,
  874. categoryCode: productItem.categoryCode,
  875. supplierCode: productItem.supplierCode,
  876. supplierName: productItem.supplierName
  877. };
  878. }
  879. )
  880. };
  881. })
  882. };
  883. });
  884. const newProducts = mergedData.map((productItem) => ({
  885. ...productItem,
  886. suspendBatchNo: productItem.batchNo || '',
  887. outInDetailRecordRequestList:
  888. productItem.outInDetailRecordRequestList.map((packingItem) => ({
  889. ...packingItem,
  890. categoryName: productItem.categoryName,
  891. categoryCode: productItem.categoryCode,
  892. supplierCode: productItem.supplierCode,
  893. supplierName: productItem.supplierName,
  894. workOrderId:
  895. this.type === '自选领用出库'
  896. ? this.form.detailList[0].workOrderId
  897. : '',
  898. pickOrderId:
  899. this.type === '自选领用出库'
  900. ? this.form.detailList[0].pickOrderId
  901. : '',
  902. taskId:
  903. this.type === '自选领用出库'
  904. ? this.form.detailList[0].taskId
  905. : '',
  906. materialDetailList: packingItem.materialDetailList.map(
  907. (materialItem) => ({
  908. ...materialItem,
  909. categoryName: productItem.categoryName,
  910. categoryCode: productItem.categoryCode,
  911. supplierCode: productItem.supplierCode,
  912. supplierName: productItem.supplierName
  913. })
  914. )
  915. }))
  916. }));
  917. // 去重合并产品列表和新产品列表
  918. const uniqueProducts =newProducts
  919. this.productList = newProducts;
  920. console.log('111111111111111');
  921. console.log(this.productList);
  922. // 排序
  923. this.productList.sort((a, b) => a.categoryCode - b.categoryCode);
  924. // 获取包装维度数据
  925. const arr = [];
  926. for (const key in this.productList) {
  927. for (const k in this.productList[key].outInDetailRecordRequestList) {
  928. arr.push({
  929. ...this.productList[key].outInDetailRecordRequestList[k]
  930. });
  931. }
  932. }
  933. this.packingList = arr;
  934. const newPacking = [];
  935. newProducts.forEach((item) => {
  936. newPacking.push(...item.outInDetailRecordRequestList);
  937. });
  938. //去重
  939. const newPackingList = [
  940. ...new Map(
  941. [...this.packingList, ...newPacking].map((item) => [item.id, item])
  942. ).values()
  943. ];
  944. this.packingList = newPackingList;
  945. this.packingList.sort((a, b) => a.categoryCode - b.categoryCode);
  946. // 获取物料维度数据
  947. let iArr = [];
  948. arr.forEach((item) => {
  949. item.materialDetailList.forEach((ele) => {
  950. iArr.push({ ...ele });
  951. });
  952. });
  953. this.materialList = iArr;
  954. const newMaterial = [];
  955. newPacking.forEach((item) => {
  956. newMaterial.push(...item.materialDetailList);
  957. });
  958. this.materialList = [...this.materialList, ...newMaterial];
  959. // 触发分页更新
  960. this.pickingPageNum = 1;
  961. this.materielPageNum = 1;
  962. this.pickingFetchData();
  963. this.materielFetchData();
  964. this.formData.outInDetailList = this.productList;
  965. console.log(this.productList, 'this.productList');
  966. console.log(this.packingList, 'this.packingList');
  967. },
  968. async getReturnStorage() {
  969. return new Promise((resolve) => {
  970. console.log(this.formData);
  971. if (this.stockError) {
  972. return this.$message.error(this.stockErrorMsg);
  973. }
  974. this.$refs.formName.validate(async (valid) => {
  975. if (!this.productList?.length) {
  976. return this.$message.error('请添加出库明细!');
  977. }
  978. let obj = deepClone({ ...this.formData, type: 2 });
  979. obj.extInfo.sourceBizNo = obj.sourceBizNo;
  980. obj.fromType = obj.type;
  981. // 处理物品类型assetType
  982. obj.extInfo.assetType = obj.extInfo?.assetType.join(',');
  983. // 处理仓库id
  984. let warehouseId = [];
  985. let warehouseName = [];
  986. let warehouseIds = this.productList
  987. .map((item) => item.warehouseId)
  988. .flat();
  989. let warehouseNames = this.productList
  990. .map((item) => item.warehouseName)
  991. .flat();
  992. warehouseIds.forEach((item, index) => {
  993. if (!warehouseId.includes(item)) {
  994. warehouseId.push(item);
  995. warehouseName.push(warehouseNames[index]);
  996. }
  997. });
  998. obj.warehouseIds = warehouseId;
  999. obj.warehouseNames = warehouseName;
  1000. console.log('2222', obj);
  1001. let isPass = false;
  1002. // 1按数量计费 2按重量计费
  1003. if (this.form.pricingWay == 2) {
  1004. if (this.materialList.length > 0) {
  1005. // 判断物料
  1006. isPass = this.materialCodeReqList.every(
  1007. (item) => item.weight > 0
  1008. );
  1009. } else {
  1010. // 判断包装重量是否全部大于0
  1011. isPass = this.packingList.every((item) => item.weight > 0);
  1012. }
  1013. } else {
  1014. isPass = true;
  1015. }
  1016. if (isPass) {
  1017. resolve(obj);
  1018. } else {
  1019. this.$message.error('委外发货重量不能为空');
  1020. }
  1021. });
  1022. });
  1023. },
  1024. onClear() {
  1025. this.formData.sourceBizNo = '';
  1026. this.warehousingMaterialList = [];
  1027. this.$refs.trees.valueTitle = '';
  1028. this.formData.clientName = '';
  1029. this.formData.clientUser = '';
  1030. this.formData.clientPhone = '';
  1031. this.$forceUpdate();
  1032. },
  1033. rowClass({ row, column, rowIndex, columnIndex }) {
  1034. if (rowIndex === 1) {
  1035. return {
  1036. display: 'none',
  1037. background: '#EEEEEE'
  1038. };
  1039. }
  1040. return { background: '#0000' };
  1041. },
  1042. // 部门点击事件
  1043. async auditorDeptClick(data) {
  1044. console.log(data);
  1045. this.formData.extInfo.verifyDeptCode = data?.id;
  1046. this.formData.extInfo.verifyDeptName = data?.name;
  1047. this.formData.verifyId = '';
  1048. this.formData.verifyName = '';
  1049. this.$refs.formName.validateField('verifyDeptName');
  1050. if (data) {
  1051. this.getStaffList(data);
  1052. }
  1053. },
  1054. getStaffList(data) {
  1055. return new Promise(async (resolve) => {
  1056. let res = await warehouseDefinition.getUserPage({
  1057. groupId: data.id,
  1058. size: 9999,
  1059. page: 1
  1060. });
  1061. this.llrLsit = res.list;
  1062. resolve();
  1063. });
  1064. },
  1065. // 初始化用户信息
  1066. async initFormData() {
  1067. console.log(this.form, 'ddddddddddddddddddddddddddddd123form');
  1068. // const res = await warehouseDefinition.tree();
  1069. // let obj = res.find(
  1070. // (item) =>
  1071. // item.id ===
  1072. // this.user.info.deptIds[this.user.info.deptIds.length - 1]
  1073. // );
  1074. // if (!obj) return;
  1075. // this.formData.extInfo.deptCode = obj.id;
  1076. // this.formData.extInfo.deptName = obj.name;
  1077. // this.formData.extInfo.createUserName = this.user.info.name;
  1078. // this.formData.createUserId = this.user.info.userId;
  1079. this.formData.extInfo.assetType = Array.from(
  1080. new Set(this.form.categoryLevelTopId?.split(','))
  1081. );
  1082. //委外出库
  1083. if (this.bizType == 7 && this.form.productList) {
  1084. const categoryids = this.form.productList.map(
  1085. (p) => p.categoryLevelTopId
  1086. );
  1087. console.log(categoryids, '委外出库的物品id');
  1088. this.formData.extInfo.assetType = categoryids;
  1089. }
  1090. // 出库类型
  1091. this.formData.bizType = this.bizType;
  1092. // 添加单据来源
  1093. this.formData.sourceBizNo = this.sourceBizNo || this.form?.code;
  1094. this.checkLock();
  1095. // 将出库状态改成出库状态 2出库 1入库
  1096. this.formData.type = 2;
  1097. // 入库登记人
  1098. this.formData.extInfo.createUserId = this.$store.state.user.info.userId;
  1099. this.formData.extInfo.createUserName = this.$store.state.user.info.name;
  1100. this.formData.createUserId = this.$store.state.user.info.userId;
  1101. await this.initDeptData(); // 确保部门树加载
  1102. if (this.form.makerId) {
  1103. warehouseDefinition.getGroupById(this.form.makerId).then((res) => {
  1104. console.log(res, 'makerId');
  1105. this.$set(this.formData.extInfo, 'verifyDeptCode', res.groupId);
  1106. this.$set(this.formData.extInfo, 'verifyDeptName', res.groupName);
  1107. });
  1108. }
  1109. // 生产相关逻辑
  1110. console.log(this.detailList, 'this.detailList');
  1111. console.log(this.saleProductList, 'this.saleProductList');
  1112. console.log(this.productList, 'this.productList');
  1113. console.log('11111111111111111111');
  1114. if (this.detailList?.length > 0) {
  1115. // 获取领料人列表
  1116. if (this.form.executorDeptId) {
  1117. this.getStaffList({ id: this.form.executorDeptId }).then(() => {
  1118. // 获取领料人和领料部门
  1119. this.formData.fromId = this.form.executorId;
  1120. this.formData.fromUser = this.form.executorName;
  1121. this.formData.extInfo.verifyDeptCode = this.form.executorDeptId;
  1122. this.formData.extInfo.verifyDeptName = this.form.executorDeptName;
  1123. });
  1124. } else {
  1125. this.formData.fromId = this.form.createUserId;
  1126. warehouseDefinition
  1127. .getGroupById(this.form.createUserId)
  1128. .then((res) => {
  1129. console.log(res, 'form没有executorDeptId有createUserId');
  1130. this.$set(this.formData, 'fromUser', res.name);
  1131. this.$set(this.formData.extInfo, 'verifyDeptCode', res.groupId);
  1132. if (res.groupId) {
  1133. this.getStaffList({ id: res.groupId });
  1134. }
  1135. this.$set(
  1136. this.formData.extInfo,
  1137. 'verifyDeptName',
  1138. res.groupName
  1139. );
  1140. });
  1141. }
  1142. console.log(this.saleProductList, 'this.saleProductList33333');
  1143. let pData = {
  1144. type: '1',
  1145. deliveryNo: this.formData.sourceBizNo,
  1146. builders: this.detailList.map((item) => {
  1147. return {
  1148. categoryId:
  1149. item.categoryId || item.instanceId || item.productId,
  1150. num: item.demandQuantity || item.measurementCount,
  1151. warehouseId: this.bizType == 11 ? item.warehouseId : '',
  1152. batchNo: item.batchNo || ''
  1153. };
  1154. })
  1155. };
  1156. let pData2 = {
  1157. type: this.wwType,
  1158. deliveryNo: this.formData.sourceBizNo,
  1159. taskIds: this.extractedList.map((item) => item.taskId),
  1160. workOrderIds: this.extractedList.map((item) => item.workOrderId)
  1161. };
  1162. let pData3 = {
  1163. //销售退货处理 外协出库
  1164. type: 3,
  1165. deliveryNo: this.formData.sourceBizNo,
  1166. outInIds: this.form?.returnInReceiptId?.split(','),
  1167. packageNos: this.detailList.map((item) => item.packageNo)
  1168. };
  1169. let pData4 = {
  1170. //受托退货
  1171. type: 3,
  1172. deliveryNo: this.formData.sourceBizNo,
  1173. ids: this.detailList.map((item) => item.packageId)?.toString()
  1174. };
  1175. let api = this.bizType == 8 ? 'getHierarchyList' : 'getHierarchyFifo';
  1176. storageApi[api](
  1177. this.wwType == 3
  1178. ? pData2
  1179. : this.bizType == 6
  1180. ? pData3
  1181. : this.bizType == 8
  1182. ? pData4
  1183. : pData
  1184. )
  1185. .then((data) => {
  1186. this.detailData(data, this.dimension);
  1187. })
  1188. .catch((err) => {
  1189. console.log(err);
  1190. });
  1191. return;
  1192. }
  1193. // 销售相关逻辑
  1194. if (this.saleProductList?.length > 0) {
  1195. this.formData.clientName = this.form.contactName;
  1196. this.formData.clientCode = this.form.contactCode;
  1197. // 获取领料人列表
  1198. this.getStaffList({ id: this.form.deptId }).then(() => {
  1199. // 获取领料人和领料部门
  1200. this.formData.fromId = this.form.makerId;
  1201. this.formData.fromUser = this.form.makerName;
  1202. this.formData.extInfo.verifyDeptCode = this.form.deptId;
  1203. this.formData.extInfo.verifyDeptName = this.form.deptName;
  1204. });
  1205. console.log(this.saleProductList, 'this.saleProductList11111');
  1206. let pData = {
  1207. type: '1',
  1208. deliveryNo: this.formData.sourceBizNo,
  1209. builders: this.saleProductList.map((item) => {
  1210. return {
  1211. categoryId: item.productId || item.categoryId,
  1212. num: item.totalCount,
  1213. // 处理销售发货时物品清单和出库清单仓库不一致的问题
  1214. warehouseId: this.bizType == 3 ? item.warehouseId : '',
  1215. colorKey: item.colorKey || '',
  1216. batchNo: item.batchNo || '',
  1217. categoryModel: item.modelType || '',
  1218. deliveryDetailId: item.id || ''
  1219. };
  1220. })
  1221. };
  1222. let pData2 = {
  1223. type: this.wwType,
  1224. deliveryNo: this.formData.sourceBizNo,
  1225. taskIds: this.extractedList.map((item) => item.taskId),
  1226. workOrderIds: this.extractedList.map((item) => item.workOrderId)
  1227. };
  1228. console.log('111~~~~~~~~', pData);
  1229. storageApi
  1230. .getHierarchyFifo(this.wwType == 3 ? pData2 : pData)
  1231. .then((data) => {
  1232. this.detailData(data, this.dimension);
  1233. })
  1234. .catch((err) => {
  1235. console.log('err~~~', err);
  1236. this.stockError = true;
  1237. this.stockErrorMsg = err;
  1238. });
  1239. return;
  1240. }
  1241. //采购委外
  1242. if (this.form.productList?.length > 0) {
  1243. this.getStaffList({ id: this.form.deptId }).then(() => {
  1244. this.formData.fromId = this.form.makerId;
  1245. this.formData.fromUser = this.form.makerName;
  1246. this.formData.extInfo.verifyDeptCode = this.form.deptId;
  1247. this.formData.extInfo.verifyDeptName = this.form.deptName;
  1248. });
  1249. console.log(this.saleProductList, 'this.saleProductList22222');
  1250. let pData = {
  1251. type: '1',
  1252. builders: this.form.productList.map((item) => {
  1253. return {
  1254. categoryId: item.productId,
  1255. num: item.totalCount,
  1256. price: item.totalPrice,
  1257. unitPrice: item.singlePrice,
  1258. weight: item.singleWeight * item.totalCount || 0,
  1259. batchNo: item.batchNo || '',
  1260. taskId: item.taskId || '',
  1261. deliveryDetailId: item.id || ''
  1262. };
  1263. })
  1264. };
  1265. let pData2 = {
  1266. type: 3,
  1267. taskIds: this.form.productList.map((item) => item.taskId),
  1268. workOrderIds: [this.form.sourceId]
  1269. };
  1270. storageApi
  1271. .getHierarchyFifo(this.form.sourceId ? pData2 : pData)
  1272. .then((data) => {
  1273. this.detailData(data, this.dimension);
  1274. })
  1275. .catch((err) => {
  1276. console.log(err);
  1277. });
  1278. }
  1279. // if (this.form.productList?.length > 0) {
  1280. // this.getStaffList({ id: this.form.deptId }).then(() => {
  1281. // this.formData.fromId = this.form.makerId;
  1282. // this.formData.fromUser = this.form.makerName;
  1283. // this.formData.extInfo.verifyDeptCode = this.form.deptId;
  1284. // this.formData.extInfo.verifyDeptName = this.form.deptName;
  1285. // });
  1286. // let pData = {
  1287. // type: '1',
  1288. // builders: this.form.productList.map((item) => {
  1289. // return {
  1290. // categoryId: item.productId,
  1291. // num: item.totalCount,
  1292. // price: item.totalPrice,
  1293. // unitPrice: item.singlePrice,
  1294. // weight: item.singleWeight * item.totalCount || 0,
  1295. // batchNo: item.batchNo || '',
  1296. // taskId: item.taskId || ''
  1297. // };
  1298. // })
  1299. // };
  1300. // let pData2 = {
  1301. // type: 3,
  1302. // taskIds: this.form.productList.map((item) => item.taskId),
  1303. // workOrderIds: [this.form.sourceId]
  1304. // };
  1305. // storageApi
  1306. // .getHierarchyFifo(this.form.sourceId ? pData2 : pData)
  1307. // .then((data) => {
  1308. // this.detailData(data, this.dimension);
  1309. // })
  1310. // .catch((err) => {
  1311. // console.log(err);
  1312. // });
  1313. // }
  1314. },
  1315. // 初始化部门数据
  1316. initDeptData() {
  1317. return new Promise(async (resolve) => {
  1318. const res = await warehouseDefinition.tree();
  1319. this.treeList = this.$util.toTreeData({
  1320. data: res,
  1321. idField: 'id',
  1322. parentIdField: 'parentId'
  1323. });
  1324. this.$nextTick(() => {
  1325. resolve();
  1326. });
  1327. });
  1328. },
  1329. addStock() {
  1330. console.log(this.formData.extInfo.assetType);
  1331. if (
  1332. !(
  1333. this.formData.extInfo.assetType &&
  1334. this.formData.extInfo.assetType.length > 0
  1335. )
  1336. )
  1337. return this.$message.error('请选择出库产品类型');
  1338. if (!this.formData.bizType && this.formData.bizType !== 0)
  1339. return this.$message.error('请选择出库场景');
  1340. this.$refs.assetsDialogRef.open(this.productList);
  1341. },
  1342. handleBizSceneChange() {
  1343. if (this.formData.extInfo.assetType == 7) {
  1344. this.formData.extInfo.sourceBizNo = '';
  1345. }
  1346. this.formData.sourceBizNo = '';
  1347. },
  1348. deleteProductList(row, index) {
  1349. // 1. 获取当前物料的所有包装列表
  1350. const targetPackages = row.outInDetailRecordRequestList || [];
  1351. const packageIds = new Set(targetPackages.map((p) => p.id));
  1352. console.log('targetPackages', targetPackages);
  1353. console.log('packageIds包装的id', packageIds);
  1354. // 从packingList中移除相关包装
  1355. this.packingList = this.packingList.filter(
  1356. (p) => !packageIds.has(p.id) && p.categoryCode !== row.categoryCode
  1357. );
  1358. console.log('包装列表', this.packingList);
  1359. // 从materialList中移除关联物料
  1360. const materialIds = new Set();
  1361. targetPackages.forEach((packageItem) => {
  1362. packageItem.materialDetailList.forEach((material) => {
  1363. materialIds.add(material.id);
  1364. });
  1365. });
  1366. this.materialList = this.materialList.filter(
  1367. (m) => !materialIds.has(m.id) && m.categoryCode !== row.categoryCode
  1368. );
  1369. this.productList.splice(index, 1);
  1370. // this.$nextTick(() => {
  1371. // this.$refs.productListTable?.doLayout()
  1372. // this.$refs.showPackingListTable?.doLayout()
  1373. // this.$refs.multipleTable?.doLayout()
  1374. // })
  1375. }
  1376. },
  1377. watch: {
  1378. packingList: {
  1379. handler(newVal) {
  1380. console.log('包装列表', newVal);
  1381. console.log('当前包装列表加载页数2', this.pickingPageNum);
  1382. this.showPackingList = newVal.slice(
  1383. 0,
  1384. this.pageSize * (this.pickingPageNum > 0 ? this.pickingPageNum : 1)
  1385. );
  1386. },
  1387. deep: true
  1388. },
  1389. materialList: {
  1390. handler(newVal) {
  1391. console.log('物料列表', newVal);
  1392. console.log('当前物料列表加载页数', this.materielPageNum);
  1393. this.showMaterialList = newVal.slice(
  1394. 0,
  1395. this.pageSize *
  1396. (this.materielPageNum > 0 ? this.materielPageNum : 1)
  1397. );
  1398. },
  1399. deep: true
  1400. }
  1401. // detailList: {
  1402. // handler(newVal) {
  1403. // if (newVal.length) {
  1404. // this.initFormData();
  1405. // }
  1406. // },
  1407. // deep: true
  1408. // }
  1409. }
  1410. };
  1411. </script>
  1412. <style lang="scss" scoped>
  1413. ::v-deep .el-row {
  1414. display: flex;
  1415. flex-wrap: wrap;
  1416. }
  1417. ::v-deep.form-table {
  1418. .el-form-item {
  1419. margin-bottom: 0;
  1420. }
  1421. .el-input__inner {
  1422. padding: 0 10px;
  1423. }
  1424. }
  1425. .p20 {
  1426. padding: 20px;
  1427. }
  1428. .el-select,
  1429. .el-date-editor {
  1430. width: 100%;
  1431. }
  1432. .el-form-item {
  1433. margin-bottom: 22px;
  1434. }
  1435. .material {
  1436. margin-top: 20px;
  1437. .flex {
  1438. display: flex;
  1439. justify-content: space-between;
  1440. font-size: 14px;
  1441. align-items: center;
  1442. .red {
  1443. color: #ff4949;
  1444. }
  1445. }
  1446. }
  1447. .mt10 {
  1448. margin-top: 10px;
  1449. }
  1450. .mt20 {
  1451. margin-top: 20px;
  1452. }
  1453. .center {
  1454. text-align: center;
  1455. }
  1456. </style>