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