add.vue 86 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <header-title title="基本信息"></header-title>
  5. <el-form
  6. :model="formData"
  7. ref="formName"
  8. label-width="110px"
  9. :rules="rules"
  10. >
  11. <el-row :gutter="20">
  12. <!-- <el-col :span="8">
  13. <el-form-item label="入库单号" prop="bizNum">
  14. <el-input :value="formData.bizNum" disabled /></el-form-item
  15. ></el-col> -->
  16. <!-- <el-col :span="8">
  17. <el-form-item label="仓库" prop="warehouseId">
  18. <el-select
  19. filterable
  20. v-model="formData.warehouseId"
  21. clearable
  22. :disabled="
  23. !!(warehousingMaterialList && warehousingMaterialList.length)
  24. "
  25. >
  26. <el-option
  27. v-for="(item, index) in warehouseList"
  28. :key="index"
  29. :label="item.name"
  30. :value="item.id"
  31. @click.native="warehouse = item"
  32. ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. </el-col> -->
  36. <el-col :span="8">
  37. <el-form-item label="物品类型" prop="extInfo.assetType">
  38. <!-- <DictSelection
  39. dictName="类型用途"
  40. :disabled="
  41. !!(warehousingMaterialList && warehousingMaterialList.length)
  42. "
  43. clearable
  44. v-model="formData.extInfo.assetType"
  45. @itemChange="handleChange"
  46. /> -->
  47. <!-- <el-select
  48. :disabled="
  49. !!(warehousingMaterialList && warehousingMaterialList.length)
  50. "
  51. clearable
  52. v-model="formData.extInfo.assetType"
  53. @change="handleChanges"
  54. >
  55. <el-option
  56. v-for="(item, index) in codeList"
  57. :key="index"
  58. :label="item.dictValue"
  59. :value="item.dictCode"
  60. ></el-option>
  61. </el-select> -->
  62. <selectTree
  63. ref="tree"
  64. class="form-ipt"
  65. size="medium"
  66. style="width: 100%"
  67. :value="formData.extInfo.assetType"
  68. clearable
  69. :options="codeList"
  70. :props="{
  71. value: 'id',
  72. label: 'name',
  73. children: 'children'
  74. }"
  75. @getValue="codeListValue"
  76. :isAll="false"
  77. />
  78. </el-form-item>
  79. </el-col>
  80. <el-col :span="8">
  81. <el-form-item label="入库类型" prop="bizType">
  82. <el-select
  83. @change="onClear"
  84. filterable
  85. placeholder="请选择"
  86. v-model="formData.bizType"
  87. clearable
  88. :disabled="
  89. !!(warehousingMaterialList && warehousingMaterialList.length)
  90. "
  91. >
  92. <el-option
  93. v-for="item in sceneState"
  94. :key="item.code"
  95. :value="item.code + ''"
  96. :label="item.label"
  97. ></el-option>
  98. </el-select> </el-form-item
  99. ></el-col>
  100. <el-col :span="8">
  101. <el-form-item
  102. v-if="formData.bizType == 2"
  103. label="采购收货单"
  104. prop="documentSource"
  105. >
  106. <el-input
  107. placeholder="请输入"
  108. v-model="formData.extInfo.documentSource"
  109. @click.native="handlePicker()"
  110. :disabled="isTask"
  111. >
  112. <el-button
  113. slot="append"
  114. icon="el-icon-circle-close"
  115. @click.stop="onClear"
  116. ></el-button>
  117. </el-input>
  118. </el-form-item>
  119. <el-form-item
  120. v-if="formData.bizType == 1"
  121. label="生产工单"
  122. prop="documentSource"
  123. >
  124. <el-input
  125. placeholder="请输入"
  126. clearable
  127. v-model="formData.extInfo.documentSource"
  128. /></el-form-item>
  129. <el-form-item
  130. v-if="
  131. formData.bizType != 1 &&
  132. formData.bizType != 2 &&
  133. formData.bizType != 3
  134. "
  135. label="销售订单"
  136. prop="documentSource"
  137. >
  138. <el-input
  139. placeholder="请输入"
  140. clearable
  141. v-model="formData.extInfo.documentSource"
  142. /></el-form-item>
  143. <el-form-item
  144. v-if="formData.bizType == 3"
  145. label="出库单"
  146. prop="documentSource"
  147. >
  148. <el-input
  149. placeholder="请输入"
  150. clearable
  151. v-model="formData.extInfo.documentSource"
  152. /></el-form-item>
  153. </el-col>
  154. <el-col :span="8">
  155. <el-form-item label="权属部门" prop="deptName">
  156. <el-input
  157. placeholder="权属部门"
  158. disabled
  159. v-model="formData.extInfo.deptName"
  160. clearable
  161. />
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="8">
  165. <el-form-item label="入库登记人">
  166. <el-input
  167. placeholder="登记人"
  168. disabled
  169. v-model="formData.extInfo.createUserName"
  170. clearable /></el-form-item
  171. ></el-col>
  172. <!-- <el-col :span="8">
  173. <el-form-item label="入库时间" prop="outInTime">
  174. <el-date-picker
  175. v-model="formData.outInTime"
  176. clearable
  177. type="datetime"
  178. value-format="yyyy-MM-dd HH:mm:ss"
  179. placeholder="选择日期"
  180. >
  181. </el-date-picker></el-form-item
  182. ></el-col> -->
  183. <el-col :span="8" v-if="formData.bizType == 2">
  184. <el-form-item label="供应商" prop="supplierName">
  185. <!-- <DictSelection
  186. dictName="经销商列表"
  187. clearable
  188. v-model="formData.extInfo.supplierId"
  189. @itemChange="ChangeSupplier"
  190. /> -->
  191. <el-input
  192. placeholder="请输入"
  193. clearable
  194. v-model="formData.extInfo.supplierName"
  195. />
  196. </el-form-item>
  197. </el-col>
  198. <!-- <el-col :span="8" v-if="formData.bizType == 2">
  199. <el-form-item label="物料代号" prop="supplierCode">
  200. <el-input
  201. placeholder="请输入"
  202. v-model="formData.supplierCode"
  203. clearable /></el-form-item
  204. ></el-col> -->
  205. <!-- <el-col :span="8" v-if="formData.bizType == 2">
  206. <el-form-item label="客户" prop="clientName">
  207. <el-input
  208. placeholder="请输入"
  209. clearable
  210. v-model="formData.clientName"
  211. />
  212. </el-form-item>
  213. </el-col> -->
  214. <!-- <el-col :span="8" v-if="formData.bizType == 2">
  215. <el-form-item label="客户代号" prop="clientCode">
  216. <el-input
  217. placeholder="请输入"
  218. v-model="formData.clientCode"
  219. clearable /></el-form-item
  220. ></el-col> -->
  221. <!-- <el-col :span="8">
  222. <el-form-item label="送货人" prop="fromUser">
  223. <el-input
  224. placeholder="请输入"
  225. v-model="formData.fromUser"
  226. clearable /></el-form-item
  227. ></el-col> -->
  228. <el-col :span="8">
  229. <el-form-item label="送货人" prop="fromUser">
  230. <el-input
  231. placeholder="请输入"
  232. v-model="formData.fromUser"
  233. clearable
  234. />
  235. <!-- <el-select
  236. v-model="formData.fromUser"
  237. filterable
  238. placeholder="请选择送货人"
  239. >
  240. <el-option
  241. v-for="item in contactList"
  242. :key="item.id"
  243. :label="item.linkName"
  244. :value="item.id"
  245. @click.native="
  246. () => (formData.extInfo.deliveryPhone = item.mobilePhone)
  247. "
  248. >
  249. </el-option>
  250. </el-select> -->
  251. </el-form-item></el-col
  252. >
  253. <el-col :span="8">
  254. <el-form-item label="送货人联系方式" prop="deliveryPhone">
  255. <el-input
  256. placeholder="请输入"
  257. v-model="formData.extInfo.deliveryPhone"
  258. clearable /></el-form-item
  259. ></el-col>
  260. <!-- <el-col :span="8">
  261. <el-form-item label="紧急状态" prop="urgent">
  262. <el-select
  263. filterable
  264. placeholder="请选择"
  265. v-model="formData.extInfo.urgent"
  266. clearable
  267. >
  268. <el-option
  269. v-for="item in emergencyState"
  270. :key="item.code"
  271. :value="item.code"
  272. :label="item.label"
  273. ></el-option>
  274. </el-select> </el-form-item
  275. ></el-col> -->
  276. <!-- <el-col :span="8">
  277. <el-form-item label="审核人部门" prop="verifyDeptName">
  278. <selectTree
  279. ref="tree"
  280. class="form-ipt"
  281. size="medium"
  282. style="width: 100%"
  283. clearable
  284. :options="treeList"
  285. :props="{
  286. value: 'code',
  287. label: 'name',
  288. children: 'children'
  289. }"
  290. @getValue="auditorDeptClick"
  291. />
  292. </el-form-item>
  293. </el-col>
  294. <el-col :span="8">
  295. <el-form-item label="审核人" prop="verifyId">
  296. <el-select
  297. filterable
  298. class="form-ipt"
  299. style="width: 100%"
  300. v-model="formData.verifyId"
  301. placeholder="请选择"
  302. >
  303. <el-option
  304. v-for="item in staffList"
  305. :key="item.id"
  306. :label="item.name"
  307. :value="item.id"
  308. @click.native="changeVerfy(item)"
  309. >
  310. </el-option>
  311. </el-select>
  312. </el-form-item>
  313. </el-col> -->
  314. <!-- <el-col :span="24">
  315. <el-form-item label="附件" prop="contentImage">
  316. <selectUpload @getImgs="upload" :initData="uploadList" />
  317. </el-form-item>
  318. </el-col> -->
  319. <el-col :span="24">
  320. <el-form-item label="备注" prop="remark">
  321. <el-input
  322. v-model="formData.remark"
  323. clearable
  324. type="textarea"
  325. placeholder="请详细说明"
  326. :rows="4"
  327. ></el-input>
  328. </el-form-item>
  329. </el-col>
  330. </el-row>
  331. </el-form>
  332. <div class="material">
  333. <header-title title="产品信息">
  334. <el-button type="primary" @click="addStock" v-if="!isTask"
  335. >添加</el-button
  336. >
  337. </header-title>
  338. <div class="mt10 form-table">
  339. <el-form
  340. ref="warehousingMaterialListRef"
  341. :model="{ warehousingMaterialList: warehousingMaterialList }"
  342. :show-message="false"
  343. >
  344. <el-button
  345. v-if="warehousingMaterialList.length != 0"
  346. type="success"
  347. plain
  348. style="margin-bottom: 20px; float: right; margin-right: 20px"
  349. size="mini"
  350. @click="listSaveArrs"
  351. >批量保存</el-button
  352. >
  353. <el-table
  354. v-if="isWeight"
  355. :header-cell-style="rowClass"
  356. ref="warehousingMaterialListTable"
  357. :key="formData.extInfo.assetType"
  358. :data="warehousingMaterialList"
  359. tooltip-effect="dark"
  360. style="width: 100%"
  361. stripe
  362. >
  363. <el-table-column
  364. label="序号"
  365. type="index"
  366. width="50"
  367. align="center"
  368. >
  369. </el-table-column>
  370. <el-table-column
  371. label="编码"
  372. prop="assetCode"
  373. align="center"
  374. width="130"
  375. ></el-table-column>
  376. <el-table-column
  377. label="名称"
  378. align="center"
  379. width="200"
  380. prop="assetName"
  381. ></el-table-column>
  382. <!-- <el-table-column
  383. label="客户编码"
  384. align="center"
  385. width="150"
  386. prop="customCode"
  387. v-if="formData.bizType == 1"
  388. >
  389. <template slot-scope="{ row, $index }">
  390. <template v-if="row.isSave">
  391. {{ row.customCode }}
  392. </template>
  393. <el-form-item
  394. v-else
  395. :prop="`warehousingMaterialList.${$index}.customCode`"
  396. required
  397. >
  398. <el-input v-model="row.customCode"> </el-input>
  399. </el-form-item>
  400. </template>
  401. </el-table-column>
  402. <el-table-column
  403. label="供应商编码"
  404. align="center"
  405. width="150"
  406. prop="customCode"
  407. v-if="formData.bizType == 2"
  408. >
  409. <template slot-scope="{ row, $index }">
  410. <template v-if="row.isSave">
  411. {{ row.supplierCode }}
  412. </template>
  413. <el-form-item
  414. v-else
  415. :prop="`warehousingMaterialList.${$index}.supplierCode`"
  416. required
  417. >
  418. <el-input v-model="row.supplierCode"> </el-input>
  419. </el-form-item>
  420. </template>
  421. </el-table-column> -->
  422. <el-table-column
  423. v-for="(item, index) in tableHeader"
  424. :key="index"
  425. align="center"
  426. :label="item.label"
  427. width="150"
  428. :prop="item.prop"
  429. >
  430. <template slot-scope="{ row }">
  431. <template v-if="item.formatter">{{
  432. item.formatter(row)
  433. }}</template>
  434. <template v-else>{{ row[item.prop] }}</template>
  435. </template>
  436. </el-table-column>
  437. <el-table-column
  438. label="批次号"
  439. prop="batchNo"
  440. width="70"
  441. align="center"
  442. >
  443. <template slot-scope="{ row, $index }">
  444. <template v-if="row.isSave">
  445. {{ row.batchNo }}
  446. </template>
  447. <el-form-item
  448. v-else
  449. :prop="`warehousingMaterialList.${$index}.batchNo`"
  450. required
  451. >
  452. <!-- <el-input v-model="row.batchNo"></el-input> -->
  453. {{ row.batchNo }}
  454. </el-form-item>
  455. </template>
  456. </el-table-column>
  457. <el-table-column
  458. label="最小包装单元"
  459. align="center"
  460. prop="minPackingCount"
  461. width="100"
  462. >
  463. <el-table-column label="" prop="minPackingCount" width="100">
  464. <template slot-scope="{ row, $index }">
  465. <template v-if="row.isSave">
  466. {{ row.minPackingCount }}
  467. </template>
  468. <el-form-item
  469. v-else
  470. :prop="`warehousingMaterialList.${$index}.minPackingCount`"
  471. required
  472. >
  473. <el-input
  474. v-model="row.minPackingCount"
  475. @input="minPackingCountChange(row, $event)"
  476. >
  477. </el-input>
  478. </el-form-item>
  479. </template>
  480. </el-table-column>
  481. <el-table-column label="" prop="minPackingCount">
  482. <template slot-scope="{ row, $index }">
  483. {{ handleRowUnit(row) }} /{{ row.minPackUnit }}
  484. </template>
  485. </el-table-column>
  486. </el-table-column>
  487. <el-table-column
  488. label="包装数量"
  489. prop="outInNum"
  490. width="150"
  491. align="center"
  492. >
  493. <template slot-scope="{ row, $index }">
  494. <template v-if="row.isSave || formData.bizType == 5">
  495. {{ row.outInNum }} {{ row.minPackUnit }}
  496. </template>
  497. <el-form-item
  498. v-else
  499. :prop="`warehousingMaterialList.${$index}.outInNum`"
  500. required
  501. >
  502. <el-input
  503. v-model="row.outInNum"
  504. @input="packNum(row, $event)"
  505. >
  506. <template slot="append">
  507. {{ row.minPackUnit ? row.minPackUnit : '/' }}
  508. </template>
  509. </el-input>
  510. </el-form-item>
  511. </template>
  512. </el-table-column>
  513. <el-table-column label="计量数量" prop="counts">
  514. <template slot-scope="{ row, $index }">
  515. {{ row.minPackingCount * row.outInNum }}
  516. </template>
  517. </el-table-column>
  518. <el-table-column
  519. label="计量单位"
  520. prop="batchNo"
  521. width="100"
  522. align="center"
  523. >
  524. <!-- v-if="formData.extInfo.assetType == 1" -->
  525. <template slot-scope="{ row, $index }">
  526. <template>
  527. {{ row.measuringUnit }}
  528. </template>
  529. </template>
  530. </el-table-column>
  531. <!-- <el-table-column
  532. label="计量单位"
  533. prop="batchNo"
  534. width="100"
  535. align="center"
  536. v-if="formData.extInfo.assetType == 4"
  537. >
  538. <template slot-scope="{ row, $index }">
  539. <template>
  540. {{ row.measuringUnit }}
  541. </template>
  542. </template>
  543. </el-table-column> -->
  544. <!-- <el-table-column
  545. label="数量"
  546. prop="batchNo"
  547. width="150"
  548. align="center"
  549. v-if="formData.extInfo.assetType == 1"
  550. >
  551. <template slot-scope="{ row, $index }">
  552. <template> {{ row.outInNum }} </template>
  553. </template>
  554. </el-table-column>
  555. <el-table-column
  556. label="数量"
  557. prop="batchNo"
  558. width="150"
  559. align="center"
  560. v-if="formData.extInfo.assetType == 4"
  561. >
  562. <template slot-scope="{ row, $index }">
  563. <template>
  564. {{ row.minPackingCount * row.outInNum }}
  565. </template>
  566. </template>
  567. </el-table-column> -->
  568. <el-table-column
  569. label="重量"
  570. align="center"
  571. prop="contentImage"
  572. :show-overflow-tooltip="true"
  573. >
  574. <!-- v-if="formData.extInfo.assetType == 1" -->
  575. <template slot-scope="{ row, $index }">
  576. {{ row.weight }}
  577. <template slot="append">
  578. {{ handleRowUnit(row) }}
  579. <!-- {{
  580. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  581. }} -->
  582. </template>
  583. </template>
  584. </el-table-column>
  585. <!-- <el-table-column
  586. label="重量"
  587. align="center"
  588. prop="contentImage"
  589. :show-overflow-tooltip="true"
  590. v-if="formData.extInfo.assetType == 4"
  591. >
  592. <template slot-scope="{ row, $index }">
  593. {{
  594. deviceWeight(
  595. row.roughWeight,
  596. row.minPackingCount * row.outInNum
  597. )
  598. }}
  599. <template slot="append"> -->
  600. <!-- {{ handleRowUnit(row) }} -->
  601. <!-- {{
  602. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  603. }} -->
  604. <!-- </template>
  605. </template>
  606. </el-table-column> -->
  607. <el-table-column
  608. label="重量单位"
  609. align="center"
  610. prop="contentImage"
  611. :show-overflow-tooltip="true"
  612. >
  613. <template slot-scope="{ row, $index }">
  614. {{ row.weightUnit }}
  615. <template slot="append"> </template>
  616. </template>
  617. </el-table-column>
  618. <el-table-column
  619. label="单价"
  620. prop="univalence"
  621. width="150"
  622. align="center"
  623. >
  624. <template slot-scope="{ row, $index }">
  625. <!-- <template v-if="row.isSave || formData.bizType == 5">
  626. <template v-if="row.univalence || row.univalence === 0">
  627. {{ row.univalence
  628. }}{{
  629. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  630. }}
  631. </template>
  632. </template> -->
  633. <!-- v-else -->
  634. <el-form-item
  635. :prop="`warehousingMaterialList.${$index}.univalence`"
  636. >
  637. <el-input
  638. v-model="row.univalence"
  639. placeholder="非必填"
  640. @input="
  641. (value) =>
  642. (row.univalence = value.replace(/[^0-9.]+/g, ''))
  643. "
  644. >
  645. <template slot="append">
  646. 元/{{ handleRowUnit(row) }}
  647. <!-- {{
  648. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  649. }} -->
  650. </template>
  651. </el-input>
  652. </el-form-item>
  653. </template>
  654. </el-table-column>
  655. <el-table-column
  656. label="金额"
  657. align="center"
  658. prop="contentImage"
  659. :show-overflow-tooltip="true"
  660. >
  661. <template slot-scope="{ row, $index }">
  662. {{
  663. calcSumTotal(
  664. row.outInNum,
  665. row.minPackingCount,
  666. row.univalence,
  667. row
  668. )
  669. }}
  670. </template>
  671. </el-table-column>
  672. <el-table-column
  673. label="货位"
  674. prop="warehouseName"
  675. :show-overflow-tooltip="true"
  676. width="250"
  677. required
  678. >
  679. <template slot-scope="{ row, $index }">
  680. <el-form-item
  681. :prop="`warehousingMaterialList.${$index}.houseList`"
  682. :required="true"
  683. >
  684. <div @click="handleWareHouse(row, $index)">
  685. <div
  686. style="color: #ff4949"
  687. v-if="row.houseList.length == 0"
  688. >
  689. ---(必填)
  690. </div>
  691. <div v-else>
  692. <div
  693. class="fontOmitted"
  694. v-for="(item, index) in row.houseList"
  695. :key="index"
  696. >
  697. {{ item.warehouseName }}- {{ item.areaName }}-
  698. {{ item.shelfCode }}- {{ item.cargoSpaceCode
  699. }}<span style="color: #ff4949" v-if="item.num">
  700. - {{ item.num }}(数)</span
  701. >
  702. <br />
  703. </div>
  704. </div>
  705. </div>
  706. </el-form-item>
  707. </template>
  708. </el-table-column>
  709. <el-table-column
  710. label="质检单"
  711. v-if="formData.extInfo.assetType === 3"
  712. prop="contentImage"
  713. :show-overflow-tooltip="true"
  714. >
  715. <template slot-scope="{ row, $index }">
  716. <upload @on-success="(data) => (row.contentImage = [data])"
  717. ><template slot="placeholder">上传</template></upload
  718. >
  719. </template>
  720. </el-table-column>
  721. <el-table-column
  722. label="操作"
  723. width="200"
  724. fixed="right"
  725. align="center"
  726. >
  727. <template slot="header" slot-scope="scope"> 操作 </template>
  728. <template slot-scope="{ row, $index }">
  729. <el-button
  730. type="text"
  731. v-show="!row.isSave"
  732. @click="listSave(row, $index)"
  733. >保存</el-button
  734. >
  735. <el-button
  736. type="text"
  737. v-show="row.isSave"
  738. @click="listEdit(row, $index)"
  739. >编辑</el-button
  740. >
  741. <el-button
  742. type="text"
  743. v-if="formData.bizType == 5"
  744. v-show="!row.isSave"
  745. @click="chooseAssets(row, $index)"
  746. >选择资产编号</el-button
  747. >
  748. <el-button
  749. type="text"
  750. @click="listDel(row, $index)"
  751. v-if="!isTask"
  752. >删除</el-button
  753. >
  754. </template>
  755. </el-table-column>
  756. </el-table>
  757. </el-form>
  758. </div>
  759. <div class="mt20">
  760. <header-title :title="`包装明细`">
  761. <div class="switch_right">
  762. <span v-if="materialCodeReqList.length != 0">
  763. 分拆<el-switch
  764. v-model="isDetail"
  765. active-color="#13ce66"
  766. inactive-color="#ff4949"
  767. @change="handleIsDetail"
  768. style="margin-left: 10px"
  769. >
  770. </el-switch>
  771. </span>
  772. <el-button
  773. style="margin-left: 20px"
  774. type="text"
  775. @click="dateSetting"
  776. v-if="formData.bizType != 5"
  777. >批量设置{{
  778. curDateType === 'manufactureTime' ? '生产日期' : '采购日期'
  779. }}</el-button
  780. >
  781. </div>
  782. </header-title>
  783. <el-button
  784. v-if="materialCodeReqList.length != 0"
  785. type="success"
  786. plain
  787. style="margin-bottom: 20px; float: right; margin-right: 20px"
  788. size="mini"
  789. @click="wrapListSave"
  790. >批量保存</el-button
  791. >
  792. <el-table
  793. ref="materialCodeReqListTable"
  794. :data="materialCodeReqList"
  795. tooltip-effect="dark"
  796. :key="formData.bizType"
  797. :header-cell-style="rowClass"
  798. style="width: 100%"
  799. stripe
  800. height="300px"
  801. @selection-change="handleSelectionChange"
  802. >
  803. <el-table-column
  804. label=""
  805. type="selection"
  806. align="center"
  807. width="50"
  808. v-if="formData.bizType != 5"
  809. >
  810. </el-table-column>
  811. <el-table-column label="序号" type="index" width="50">
  812. </el-table-column>
  813. <el-table-column
  814. label="编码"
  815. prop="assetCode"
  816. width="130"
  817. :show-overflow-tooltip="true"
  818. ></el-table-column>
  819. <el-table-column
  820. label="名称"
  821. prop="assetName"
  822. width="150"
  823. :show-overflow-tooltip="true"
  824. ></el-table-column>
  825. <el-table-column
  826. label="批次号"
  827. prop="batchNo"
  828. width="70"
  829. ></el-table-column>
  830. <el-table-column
  831. :label="`包装编码`"
  832. prop="onlyCode"
  833. width="130"
  834. :show-overflow-tooltip="true"
  835. ></el-table-column>
  836. <el-table-column
  837. label="包装数量"
  838. prop="packingCount"
  839. width="80"
  840. ></el-table-column>
  841. <el-table-column
  842. label="包装单位"
  843. prop="packingUnit"
  844. ></el-table-column>
  845. <el-table-column
  846. label="计量数量"
  847. prop="minPackingCount"
  848. ></el-table-column>
  849. <el-table-column
  850. label="计量单位"
  851. prop="measuringUnit"
  852. ></el-table-column>
  853. <el-table-column label="物料代号" prop="materielCode">
  854. <template slot-scope="{ row }">
  855. <el-input
  856. v-if="!row.isPack"
  857. v-model="row.materielCode"
  858. ></el-input>
  859. <span v-else>{{ row.materielCode }}</span>
  860. </template>
  861. </el-table-column>
  862. <el-table-column label="客户代号" prop="clientCode">
  863. <template slot-scope="{ row }">
  864. <el-input
  865. v-if="!row.isPack"
  866. v-model="row.clientCode"
  867. ></el-input>
  868. <span v-else> {{ row.clientCode }}</span>
  869. </template>
  870. </el-table-column>
  871. <el-table-column label="刻码" prop="engrave">
  872. <template slot-scope="{ row }">
  873. <el-input v-if="!row.isPack" v-model="row.engrave"></el-input>
  874. <span v-else>{{ row.engrave }}</span>
  875. </template>
  876. </el-table-column>
  877. <el-table-column label="重量" prop="weight" width="100">
  878. <template slot-scope="{ row }">
  879. <el-input
  880. v-if="!row.isPack"
  881. v-model="row.weight"
  882. @input="weightInput($event, row)"
  883. ></el-input>
  884. <span v-else>{{ row.weight }}</span>
  885. </template>
  886. </el-table-column>
  887. <el-table-column label="重量单位" prop="weightUtil">
  888. <template slot-scope="{ row }">
  889. {{ row.weightUtil }}
  890. </template>
  891. </el-table-column>
  892. <el-table-column label="质检结果" prop="result" width="120">
  893. <template slot-scope="{ row }">
  894. <DictSelection
  895. dictName="质检结果"
  896. clearable
  897. v-model="row.result"
  898. v-if="!row.isPack"
  899. @updateVal="changeWrapStatus($event, row)"
  900. />
  901. <span v-else>{{ qualityResults[row.result] }}</span>
  902. </template>
  903. </el-table-column>
  904. <el-table-column label="质检状态" prop="status" width="120">
  905. <template slot-scope="{ row }">
  906. <span>{{ qualityStatus[row.status] }}</span>
  907. </template>
  908. </el-table-column>
  909. <el-table-column
  910. v-if="formData.bizType != 5"
  911. label="生产日期"
  912. prop=""
  913. width="220"
  914. >
  915. <template slot="header" slot-scope="scope">
  916. <el-select filterable v-model="curDateType">
  917. <el-option
  918. value="manufactureTime"
  919. label="生产日期"
  920. ></el-option>
  921. <el-option
  922. value="procurementTime"
  923. label="采购日期"
  924. ></el-option>
  925. </el-select>
  926. </template>
  927. <template slot-scope="{ row }">
  928. <template v-if="formData.bizType == 5">
  929. {{ row[curDateType] }}
  930. </template>
  931. <el-date-picker
  932. v-else
  933. :disabled="row.ispack"
  934. size="small"
  935. v-model="row[curDateType]"
  936. type="datetime"
  937. value-format="yyyy-MM-dd HH:mm:ss"
  938. placeholder="选择日期"
  939. >
  940. </el-date-picker>
  941. </template>
  942. </el-table-column>
  943. <template v-else>
  944. <el-table-column
  945. label="生产日期"
  946. prop="manufactureTime"
  947. width="200"
  948. ></el-table-column>
  949. <el-table-column
  950. label="采购日期"
  951. prop="procurementTime"
  952. width="200"
  953. ></el-table-column>
  954. </template>
  955. <el-table-column label="操作" width="80" fixed="right">
  956. <template slot-scope="{ row }">
  957. <el-button type="text" @click="packCout(row)">
  958. {{ !row.isPack ? '保存' : '编辑' }}
  959. </el-button>
  960. </template>
  961. </el-table-column>
  962. </el-table>
  963. <!-- </el-tab-pane>
  964. </el-tabs> -->
  965. </div>
  966. <div class="mt20" v-if="isDetail">
  967. <header-title :title="`物料明细`"> </header-title>
  968. <el-button
  969. v-if="resultArray.length != 0"
  970. type="success"
  971. plain
  972. style="margin-bottom: 20px; float: right; margin-right: 20px"
  973. size="mini"
  974. @click="materialListSave"
  975. >批量保存</el-button
  976. >
  977. <el-table
  978. ref="resultArrayTable"
  979. :data="resultArray"
  980. tooltip-effect="dark"
  981. :key="formData.bizType"
  982. :header-cell-style="rowClass"
  983. style="width: 100%"
  984. stripe
  985. height="300px"
  986. @selection-change="handleSelectionChange"
  987. >
  988. <el-table-column label="序号" type="index" width="50">
  989. </el-table-column>
  990. <el-table-column
  991. label="编码"
  992. prop="assetCode"
  993. :show-overflow-tooltip="true"
  994. ></el-table-column>
  995. <el-table-column
  996. label="名称"
  997. prop="assetName"
  998. width="200"
  999. :show-overflow-tooltip="true"
  1000. ></el-table-column>
  1001. <el-table-column
  1002. label="批次号"
  1003. prop="batchNo"
  1004. width="80"
  1005. ></el-table-column>
  1006. <el-table-column
  1007. label="物料编码"
  1008. prop="no"
  1009. width="200"
  1010. :show-overflow-tooltip="true"
  1011. ></el-table-column>
  1012. <el-table-column
  1013. label="计量数量"
  1014. prop="minPackingCount"
  1015. width="90"
  1016. ></el-table-column>
  1017. <el-table-column
  1018. width="80"
  1019. label="计量单位"
  1020. prop="measuringUnit"
  1021. ></el-table-column>
  1022. <el-table-column label="物料代号" prop="meterielCode">
  1023. <template slot-scope="{ row }">
  1024. <el-input
  1025. v-model="row.materielCode"
  1026. v-if="!row.isPack"
  1027. ></el-input>
  1028. <span v-else>{{ row.materialCode }}</span>
  1029. </template>
  1030. </el-table-column>
  1031. <el-table-column label="客户代号" prop="clientCode">
  1032. <template slot-scope="{ row }">
  1033. <el-input
  1034. v-model="row.clientCode"
  1035. v-if="!row.isPack"
  1036. ></el-input>
  1037. <span v-else> {{ row.clientCode }}</span>
  1038. </template>
  1039. </el-table-column>
  1040. <el-table-column label="刻码" prop="engrave">
  1041. <template slot-scope="{ row }">
  1042. <el-input v-model="row.engrave" v-if="!row.isPack"></el-input>
  1043. <span v-else> {{ row.engrave }}</span>
  1044. </template>
  1045. </el-table-column>
  1046. <el-table-column width="100" label="重量" prop="weight">
  1047. <template slot-scope="{ row }">
  1048. <el-input v-model="row.weight" v-if="!row.isPack"></el-input>
  1049. <span v-else>{{ row.weight }}</span>
  1050. </template>
  1051. </el-table-column>
  1052. <el-table-column label="重量单位" prop="weightUnit" width="100">
  1053. </el-table-column>
  1054. <el-table-column label="质检结果" prop="result" width="120">
  1055. <template slot-scope="{ row }">
  1056. <DictSelection
  1057. dictName="质检结果"
  1058. clearable
  1059. v-model="row.result"
  1060. v-if="!row.isPack"
  1061. @updateVal="changeWrapStatus($event, row)"
  1062. />
  1063. <span v-else>{{ qualityResults[row.result] }}</span>
  1064. </template>
  1065. </el-table-column>
  1066. <el-table-column label="质检状态" prop="status" width="120">
  1067. <template slot-scope="{ row }">
  1068. <span>{{ qualityStatus[row.status] }}</span>
  1069. </template>
  1070. </el-table-column>
  1071. <el-table-column label="操作" width="80" fixed="right">
  1072. <template slot-scope="{ row }">
  1073. <el-button type="text" @click="materialBtn(row)">
  1074. {{ !row.isPack ? '保存' : '编辑' }}
  1075. </el-button>
  1076. </template>
  1077. </el-table-column>
  1078. </el-table>
  1079. </div>
  1080. </div>
  1081. <div class="center mt20">
  1082. <el-button
  1083. type="primary"
  1084. v-if="!isTask"
  1085. @click="handleSave"
  1086. :loading="saveLoading"
  1087. >保存</el-button
  1088. >
  1089. <el-button @click="$router.go(-1)" v-if="!isTask">返回</el-button>
  1090. </div>
  1091. </el-card>
  1092. <selectType
  1093. :visibleDialog.sync="visibleDialog"
  1094. :title="title"
  1095. :tableHeader="tableHeader"
  1096. :bizScene="formData.bizType"
  1097. :type="[selectEquiType]"
  1098. :loadTree.sync="loadTree"
  1099. @selectTableData="onSelectTableData"
  1100. />
  1101. <WareHouseDailog
  1102. ref="wareHouseDailogRef"
  1103. @houseData="houseData"
  1104. ></WareHouseDailog>
  1105. <ReturnSelect
  1106. ref="returnSelectRef"
  1107. :tableHeader="tableHeader"
  1108. :curDateType="curDateType"
  1109. ></ReturnSelect>
  1110. <el-dialog :visible.sync="dateVisible" title="选择日期" width="400px">
  1111. <el-date-picker
  1112. size="small"
  1113. v-model="batchTime"
  1114. type="datetime"
  1115. style="width: 320px"
  1116. value-format="yyyy-MM-dd HH:mm:ss"
  1117. placeholder="选择日期"
  1118. >
  1119. </el-date-picker>
  1120. <div style="text-align: right; margin-top: 20px">
  1121. <el-button @click="dateVisible = false">取消</el-button>
  1122. <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
  1123. >确认</el-button
  1124. >
  1125. </div>
  1126. </el-dialog>
  1127. <!-- 销售订单 -->
  1128. <picker ref="pickerRef" @success="pickerSuccess" />
  1129. </div>
  1130. </template>
  1131. <script>
  1132. import { approveTaskWithVariables } from '@/api/bpm/task';
  1133. import { getProductList } from '@/api/bpm/components/saleManage/contact';
  1134. import { getLoginUser } from '@/api/login';
  1135. import picker from '@/views/bpm/stockManagement/components/picker.vue';
  1136. import outin from '@/api/warehouseManagement/outin';
  1137. import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
  1138. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  1139. import selectUpload from '@/components/selectUpload';
  1140. import upload from '@/components/uploadImg';
  1141. import {
  1142. warehousingType,
  1143. sceneState,
  1144. emergencyState,
  1145. materialType
  1146. } from '@/utils/dict/index';
  1147. // import { getInfo, warehousingAdd, getAssetNum } from '@/api/stockManagement';
  1148. import selectTree from '@/components/selectTree';
  1149. import selectType from '@/views/bpm/stockManagement/components/selectType.vue';
  1150. import WareHouseDailog from '@/views/bpm/stockManagement/components/WareHouseDailog.vue';
  1151. import ReturnSelect from '@/views/bpm/stockManagement/components/ReturnSelect.vue';
  1152. // import supplier from '@/api/main/supplier';
  1153. // import org from '@/api/main/org';
  1154. // import user from '@/api/main/user';
  1155. import { tableHeader } from '@/views/bpm/handleTask/components/inoutBound/common';
  1156. import { getCode } from '@/api/codeManagement/index.js';
  1157. import { number } from 'echarts/core';
  1158. // import { purchaseorderGetById, contactlink } from '@/api/mes';
  1159. import { getReceiveSaleOrderrecordDetail } from '@/api/bpm/components/purchasingManage/purchaseorderreceive';
  1160. export default {
  1161. components: {
  1162. selectUpload,
  1163. selectTree,
  1164. selectType,
  1165. WareHouseDailog,
  1166. upload,
  1167. ReturnSelect,
  1168. picker
  1169. },
  1170. data() {
  1171. return {
  1172. showMaterialTable: true, // 缓存包装明细列表
  1173. isSplit: false, // 是否拆分到物料明细
  1174. qualityStatus: {
  1175. 0: '未检',
  1176. 1: '已检',
  1177. 2: '部分检'
  1178. }, // 质检状态 0未检 1已检
  1179. qualityResults: {
  1180. 0: '合格',
  1181. 1: '不合格',
  1182. 3: '让步接收'
  1183. }, // 质检结果 0合格 1不合格 3让步接收
  1184. isTask: false,
  1185. isWeight: true,
  1186. resultArray: [],
  1187. isDetail: false,
  1188. contactList: [],
  1189. pickerRow: {},
  1190. fromUserList: [],
  1191. codeList: [],
  1192. materialType,
  1193. warehousingType,
  1194. sceneState,
  1195. emergencyState,
  1196. saveLoading: false,
  1197. visibleDialog: false,
  1198. curDateType: 'manufactureTime',
  1199. materialCodeReqListSelected: [],
  1200. // warehouseList: [], //仓库数组
  1201. // warehouse: {},
  1202. title: '',
  1203. tableData2: [],
  1204. uploadList: [],
  1205. supplierList: [],
  1206. warehousingMaterialList: [],
  1207. activeName: 'a',
  1208. loadTree: true,
  1209. selectEquiType: '',
  1210. batchTime: '',
  1211. dateVisible: false,
  1212. treeList: [],
  1213. staffList: [],
  1214. formData: {
  1215. extInfo: {
  1216. assetType: '', //物品类型
  1217. deptCode: '', //部门code
  1218. deptName: '', //部门名称
  1219. verifyDeptCode: '', //审核部门编码
  1220. verifyDeptName: '', //审核部门名称
  1221. deliveryName: '', //送货人名称
  1222. deliveryPhone: '', //送货人电话
  1223. documentSource: '', //销售订单
  1224. urgent: '', //紧急状态
  1225. supplierId: '', //供应商ID
  1226. supplierName: '', //供应商名称
  1227. createUserName: '', //创建人名字
  1228. contentImage: [] //图片数组
  1229. },
  1230. fromUser: '', //送货人
  1231. bizType: '', //物品类型
  1232. verifyId: '', //审核人Id
  1233. verifyName: '', //审核人名称
  1234. createUserId: '',
  1235. remark: ''
  1236. },
  1237. rules: {
  1238. 'extInfo.assetType': {
  1239. required: true,
  1240. message: '请选择物品类型',
  1241. trigger: 'change'
  1242. },
  1243. bizType: {
  1244. required: true,
  1245. message: '请选择入库场景',
  1246. trigger: 'change'
  1247. }
  1248. }
  1249. };
  1250. },
  1251. props: ['inboundType'],
  1252. computed: {
  1253. // 条码信息
  1254. materialCodeReqList() {
  1255. return this.warehousingMaterialList
  1256. .map((i) => i.warehouseLedgerDetails || [])
  1257. .flat();
  1258. },
  1259. tableHeader() {
  1260. return tableHeader(this.selectEquiType);
  1261. }
  1262. },
  1263. created() {
  1264. if (this.$route.query.id) {
  1265. // this._getInfo()
  1266. } else {
  1267. let obj = localStorage.getItem('orgInfo')
  1268. ? JSON.parse(localStorage.getItem('orgInfo'))
  1269. : {};
  1270. this.formData.createUserName = obj.name;
  1271. this.formData.extInfo.deptName = obj.dept?.name;
  1272. this.formData.deptCode = obj.dept?.code;
  1273. }
  1274. this.initData();
  1275. },
  1276. methods: {
  1277. // 包装维度最小包装单元改变——>总重量
  1278. minPackingCountChange(row, value) {
  1279. row.minPackingCount = value.replace(/^(0+)|[^\d]+/g, '');
  1280. if (row.outInNum >= 0 && value >= 0) {
  1281. this.packNum(row, row.outInNum);
  1282. }
  1283. },
  1284. // 选择质检结果改变质检状态
  1285. changeWrapStatus(resultValue, row) {
  1286. switch (resultValue) {
  1287. case '':
  1288. // 清空质检状态
  1289. row.status = '0';
  1290. break;
  1291. default:
  1292. // 默认已检质检状态
  1293. row.status = '1';
  1294. break;
  1295. }
  1296. },
  1297. cancel() {
  1298. this.$emit('cancel');
  1299. },
  1300. weightInput(value, row) {
  1301. const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
  1302. const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
  1303. if (decimalCount > 1) {
  1304. // 如果小数点个数大于1,移除多余的小数点
  1305. const lastIndex = newValue.lastIndexOf('.');
  1306. row.weight =
  1307. newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1);
  1308. } else if (decimalCount === 1) {
  1309. // 如果小数点个数等于1,允许小数点的输入
  1310. row.weight = newValue;
  1311. } else {
  1312. row.weight = newValue === '' ? 0 : parseFloat(newValue); // 如果输入为空,则设为0
  1313. }
  1314. },
  1315. handleIsDetail(event) {
  1316. this.isSplit = event;
  1317. const list = this.materialCodeReqList;
  1318. if (event) {
  1319. let resultArray = [];
  1320. list.forEach((item) => {
  1321. // 包装维度改成已保存状态
  1322. item.isPack = true;
  1323. // 拆分物料维度并生成列表
  1324. for (let i = 1; i <= Number(item.minPackingCount); i++) {
  1325. resultArray.push({
  1326. onlyCode: item.onlyCode,
  1327. no: item.onlyCode + i.toString().padStart(4, '0'),
  1328. assetCode: item.assetCode,
  1329. assetName: item.assetName,
  1330. batchNo: item.batchNo,
  1331. minPackingCount: 1,
  1332. measuringUnit: item.measuringUnit,
  1333. materielCode: item.materielCode,
  1334. clientCode: item.clientCode,
  1335. weight: item.weight / Number(item.minPackingCount),
  1336. weightUnit: item.weightUnit,
  1337. engrave: item.engrave,
  1338. result: item.result,
  1339. status: item.status,
  1340. isPack: false
  1341. });
  1342. }
  1343. });
  1344. this.resultArray = resultArray;
  1345. // 批量修改包装明细
  1346. this.isWeight = false;
  1347. this.bulkEditingWrap();
  1348. this.$nextTick(() => {
  1349. this.isWeight = true;
  1350. });
  1351. } else {
  1352. // 包装维度改成编辑状态
  1353. list.forEach((item) => {
  1354. item.isPack = false;
  1355. });
  1356. // 清空物料维度列表
  1357. this.resultArray = [];
  1358. }
  1359. },
  1360. //包装明细保存
  1361. packCout(row) {
  1362. //true保存==》反之
  1363. if (!row.isPack) {
  1364. row.isPack = true;
  1365. const code = row.assetCode;
  1366. const batchNo = row.batchNo;
  1367. //做防护,防止weight字符串类型
  1368. this.materialCodeReqList.forEach((ele) => {
  1369. ele.weight = Number(ele.weight);
  1370. });
  1371. // const count = this.materialCodeReqList.reduce(
  1372. // (acc, curr) => acc + curr.weight,
  1373. // 0
  1374. // );
  1375. // 修改产品信息重量(包装维度累计)
  1376. this.isWeight = false;
  1377. this.warehousingMaterialList.forEach((item) => {
  1378. if (item.assetCode == code && item.batchNo == batchNo) {
  1379. let arr = [];
  1380. for (const key in this.materialCodeReqList) {
  1381. if (
  1382. this.materialCodeReqList[key].assetCode == item.assetCode &&
  1383. this.materialCodeReqList[key].batchNo == item.batchNo
  1384. ) {
  1385. arr.push({ ...this.materialCodeReqList[key] });
  1386. }
  1387. }
  1388. const count = arr.reduce(
  1389. (acc, curr) =>
  1390. Number(this.$math.format(+acc + +curr.weight, 14)),
  1391. 0
  1392. );
  1393. this.$set(item, 'weight', count);
  1394. }
  1395. });
  1396. this.$nextTick(() => {
  1397. this.isWeight = true;
  1398. });
  1399. } else {
  1400. row.isPack = false;
  1401. }
  1402. // setTimeout(() => {
  1403. // }, 100);
  1404. },
  1405. // 批量修改包装明细
  1406. bulkEditingWrap() {
  1407. // 批量修改包装明细列表状态(已保存)
  1408. this.materialCodeReqList.forEach((item) => {
  1409. item.isPack = true;
  1410. });
  1411. // 改变产品明细重量
  1412. this.warehousingMaterialList.forEach((outItem) => {
  1413. let arr = [];
  1414. this.materialCodeReqList.forEach((inneritem) => {
  1415. if (
  1416. inneritem.assetCode == outItem.assetCode &&
  1417. inneritem.batchNo == outItem.batchNo
  1418. ) {
  1419. arr.push(inneritem);
  1420. }
  1421. });
  1422. const count = arr.reduce(
  1423. (acc, curr) => Number(this.$math.format(+acc + +curr.weight, 14)),
  1424. 0
  1425. );
  1426. this.$set(outItem, 'weight', count);
  1427. });
  1428. },
  1429. // 批量修改物料明细
  1430. bulkEditingMaterial() {
  1431. // 批量修改物料明细列表状态(已保存)
  1432. this.resultArray.forEach((item) => {
  1433. item.isPack = true;
  1434. });
  1435. // 改变包装明细重量
  1436. this.materialCodeReqList.forEach((outItem) => {
  1437. let arr = [];
  1438. this.resultArray.forEach((inneritem) => {
  1439. if (
  1440. inneritem.assetCode == outItem.assetCode &&
  1441. inneritem.batchNo == outItem.batchNo
  1442. ) {
  1443. arr.push(inneritem);
  1444. }
  1445. });
  1446. const count = arr.reduce(
  1447. (acc, curr) => Number(this.$math.format(+acc + +curr.weight, 14)),
  1448. 0
  1449. );
  1450. this.$set(outItem, 'weight', count);
  1451. });
  1452. },
  1453. // 物料明细保存
  1454. materialBtn(row) {
  1455. console.log(row);
  1456. console.log(this.resultArray);
  1457. console.log(this.materialCodeReqList);
  1458. // true保存 false编辑
  1459. if (!row.isPack) {
  1460. row.isPack = true;
  1461. // 物料维度修改质检改变包装维度质检(结果和状态)
  1462. this.materialCodeReqList.forEach((outItem) => {
  1463. let arr = [];
  1464. this.resultArray.forEach((inneritem) => {
  1465. if (inneritem.onlyCode == outItem.onlyCode) {
  1466. arr.push(inneritem);
  1467. }
  1468. });
  1469. console.log(arr);
  1470. // 首先判断是未填/合格不合格
  1471. let boolen = arr.every((item) => {
  1472. return item.result === '' || item.result === undefined;
  1473. });
  1474. // 判断只要物料全部质检结果(未填)——>包装质检结果(未填) 状态(未检)
  1475. if (boolen) {
  1476. this.$set(outItem, 'result', '');
  1477. this.$set(outItem, 'status', '0');
  1478. } else {
  1479. // 判断只要物料有一个质检结果(不合格)——>包装质检结果(不合格) 状态(已检)
  1480. let boolen = arr.some((item) => {
  1481. return item.result === '1';
  1482. });
  1483. if (boolen) {
  1484. this.$set(outItem, 'result', '1');
  1485. this.$set(outItem, 'status', '1');
  1486. } else {
  1487. // 判断只要物料有一个质检结果(让步接收)——>包装质检结果(让步接收) 状态(已检)
  1488. let boolen = arr.some((item) => {
  1489. return item.result === '3';
  1490. });
  1491. if (boolen) {
  1492. // 让步接收 已检
  1493. this.$set(outItem, 'result', '3');
  1494. this.$set(outItem, 'status', '1');
  1495. } else {
  1496. // 判断只要物料有全部质检结果(合格)——>包装质检结果(合格) 状态(已检)
  1497. let boolen = arr.every((item) => {
  1498. return item.result === '0';
  1499. });
  1500. if (boolen) {
  1501. // 合格 已检
  1502. this.$set(outItem, 'result', '0');
  1503. this.$set(outItem, 'status', '1');
  1504. } else {
  1505. // 合格 部分检
  1506. this.$set(outItem, 'result', '0');
  1507. this.$set(outItem, 'status', '2');
  1508. }
  1509. }
  1510. }
  1511. }
  1512. // this.$set(outItem, 'result', boolen ? '1' : '0');
  1513. });
  1514. // 物料维度修改重量改变包装维度重量
  1515. let onlyCode = row.onlyCode;
  1516. this.materialCodeReqList.forEach((item) => {
  1517. if (item.onlyCode === onlyCode) {
  1518. let arr = [];
  1519. for (const key in this.resultArray) {
  1520. if (this.resultArray[key].onlyCode == item.onlyCode) {
  1521. arr.push({ ...this.resultArray[key] });
  1522. }
  1523. }
  1524. const count = arr.reduce(
  1525. (acc, curr) =>
  1526. Number(this.$math.format(+acc + +curr.weight, 14)),
  1527. 0
  1528. );
  1529. this.$set(item, 'weight', count);
  1530. }
  1531. });
  1532. // 包装维度修改重量改变产品信息
  1533. this.isWeight = false;
  1534. // 批量修改包装明细
  1535. this.bulkEditingWrap();
  1536. this.$nextTick(() => {
  1537. this.isWeight = true;
  1538. });
  1539. } else {
  1540. row.isPack = false;
  1541. }
  1542. },
  1543. packNum(row, value) {
  1544. const total = {
  1545. packingCount: Number(row.minPackingCount),
  1546. outInNum: Number(row.outInNum)
  1547. };
  1548. if (row.measuringUnit == row.weightUnit) {
  1549. row.weight = Number(
  1550. this.$math.format(
  1551. total.packingCount * 1 * total.outInNum.toFixed(2),
  1552. 14
  1553. )
  1554. );
  1555. } else {
  1556. const totals = Number(
  1557. this.$math.format(total.packingCount * total.outInNum, 14)
  1558. );
  1559. row.weight = Number(
  1560. this.$math.format(totals * row.netWeight.toFixed(2), 14)
  1561. );
  1562. }
  1563. return (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''));
  1564. },
  1565. async searchContact(id) {
  1566. const data = await contactlink({ contactId: id });
  1567. this.contactList = data.data;
  1568. },
  1569. async pickerSuccess(row) {
  1570. this.formData.bizType = '2';
  1571. this.codeListValue(row.categoryLevelTopId);
  1572. this.isTask = true;
  1573. this.pickerRow = row;
  1574. this.formData.extInfo.documentSource = row.orderNo;
  1575. this.formData.sourceBizNo = row.receiveNo;
  1576. this.formData.fromId = row.id;
  1577. this.formData.clientName = row.partaName;
  1578. this.formData.clientCode = row.partaId;
  1579. this.formData.extInfo.supplierName = row.supplierName;
  1580. this.formData.extInfo.supplierId = row.supplierId;
  1581. // await this.searchContact(row.partbId);
  1582. const data = await getReceiveSaleOrderrecordDetail(row.id);
  1583. if (this.warehousingMaterialList.length == 0) {
  1584. let list = data.productList.map((item) => {
  1585. return {
  1586. ...item,
  1587. assetName: item.productName,
  1588. assetCode: item.productCode,
  1589. categoryId: item.productCategoryId,
  1590. minPackUnit: item.packingUnit
  1591. };
  1592. });
  1593. this.onSelectTableData(await this.serachMainCode(list));
  1594. }
  1595. },
  1596. async serachMainCode(arr) {
  1597. let newArr = [];
  1598. // 使用 Promise.all 来等待所有异步操作完成
  1599. await Promise.all(
  1600. arr.map(async (item) => {
  1601. const data = await getProductList({
  1602. pageNum: 1,
  1603. size: 10,
  1604. categoryLevelId: item.categoryLevelPathIdParent,
  1605. code: item.assetCode
  1606. });
  1607. newArr.push(data.list); // 将结果存储到 newArr 中
  1608. })
  1609. );
  1610. let re = [];
  1611. for (const item of newArr) {
  1612. for (const it of item) {
  1613. re.push(it);
  1614. }
  1615. }
  1616. return re.map((item) => {
  1617. return {
  1618. ...item,
  1619. minPackUnit: item.packingUnit,
  1620. assetCode: item.code,
  1621. assetName: item.name
  1622. };
  1623. });
  1624. },
  1625. onClear() {
  1626. this.formData.extInfo.documentSource = '';
  1627. this.pickerRow = {};
  1628. this.formData.clientName = '';
  1629. this.formData.clientCode = '';
  1630. this.formData.extInfo.supplierName = '';
  1631. this.formData.extInfo.supplierId = '';
  1632. this.$forceUpdate();
  1633. },
  1634. handlePicker() {
  1635. this.$refs.pickerRef.open();
  1636. },
  1637. codeListValue(val) {
  1638. this.formData.extInfo.assetType = val.id || val;
  1639. this.$forceUpdate();
  1640. this.title = val?.name;
  1641. this.selectEquiType = val?.id || val;
  1642. },
  1643. //计算生产设备重量
  1644. deviceWeight(row, num) {
  1645. if (row) {
  1646. return Number(row * num);
  1647. } else {
  1648. return row;
  1649. }
  1650. },
  1651. //计算金额
  1652. calcSumTotal(PackingCount, outInNum, univalence) {
  1653. //最小包装单元,包装数量,单价
  1654. const total = {
  1655. PackingCount: Number(PackingCount),
  1656. outInNum: Number(outInNum),
  1657. univalence: Number(univalence == undefined ? 0 : univalence)
  1658. };
  1659. return total.PackingCount * total.outInNum * total.univalence;
  1660. },
  1661. handleRowUnit(row) {
  1662. return row.measuringUnit;
  1663. // if (this.formData.extInfo.assetType == 1) {
  1664. // return row.weightUnit;
  1665. // } else if (this.formData.extInfo.assetType == 4) {
  1666. // return row.measuringUnit;
  1667. // } else {
  1668. // return row.measuringUnit;
  1669. // }
  1670. },
  1671. changeVerfy(it) {
  1672. this.formData.verifyName = it.name;
  1673. },
  1674. //选择供应啥的操作
  1675. ChangeSupplier(data) {
  1676. this.formData.extInfo.supplierName = data.dictValue;
  1677. },
  1678. ChangeSuppliers(data) {
  1679. this.formData.clientName = data.dictValue;
  1680. },
  1681. rowClass({ row, column, rowIndex, columnIndex }) {
  1682. if (rowIndex === 1) {
  1683. return {
  1684. display: 'none',
  1685. background: '#EEEEEE',
  1686. border: 'none'
  1687. };
  1688. }
  1689. return { background: '#EEEEEE', border: 'none' };
  1690. },
  1691. calcSum(a, b, c, row) {
  1692. if (
  1693. (Number.isNaN(+a) && a !== '') ||
  1694. (Number.isNaN(+b) && b !== '') ||
  1695. (Number.isNaN(+c) && c !== '')
  1696. ) {
  1697. return '';
  1698. }
  1699. return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit];
  1700. // return a * b * c;
  1701. },
  1702. // 部门 点击事件
  1703. async auditorDeptClick(data) {
  1704. this.formData.extInfo.verifyDeptCode = data?.id;
  1705. this.formData.extInfo.verifyDeptName = data?.name;
  1706. this.formData.verifyId = '';
  1707. this.formData.verifyName = '';
  1708. this.$refs.formName.validateField('verifyDeptName');
  1709. if (data) {
  1710. this.getStaffList(data);
  1711. }
  1712. },
  1713. async getStaffList(data) {
  1714. let res = await warehouseDefinition.getUserPage({
  1715. groupId: data.id,
  1716. size: 9999,
  1717. page: 1
  1718. });
  1719. this.staffList = res.list;
  1720. },
  1721. // 详情接口
  1722. // async _getInfo () {
  1723. // const res = await getInfo({ id: this.$route.query.id })
  1724. // if (res?.success) {
  1725. // this.warehousingMaterialList = res.data.warehouseLedgerInfos.map(i => {
  1726. // i.isSave = true
  1727. // return i
  1728. // })
  1729. // this.formData = res.data.outInWarehouse
  1730. // this.uploadList = this.formData.contentImage
  1731. // }
  1732. // },
  1733. chooseAssets(row, index) {
  1734. this.$refs.returnSelectRef.open(row, (res) => {
  1735. row.outInNum = res.length;
  1736. this.$set(
  1737. row,
  1738. 'selfWarehouseLedgerDetails',
  1739. res.map((i) => {
  1740. delete i.updateTime;
  1741. delete i.createTime;
  1742. return i;
  1743. })
  1744. );
  1745. });
  1746. },
  1747. // 仓库编辑
  1748. handleWareHouse(row, idx) {
  1749. this.$refs.wareHouseDailogRef.open(row, idx);
  1750. },
  1751. // 入库操作
  1752. listEdit(row) {
  1753. this.$set(row, 'isSave', false);
  1754. row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
  1755. row.warehouseLedgerDetails = [];
  1756. // 清空物料明细防止数据错乱
  1757. this.resultArray = [];
  1758. this.isDetail = false;
  1759. },
  1760. listSave(row, index) {
  1761. const fileds = [
  1762. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  1763. `warehousingMaterialList.${index}.batchNo`,
  1764. `warehousingMaterialList.${index}.houseList`
  1765. ];
  1766. if (this.formData.bizType == 1) {
  1767. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  1768. } else if (this.formData.bizType == 2) {
  1769. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  1770. }
  1771. if (this.formData.bizType != 5) {
  1772. fileds.push(
  1773. ...[
  1774. `warehousingMaterialList.${index}.outInNum`,
  1775. `warehousingMaterialList.${index}.minPackingCount`
  1776. ]
  1777. );
  1778. } else if (
  1779. this.warehousingMaterialList.some(
  1780. (i) => !i.selfWarehouseLedgerDetails?.length
  1781. )
  1782. ) {
  1783. this.$message.error('请选择资产编号!');
  1784. return;
  1785. }
  1786. Promise.all(
  1787. fileds.map(
  1788. (item) =>
  1789. new Promise(async (resolve, rej) => {
  1790. this.$refs.warehousingMaterialListRef.validateField(
  1791. item,
  1792. (err) => {
  1793. if (err) {
  1794. rej(err);
  1795. } else {
  1796. resolve();
  1797. }
  1798. }
  1799. );
  1800. })
  1801. )
  1802. )
  1803. .then((res) => {
  1804. this.$set(row, 'isSave', true);
  1805. if (this.formData.bizType != 5) {
  1806. this.createMaterialCode(row);
  1807. } else {
  1808. // 退还
  1809. this.createMaterialCodeReturn(row);
  1810. }
  1811. })
  1812. .catch((err) => {
  1813. this.$message.error('请填入必填项!');
  1814. });
  1815. },
  1816. listSaveArrs() {
  1817. const rows = this.warehousingMaterialList;
  1818. const indexes = Array.from(
  1819. { length: this.warehousingMaterialList.length },
  1820. (_, index) => index
  1821. );
  1822. rows.forEach((row, i) => {
  1823. const index = indexes[i];
  1824. const fileds = [
  1825. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  1826. `warehousingMaterialList.${index}.batchNo`,
  1827. `warehousingMaterialList.${index}.houseList`
  1828. ];
  1829. if (this.formData.bizType == 1) {
  1830. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  1831. } else if (this.formData.bizType == 2) {
  1832. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  1833. }
  1834. if (this.formData.bizType != 5) {
  1835. fileds.push(
  1836. ...[
  1837. `warehousingMaterialList.${index}.outInNum`,
  1838. `warehousingMaterialList.${index}.minPackingCount`
  1839. ]
  1840. );
  1841. } else if (
  1842. this.warehousingMaterialList.some(
  1843. (i) => !i.selfWarehouseLedgerDetails?.length
  1844. )
  1845. ) {
  1846. this.$message.error('请选择资产编号!');
  1847. return;
  1848. }
  1849. Promise.all(
  1850. fileds.map(
  1851. (item) =>
  1852. new Promise(async (resolve, rej) => {
  1853. this.$refs.warehousingMaterialListRef.validateField(
  1854. item,
  1855. (err) => {
  1856. if (err) {
  1857. rej(err);
  1858. } else {
  1859. resolve();
  1860. }
  1861. }
  1862. );
  1863. })
  1864. )
  1865. )
  1866. .then((res) => {
  1867. this.$set(row, 'isSave', true);
  1868. if (this.formData.bizType != 5) {
  1869. this.createMaterialCode(row);
  1870. } else {
  1871. // 退还
  1872. this.createMaterialCodeReturn(row);
  1873. }
  1874. })
  1875. .catch((err) => {
  1876. // this.$message.error('请填入必填项!');
  1877. });
  1878. });
  1879. },
  1880. // listSaveArrs() {
  1881. // console.log(this.warehousingMaterialList);
  1882. // },
  1883. // 批量设置生产日期
  1884. handleSelectionChange(val) {
  1885. this.materialCodeReqListSelected = val;
  1886. },
  1887. dateSetting() {
  1888. if (!this.materialCodeReqListSelected.length) {
  1889. return this.$message.error(`请选择${this.title}明细!`);
  1890. }
  1891. this.dateVisible = true;
  1892. },
  1893. dateConfirm() {
  1894. this.materialCodeReqListSelected.forEach((item) => {
  1895. this.$set(item, this.curDateType, this.batchTime);
  1896. });
  1897. this.dateVisible = false;
  1898. },
  1899. //入库明细删除
  1900. listDel(row, index) {
  1901. this.warehousingMaterialList.splice(index, 1);
  1902. this.resultArray = [];
  1903. this.isDetail = false;
  1904. },
  1905. // 入库明细生成条码信息
  1906. async createMaterialCode(row) {
  1907. // 添加相同物品、批次号重新更新明细 原料编码
  1908. const list = this.warehousingMaterialList.filter(
  1909. (i) =>
  1910. i.assetCode === row.assetCode &&
  1911. i.batchNo === row.batchNo &&
  1912. i.isSave
  1913. );
  1914. const num = list.reduce((num, pre) => {
  1915. num += row.isUnpack
  1916. ? pre.outInNum * pre.minPackingCount
  1917. : pre.outInNum - 0;
  1918. return num;
  1919. }, 0);
  1920. const nums = list.reduce((num, pre) => {
  1921. num += pre.outInNum * pre.minPackingCount;
  1922. return num;
  1923. }, 0);
  1924. const res = await outin.getAssetNum({
  1925. assetCode: row.assetCode,
  1926. batchNum: row.batchNo,
  1927. num: num
  1928. });
  1929. // row.measuringUnit == 'PCS' ? nums :
  1930. list.forEach((item) => {
  1931. if (item.warehouseLedgerDetails?.length) {
  1932. item.warehouseLedgerDetails.forEach((i) => {
  1933. i.onlyCode = res.shift().onlyCode;
  1934. });
  1935. } else {
  1936. this.$set(
  1937. item,
  1938. 'warehouseLedgerDetails',
  1939. Array.from(
  1940. new Array(
  1941. item.isUnpack
  1942. ? item.outInNum * item.minPackingCount
  1943. : // : item.measuringUnit == 'PCS'
  1944. // ? +item.outInNum * parseInt(item.minPackingCount)
  1945. +item.outInNum
  1946. ),
  1947. (val, idx) => {
  1948. return {
  1949. ...item,
  1950. onlyCode: res.shift().onlyCode,
  1951. bizStatus: 1,
  1952. contentImage: []
  1953. };
  1954. }
  1955. )
  1956. );
  1957. }
  1958. });
  1959. // 添加相同物品,重复批次号 重新更新明细 包装编码
  1960. const batchList = this.warehousingMaterialList.filter(
  1961. (i) => i.batchNo === row.batchNo && i.isSave
  1962. );
  1963. if (batchList.length) {
  1964. const num = batchList.reduce((num, pre) => {
  1965. num += +pre.outInNum;
  1966. return num;
  1967. }, 0);
  1968. const res1 = await outin.getAssetNum({
  1969. batchNum: row.batchNo,
  1970. num
  1971. });
  1972. if (res1) {
  1973. batchList.forEach((item) => {
  1974. let num = res1.shift()?.num;
  1975. let minPackingCount = item.minPackingCount;
  1976. if (item.warehouseLedgerDetails?.length) {
  1977. item.warehouseLedgerDetails.forEach((i, index) => {
  1978. this.$set(i, 'num', num);
  1979. if (item.measuringUnit == item.weightUnit) {
  1980. this.$set(i, 'weight', item.minPackingCount);
  1981. } else {
  1982. this.$set(
  1983. i,
  1984. 'weight',
  1985. typeof 1 * item.minPackingCount * item.netWeight ===
  1986. number
  1987. ? 1
  1988. : 1 * item.minPackingCount * item.netWeight
  1989. );
  1990. }
  1991. this.$set(i, 'weightUtil', item.weightUnit);
  1992. this.$set(i, 'packingCount', 1);
  1993. this.$set(i, 'packingUnit ', item.packingUnit);
  1994. this.$set(i, 'minPackingCount ', item.minPackingCount);
  1995. this.$set(i, 'measuringUnit', item.measuringUnit);
  1996. this.$set(i, 'isPack', false);
  1997. console.log('inboundType------------', this.inboundType);
  1998. if (this.inboundType == '1') {
  1999. // 生产性采购
  2000. this.$set(i, 'result', '');
  2001. this.$set(i, 'status', '0');
  2002. } else {
  2003. // 非生产性采购
  2004. this.$set(i, 'result', '0');
  2005. this.$set(i, 'status', '1');
  2006. }
  2007. // if (this.formData.extInfo.assetType == 1) {
  2008. // this.$set(i, 'status', '0');
  2009. // } else {
  2010. // this.$set(i, 'result', '0');
  2011. // this.$set(i, 'status', '1');
  2012. // }
  2013. if (!item.isUnpack) {
  2014. if (index < item.warehouseLedgerDetails.length - 1) {
  2015. num = res1.shift()?.num;
  2016. }
  2017. } else {
  2018. // 拆包的包装编码一致
  2019. minPackingCount--;
  2020. if (
  2021. minPackingCount === 0 &&
  2022. index < item.warehouseLedgerDetails.length - 1
  2023. ) {
  2024. minPackingCount = item.minPackingCount;
  2025. num = res1.shift()?.num;
  2026. }
  2027. }
  2028. });
  2029. }
  2030. });
  2031. }
  2032. }
  2033. },
  2034. // 入库明细生成条码信息 退还
  2035. async createMaterialCodeReturn(row) {
  2036. // 添加相同物品重新更新明细 原料编码
  2037. const list = this.warehousingMaterialList.filter(
  2038. (i) => i.batchNo === row.batchNo && i.isSave
  2039. );
  2040. // 退还
  2041. const res = await getAssetNum({
  2042. batchNo: row.batchNo,
  2043. num: list.reduce((num, pre) => {
  2044. num += pre.selfWarehouseLedgerDetails.length;
  2045. return num;
  2046. }, 0)
  2047. });
  2048. if (res?.success) {
  2049. list.forEach((item) => {
  2050. let num = res.data.shift().num;
  2051. let minPackingCount = item.minPackingCount;
  2052. if (item.warehouseLedgerDetails?.length) {
  2053. item.warehouseLedgerDetails.forEach((i, index) => {
  2054. Object.assign(i, {
  2055. num,
  2056. batchNo: item.batchNo,
  2057. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  2058. cargoSpaceId: item.cargoSpaceId, //货位id
  2059. shelfId: item.shelfId, //货架id
  2060. shelfCode: item.shelfCode, //货架名称
  2061. areaId: item.areaId, //库区id
  2062. areaName: item.areaName, //库区名称
  2063. warehouseId: item.warehouseId, //仓库id
  2064. warehouseName: item.warehouseName //仓库名称
  2065. });
  2066. if (!item.isUnpack) {
  2067. // 拆包的包装编码一致
  2068. if (index < item.warehouseLedgerDetails.length - 1) {
  2069. num = res.data.shift()?.num;
  2070. }
  2071. } else {
  2072. minPackingCount--;
  2073. if (
  2074. minPackingCount === 0 &&
  2075. index < item.warehouseLedgerDetails.length - 1
  2076. ) {
  2077. minPackingCount = item.minPackingCount;
  2078. num = res1.data.shift()?.num;
  2079. }
  2080. }
  2081. });
  2082. } else {
  2083. this.$set(
  2084. item,
  2085. 'warehouseLedgerDetails',
  2086. item.selfWarehouseLedgerDetails.map((val, idx) => {
  2087. let obj = {
  2088. ...val,
  2089. bizStatus: 1,
  2090. minPackingCount: item.minPackingCount,
  2091. batchNo: item.batchNo,
  2092. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  2093. cargoSpaceId: item.cargoSpaceId, //货位id
  2094. shelfId: item.shelfId, //货架id
  2095. shelfCode: item.shelfCode, //货架名称
  2096. areaId: item.areaId, //库区id
  2097. areaName: item.areaName, //库区名称
  2098. warehouseId: item.warehouseId, //仓库id
  2099. warehouseName: item.warehouseName, //仓库名称
  2100. materialId: item.materialId,
  2101. num
  2102. };
  2103. if (!item.isUnpack) {
  2104. // 拆包的包装编码一致
  2105. if (idx < item.warehouseLedgerDetails.length - 1) {
  2106. num = res.data.shift()?.num;
  2107. }
  2108. } else {
  2109. minPackingCount--;
  2110. if (
  2111. minPackingCount === 0 &&
  2112. idx < item.warehouseLedgerDetails.length - 1
  2113. ) {
  2114. minPackingCount = item.minPackingCount;
  2115. num = res1.data.shift()?.num;
  2116. }
  2117. }
  2118. return obj;
  2119. })
  2120. );
  2121. }
  2122. });
  2123. }
  2124. },
  2125. // 包装批量保存
  2126. wrapListSave() {
  2127. // 批量修改包装明细
  2128. this.isWeight = false;
  2129. this.bulkEditingWrap();
  2130. this.$nextTick(() => {
  2131. this.isWeight = true;
  2132. });
  2133. },
  2134. // 物料批量保存
  2135. materialListSave() {
  2136. this.resultArray.forEach((item) => {
  2137. if (!item.isPack) {
  2138. this.materialBtn(item);
  2139. }
  2140. });
  2141. },
  2142. handleSave(data) {
  2143. this.$refs.formName.validate(async (valid) => {
  2144. if (valid) {
  2145. if (!this.warehousingMaterialList?.length) {
  2146. return this.$message.error('请添加入库明细!');
  2147. } else if (
  2148. this.warehousingMaterialList.some((item) => !item.isSave)
  2149. ) {
  2150. return this.$message.error('请保存入库明细!');
  2151. }
  2152. // 默认全部保存
  2153. if (this.resultArray?.length > 0) {
  2154. // 物料批量保存
  2155. this.materialListSave();
  2156. } else {
  2157. // 包装批量保存
  2158. this.wrapListSave();
  2159. }
  2160. this.formatWarehouseMaterialList();
  2161. let arr = this.warehousingMaterialList.map((item) => {
  2162. console.log(item, 'item');
  2163. return {
  2164. netWeight: item.netWeight,
  2165. num: item.num,
  2166. batchNo: item.batchNo,
  2167. code: item.productCode,
  2168. categoryId:
  2169. this.formData.bizType == 2
  2170. ? item.categoryId
  2171. ? item.categoryId
  2172. : item.id
  2173. : item.id,
  2174. count: parseInt(item.outInNum) * parseInt(item.minPackingCount),
  2175. minPackingCount: item.minPackingCount,
  2176. packingCount: item.outInNum,
  2177. price: item.univalence,
  2178. outInDetailRecordAddPOList: item.warehouseLedgerDetails,
  2179. position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
  2180. remark: '',
  2181. pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
  2182. pathName: `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`,
  2183. totalMoney:
  2184. item.outInNum * item.minPackingCount * item.univalence,
  2185. weightUnit: item.weightUnit,
  2186. customCode: item.customCode,
  2187. supplierCode: item.supplierCode,
  2188. weight: item.weight
  2189. };
  2190. });
  2191. arr.forEach((item) => {
  2192. if (item.outInDetailRecordAddPOList.length > 0) {
  2193. let list = item.outInDetailRecordAddPOList.map((it) => {
  2194. return this.formatOutInDetailRecordAddPO(it, item);
  2195. });
  2196. item.outInDetailRecordAddPOList = list;
  2197. }
  2198. });
  2199. let obj = { ...this.formData, type: 1 };
  2200. obj.outInDetailAddPOList = arr;
  2201. this.saveLoading = true;
  2202. // 入库来源storageSource 0-正常 1-外部
  2203. obj.storageSource = 1;
  2204. try {
  2205. const res = await outin.save(obj);
  2206. if (res.code == 0) {
  2207. approveTaskWithVariables(data).then((res) => {
  2208. console.log(res);
  2209. if (res.data.code == 0) {
  2210. this.$message.success('保存成功!');
  2211. this.$emit('success');
  2212. }
  2213. });
  2214. // await outin.outApproves({ outInId: res.data });
  2215. // this.$message.success('保存成功!');
  2216. // this.$emit('success');
  2217. }
  2218. } catch (error) {
  2219. console.error('保存失败:', error);
  2220. }
  2221. this.saveLoading = false;
  2222. // this.$router.push('/warehouseManagement/stockManagement');
  2223. }
  2224. });
  2225. },
  2226. formatWarehouseMaterialList() {
  2227. for (let key in this.warehousingMaterialList) {
  2228. for (let k in this.warehousingMaterialList[key].houseList) {
  2229. let house = this.warehousingMaterialList[key].houseList[k];
  2230. this.warehousingMaterialList[key].warehouseName =
  2231. house.warehouseName;
  2232. this.warehousingMaterialList[key].areaName = house.areaName;
  2233. this.warehousingMaterialList[key].shelfCode = house.shelfCode;
  2234. this.warehousingMaterialList[key].cargoSpaceCode =
  2235. house.cargoSpaceCode;
  2236. this.warehousingMaterialList[key].warehouseId = house.warehouseId;
  2237. this.warehousingMaterialList[key].areaId = house.areaId;
  2238. this.warehousingMaterialList[key].shelfId = house.shelfId;
  2239. this.warehousingMaterialList[key].cargoSpaceId = house.cargoSpaceId;
  2240. this.warehousingMaterialList[key].num = house.num;
  2241. }
  2242. }
  2243. },
  2244. formatOutInDetailRecordAddPO(it, item) {
  2245. return {
  2246. code: it.onlyCode,
  2247. dateType: this.curDateType === 'manufactureTime' ? 2 : 1,
  2248. dateValue: it[this.curDateType],
  2249. minUnit: it.minPackingCount,
  2250. minPositionId: it.cargoSpaceId,
  2251. minPackingCount: it.minPackingCount,
  2252. name: it.assetName,
  2253. pathIds: item.pathIds,
  2254. unit: it.unit,
  2255. packageNo: it.num,
  2256. clientCode: it.clientCode,
  2257. materielCode: it.materielCode,
  2258. weight: it.weight,
  2259. weightUtil: it.weightUtil,
  2260. engrave: it.engrave,
  2261. materialDetails: this.materialDetails(it.onlyCode),
  2262. packingCount: it.packingCount,
  2263. status: it.status,
  2264. result: it.result
  2265. };
  2266. },
  2267. materialDetails(onlyCode) {
  2268. return this.resultArray.filter((item) => item.onlyCode === onlyCode);
  2269. },
  2270. async getOrderCode() {
  2271. const data = await getCode('in_warehouse');
  2272. return data;
  2273. },
  2274. //添加明细
  2275. async onSelectTableData(val) {
  2276. console.log('===ssa', val);
  2277. const res = await getCode('lot_number_code');
  2278. this.warehousingMaterialList.push(
  2279. ...val.map((next) => {
  2280. next.batchNo = res;
  2281. let cur = {};
  2282. next.realInventoryAmount = next.realInventoryAmount || 0;
  2283. cur = {
  2284. ...next,
  2285. cargoSpaceCode: '', //货位编码
  2286. cargoSpaceId: '', //货位id
  2287. shelfId: '', //货架id
  2288. shelfCode: '', //货架名称
  2289. areaId: '', //库区id
  2290. areaName: '', //库区名称
  2291. warehouseId: '', //仓库id
  2292. warehouseName: '', //仓库名称
  2293. assetType: this.formData.extInfo.assetType,
  2294. expirationDate: '',
  2295. outInNum: '',
  2296. minPackingCount: '',
  2297. bizStatus: 1,
  2298. contentImage: [],
  2299. warehouseLedgerDetails: [],
  2300. houseList: []
  2301. };
  2302. return cur;
  2303. })
  2304. );
  2305. },
  2306. async initData() {
  2307. const { data } = await getTreeByGroup({ type: 1 });
  2308. this.codeList = data;
  2309. // .map((item) => {
  2310. // return { dictCode: item.id, dictValue: item.name };
  2311. // });
  2312. const res = await warehouseDefinition.tree();
  2313. this.treeList = this.$util.toTreeData({
  2314. data: res,
  2315. idField: 'id',
  2316. parentIdField: 'parentId'
  2317. });
  2318. // const res111 = await warehouseDefinition.list();
  2319. // this.warehouseList = res111.list;
  2320. let res22 = await warehouseDefinition.getUserPage({
  2321. size: -1,
  2322. page: 1
  2323. });
  2324. this.fromUserList = res22.list;
  2325. const info = await getLoginUser();
  2326. // const info = JSON.parse(localStorage.getItem('info'));
  2327. let obj = res.find(
  2328. (item) => item.id === info.deptId[info.deptId.length - 1]
  2329. );
  2330. if (!obj) return;
  2331. this.formData.extInfo.deptCode = obj.id;
  2332. this.formData.extInfo.deptName = obj.name;
  2333. this.formData.extInfo.createUserName = info.name;
  2334. this.formData.createUserId = info.id;
  2335. // this.treeList = res;
  2336. // this.formData.extInfo.deptCode =
  2337. // this.getTreeList().then((res) => {
  2338. // if (res?.success) {
  2339. // this.treeList = res.data;
  2340. // }
  2341. // });
  2342. // this.getSupplier().then((res) => {
  2343. // if (res?.success) {
  2344. // this.supplierList = res.data.items;
  2345. // }
  2346. // });
  2347. // this.getStaffList();
  2348. },
  2349. addStock() {
  2350. // this.$refs.wareHouseDailogRef.open({});
  2351. // return;
  2352. if (!this.title) return this.$message.error('请选择入库产品类型');
  2353. if (!this.formData.bizType)
  2354. return this.$message.error('请选择入库场景');
  2355. this.visibleDialog = true;
  2356. },
  2357. handleChange(data) {
  2358. this.title = data?.dictValue;
  2359. this.selectEquiType = data?.dictCode;
  2360. },
  2361. handleChanges(code) {
  2362. const data = this.codeList.find((item) => item.dictCode == code);
  2363. this.title = data?.dictValue;
  2364. this.selectEquiType = data?.dictCode;
  2365. },
  2366. getSupplier() {
  2367. return new Promise((resolve, reject) => {
  2368. supplier.list({ page: 1, size: 999 }).then((res) => {
  2369. if (res.success) {
  2370. resolve(res);
  2371. }
  2372. });
  2373. });
  2374. },
  2375. getTreeList() {
  2376. return new Promise((resolve, reject) => {
  2377. org.tree().then((res) => {
  2378. if (res.success) {
  2379. resolve(res);
  2380. }
  2381. });
  2382. });
  2383. },
  2384. upload(data) {
  2385. this.formData.contentImage = data;
  2386. this.$refs.formName.validateField('contentImage');
  2387. },
  2388. houseData(argum, idx) {
  2389. this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
  2390. }
  2391. },
  2392. watch: {
  2393. // 解决右侧悬浮操作栏不对称问题
  2394. warehousingMaterialList: {
  2395. handler() {
  2396. this.$nextTick(() => {
  2397. this.$refs.warehousingMaterialListTable.doLayout();
  2398. });
  2399. },
  2400. deep: true
  2401. },
  2402. // 解决右侧悬浮操作栏不对称问题
  2403. materialCodeReqList: {
  2404. handler() {
  2405. this.$nextTick(() => {
  2406. this.$refs.materialCodeReqListTable.doLayout();
  2407. });
  2408. },
  2409. deep: true
  2410. },
  2411. // 解决右侧悬浮操作栏不对称问题
  2412. resultArray: {
  2413. handler() {
  2414. this.$nextTick(() => {
  2415. this.$refs.resultArrayTable.doLayout();
  2416. });
  2417. },
  2418. deep: true
  2419. }
  2420. }
  2421. };
  2422. </script>
  2423. <style lang="scss" scoped>
  2424. ::v-deep.form-table {
  2425. .el-form-item {
  2426. margin-bottom: 0;
  2427. }
  2428. .el-input__inner {
  2429. padding: 0 10px;
  2430. }
  2431. ::-webkit-scrollbar {
  2432. width: 8px;
  2433. height: 8px;
  2434. background-color: transparent;
  2435. }
  2436. }
  2437. .p20 {
  2438. padding: 20px;
  2439. }
  2440. .el-select,
  2441. .el-date-editor {
  2442. width: 100%;
  2443. }
  2444. .el-form-item {
  2445. margin-bottom: 22px;
  2446. }
  2447. .material {
  2448. margin-top: 20px;
  2449. .flex {
  2450. display: flex;
  2451. justify-content: space-between;
  2452. font-size: 14px;
  2453. align-items: center;
  2454. .red {
  2455. color: #ff4949;
  2456. }
  2457. }
  2458. }
  2459. .mt10 {
  2460. margin-top: 10px;
  2461. }
  2462. .mt20 {
  2463. margin-top: 20px;
  2464. }
  2465. .center {
  2466. text-align: center;
  2467. }
  2468. .switch_left li {
  2469. border-right: 1px solid rgba(222, 222, 222, 1);
  2470. border-left: 1px solid rgba(222, 222, 222, 1);
  2471. }
  2472. .fontOmitted {
  2473. text-overflow: ellipsis;
  2474. overflow: hidden;
  2475. word-break: break-all;
  2476. white-space: nowrap;
  2477. }
  2478. .table-fixed {
  2479. .el-table__fixed-right {
  2480. height: 100% !important;
  2481. }
  2482. .el-table__fixed-left {
  2483. height: 100% !important;
  2484. }
  2485. .el-table__fixed {
  2486. height: 100% !important;
  2487. }
  2488. }
  2489. </style>