detailDialog.vue 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <div>
  5. <div class="content-detail">
  6. <header-title title="基本信息" size="16px"></header-title>
  7. <div class="mt20">
  8. <el-form label-width="120px">
  9. <el-col :span="8">
  10. <el-form-item label="入库单:">
  11. <span>{{ infoData.bizNo }}</span>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="8">
  15. <el-form-item label="入库物品类型:">
  16. <span>{{ handleAssetType(extInfo.assetType) }}</span>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="8">
  20. <el-form-item label="入库场景:">
  21. <span>{{ getSceneState(infoData.bizType) }}</span>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="8">
  25. <el-form-item label="销售订单:">
  26. <span>{{ extInfo.documentSource }}</span>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="8">
  30. <el-form-item label="权属部门:">
  31. <span>{{ extInfo.deptName }}</span>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="8">
  35. <el-form-item label="入库登记人:">
  36. <span>{{ extInfo.createUserName }}</span>
  37. </el-form-item>
  38. </el-col>
  39. <!-- <el-col :span="8">
  40. <el-form-item label="创建时间:">
  41. <span>{{ infoData.createTime }}</span>
  42. </el-form-item>
  43. </el-col> -->
  44. <el-col :span="8">
  45. <el-form-item label="入库时间:">
  46. <span>{{ infoData.createTime }}</span>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="8">
  50. <el-form-item label="状态:">
  51. <span>{{ getAuditStatus(infoData.verifyStatus) }}</span>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="8">
  55. <el-form-item label="审核人:">
  56. <span>{{ infoData.verifyName }}</span>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="8" v-if="infoData.bizType == 2">
  60. <el-form-item label="客户:">
  61. <span>{{ infoData.clientName }}</span>
  62. </el-form-item>
  63. </el-col>
  64. <!-- <el-col :span="8" v-if="infoData.bizType == 2">
  65. <el-form-item label="客户代码:">
  66. <span>{{ infoData.clientCode }}</span>
  67. </el-form-item>
  68. </el-col> -->
  69. <el-col :span="8" v-if="infoData.bizType == 2">
  70. <el-form-item label="供应商:">
  71. <span>{{ extInfo.supplierName }}</span>
  72. </el-form-item>
  73. </el-col>
  74. <!-- <el-col :span="8" v-if="infoData.bizType != 2">
  75. <el-form-item label="供应商代码:">
  76. <span>{{ extInfo.supplierCode }}</span>
  77. </el-form-item>
  78. </el-col> -->
  79. <el-col :span="8">
  80. <el-form-item label="送货人:">
  81. <span>{{ infoData.fromUser }}</span>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="8">
  85. <el-form-item label="送货人联系方式:">
  86. <span>{{ extInfo.deliveryPhone }}</span>
  87. </el-form-item>
  88. </el-col>
  89. <el-col :span="8">
  90. <el-form-item label="附件:">
  91. <!-- <el-link
  92. type="primary"
  93. v-for="(item, index) in infoData.contentImage"
  94. @click="contentImageDownload(item)"
  95. :key="item.name"
  96. >{{ item.name }}</el-link
  97. > -->
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="8">
  101. <el-form-item
  102. prop="qualityFile"
  103. label="回执附件"
  104. :rules="{
  105. required: true,
  106. trigger: 'blur'
  107. }"
  108. >
  109. <fileUpload
  110. v-model="qualityFile"
  111. module="main"
  112. :showLib="false"
  113. :limit="10"
  114. />
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="24">
  118. <el-form-item label="备注:">
  119. <span>{{ infoData.remark }}</span>
  120. </el-form-item>
  121. </el-col>
  122. </el-form>
  123. </div>
  124. </div>
  125. <div class="content-detail mt20">
  126. <header-title title="物品信息" size="16px"></header-title>
  127. <!-- =={{ warehousingMaterialList }} -->
  128. <div class="mt20">
  129. <div class="mt10">
  130. <el-form
  131. ref="warehousingMaterialListRef"
  132. :model="{ warehousingMaterialList: warehousingMaterialList }"
  133. :show-message="false"
  134. >
  135. <el-table
  136. ref="warehousingMaterialListTable"
  137. :data="warehousingMaterialList"
  138. tooltip-effect="dark"
  139. :key="infoData.assetType"
  140. style="width: 100%"
  141. stripe
  142. :header-cell-style="rowClass"
  143. >
  144. <el-table-column label="序号" type="index" width="50">
  145. </el-table-column>
  146. <el-table-column
  147. label="编码"
  148. prop="categoryCode"
  149. align="center"
  150. width="150"
  151. ></el-table-column>
  152. <el-table-column
  153. label="名称"
  154. align="center"
  155. width="170"
  156. prop="name"
  157. ></el-table-column>
  158. <el-table-column
  159. v-for="(item, index) in tableHeader"
  160. :key="index"
  161. align="center"
  162. :label="item.label"
  163. width="150"
  164. :prop="item.prop"
  165. >
  166. <template slot-scope="{ row }">
  167. <template v-if="item.formatter">{{
  168. item.formatter(row)
  169. }}</template>
  170. <template v-else>{{ row[item.prop] }}</template>
  171. </template>
  172. </el-table-column>
  173. <el-table-column
  174. label="批次号"
  175. prop="batchNo"
  176. width="70"
  177. align="center"
  178. >
  179. </el-table-column>
  180. <el-table-column
  181. label="最小包装单元"
  182. align="center"
  183. prop="minPackingCount"
  184. width="100"
  185. >
  186. <el-table-column
  187. label=""
  188. prop="minPackingCount"
  189. width="100"
  190. align="center"
  191. >
  192. <template slot-scope="{ row, $index }">
  193. <template v-if="row.isSave">
  194. {{ row.minPackingCount }}
  195. </template>
  196. <el-form-item
  197. v-else
  198. :prop="`warehousingMaterialList.${$index}.minPackingCount`"
  199. required
  200. >
  201. <el-input
  202. v-model="row.minPackingCount"
  203. @input="
  204. (value) =>
  205. (row.minPackingCount = value.replace(
  206. /^(0+)|[^\d]+/g,
  207. ''
  208. ))
  209. "
  210. >
  211. </el-input>
  212. </el-form-item>
  213. </template>
  214. </el-table-column>
  215. <el-table-column label="" prop="minPackingCount">
  216. <template slot-scope="{ row, $index }">
  217. {{ handleRowUnit(row) }} /{{ row.packingUnit }}
  218. </template>
  219. </el-table-column>
  220. </el-table-column>
  221. <el-table-column
  222. label="包装数量"
  223. prop="packingCount"
  224. width="130"
  225. align="center"
  226. >
  227. <!-- <template slot-scope="{ row, $index }">
  228. {{ row.packingCount }} {{ row.packingUnit }}
  229. </template> -->
  230. <template slot-scope="{ row, $index }">
  231. <template v-if="row.isSave">
  232. {{ row.packingCount }} {{ row.packingUnit }}
  233. </template>
  234. <el-form-item
  235. v-else
  236. :prop="`warehousingMaterialList.${$index}.packingCount`"
  237. required
  238. >
  239. <el-input
  240. v-model="row.packingCount"
  241. @input="packNum(row, $event)"
  242. >
  243. <template slot="append">
  244. {{ row.packingUnit ? row.packingUnit : '/' }}
  245. </template>
  246. </el-input>
  247. </el-form-item>
  248. </template>
  249. </el-table-column>
  250. <el-table-column
  251. label="计量数量"
  252. prop="batchNo"
  253. width="100"
  254. align="center"
  255. >
  256. <template slot-scope="{ row, $index }">
  257. <template>
  258. {{ row.minPackingCount * row.packingCount }}
  259. </template>
  260. </template>
  261. </el-table-column>
  262. <el-table-column
  263. label="计量单位"
  264. prop="batchNo"
  265. width="100"
  266. align="center"
  267. >
  268. <template slot-scope="{ row, $index }">
  269. <template>
  270. {{ row.measuringUnit }}
  271. </template>
  272. </template>
  273. </el-table-column>
  274. <el-table-column
  275. label="重量"
  276. prop="count"
  277. width="100"
  278. align="center"
  279. >
  280. <template slot-scope="{ row, $index }">
  281. {{ row.weight }}
  282. </template>
  283. </el-table-column>
  284. <el-table-column
  285. label="重量单位"
  286. prop="count"
  287. width="100"
  288. align="center"
  289. >
  290. <template slot-scope="{ row, $index }">
  291. {{ row.weightUnit }}
  292. </template>
  293. </el-table-column>
  294. <el-table-column
  295. label="单价"
  296. prop="price"
  297. width="190"
  298. align="center"
  299. >
  300. <template slot-scope="{ row, $index }">
  301. <template v-if="row.isSave">
  302. {{ row.price }}
  303. </template>
  304. <el-form-item v-else>
  305. <el-input
  306. v-model="row.price"
  307. placeholder="非必填"
  308. @input="
  309. (value) =>
  310. (row.price = value.replace(/[^0-9.]+/g, ''))
  311. "
  312. >
  313. <template slot="append">
  314. 元/{{ handleRowUnit(row) }}
  315. </template>
  316. </el-input>
  317. </el-form-item>
  318. </template>
  319. </el-table-column>
  320. <el-table-column
  321. label="金额"
  322. align="center"
  323. prop="contentImage"
  324. :show-overflow-tooltip="true"
  325. width="100"
  326. >
  327. <template slot-scope="{ row, $index }">
  328. <!-- // calcSum(
  329. // row.outInNum,
  330. // row.univalenceUnit,
  331. // row.univalence,
  332. // row
  333. // ) -->
  334. {{
  335. calcSumTotal(
  336. row.packingCount,
  337. row.minPackingCount,
  338. row.price,
  339. row
  340. )
  341. }}
  342. </template>
  343. </el-table-column>
  344. <el-table-column
  345. label="货位"
  346. prop="position"
  347. :show-overflow-tooltip="true"
  348. width="200"
  349. >
  350. <template slot-scope="{ row, $index }">
  351. <template v-if="row.isSave">
  352. {{ row.position }}
  353. </template>
  354. <el-form-item
  355. v-else
  356. :prop="`warehousingMaterialList.${$index}.position`"
  357. :required="true"
  358. >
  359. <span @click="handleWareHouse(row, $index)">
  360. {{ row.position }}</span
  361. >
  362. </el-form-item>
  363. </template>
  364. </el-table-column>
  365. <!-- <el-table-column
  366. label="操作"
  367. width="200"
  368. fixed="right"
  369. align="center"
  370. >
  371. <template slot-scope="{ row, $index }">
  372. <el-button
  373. type="text"
  374. v-show="!row.isSave"
  375. @click="listSave(row, $index)"
  376. >保存</el-button
  377. >
  378. <el-button
  379. type="text"
  380. v-show="row.isSave"
  381. @click="listEdit(row, $index)"
  382. >编辑</el-button
  383. >
  384. </template>
  385. </el-table-column> -->
  386. </el-table>
  387. </el-form>
  388. </div>
  389. </div>
  390. </div>
  391. <div class="mt20">
  392. <!-- =={{ getDictValue('类型用途', infoData.assetType) }} -->
  393. <!-- ${handleAssetType(extInfo.assetType)} -->
  394. <header-title :title="`包装明细`" size="16px"></header-title>
  395. <el-table
  396. ref="detailListTable"
  397. :data="detailList"
  398. tooltip-effect="dark"
  399. :header-cell-style="rowClass"
  400. style="width: 100%"
  401. stripe
  402. >
  403. <el-table-column label="序号" type="index" width="50">
  404. </el-table-column>
  405. <el-table-column label="编码" prop="categoryCode"></el-table-column>
  406. <el-table-column label="名称" prop="name"></el-table-column>
  407. <el-table-column label="批次号" prop="batchNo"></el-table-column>
  408. <el-table-column label="包装编码" prop="code"></el-table-column>
  409. <el-table-column
  410. label="包装数量"
  411. prop="packingCount"
  412. width="80"
  413. ></el-table-column>
  414. <el-table-column
  415. label="包装单位"
  416. prop="packingUnit"
  417. ></el-table-column>
  418. <el-table-column
  419. label="计量数量"
  420. prop="minPackingCount"
  421. ></el-table-column>
  422. <el-table-column
  423. label="计量单位"
  424. prop="measuringUnit"
  425. ></el-table-column>
  426. <el-table-column label="物料代号" prop="materielCode" width="130">
  427. <template slot-scope="{ row }">
  428. <el-input
  429. v-show="!row.isPack"
  430. v-model="row.materielCode"
  431. ></el-input>
  432. <span v-show="row.isPack">{{ row.materielCode }}</span>
  433. </template>
  434. </el-table-column>
  435. <el-table-column label="客户代号" prop="clientCode">
  436. <template slot-scope="{ row }">
  437. <el-input
  438. v-show="!row.isPack"
  439. v-model="row.clientCode"
  440. ></el-input>
  441. <span v-show="row.isPack">{{ row.clientCode }}</span>
  442. </template>
  443. </el-table-column>
  444. <!-- v-if="infoData.bizType == 1" -->
  445. <el-table-column label="刻码" prop="engrave">
  446. <template slot-scope="{ row }">
  447. <el-input v-show="!row.isPack" v-model="row.engrave"></el-input>
  448. <span v-show="row.isPack">{{ row.engrave }}</span>
  449. </template>
  450. </el-table-column>
  451. <el-table-column label="重量" prop="weight">
  452. <template slot-scope="{ row }">
  453. <el-input v-show="!row.isPack" v-model="row.weight"></el-input>
  454. <span v-show="row.isPack">{{ row.weight }}</span>
  455. </template>
  456. </el-table-column>
  457. <el-table-column label="重量单位" prop="weightUtil">
  458. <template slot-scope="{ row }">
  459. {{ row.weightUtil }}
  460. </template>
  461. </el-table-column>
  462. <el-table-column label="质检结果" prop="result" width="120">
  463. <template slot-scope="{ row }">
  464. <DictSelection
  465. dictName="质检结果"
  466. clearable
  467. v-model="row.result"
  468. v-if="!row.isPack"
  469. @updateVal="changeWrapStatus($event, row)"
  470. />
  471. <span v-else>{{ qualityResults[row.result] }}</span>
  472. </template>
  473. </el-table-column>
  474. <el-table-column label="质检状态" prop="status" width="120">
  475. <template slot-scope="{ row }">
  476. <span>{{ qualityStatus[row.status] }}</span>
  477. </template>
  478. </el-table-column>
  479. <el-table-column label="日期" prop="createTime" width="200">
  480. <template slot="header" slot-scope="scope">
  481. {{ dateTypes == 1 ? '采购日期' : '生产日期' }}
  482. </template>
  483. <template slot-scope="{ row }">
  484. {{ row.createTime }}
  485. </template>
  486. </el-table-column>
  487. <!-- <el-table-column
  488. label="操作"
  489. width="100"
  490. fixed="right"
  491. align="center"
  492. >
  493. <template slot-scope="{ row, $index }">
  494. <el-button
  495. type="text"
  496. v-show="!row.isPack"
  497. @click="packSave(row, $index)"
  498. >保存</el-button
  499. >
  500. <el-button
  501. type="text"
  502. v-show="row.isPack"
  503. @click="packEdit(row, $index)"
  504. >编辑</el-button
  505. >
  506. </template>
  507. </el-table-column> -->
  508. </el-table>
  509. </div>
  510. <div class="mt20">
  511. <header-title :title="`物料明细`" size="16px"> </header-title>
  512. <el-table
  513. ref="metailListTable"
  514. :data="metailList"
  515. tooltip-effect="dark"
  516. :header-cell-style="rowClass"
  517. style="width: 100%"
  518. stripe
  519. >
  520. <el-table-column label="序号" type="index" width="50">
  521. </el-table-column>
  522. <el-table-column label="编码" prop="assetCode"></el-table-column>
  523. <el-table-column
  524. label="名称"
  525. prop="assetName"
  526. width="200"
  527. ></el-table-column>
  528. <el-table-column
  529. label="批次号"
  530. prop="batchNo"
  531. width="80"
  532. ></el-table-column>
  533. <el-table-column
  534. label="物料编码"
  535. prop="no"
  536. width="200"
  537. ></el-table-column>
  538. <el-table-column
  539. label="计量数量"
  540. prop="minPackingCount"
  541. width="90"
  542. ></el-table-column>
  543. <el-table-column
  544. width="80"
  545. label="计量单位"
  546. prop="measuringUnit"
  547. ></el-table-column>
  548. <el-table-column label="物料代号" prop="materielCode" width="130">
  549. <template slot-scope="{ row }">
  550. {{ row.materielCode }}
  551. </template>
  552. </el-table-column>
  553. <el-table-column label="客户代号" prop="clientCode">
  554. <template slot-scope="{ row }">
  555. {{ row.clientCode }}
  556. </template>
  557. </el-table-column>
  558. <!-- v-if="infoData.bizType == 1" -->
  559. <el-table-column label="刻码" prop="engrave">
  560. <template slot-scope="{ row }">
  561. {{ row.engrave }}
  562. </template>
  563. </el-table-column>
  564. <el-table-column width="100" label="重量" prop="weight">
  565. <template slot-scope="{ row }">
  566. <el-input v-show="!row.isPack" v-model="row.weight"></el-input>
  567. <span v-show="row.isPack">{{ row.weight }}</span>
  568. </template>
  569. </el-table-column>
  570. <el-table-column label="重量单位" prop="weightUnit">
  571. <template slot-scope="{ row }">
  572. {{ row.weightUnit }}
  573. </template>
  574. </el-table-column>
  575. <el-table-column label="质检结果" prop="result" width="120">
  576. <template slot-scope="{ row }">
  577. <DictSelection
  578. dictName="质检结果"
  579. clearable
  580. v-model="row.result"
  581. v-if="!row.isPack"
  582. @updateVal="changeWrapStatus($event, row)"
  583. />
  584. <span v-else>{{ qualityResults[row.result] }}</span>
  585. </template>
  586. </el-table-column>
  587. <el-table-column label="质检状态" prop="status" width="120">
  588. <template slot-scope="{ row }">
  589. <span>{{ qualityStatus[row.status] }}</span>
  590. </template>
  591. </el-table-column>
  592. <!-- <el-table-column
  593. label="操作"
  594. width="80"
  595. fixed="right"
  596. v-if="taskDefinitionKey == 'qualityInspection'"
  597. >
  598. <template slot-scope="{ row }">
  599. <el-button
  600. v-show="!row.isPack"
  601. type="text"
  602. @click="packMeta(row)"
  603. >
  604. 保存
  605. </el-button>
  606. <el-button v-show="row.isPack" type="text" @click="edit(row)">
  607. 编辑
  608. </el-button>
  609. </template>
  610. </el-table-column> -->
  611. </el-table>
  612. </div>
  613. </div>
  614. <!-- <div class="center mt20" style="text-align: center">
  615. <el-button type="primary" @click="handleSave" :loading="saveLoading"
  616. >保存</el-button
  617. >
  618. <el-button @click="$router.go(-1)">返回</el-button>
  619. </div> -->
  620. <!-- <WareHouseDailog
  621. ref="wareHouseDailogRef"
  622. @houseData="houseData"
  623. ></WareHouseDailog> -->
  624. </el-card>
  625. </div>
  626. </template>
  627. <script>
  628. // import { getInfo } from '@/api/stockManagement';
  629. import StatusStep from '@/components/StatusStep/common.vue';
  630. // import { fileSystemDownload } from '@/utils';
  631. import outin from '@/api/warehouseManagement/outin';
  632. import fileUpload from '@/components/upload/fileUpload';
  633. import {
  634. allCategoryLevel,
  635. getTreeByPid,
  636. getOutInBySourceBizNo,
  637. getOutInBySourceBizNoOrError,
  638. updateOutInRecord,
  639. updateMaterialById
  640. } from '@/api/classifyManage';
  641. import {
  642. materialType,
  643. warehousingType,
  644. useDict,
  645. useDictLabel,
  646. inputStatus,
  647. emergencyState,
  648. sceneState
  649. } from '@/utils/dict/index';
  650. import { auditStatus } from '@/utils/dict/common';
  651. // import { batchBarPrint } from '@/api/ledgerAssets/booksList';
  652. import { tableHeader } from './common';
  653. import { mapGetters, mapActions } from 'vuex';
  654. export default {
  655. components: { StatusStep, fileUpload },
  656. props: {
  657. businessId: {
  658. default: ''
  659. },
  660. type: {
  661. default: ''
  662. },
  663. taskDefinitionKey: {
  664. default: ''
  665. }
  666. },
  667. data() {
  668. return {
  669. qualityStatus: {
  670. 0: '未检',
  671. 1: '已检',
  672. 2: '部分检'
  673. }, // 质检状态 0未检 1已检
  674. qualityResults: {
  675. 0: '合格',
  676. 1: '不合格',
  677. 3: '让步接收'
  678. },
  679. qualityFile: '',
  680. saveLoading: false,
  681. metailList: [],
  682. dateTypes: 1,
  683. detailList: [],
  684. extInfo: {},
  685. codeList: [],
  686. auditStatus,
  687. infoData: {},
  688. warehousingMaterialList: [],
  689. tableData2: [],
  690. activeName: 'a',
  691. num: 1,
  692. openWindows: false, //打印弹窗
  693. barCodeConfig: [],
  694. stepsTitle: '已完成',
  695. stepsStatus: 'success',
  696. active: 0,
  697. // 条码类型枚举
  698. codeTypeObj: {
  699. 生产设备: 'EQUIPMENT',
  700. 舟皿: '',
  701. 周转车: 'TURNOVER_CAR',
  702. 模具: 'MODE',
  703. 库位: 'STORE_LOCAL',
  704. 混合料: 'MIX_MATER',
  705. 混炼料: 'MIXING_MATER',
  706. 破碎料: 'CRUSH_MATER',
  707. 货架: 'GOODS_SHELF',
  708. 返回料: 'RETURN_MATER',
  709. 返工料: 'REWORK_MATER',
  710. 备品备件: 'SPARE_PART',
  711. 车削料: 'LATHE_MATER',
  712. 风管料: 'WIND_PIPE_MATER',
  713. 地面料: 'GROUND_MATER'
  714. }
  715. };
  716. },
  717. watch: {
  718. 'infoData.verifyStatus': {
  719. immediate: true,
  720. handler(val) {
  721. if (val == 0) {
  722. this.active = 1;
  723. this.stepsTitle = '未审核';
  724. this.stepsStatus = 'wait';
  725. } else if (val == 1) {
  726. this.active = 2;
  727. this.stepsTitle = '审核中';
  728. this.stepsStatus = 'process';
  729. } else if (val == 2) {
  730. this.active = 2;
  731. this.stepsTitle = '审核通过';
  732. this.stepsStatus = 'success';
  733. } else if (val == 3) {
  734. this.active = 2;
  735. this.stepsTitle = '驳回';
  736. this.stepsStatus = 'error';
  737. }
  738. }
  739. },
  740. // 解决右侧悬浮操作栏不对称问题
  741. warehousingMaterialList: {
  742. handler() {
  743. this.$nextTick(() => {
  744. this.$refs.warehousingMaterialListTable.doLayout();
  745. });
  746. },
  747. deep: true
  748. },
  749. // 解决右侧悬浮操作栏不对称问题
  750. detailList: {
  751. handler() {
  752. this.$nextTick(() => {
  753. this.$refs.detailListTable.doLayout();
  754. });
  755. },
  756. deep: true
  757. },
  758. // 解决右侧悬浮操作栏不对称问题
  759. metailList: {
  760. handler() {
  761. this.$nextTick(() => {
  762. this.$refs.metailListTable.doLayout();
  763. });
  764. },
  765. deep: true
  766. }
  767. },
  768. computed: {
  769. ...mapGetters(['getDictValue']),
  770. curDateType() {
  771. if (this.materialCodeReqList) {
  772. return this.materialCodeReqList[0].manufactureTime
  773. ? 'manufactureTime'
  774. : 'procurementTime';
  775. }
  776. },
  777. tableHeader() {
  778. return tableHeader(this.infoData.assetType);
  779. },
  780. emergencyState() {
  781. return useDict(emergencyState)(this.infoData.emergencyState);
  782. }
  783. // 条码信息
  784. // materialCodeReqList() {
  785. // return this.warehousingMaterialList.warehouseLedgerDetails;
  786. // }
  787. },
  788. created() {
  789. // this.requestDict('类型用途');
  790. this._getInfo();
  791. },
  792. methods: {
  793. // 选择质检结果改变质检状态
  794. changeWrapStatus(resultValue, row) {
  795. switch (resultValue) {
  796. case '':
  797. // 清空质检状态
  798. row.status = '0';
  799. break;
  800. default:
  801. // 默认已检质检状态
  802. row.status = '1';
  803. break;
  804. }
  805. },
  806. //包装结果
  807. packItem(val, row) {
  808. row.status = '1';
  809. },
  810. edit(data) {
  811. this.$set(data, 'isPack', false);
  812. },
  813. //质检物料提交
  814. async packMeta(data) {
  815. if (!data.result) {
  816. return this.$message.error('请选择质检结果!');
  817. }
  818. this.$set(data, 'isPack', true);
  819. // data.status = 1;
  820. // data.result = Number(data.result);
  821. await updateMaterialById(data);
  822. // this._getInfo();
  823. this.detailList.forEach((outItem) => {
  824. let arr = [];
  825. this.metailList.forEach((inneritem) => {
  826. if (inneritem.onlyCode == outItem.code) {
  827. arr.push(inneritem);
  828. }
  829. });
  830. console.log('arr-----------', arr);
  831. // 首先判断是未填/合格不合格
  832. let boolen = arr.every((item) => {
  833. return item.result == '' || item.result == undefined;
  834. });
  835. // 判断只要物料全部质检结果(未填)——>包装质检结果(未填) 状态(未检)
  836. if (boolen) {
  837. this.$set(outItem, 'result', '');
  838. this.$set(outItem, 'status', '0');
  839. } else {
  840. // 判断只要物料有一个质检结果(不合格)——>包装质检结果(不合格) 状态(已检)
  841. let boolen = arr.some((item) => {
  842. return item.result == '1';
  843. });
  844. if (boolen) {
  845. this.$set(outItem, 'result', '1');
  846. this.$set(outItem, 'status', '1');
  847. } else {
  848. // 判断只要物料有一个质检结果(让步接收)——>包装质检结果(让步接收) 状态(已检)
  849. let boolen = arr.some((item) => {
  850. return item.result == '3';
  851. });
  852. if (boolen) {
  853. // 让步接收 已检
  854. this.$set(outItem, 'result', '3');
  855. this.$set(outItem, 'status', '1');
  856. } else {
  857. // 判断只要物料有全部质检结果(合格)——>包装质检结果(合格) 状态(已检)
  858. let boolen = arr.every((item) => {
  859. return item.result == '0';
  860. });
  861. if (boolen) {
  862. // 合格 已检
  863. this.$set(outItem, 'result', '0');
  864. this.$set(outItem, 'status', '1');
  865. } else {
  866. // 合格 部分检
  867. this.$set(outItem, 'result', '0');
  868. this.$set(outItem, 'status', '2');
  869. }
  870. }
  871. }
  872. }
  873. // this.$set(outItem, 'result', boolen ? '1' : '0');
  874. });
  875. },
  876. //质检提交
  877. async packCout(data) {
  878. if (!data.result) {
  879. return this.$message.error('请选择质检结果!');
  880. }
  881. data.status = 1;
  882. await updateOutInRecord(data);
  883. this._getInfo();
  884. },
  885. //获取质检状态
  886. getStatus() {
  887. return this.detailList.filter((item) => item.status == 1);
  888. },
  889. //获取回执附件
  890. getQualityFile() {
  891. return { qualityFile: this.qualityFile, id: this.infoData.id };
  892. },
  893. //包装保存
  894. async packSave(row, index) {
  895. console.log('===', row);
  896. console.log('row.minPackingCount', row.minPackingCount);
  897. console.log(' this.detailList.length', this.detailList.length);
  898. console.log(this.warehousingMaterialList);
  899. let packNo = 0;
  900. this.warehousingMaterialList.forEach((item) => {
  901. if (
  902. item.categoryCode == row.categoryCode &&
  903. item.batchNo == row.batchNo
  904. ) {
  905. if (this.warehousingMaterialList.length != 1) {
  906. packNo = this.warehousingMaterialList.length;
  907. } else {
  908. packNo = item.packingCount;
  909. }
  910. }
  911. });
  912. console.log('packNopackNopackNo', packNo);
  913. if (packNo != this.detailList.length) {
  914. //存当前没改之前包装数量
  915. let count = 0;
  916. for (const item of this.warehousingMaterialList) {
  917. console.log('item', item);
  918. if (item.categoryId == row.categoryId) {
  919. count = item.outInNum;
  920. }
  921. }
  922. console.log(111);
  923. //新增包装更新物料
  924. const arr = [];
  925. console.log('==================', row);
  926. // row.outInDetailRecordVOList.forEach((it) => {
  927. // it.outInDetailRecordMaterialDetailVOList.forEach((item) => {
  928. // arr.push({ ...item });
  929. // });
  930. // });
  931. this.warehousingMaterialList.forEach((item) => {
  932. item.outInDetailRecordVOList.forEach((it) => {
  933. it.outInDetailRecordMaterialDetailVOList.forEach((item) => {
  934. arr.push({ ...item });
  935. });
  936. });
  937. });
  938. if (row.minPackingCount < Number(count)) {
  939. console.log(1);
  940. console.log('arr====arr', arr);
  941. console.log('rrrr', this.metailList.length);
  942. this.metailList = this.metaUpdate(arr, row);
  943. } else {
  944. console.log(2);
  945. this.metailList = this.metaAdd(arr, row);
  946. }
  947. this.$set(row, 'isPack', true);
  948. await updateOutInRecord(row);
  949. this.$message.success('修改成功');
  950. return;
  951. }
  952. this.$set(row, 'isPack', true);
  953. //更新包装明细数据,同步物料明细
  954. for (const i in this.metailList) {
  955. if (this.metailList[i].onlyCode == row.code) {
  956. this.metailList[i].clientCode = row.clientCode; //客户代号
  957. this.metailList[i].materielCode = row.materielCode; //物料代号
  958. this.metailList[i].result = row.result; //质检结果
  959. this.metailList[i].status = row.status; //质检状态
  960. this.metailList[i].weight = row.weight / row.minPackingCount; //重量
  961. }
  962. }
  963. //更新包装明细重量,更新物品重量
  964. const list = this.detailList;
  965. let sum = 0;
  966. for (let i = 0; i < list.length; i++) {
  967. sum += Number(list[i].weight);
  968. }
  969. await updateOutInRecord(row);
  970. this.$message.success('修改成功');
  971. this.warehousingMaterialList.forEach((item) => {
  972. if (
  973. item.categoryCode == row.categoryCode &&
  974. item.categoryCode == row.categoryCode
  975. ) {
  976. item.weight = sum;
  977. }
  978. });
  979. console.log(this.warehousingMaterialList);
  980. },
  981. //更新物料
  982. metaUpdate(arr, row) {
  983. const obj = {
  984. assetCode: row.categoryCode,
  985. assetName: row.name,
  986. batchNo: row.batchNo,
  987. clientCode: row.clientCode,
  988. createTime: row.createTime,
  989. engrave: '',
  990. id: '',
  991. materielCode: row.materielCode,
  992. measuringUnit: row.measuringUnit,
  993. minPackingCount: 1,
  994. no: '',
  995. onlyCode: row.code,
  996. outInDetailRecordId: '',
  997. pathName: row.position,
  998. result: row.result,
  999. status: row.status,
  1000. weight: row.weight / row.minPackingCount,
  1001. weightUnit: row.weightUtil,
  1002. counts: row.minPackingCount
  1003. };
  1004. // 生成 no 字段的值
  1005. let newArr = [];
  1006. for (let i = 1; i <= obj.counts; i++) {
  1007. newArr.push({
  1008. ...obj,
  1009. no: obj.onlyCode + i.toString().padStart(4, '0')
  1010. });
  1011. }
  1012. console.log('新增', newArr);
  1013. console.log(arr);
  1014. let data = this.metailList.concat(newArr);
  1015. const uniqueData = data.reduce((acc, curr) => {
  1016. acc[curr.no] = curr;
  1017. return acc;
  1018. }, {});
  1019. const result = Object.values(uniqueData);
  1020. return result;
  1021. },
  1022. //包装编辑
  1023. packEdit(row, index) {
  1024. console.log('row', row);
  1025. console.log('this.detailList', this.detailList);
  1026. this.$set(row, 'isPack', false);
  1027. this.$set(
  1028. row,
  1029. 'result',
  1030. row.result != null ? row.result.toString() : ''
  1031. );
  1032. this.$set(
  1033. row,
  1034. 'status',
  1035. row.status != null ? row.status.toString() : ''
  1036. );
  1037. },
  1038. houseData(argum, idx) {
  1039. this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
  1040. argum.forEach((item) => {
  1041. item.position = `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`;
  1042. item.pathIds = `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`;
  1043. });
  1044. console.log(argum);
  1045. this.$set(
  1046. this.warehousingMaterialList[idx],
  1047. 'position',
  1048. argum[0].position
  1049. );
  1050. console.log(
  1051. 'this.warehousingMaterialList',
  1052. this.warehousingMaterialList
  1053. );
  1054. },
  1055. // 仓库编辑
  1056. handleWareHouse(row, idx) {
  1057. const a = row.pathIds.split(',');
  1058. const b = row.position.split('-');
  1059. row.houseList = [
  1060. {
  1061. warehouseId: a[0],
  1062. warehouseNam: b[0] + '-' + b[1],
  1063. areaId: a[1],
  1064. areaName: b[2],
  1065. shelfId: a[2],
  1066. shelfCode: b[3],
  1067. cargoSpaceId: a[3],
  1068. cargoSpaceCode: b[4],
  1069. num: row.packingCount
  1070. }
  1071. ];
  1072. this.$refs.wareHouseDailogRef.open(
  1073. { ...row, outInNum: row.packingCount, warehouseId: a[0] },
  1074. idx
  1075. );
  1076. },
  1077. async handleSave() {
  1078. this.saveLoading = true;
  1079. if (this.detailList.length != 0) {
  1080. let a = this.infoData;
  1081. let array1 = this.warehousingMaterialList;
  1082. let array2 = this.detailList.map((item) => {
  1083. return { ...item, materialDetails: this.metailList };
  1084. });
  1085. // 遍历数组1
  1086. array1.forEach((item1) => {
  1087. item1.arr = [];
  1088. item1.outInDetailRecordUpdatePOList = [];
  1089. // 遍历数组2
  1090. array2.forEach((item2) => {
  1091. if (
  1092. item1.id == item2.outInDetailId &&
  1093. item1.batchNo == item2.batchNo &&
  1094. item1.categoryCode == item2.categoryCode
  1095. ) {
  1096. // 判断id、batchNo、categoryId是否相等
  1097. // 将数组2对象添加到数组1对象的outInDetailRecordVOList中
  1098. item1.arr.push(item2);
  1099. } else {
  1100. console.log(item2);
  1101. item1.outInDetailRecordUpdatePOList.push({ ...item2 });
  1102. }
  1103. });
  1104. });
  1105. array1.forEach((ele) => {
  1106. if (ele.outInDetailRecordUpdatePOList.length == ele.arr.length) {
  1107. delete ele.arr;
  1108. } else {
  1109. ele.outInDetailRecordUpdatePOList = ele.arr;
  1110. delete ele.arr;
  1111. }
  1112. });
  1113. array1.forEach((e) => {
  1114. if (e.hasOwnProperty('houseList')) {
  1115. e.houseList.forEach((item) => {
  1116. e.position = `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`;
  1117. e.pathIds = `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`;
  1118. });
  1119. }
  1120. });
  1121. delete array1.houseList;
  1122. a.outInDetailUpdatePOList = array1;
  1123. a.extInfo = this.extInfo;
  1124. const obj = this.formatUpdate(a);
  1125. console.log('sss===》', obj);
  1126. try {
  1127. const data = await outin.update(obj);
  1128. if (data.code == 0) {
  1129. this.$message.success('修改成功!');
  1130. // this.$router.push('/warehouseManagement/stockManagement');
  1131. }
  1132. } catch (error) {
  1133. this.saveLoading = false;
  1134. }
  1135. } else {
  1136. this.$message.warning('包装明细为空!');
  1137. }
  1138. this.saveLoading = false;
  1139. },
  1140. formatUpdate(a) {
  1141. delete a.outInDetailVOList;
  1142. console.log(a);
  1143. // 删除 outInDetailVOList 数组对象里面的 outInDetailRecordVOList 数组对象里面的 outInDetailRecordMaterialDetailVOList
  1144. a.outInDetailUpdatePOList = a.outInDetailUpdatePOList.map((item) => {
  1145. const newItem = { ...item };
  1146. delete newItem.outInDetailRecordVOList;
  1147. return newItem;
  1148. });
  1149. const newData = {
  1150. ...a,
  1151. outInDetailUpdatePOList: a.outInDetailUpdatePOList.map((detail) => {
  1152. const { outInDetailRecordMaterialDetailVOList, ...rest } = detail;
  1153. return {
  1154. ...rest,
  1155. outInDetailRecordUpdatePOList:
  1156. rest.outInDetailRecordUpdatePOList.map((record) => {
  1157. const {
  1158. outInDetailRecordMaterialDetailVOList,
  1159. ...recordRest
  1160. } = record;
  1161. return { ...recordRest };
  1162. })
  1163. };
  1164. })
  1165. };
  1166. // 对原始数据进行深拷贝,以避免修改原始数据
  1167. const arr = JSON.parse(JSON.stringify(newData));
  1168. // 遍历 outInDetailUpdatePOList 数组
  1169. arr.outInDetailUpdatePOList.forEach((detail) => {
  1170. // 遍历 outInDetailRecordUpdatePOList 数组
  1171. detail.outInDetailRecordUpdatePOList.forEach((record) => {
  1172. // 筛选出与 code 相等的 materialDetails 项
  1173. const matchedDetails = record.materialDetails.filter(
  1174. (item) => item.onlyCode === record.code
  1175. );
  1176. // 将匹配项放入 materialDetails 数组中
  1177. record.materialDetails = matchedDetails;
  1178. });
  1179. });
  1180. return arr;
  1181. },
  1182. packNum(row, value) {
  1183. const total = {
  1184. packingCount: Number(
  1185. row.minPackingCount > 0 ? row.minPackingCount : 0
  1186. ),
  1187. outInNum: Number(row.outInNum > 0 ? row.outInNum : 0)
  1188. };
  1189. if (row.measuringUnit == row.weightUnit) {
  1190. row.weight = Number(
  1191. this.$math.format(
  1192. total.packingCount * 1 * total.outInNum.toFixed(2),
  1193. 14
  1194. )
  1195. );
  1196. } else {
  1197. const totals = Number(
  1198. this.$math.format(total.packingCount * total.outInNum, 14)
  1199. );
  1200. row.weight = Number(
  1201. this.$math.format(
  1202. totals * (row.netWeight > 0 ? row.netWeight.toFixed(2) : 0),
  1203. 14
  1204. )
  1205. );
  1206. }
  1207. return (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''));
  1208. },
  1209. listEdit(row) {
  1210. this.$set(row, 'isSave', false);
  1211. //包装
  1212. const list = this.detailList;
  1213. for (let i = 0; i < list.length; i++) {
  1214. if (list[i].categoryCode === row.categoryCode) {
  1215. // 删除满足条件的对象
  1216. this.detailList.splice(i, 1);
  1217. // 因为删除了一个对象,需要将索引减1
  1218. i--;
  1219. }
  1220. }
  1221. //物料
  1222. const lists = this.metailList;
  1223. for (let i = 0; i < lists.length; i++) {
  1224. if (lists[i].assetCode === row.categoryCode) {
  1225. // 删除满足条件的对象
  1226. this.metailList.splice(i, 1);
  1227. // 因为删除了一个对象,需要将索引减1
  1228. i--;
  1229. }
  1230. }
  1231. },
  1232. listSave(row, index) {
  1233. console.log(row);
  1234. const fileds = [
  1235. // `warehousingMaterialList.${index}.batchNo`,
  1236. `warehousingMaterialList.${index}.position`
  1237. ];
  1238. console.log('==1', this.infoData.bizType);
  1239. if (this.infoData.bizType != 5) {
  1240. fileds.push(
  1241. ...[
  1242. // `warehousingMaterialList.${index}.packingCount`,
  1243. // `warehousingMaterialList.${index}.minPackingCount`
  1244. ]
  1245. );
  1246. } else if (
  1247. this.warehousingMaterialList.some(
  1248. (i) => !i.outInDetailRecordVOList?.length
  1249. )
  1250. ) {
  1251. this.$message.error('请选择资产编号!');
  1252. return;
  1253. }
  1254. Promise.all(
  1255. fileds.map(
  1256. (item) =>
  1257. new Promise(async (resolve, rej) => {
  1258. this.$refs.warehousingMaterialListRef.validateField(
  1259. item,
  1260. (err) => {
  1261. if (err) {
  1262. rej(err);
  1263. } else {
  1264. resolve();
  1265. }
  1266. }
  1267. );
  1268. })
  1269. )
  1270. )
  1271. .then((res) => {
  1272. this.$set(row, 'isSave', true);
  1273. if (this.infoData.bizType != 5) {
  1274. this.createMaterialCode(row);
  1275. } else {
  1276. // 退还
  1277. // this.createMaterialCodeReturn(row);
  1278. }
  1279. })
  1280. .catch((err) => {
  1281. console.log(err);
  1282. this.$message.error('请填入必填项!');
  1283. });
  1284. },
  1285. async createMaterialCode(row) {
  1286. console.log('==--', row);
  1287. const {
  1288. packingCount,
  1289. minPackingCount,
  1290. weight,
  1291. outInDetailRecordVOList
  1292. } = row;
  1293. // console.log(row);
  1294. // if (row.houseList) {
  1295. // row.houseList.forEach((item) => {
  1296. // position = `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`;
  1297. // pathIds = `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`;
  1298. // });
  1299. // }
  1300. const codes = outInDetailRecordVOList[0].code;
  1301. const index = outInDetailRecordVOList[0].code.indexOf('636');
  1302. const result = codes.slice(-3);
  1303. const dataArray = []; // 物品列表
  1304. for (let i = 0; i < packingCount; i++) {
  1305. const newData = { ...row };
  1306. if (outInDetailRecordVOList.length != packingCount) {
  1307. newData.minPackingCount = row.minPackingCount;
  1308. newData.packingCount = 1;
  1309. newData.weight = weight / packingCount;
  1310. newData.weightUtil = row.weightUnit;
  1311. newData.outInDetailId = row.id;
  1312. } else {
  1313. newData.minPackingCount = row.minPackingCount;
  1314. newData.weight = weight / packingCount;
  1315. newData.packingCount = row.packingCount / packingCount;
  1316. newData.weightUtil = row.weightUnit;
  1317. newData.outInDetailId = row.id;
  1318. }
  1319. dataArray.push(newData);
  1320. }
  1321. for (let j = 0; j < dataArray.length; j++) {
  1322. const num = Number(result);
  1323. const nums = num + j;
  1324. const str = nums.toString().padStart(result.length, '0');
  1325. dataArray[j].code =
  1326. dataArray[j].categoryCode + dataArray[j].batchNo + str;
  1327. dataArray[j].isPack = true;
  1328. }
  1329. const list = JSON.parse(localStorage.getItem('exitList'));
  1330. console.log('list', '-------------');
  1331. dataArray.forEach((ele, index) => {
  1332. if (index < list.length) {
  1333. if (ele.code === list[index].code) {
  1334. ele.id = list[index].id;
  1335. } else {
  1336. ele.isPack = false;
  1337. ele.id = ''; // 当 code 不匹配时,将 id 设为空字符串
  1338. }
  1339. } else {
  1340. ele.isPack = false;
  1341. ele.id = ''; // 如果 index 超出了 list 的范围,将 id 设为空字符串
  1342. }
  1343. });
  1344. console.log('dataArray----', dataArray);
  1345. this.detailList = this.pacKUpdate(dataArray);
  1346. this.metailList = this.metailUpdate(dataArray);
  1347. // this.metailList = this.metaAdd(dataArray);
  1348. console.log('====>>>>>1', dataArray);
  1349. },
  1350. //包装修改
  1351. pacKUpdate(arr) {
  1352. for (const it of arr) {
  1353. for (const ti of it.outInDetailRecordVOList) {
  1354. if (ti.id == it.id) {
  1355. it.materielCode = ti.materielCode;
  1356. it.clientCode = ti.clientCode;
  1357. it.result = ti.result;
  1358. it.status = ti.status;
  1359. }
  1360. }
  1361. }
  1362. return arr;
  1363. },
  1364. //物料新增
  1365. metaAdd(arr) {
  1366. const list = arr;
  1367. let resultArray = [];
  1368. list.forEach((item) => {
  1369. for (let i = 1; i <= Number(item.minPackingCount); i++) {
  1370. resultArray.push({
  1371. onlyCode: item.code,
  1372. no: item.code + i.toString().padStart(4, '0'),
  1373. assetCode: item.categoryCode,
  1374. assetName: item.name,
  1375. batchNo: item.batchNo,
  1376. minPackingCount: 1,
  1377. measuringUnit: item.measuringUnit,
  1378. materielCode: item.materielCode,
  1379. clientCode: item.clientCode,
  1380. weight: item.weight / Number(item.minPackingCount),
  1381. weightUnit: item.weightUnit,
  1382. engrave: item.engrave,
  1383. result: item.result,
  1384. status: item.status
  1385. });
  1386. }
  1387. });
  1388. return resultArray;
  1389. // console.log('物料', resultArray);
  1390. },
  1391. // 物料明细保存
  1392. materialBtn(row) {
  1393. console.log(row);
  1394. console.log(this.resultArray);
  1395. console.log(this.materialCodeReqList);
  1396. // true保存 false编辑
  1397. if (!row.isPack) {
  1398. row.isPack = true;
  1399. // 物料维度修改质检改变包装维度质检(结果和状态)
  1400. this.materialCodeReqList.forEach((outItem) => {
  1401. let arr = [];
  1402. this.resultArray.forEach((inneritem) => {
  1403. if (inneritem.onlyCode == outItem.onlyCode) {
  1404. arr.push(inneritem);
  1405. }
  1406. });
  1407. console.log(arr);
  1408. // 首先判断是未填/合格不合格
  1409. let boolen = arr.every((item) => {
  1410. return item.result === '' || item.result === undefined;
  1411. });
  1412. // 判断只要物料全部质检结果(未填)——>包装质检结果(未填) 状态(未检)
  1413. if (boolen) {
  1414. this.$set(outItem, 'result', '');
  1415. this.$set(outItem, 'status', '0');
  1416. } else {
  1417. // 判断只要物料有一个质检结果(不合格)——>包装质检结果(不合格) 状态(已检)
  1418. let boolen = arr.some((item) => {
  1419. return item.result === '1';
  1420. });
  1421. if (boolen) {
  1422. this.$set(outItem, 'result', '1');
  1423. this.$set(outItem, 'status', '1');
  1424. } else {
  1425. // 判断只要物料有一个质检结果(让步接收)——>包装质检结果(让步接收) 状态(已检)
  1426. let boolen = arr.some((item) => {
  1427. return item.result === '3';
  1428. });
  1429. if (boolen) {
  1430. // 让步接收 已检
  1431. this.$set(outItem, 'result', '3');
  1432. this.$set(outItem, 'status', '1');
  1433. } else {
  1434. // 判断只要物料有全部质检结果(合格)——>包装质检结果(合格) 状态(已检)
  1435. let boolen = arr.every((item) => {
  1436. return item.result === '0';
  1437. });
  1438. if (boolen) {
  1439. // 合格 已检
  1440. this.$set(outItem, 'result', '0');
  1441. this.$set(outItem, 'status', '1');
  1442. } else {
  1443. // 合格 部分检
  1444. this.$set(outItem, 'result', '0');
  1445. this.$set(outItem, 'status', '2');
  1446. }
  1447. }
  1448. }
  1449. }
  1450. // this.$set(outItem, 'result', boolen ? '1' : '0');
  1451. });
  1452. // 物料维度修改重量改变包装维度重量
  1453. let onlyCode = row.onlyCode;
  1454. this.materialCodeReqList.forEach((item) => {
  1455. if (item.onlyCode === onlyCode) {
  1456. let arr = [];
  1457. for (const key in this.resultArray) {
  1458. if (this.resultArray[key].onlyCode == item.onlyCode) {
  1459. arr.push({ ...this.resultArray[key] });
  1460. }
  1461. }
  1462. const count = arr.reduce(
  1463. (acc, curr) =>
  1464. Number(this.$math.format(+acc + +curr.weight, 14)),
  1465. 0
  1466. );
  1467. this.$set(item, 'weight', count);
  1468. }
  1469. });
  1470. // 包装维度修改重量改变产品信息
  1471. this.isWeight = false;
  1472. // 批量修改包装明细
  1473. this.bulkEditingWrap();
  1474. this.$nextTick(() => {
  1475. this.isWeight = true;
  1476. });
  1477. } else {
  1478. row.isPack = false;
  1479. }
  1480. },
  1481. //物料修改
  1482. metailUpdate(arr) {
  1483. console.log('---', arr);
  1484. const extractedArray = [];
  1485. arr.forEach((item) => {
  1486. item.outInDetailRecordVOList.forEach((record) => {
  1487. extractedArray.push(
  1488. ...record.outInDetailRecordMaterialDetailVOList
  1489. );
  1490. });
  1491. });
  1492. // 用于存储已经遇到的ID
  1493. let idMap = {};
  1494. // 用于存储结果的数组
  1495. let uniqueArray = [];
  1496. // 遍历原始数据
  1497. for (let i = 0; i < extractedArray.length; i++) {
  1498. let currentItem = extractedArray[i];
  1499. // 检查当前ID是否已经在map中存在
  1500. if (!idMap[currentItem.id]) {
  1501. // 如果ID不存在,将当前ID添加到map中,并将当前数据添加到结果数组中
  1502. idMap[currentItem.id] = true;
  1503. uniqueArray.push(currentItem);
  1504. }
  1505. }
  1506. return uniqueArray;
  1507. },
  1508. //计算金额
  1509. calcSumTotal(PackingCount, outInNum, univalence) {
  1510. //最小包装单元,包装数量,单价
  1511. const total = {
  1512. PackingCount: Number(PackingCount),
  1513. outInNum: Number(outInNum),
  1514. univalence: Number(univalence == undefined ? 0 : univalence)
  1515. };
  1516. return total.PackingCount * total.outInNum * total.univalence;
  1517. },
  1518. ...mapActions('dict', ['requestDict']),
  1519. getAuditStatus: useDictLabel(auditStatus),
  1520. getMaterialType: useDictLabel(materialType),
  1521. getInputStatus: useDictLabel(inputStatus),
  1522. getSceneState: useDictLabel(sceneState),
  1523. handleRowUnit(row) {
  1524. return row.measuringUnit;
  1525. // if (this.extInfo.assetType == 1) {
  1526. // console.log(row);
  1527. // return row.weightUnit;
  1528. // } else if (this.extInfo.assetType == 4) {
  1529. // return row.measuringUnit;
  1530. // } else {
  1531. // return row.measuringUnit;
  1532. // }
  1533. },
  1534. handleAssetType(r) {
  1535. const code = this.codeList.find((item) => item.dictCode == r);
  1536. return code?.dictValue;
  1537. },
  1538. rowClass({ row, column, rowIndex, columnIndex }) {
  1539. if (rowIndex === 1) {
  1540. return {
  1541. display: 'none',
  1542. background: '#EEEEEE',
  1543. border: 'none'
  1544. };
  1545. }
  1546. return { background: '#EEEEEE', border: 'none' };
  1547. },
  1548. // 初始化数据
  1549. async _getInfo() {
  1550. const res =
  1551. this.type == 'sourceBizNo'
  1552. ? await getOutInBySourceBizNo(this.businessId)
  1553. : await outin.getById(this.businessId);
  1554. console.log('===', res);
  1555. if (res) {
  1556. this.infoData = res;
  1557. this.extInfo = res.extInfo;
  1558. // 获取物品维度列表
  1559. this.warehousingMaterialList = res.outInDetailVOList.map((item) => {
  1560. return { ...item, isSave: true };
  1561. });
  1562. const arr = [];
  1563. for (const key in this.warehousingMaterialList) {
  1564. for (const k in this.warehousingMaterialList[key]
  1565. .outInDetailRecordVOList) {
  1566. arr.push({
  1567. ...this.warehousingMaterialList[key].outInDetailRecordVOList[k],
  1568. weightUnit: this.warehousingMaterialList[key].weightUnit
  1569. });
  1570. }
  1571. }
  1572. this.exitList = arr;
  1573. localStorage.setItem('exitList', JSON.stringify(arr));
  1574. this.dateTypes = arr[0].dateType;
  1575. // 获取包装维度列表
  1576. this.detailList = arr.map((item) => {
  1577. return { ...item, isPack: true };
  1578. });
  1579. let iArr = [];
  1580. arr.forEach((item) => {
  1581. item.outInDetailRecordMaterialDetailVOList.forEach((ele) => {
  1582. iArr.push({ ...ele });
  1583. });
  1584. });
  1585. this.metailList = iArr.map((item) => {
  1586. return {
  1587. ...item,
  1588. isPack: true,
  1589. result:
  1590. item.result == 0
  1591. ? '0'
  1592. : item.result != null
  1593. ? item.result.toString()
  1594. : ''
  1595. };
  1596. });
  1597. }
  1598. // const { data } = await getTreeByPid(0);
  1599. const { data } = await allCategoryLevel();
  1600. this.codeList = data.map((item) => {
  1601. return { dictCode: item.id, dictValue: item.name };
  1602. });
  1603. },
  1604. calcSum(a, b, c, row) {
  1605. if (
  1606. (Number.isNaN(+a) && a !== '') ||
  1607. (Number.isNaN(+b) && b !== '') ||
  1608. (Number.isNaN(+c) && c !== '')
  1609. ) {
  1610. return '';
  1611. }
  1612. return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit];
  1613. },
  1614. contentImageDownload(item) {
  1615. fileSystemDownload(item);
  1616. },
  1617. selectActive(num) {
  1618. this.num = num;
  1619. }
  1620. }
  1621. };
  1622. </script>
  1623. <style lang="scss" scoped>
  1624. ::v-deep .page-title {
  1625. border-bottom: none;
  1626. }
  1627. ::v-deep .page-title-div {
  1628. width: 100%;
  1629. }
  1630. .stepsStatus {
  1631. width: 40%;
  1632. margin: 0 auto;
  1633. }
  1634. .el-form-item {
  1635. margin-bottom: 10px;
  1636. }
  1637. .p20 {
  1638. padding: 20px;
  1639. }
  1640. .flex {
  1641. display: flex;
  1642. }
  1643. .title {
  1644. justify-content: space-between;
  1645. border-bottom: 1px solid #ccc;
  1646. padding-bottom: 5px;
  1647. span {
  1648. font-size: 16px;
  1649. }
  1650. .col {
  1651. padding-left: 40px;
  1652. font-size: 14px;
  1653. color: #aaaaaa;
  1654. }
  1655. }
  1656. .degree {
  1657. margin-right: 10px;
  1658. padding: 0px 15px;
  1659. color: #fff;
  1660. font-size: 13px;
  1661. line-height: 23px;
  1662. border-radius: 23px;
  1663. display: flex;
  1664. align-items: center;
  1665. justify-content: space-between;
  1666. span {
  1667. width: 5px;
  1668. height: 5px;
  1669. border-radius: 100%;
  1670. margin-right: 6px;
  1671. background-color: #fff;
  1672. }
  1673. }
  1674. .red {
  1675. background-color: rgb(163, 0, 20);
  1676. }
  1677. .blue {
  1678. background-color: #1989fa;
  1679. }
  1680. .createdInfo {
  1681. justify-content: space-around;
  1682. margin-top: 10px;
  1683. font-size: 14px;
  1684. .col {
  1685. color: #6e6e6e;
  1686. padding-right: 10px;
  1687. }
  1688. }
  1689. .mt40 {
  1690. margin-top: 40px;
  1691. }
  1692. .custSteps {
  1693. margin-top: 20px;
  1694. margin-left: 70px;
  1695. .box {
  1696. width: 158px;
  1697. border: 1px solid #ccc;
  1698. padding: 10px;
  1699. flex-direction: row;
  1700. flex-wrap: wrap;
  1701. // justify-content: space-between;
  1702. font-size: 12px;
  1703. color: #9e9e9e;
  1704. .x {
  1705. width: 20px;
  1706. height: 15px;
  1707. margin-right: 5px;
  1708. }
  1709. .q {
  1710. background-color: #d0e4d5;
  1711. }
  1712. .b {
  1713. background-color: #1989fa;
  1714. }
  1715. .g {
  1716. background-color: #157a2c;
  1717. }
  1718. .r {
  1719. background-color: #a30014;
  1720. }
  1721. .a {
  1722. align-items: center;
  1723. margin-bottom: 10px;
  1724. }
  1725. .mr10 {
  1726. margin-right: 10px;
  1727. }
  1728. .mb0 {
  1729. margin-bottom: 0;
  1730. }
  1731. }
  1732. .stepsInfo {
  1733. // flex: 1;
  1734. width: 483px;
  1735. }
  1736. }
  1737. .mt20 {
  1738. margin-top: 20px;
  1739. }
  1740. .content-detail {
  1741. overflow: hidden;
  1742. }
  1743. .executor {
  1744. font-size: 14px;
  1745. .col {
  1746. color: #6e6e6e;
  1747. padding-right: 10px;
  1748. }
  1749. }
  1750. .result {
  1751. justify-content: space-around;
  1752. }
  1753. .mr20 {
  1754. margin-right: 20px;
  1755. }
  1756. .details {
  1757. font-size: 14px;
  1758. margin-bottom: 10px;
  1759. }
  1760. .customSteps {
  1761. margin-top: 40px;
  1762. font-size: 14px;
  1763. margin-left: 80px;
  1764. .time {
  1765. font-size: 12px;
  1766. color: #6e6e6e;
  1767. margin-right: 20px;
  1768. position: relative;
  1769. &::after {
  1770. content: '';
  1771. width: 1px;
  1772. height: 100%;
  1773. background-color: #157a2c;
  1774. position: absolute;
  1775. right: -26px;
  1776. }
  1777. }
  1778. .flex:last-child {
  1779. .time {
  1780. &::after {
  1781. display: none;
  1782. }
  1783. }
  1784. }
  1785. .round {
  1786. margin-right: 20px;
  1787. width: 10px;
  1788. height: 10px;
  1789. border-radius: 100%;
  1790. background-color: #157a2c;
  1791. position: relative;
  1792. span {
  1793. position: absolute;
  1794. top: 50%;
  1795. left: 50%;
  1796. width: 4px;
  1797. height: 4px;
  1798. background-color: #fff;
  1799. border-radius: 100%;
  1800. transform: translate(-2px, -2px);
  1801. }
  1802. }
  1803. .text {
  1804. .info {
  1805. margin-top: 10px;
  1806. width: 955px;
  1807. background-color: #f0f3f3;
  1808. overflow: hidden;
  1809. padding: 10px;
  1810. margin-bottom: 10px;
  1811. }
  1812. }
  1813. }
  1814. .switch_left li {
  1815. border-right: 1px solid rgba(222, 222, 222, 1);
  1816. border-left: 1px solid rgba(222, 222, 222, 1);
  1817. }
  1818. </style>