detailDialog.vue 62 KB

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