add_2.vue 95 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <header-title title="基本信息">
  5. <div class="right_control">
  6. <el-upload
  7. ref="fileUploadBtn"
  8. action="#"
  9. :auto-upload="false"
  10. :on-change="onChange1"
  11. :limit="1"
  12. :show-file-list="false"
  13. accept=".xls,.xlsx"
  14. >
  15. <el-button type="primary">导入库存excel</el-button>
  16. </el-upload>
  17. <el-upload
  18. ref="fileUploadBtn1"
  19. action="#"
  20. :auto-upload="false"
  21. :on-change="onChange"
  22. :limit="1"
  23. :show-file-list="false"
  24. accept=".xls,.xlsx"
  25. >
  26. <el-button type="primary">导入备品备件excel</el-button>
  27. </el-upload>
  28. <el-button type="primary" @click="back">返回</el-button>
  29. </div>
  30. </header-title>
  31. <el-form
  32. :model="formData"
  33. ref="formName"
  34. label-width="110px"
  35. :rules="rules"
  36. >
  37. <el-row :gutter="20">
  38. <el-col :span="6">
  39. <el-form-item label="物品类型" prop="extInfo.assetType">
  40. <el-select
  41. style="width: 100%"
  42. multiple
  43. v-model="formData.extInfo.assetType"
  44. placeholder="请选择"
  45. >
  46. <el-option
  47. v-for="item in goodsLists"
  48. :key="item.id"
  49. :label="item.name"
  50. :value="item.id"
  51. >
  52. </el-option>
  53. </el-select>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="6">
  57. <el-form-item label="入库类型" prop="bizType">
  58. <el-select
  59. style="width: 100%"
  60. filterable
  61. placeholder="请选择"
  62. v-model="formData.bizType"
  63. clearable
  64. >
  65. <el-option
  66. v-for="item in sceneState"
  67. :key="item.code"
  68. :value="item.code + ''"
  69. :label="item.label"
  70. ></el-option>
  71. </el-select> </el-form-item
  72. ></el-col>
  73. <el-col :span="6">
  74. <el-form-item label="单据来源" prop="sourceBizNo">
  75. <el-input
  76. placeholder="请选择"
  77. v-model="formData.sourceBizNo"
  78. @click.native="openDocumentSourceDialog"
  79. >
  80. <el-button
  81. @click="clearSourceBizNo"
  82. slot="append"
  83. icon="el-icon-circle-close"
  84. ></el-button>
  85. </el-input>
  86. </el-form-item>
  87. </el-col>
  88. <!-- <el-col :span="6">
  89. <el-form-item label="权属部门" prop="deptName">
  90. <el-input
  91. placeholder="权属部门"
  92. disabled
  93. v-model="formData.extInfo.deptName"
  94. clearable
  95. />
  96. </el-form-item>
  97. </el-col> -->
  98. <el-col :span="6">
  99. <el-form-item label="入库时间">
  100. <el-date-picker
  101. v-model="formData.storageTime"
  102. type="datetime"
  103. value-format="yyyy-MM-dd HH:mm:ss"
  104. placeholder="选择日期时间"
  105. >
  106. </el-date-picker></el-form-item
  107. ></el-col>
  108. <el-col :span="6">
  109. <el-form-item label="入库登记人">
  110. <el-input
  111. placeholder="登记人"
  112. disabled
  113. v-model="formData.extInfo.createUserName"
  114. clearable /></el-form-item
  115. ></el-col>
  116. <el-col :span="6" v-if="formData.bizType == 2">
  117. <el-form-item label="供应商" prop="supplierName">
  118. <el-input
  119. placeholder="请输入"
  120. clearable
  121. v-model="formData.extInfo.supplierName"
  122. />
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="6">
  126. <el-form-item label="送货人" prop="fromUser">
  127. <el-input
  128. placeholder="请输入"
  129. v-model="formData.fromUser"
  130. clearable
  131. /> </el-form-item
  132. ></el-col>
  133. <el-col :span="6">
  134. <el-form-item label="送货人联系方式" prop="deliveryPhone">
  135. <el-input
  136. placeholder="请输入"
  137. v-model="formData.extInfo.deliveryPhone"
  138. clearable /></el-form-item
  139. ></el-col>
  140. <el-col :span="6">
  141. <el-form-item label="备注" prop="remark">
  142. <el-input
  143. v-model="formData.remark"
  144. placeholder="请详细说明"
  145. ></el-input>
  146. </el-form-item>
  147. </el-col>
  148. </el-row>
  149. </el-form>
  150. <div class="inbound_details">
  151. <header-title title="产品信息">
  152. <el-button type="primary" @click="addProduct">添加</el-button>
  153. </header-title>
  154. <div class="form_table">
  155. <el-form
  156. ref="productListRef"
  157. :model="{ productList: productList }"
  158. :show-message="false"
  159. >
  160. <el-button
  161. v-if="productList.length != 0"
  162. type="success"
  163. plain
  164. style="margin-bottom: 20px; float: right; margin-right: 20px"
  165. size="mini"
  166. @click="listSaveArrs"
  167. >批量保存</el-button
  168. >
  169. <el-button
  170. v-if="productList.length != 0 && this.packingList.length == 0"
  171. type="success"
  172. plain
  173. style="margin-bottom: 20px; float: right; margin-right: 20px"
  174. size="mini"
  175. @click="handleWareHouse(productList[0])"
  176. >批量选择仓库</el-button
  177. >
  178. <el-table
  179. :header-cell-style="rowClass"
  180. :max-height="300"
  181. border
  182. ref="productListTable"
  183. :data="productList"
  184. tooltip-effect="dark"
  185. >
  186. <el-table-column
  187. label="序号"
  188. type="index"
  189. width="50"
  190. align="center"
  191. >
  192. </el-table-column>
  193. <el-table-column
  194. label="编码"
  195. prop="categoryCode"
  196. align="center"
  197. width="130"
  198. :show-overflow-tooltip="true"
  199. ></el-table-column>
  200. <el-table-column
  201. label="名称"
  202. align="center"
  203. width="200"
  204. prop="categoryName"
  205. :show-overflow-tooltip="true"
  206. ></el-table-column>
  207. <el-table-column
  208. label="型号"
  209. align="center"
  210. width="100"
  211. prop="categoryModel"
  212. :show-overflow-tooltip="true"
  213. ></el-table-column>
  214. <el-table-column
  215. label="规格"
  216. align="center"
  217. width="100"
  218. prop="specification"
  219. :show-overflow-tooltip="true"
  220. ></el-table-column>
  221. <el-table-column
  222. label="牌号"
  223. align="center"
  224. width="100"
  225. prop="brandNum"
  226. :show-overflow-tooltip="true"
  227. ></el-table-column>
  228. <el-table-column
  229. v-for="(item, index) in newColumns"
  230. :label="item.label"
  231. :align="item.align"
  232. :prop="item.prop"
  233. :show-overflow-tooltip="item.showOverflowTooltip"
  234. ></el-table-column>
  235. <el-table-column
  236. label="批次号"
  237. align="center"
  238. width="100"
  239. prop="batchNo"
  240. >
  241. <template slot-scope="{ row, $index }">
  242. <template v-if="row.isSave">
  243. {{ row.batchNo }}
  244. </template>
  245. <el-form-item
  246. v-else
  247. :prop="`productList.${$index}.batchNo`"
  248. required
  249. >
  250. <el-input
  251. :ref="'batchNo' + $index"
  252. @keyup.native="
  253. moveFocus($event, $index, 'batchNo', '产品', row)
  254. "
  255. v-model.number="row.batchNo"
  256. >
  257. </el-input>
  258. </el-form-item>
  259. </template>
  260. </el-table-column>
  261. <el-table-column
  262. label="最小包装单元"
  263. align="center"
  264. prop="minPackingQuantity"
  265. width="200"
  266. >
  267. <template slot-scope="{ row, $index }">
  268. <template v-if="row.isSave">
  269. {{ row.minPackingQuantity }}
  270. </template>
  271. <el-form-item
  272. v-else
  273. :prop="`productList.${$index}.minPackingQuantity`"
  274. required
  275. >
  276. <el-input
  277. type="number"
  278. :ref="'minPackingQuantity' + $index"
  279. @keyup.native="
  280. moveFocus(
  281. $event,
  282. $index,
  283. 'minPackingQuantity',
  284. '产品',
  285. row
  286. )
  287. "
  288. v-model="row.minPackingQuantity"
  289. @input="minPackingQuantityChange(row, $event, $index)"
  290. >
  291. <template slot="append">
  292. {{ row.measureUnit }} /{{ row.packingUnit }}
  293. </template>
  294. </el-input>
  295. </el-form-item>
  296. </template>
  297. </el-table-column>
  298. <el-table-column
  299. label="包装数量"
  300. prop="packingQuantity"
  301. width="150"
  302. align="center"
  303. >
  304. <template slot-scope="{ row, $index }">
  305. <template v-if="row.isSave">
  306. {{ row.packingQuantity }} {{ row.packingUnit }}
  307. </template>
  308. <el-form-item
  309. v-else
  310. :prop="`productList.${$index}.packingQuantity`"
  311. required
  312. >
  313. <el-input
  314. :ref="'packingQuantity' + $index"
  315. @keyup.native="
  316. moveFocus(
  317. $event,
  318. $index,
  319. 'packingQuantity',
  320. '产品',
  321. row
  322. )
  323. "
  324. v-model.number="row.packingQuantity"
  325. @input="packNum(row, $event, $index)"
  326. >
  327. <template slot="append">
  328. {{ row.packingUnit ? row.packingUnit : '/' }}
  329. </template>
  330. </el-input>
  331. </el-form-item>
  332. </template>
  333. </el-table-column>
  334. <el-table-column
  335. label="计量数量"
  336. prop="measureQuantity"
  337. :show-overflow-tooltip="true"
  338. >
  339. <template slot-scope="{ row, $index }">
  340. {{
  341. changeCount(
  342. $math.format(
  343. row.minPackingQuantity * row.packingQuantity,
  344. 14
  345. )
  346. )
  347. }}
  348. </template>
  349. </el-table-column>
  350. <el-table-column
  351. label="计量单位"
  352. prop="measureUnit"
  353. width="100"
  354. align="center"
  355. >
  356. <template slot-scope="{ row, $index }">
  357. <template>
  358. {{ row.measureUnit }}
  359. </template>
  360. </template>
  361. </el-table-column>
  362. <el-table-column
  363. label="重量"
  364. align="center"
  365. prop="weight"
  366. :show-overflow-tooltip="true"
  367. >
  368. <template slot-scope="{ row, $index }">
  369. {{ row.weight }}
  370. <template slot="append">
  371. {{ row.measureUnit }}
  372. </template>
  373. </template>
  374. </el-table-column>
  375. <el-table-column
  376. label="重量单位"
  377. align="center"
  378. prop="weightUnit"
  379. :show-overflow-tooltip="true"
  380. >
  381. <template slot-scope="{ row, $index }">
  382. {{ row.weightUnit }}
  383. <template slot="append"> </template>
  384. </template>
  385. </el-table-column>
  386. <el-table-column
  387. label="单价"
  388. prop="price"
  389. width="200"
  390. align="center"
  391. >
  392. <template slot-scope="{ row, $index }">
  393. <template v-if="row.isSave">
  394. {{ row.price }}元/{{ row.measureUnit }}
  395. </template>
  396. <el-form-item v-else>
  397. <el-input
  398. type="number"
  399. :ref="'price' + $index"
  400. @keyup.native="
  401. moveFocus($event, $index, 'price', '产品', row)
  402. "
  403. v-model.number="row.price"
  404. placeholder="非必填"
  405. @input="
  406. (value) => (row.price = value.replace(/[^0-9.]+/g, ''))
  407. "
  408. >
  409. <template slot="append">
  410. 元/{{ row.measureUnit }}
  411. </template>
  412. </el-input>
  413. </el-form-item>
  414. </template>
  415. </el-table-column>
  416. <el-table-column
  417. label="金额"
  418. align="center"
  419. prop="contentImage"
  420. :show-overflow-tooltip="true"
  421. >
  422. <template slot-scope="{ row, $index }">
  423. {{
  424. changeCount(
  425. calcSumTotal(
  426. row.packingQuantity,
  427. row.minPackingQuantity,
  428. row.price,
  429. row
  430. )
  431. )
  432. }}
  433. </template>
  434. </el-table-column>
  435. <el-table-column
  436. label="供应商"
  437. align="center"
  438. prop="supplierId"
  439. width="200"
  440. :show-overflow-tooltip="true"
  441. >
  442. <template slot-scope="{ row, $index }">
  443. <template v-if="row.isSave">
  444. {{ row.supplierName }}
  445. </template>
  446. <el-select
  447. v-else
  448. @change="selectSupplier($event, row)"
  449. v-model="row.supplierId"
  450. placeholder="请选择"
  451. >
  452. <el-option
  453. v-for="item in row.supplierListOptions"
  454. :label="item.name"
  455. :value="item.id"
  456. :key="item.id"
  457. >
  458. </el-option>
  459. </el-select>
  460. </template>
  461. </el-table-column>
  462. <el-table-column
  463. label="仓库"
  464. align="center"
  465. prop="warehouseName"
  466. :show-overflow-tooltip="true"
  467. width="300"
  468. >
  469. <template slot-scope="{ row, $index }">
  470. <el-form-item
  471. :prop="`productList.${$index}.warehouseId`"
  472. required
  473. >
  474. <div
  475. :class="
  476. row.warehouseName
  477. ? 'wareHouse_style'
  478. : 'wareHouse_style red_color'
  479. "
  480. @click="handleWareHouse(row, $index)"
  481. >
  482. <span>
  483. {{
  484. row.warehouseName ? row.warehouseName : '请选择仓库'
  485. }}
  486. </span>
  487. </div>
  488. </el-form-item>
  489. </template>
  490. </el-table-column>
  491. <el-table-column
  492. label="采购原因"
  493. align="center"
  494. width="200"
  495. prop="purpose"
  496. :show-overflow-tooltip="true"
  497. >
  498. <template slot-scope="{ row, $index }">
  499. <template v-if="row.isSave">
  500. {{ row.purpose }}
  501. </template>
  502. <el-input
  503. v-else
  504. :ref="'purpose' + $index"
  505. @keyup.native="
  506. moveFocus($event, $index, 'purpose', '产品', row)
  507. "
  508. v-model="row.purpose"
  509. >
  510. </el-input>
  511. </template>
  512. </el-table-column>
  513. <el-table-column
  514. label="操作"
  515. width="200"
  516. fixed="right"
  517. align="center"
  518. >
  519. <template slot="header" slot-scope="scope"> 操作 </template>
  520. <template slot-scope="{ row, $index }">
  521. <el-button
  522. type="text"
  523. v-show="!row.isSave"
  524. @click="listSave(row, $index)"
  525. >保存</el-button
  526. >
  527. <el-button
  528. type="text"
  529. v-show="row.isSave"
  530. @click="listEdit(row, $index)"
  531. >编辑</el-button
  532. >
  533. <el-button type="text" @click="listDel(row, $index)"
  534. >删除</el-button
  535. >
  536. </template>
  537. </el-table-column>
  538. </el-table>
  539. </el-form>
  540. </div>
  541. </div>
  542. <div v-if="showPackingList.length > 0" class="inbound_details">
  543. <header-title :title="`包装明细`">
  544. <div class="switch_right">
  545. <el-button
  546. style="margin-left: 20px"
  547. type="text"
  548. @click="dateSetting"
  549. >批量设置{{
  550. curDateType === 'productionDate' ? '生产日期' : '采购日期'
  551. }}</el-button
  552. >
  553. </div>
  554. </header-title>
  555. <el-table
  556. v-if="isWrapTable"
  557. ref="packingListTable"
  558. :data="showPackingList"
  559. tooltip-effect="dark"
  560. :key="formData.bizType"
  561. :header-cell-style="rowClass"
  562. style="width: 100%"
  563. border
  564. stripe
  565. :max-height="300"
  566. v-el-table-infinite-scroll="pickingHandleScroll"
  567. @selection-change="handleSelectionChange"
  568. >
  569. <el-table-column
  570. fixed="left"
  571. type="selection"
  572. align="center"
  573. width="50"
  574. >
  575. </el-table-column>
  576. <el-table-column label="序号" type="index" width="50">
  577. </el-table-column>
  578. <el-table-column
  579. label="编码"
  580. prop="categoryCode"
  581. width="130"
  582. :show-overflow-tooltip="true"
  583. ></el-table-column>
  584. <el-table-column
  585. label="名称"
  586. prop="categoryName"
  587. width="150"
  588. :show-overflow-tooltip="true"
  589. ></el-table-column>
  590. <el-table-column
  591. label="型号"
  592. align="center"
  593. width="100"
  594. prop="categoryModel"
  595. :show-overflow-tooltip="true"
  596. ></el-table-column>
  597. <el-table-column
  598. label="规格"
  599. align="center"
  600. width="100"
  601. prop="specification"
  602. :show-overflow-tooltip="true"
  603. ></el-table-column>
  604. <el-table-column
  605. label="牌号"
  606. align="center"
  607. width="100"
  608. prop="brandNum"
  609. :show-overflow-tooltip="true"
  610. ></el-table-column>
  611. <el-table-column
  612. label="批次号"
  613. prop="batchNo"
  614. width="70"
  615. ></el-table-column>
  616. <el-table-column
  617. :label="`包装编码`"
  618. prop="packageNo"
  619. width="200"
  620. :show-overflow-tooltip="true"
  621. ></el-table-column>
  622. <el-table-column
  623. label="包装数量"
  624. prop="packingQuantity"
  625. width="80"
  626. ></el-table-column>
  627. <el-table-column
  628. label="包装单位"
  629. prop="packingUnit"
  630. ></el-table-column>
  631. <el-table-column
  632. label="计量数量"
  633. prop="measureQuantity"
  634. :show-overflow-tooltip="true"
  635. ></el-table-column>
  636. <el-table-column
  637. label="计量单位"
  638. prop="measureUnit"
  639. ></el-table-column>
  640. <el-table-column label="允许拆包" prop="isUnpack">
  641. <template slot-scope="{ row, $index }">
  642. {{ row.isUnpack ? '是' : '否' }}
  643. </template>
  644. </el-table-column>
  645. <el-table-column
  646. label="仓库"
  647. :show-overflow-tooltip="true"
  648. prop="warehouseName"
  649. width="200"
  650. ></el-table-column>
  651. <el-table-column
  652. label="物料代号"
  653. prop="materielDesignation"
  654. width="130"
  655. >
  656. <template slot-scope="{ row, $index }">
  657. <el-input
  658. v-if="!row.isPack"
  659. :ref="'packing_materielDesignation' + $index"
  660. @keyup.native="
  661. moveFocus(
  662. $event,
  663. $index,
  664. 'packing_materielDesignation',
  665. '包装',
  666. row
  667. )
  668. "
  669. v-model="row.materielDesignation"
  670. ></el-input>
  671. <span v-else>{{ row.materielDesignation }}</span>
  672. </template>
  673. </el-table-column>
  674. <el-table-column label="客户代号" prop="clientCode">
  675. <template slot-scope="{ row, $index }">
  676. <el-input
  677. v-if="!row.isPack"
  678. :ref="'packing_clientCode' + $index"
  679. @keyup.native="
  680. moveFocus($event, $index, 'packing_clientCode', '包装', row)
  681. "
  682. v-model="row.clientCode"
  683. ></el-input>
  684. <span v-else> {{ row.clientCode }}</span>
  685. </template>
  686. </el-table-column>
  687. <el-table-column label="刻码" prop="engrave" width="140">
  688. <template slot-scope="{ row, $index }">
  689. <el-input
  690. v-if="!row.isPack"
  691. :ref="'packing_engrave' + $index"
  692. @keyup.native="
  693. moveFocus($event, $index, 'packing_engrave', '包装', row)
  694. "
  695. v-model="row.engrave"
  696. ></el-input>
  697. <span v-else>{{ row.engrave }}</span>
  698. </template>
  699. </el-table-column>
  700. <el-table-column label="重量" prop="weight" width="100">
  701. <template slot-scope="{ row, $index }">
  702. <el-input
  703. v-if="!row.isPack && row.measureUnit != row.weightUnit"
  704. :ref="'packing_weight' + $index"
  705. @keyup.native="
  706. moveFocus($event, $index, 'packing_weight', '包装', row)
  707. "
  708. v-model.number="row.weight"
  709. @input="weightInput($event, row, '包装')"
  710. ></el-input>
  711. <span v-else>{{ row.weight }}</span>
  712. </template>
  713. </el-table-column>
  714. <el-table-column label="重量单位" prop="weightUnit">
  715. <template slot-scope="{ row }">
  716. {{ row.weightUnit }}
  717. </template>
  718. </el-table-column>
  719. <el-table-column label="质检结果" prop="result" width="120">
  720. <template slot-scope="{ row }">
  721. <el-select
  722. v-if="!row.isPack"
  723. @change="changeWrapStatus($event, row, '包装')"
  724. v-model="row.result"
  725. placeholder="请选择"
  726. >
  727. <el-option
  728. v-for="item in qualityResultsOptions"
  729. :label="item.label"
  730. :value="item.value"
  731. :key="item.value"
  732. >
  733. </el-option>
  734. </el-select>
  735. <span v-else>{{ qualityResults[row.result] }}</span>
  736. </template>
  737. </el-table-column>
  738. <el-table-column label="质检状态" prop="status" width="120">
  739. <template slot-scope="{ row }">
  740. <span>{{ qualityStatus[row.status] }}</span>
  741. </template>
  742. </el-table-column>
  743. <el-table-column label="生产日期" prop="" width="220">
  744. <template slot="header" slot-scope="scope">
  745. <el-select filterable v-model="curDateType">
  746. <el-option value="productionDate" label="生产日期"></el-option>
  747. <el-option value="purchaseDate" label="采购日期"></el-option>
  748. </el-select>
  749. </template>
  750. <template slot-scope="{ row }">
  751. <template v-if="formData.bizType == 5">
  752. {{ row[curDateType] }}
  753. </template>
  754. <el-date-picker
  755. v-else
  756. :disabled="row.isPack"
  757. size="small"
  758. v-model="row[curDateType]"
  759. type="datetime"
  760. value-format="yyyy-MM-dd HH:mm:ss"
  761. placeholder="选择日期"
  762. >
  763. </el-date-picker>
  764. </template>
  765. </el-table-column>
  766. <!-- <el-table-column label="操作" width="120" fixed="right">
  767. <template slot-scope="{ row, $index }">
  768. <el-button type="text" @click="wrapDelete(row, $index)">
  769. 删除
  770. </el-button>
  771. </template>
  772. </el-table-column> -->
  773. </el-table>
  774. </div>
  775. <div v-if="showMaterialList.length > 0" class="inbound_details">
  776. <header-title :title="`物料明细`"></header-title>
  777. <el-table
  778. ref="materialListTable"
  779. :data="showMaterialList"
  780. tooltip-effect="dark"
  781. :key="formData.bizType"
  782. :header-cell-style="rowClass"
  783. style="width: 100%"
  784. border
  785. stripe
  786. :max-height="300"
  787. v-el-table-infinite-scroll="materielHandleScroll"
  788. >
  789. <el-table-column label="序号" type="index" width="50">
  790. </el-table-column>
  791. <el-table-column
  792. label="编码"
  793. prop="categoryCode"
  794. width="130"
  795. :show-overflow-tooltip="true"
  796. ></el-table-column>
  797. <el-table-column
  798. label="名称"
  799. prop="categoryName"
  800. width="150"
  801. :show-overflow-tooltip="true"
  802. ></el-table-column>
  803. <el-table-column
  804. label="型号"
  805. align="center"
  806. width="100"
  807. prop="categoryModel"
  808. :show-overflow-tooltip="true"
  809. ></el-table-column>
  810. <el-table-column
  811. label="规格"
  812. align="center"
  813. width="100"
  814. prop="specification"
  815. :show-overflow-tooltip="true"
  816. ></el-table-column>
  817. <el-table-column
  818. label="牌号"
  819. align="center"
  820. width="100"
  821. prop="brandNum"
  822. :show-overflow-tooltip="true"
  823. ></el-table-column>
  824. <el-table-column
  825. label="批次号"
  826. prop="batchNo"
  827. width="70"
  828. ></el-table-column>
  829. <el-table-column
  830. label="物料编码"
  831. prop="materialCode"
  832. width="200"
  833. :show-overflow-tooltip="true"
  834. ></el-table-column>
  835. <el-table-column
  836. label="计量数量"
  837. prop="measureQuantity"
  838. width="90"
  839. :show-overflow-tooltip="true"
  840. ></el-table-column>
  841. <el-table-column
  842. width="80"
  843. label="计量单位"
  844. prop="measureUnit"
  845. ></el-table-column>
  846. <el-table-column
  847. label="物料代号"
  848. prop="materielDesignation"
  849. width="130"
  850. >
  851. <template slot-scope="{ row, $index }">
  852. <el-input
  853. v-if="!row.isPack"
  854. :ref="'material_materielDesignation' + $index"
  855. @keyup.native="
  856. moveFocus(
  857. $event,
  858. $index,
  859. 'material_materielDesignation',
  860. '物料',
  861. row
  862. )
  863. "
  864. v-model="row.materielDesignation"
  865. ></el-input>
  866. <span v-else>{{ row.materielDesignation }}</span>
  867. </template>
  868. </el-table-column>
  869. <el-table-column label="客户代号" prop="clientCode">
  870. <template slot-scope="{ row, $index }">
  871. <el-input
  872. v-if="!row.isPack"
  873. :ref="'material_clientCode' + $index"
  874. @keyup.native="
  875. moveFocus($event, $index, 'material_clientCode', '物料', row)
  876. "
  877. v-model="row.clientCode"
  878. ></el-input>
  879. <span v-else>{{ row.clientCode }}</span>
  880. </template>
  881. </el-table-column>
  882. <el-table-column label="刻码" prop="engrave" width="140">
  883. <template slot-scope="{ row, $index }">
  884. <el-input
  885. v-if="!row.isPack"
  886. :ref="'material_engrave' + $index"
  887. @keyup.native="
  888. moveFocus($event, $index, 'material_engrave', '物料', row)
  889. "
  890. v-model="row.engrave"
  891. ></el-input>
  892. <span v-else>{{ row.engrave }}</span>
  893. </template>
  894. </el-table-column>
  895. <el-table-column label="重量" prop="weight" width="100">
  896. <template slot-scope="{ row, $index }">
  897. <el-input
  898. v-if="!row.isPack && row.measureUnit != row.weightUnit"
  899. :ref="'material_weight' + $index"
  900. @keyup.native="
  901. moveFocus($event, $index, 'material_weight', '物料', row)
  902. "
  903. @input="weightInput($event, row, '物料')"
  904. v-model.number="row.weight"
  905. ></el-input>
  906. <span v-else>{{ row.weight }}</span>
  907. </template>
  908. </el-table-column>
  909. <el-table-column
  910. label="重量单位"
  911. prop="weightUnit"
  912. width="100"
  913. ></el-table-column>
  914. <el-table-column label="质检结果" prop="result" width="120">
  915. <template slot-scope="{ row }">
  916. <el-select
  917. v-if="!row.isPack"
  918. @change="changeWrapStatus($event, row, '物料')"
  919. v-model="row.result"
  920. placeholder="请选择"
  921. >
  922. <el-option
  923. v-for="item in qualityResultsOptions"
  924. :label="item.label"
  925. :value="item.value"
  926. :key="item.value"
  927. >
  928. </el-option>
  929. </el-select>
  930. <span v-else>{{ qualityResults[row.result] }}</span>
  931. </template>
  932. </el-table-column>
  933. <el-table-column label="质检状态" prop="status" width="120">
  934. <template slot-scope="{ row }">
  935. <span>{{ qualityStatus[row.status] }}</span>
  936. </template>
  937. </el-table-column>
  938. <!-- <el-table-column label="操作" width="120" fixed="right">
  939. <template slot-scope="{ row, $index }">
  940. <el-button type="text" @click="materialDelete(row, $index)">
  941. 删除
  942. </el-button>
  943. </template>
  944. </el-table-column> -->
  945. </el-table>
  946. </div>
  947. <div v-if="showPackingList.length > 0" class="storage_btn">
  948. <el-button type="primary" :loading="saveLoading" @click="storage"
  949. >入库</el-button
  950. >
  951. </div>
  952. </el-card>
  953. <!-- 产品选择弹框 -->
  954. <selectType
  955. :visibleDialog.sync="visibleDialog"
  956. :title="title"
  957. :bizScene="formData.bizType"
  958. :treeIds="formData.extInfo.assetType"
  959. :loadTree.sync="loadTree"
  960. @selectTableData="addGoods"
  961. />
  962. <!-- 仓库选择弹框 -->
  963. <WarehousingDialog
  964. ref="wareHouseDailogRef"
  965. @selection="wareHouseSelection"
  966. ></WarehousingDialog>
  967. <!-- 生产日期、采购日期弹框 -->
  968. <el-dialog :visible.sync="dateVisible" title="选择日期" width="400px">
  969. <el-date-picker
  970. size="small"
  971. v-model="batchTime"
  972. type="datetime"
  973. style="width: 320px"
  974. value-format="yyyy-MM-dd HH:mm:ss"
  975. placeholder="选择日期"
  976. >
  977. </el-date-picker>
  978. <div style="text-align: right; margin-top: 20px">
  979. <el-button @click="dateVisible = false">取消</el-button>
  980. <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
  981. >确认</el-button
  982. >
  983. </div>
  984. </el-dialog>
  985. <outboundRequisitionDialog
  986. ref="outboundRequisitionDialogRef"
  987. @detailData="outboundRequisitionSelection"
  988. type="1"
  989. :bizType="formData.bizType"
  990. />
  991. </div>
  992. </template>
  993. <script>
  994. import XLSX from 'xlsx';
  995. import outboundRequisitionDialog from '../components/outboundRequisitionDialog.vue';
  996. import elTableInfiniteScroll from 'el-table-infinite-scroll';
  997. import storageApi from '@/api/warehouseManagement/index.js';
  998. import WarehousingDialog from '../components/WarehousingDialog.vue';
  999. import { getCode } from '@/api/codeManagement/index.js';
  1000. import selectType from './components/selectType';
  1001. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  1002. import {
  1003. sceneState,
  1004. qualityResultsOptions,
  1005. qualityResults,
  1006. qualityStatus
  1007. } from '@/utils/dict/index';
  1008. import { getTreeByGroup } from '@/api/classifyManage';
  1009. import outin from '@/api/warehouseManagement/outin';
  1010. import { deepClone } from '@/utils';
  1011. import BigNumber from 'bignumber.js';
  1012. export default {
  1013. components: {
  1014. selectType,
  1015. WarehousingDialog,
  1016. outboundRequisitionDialog
  1017. },
  1018. // 虚拟列表滚动方法
  1019. directives: {
  1020. 'el-table-infinite-scroll': elTableInfiniteScroll
  1021. },
  1022. data() {
  1023. return {
  1024. newColumns: [], // 动态表头
  1025. sceneState,
  1026. saveLoading: false,
  1027. dateVisible: false,
  1028. loadTree: true,
  1029. visibleDialog: false,
  1030. title: '选择产品',
  1031. goodsLists: [],
  1032. formData: {
  1033. bizType: '',
  1034. storageTime: '',
  1035. extInfo: {
  1036. assetType: []
  1037. }
  1038. },
  1039. rules: {
  1040. 'extInfo.assetType': {
  1041. required: true,
  1042. message: '请选择物品类型',
  1043. trigger: 'blur'
  1044. },
  1045. bizType: {
  1046. required: true,
  1047. message: '请选择入库场景',
  1048. trigger: 'change'
  1049. }
  1050. },
  1051. qualityResultsOptions, // 质检结果下拉选项 0无 1合格 2不合格
  1052. qualityStatus, // 质检状态 0未检 1已检
  1053. qualityResults, // 质检结果 0无 1合格 2不合格
  1054. productList: [], // 产品列表
  1055. packingList: [], // 包装列表
  1056. showPackingList: [], // 包装列表(虚拟列表)
  1057. materialList: [], // 物料列表
  1058. showMaterialList: [], // 物料列表(虚拟列表)
  1059. curDateType: 'productionDate',
  1060. packingListSelected: [], // 包装选择列表
  1061. isWrapTable: true, // 解决表格不刷新问题(包装)
  1062. currentPackingQuantity: '', // 当前包装数量
  1063. batchTime: '', // 生产日期、采购日期
  1064. pageSize: 20, // 物料和包装列表条数
  1065. pickingPageNum: 1, // 包装虚拟分页页数
  1066. materielPageNum: 1, // 物料虚拟分页页数
  1067. selWWData: {}
  1068. };
  1069. },
  1070. computed: {
  1071. clientEnvironmentId() {
  1072. return this.$store.state.user.info.clientEnvironmentId;
  1073. }
  1074. },
  1075. watch: {
  1076. packingList: {
  1077. handler(newVal) {
  1078. console.log('包装列表', newVal);
  1079. console.log('当前包装列表加载页数', this.pickingPageNum);
  1080. this.showPackingList = newVal.slice(
  1081. 0,
  1082. this.pageSize * (this.pickingPageNum > 0 ? this.pickingPageNum : 1)
  1083. );
  1084. },
  1085. deep: true
  1086. },
  1087. materialList: {
  1088. handler(newVal) {
  1089. console.log('物料列表', newVal);
  1090. console.log('当前物料列表加载页数', this.materielPageNum);
  1091. this.showMaterialList = newVal.slice(
  1092. 0,
  1093. this.pageSize *
  1094. (this.materielPageNum > 0 ? this.materielPageNum : 1)
  1095. );
  1096. },
  1097. deep: true
  1098. }
  1099. },
  1100. created() {
  1101. this.getFieldModel();
  1102. this.getListItems();
  1103. this.initUserInfo();
  1104. this.getNowFormatDate();
  1105. if (this.$route.query.id) {
  1106. storageApi
  1107. .getApplystorageDetailById(this.$route.query.id)
  1108. .then(async (data) => {
  1109. console.log(data);
  1110. this.formData.extInfo.assetType = [data.rootCategoryLevelId];
  1111. this.formData.bizType = String(data.type);
  1112. this.formData.sourceBizNo = data.code;
  1113. const batchNo = await getCode('lot_number_code');
  1114. this.productList = data.detailList.map((item, index) => {
  1115. return {
  1116. index: this.productList.length + index,
  1117. categoryId: item.categoryId, // 物品id
  1118. categoryName: item.categoryName, // 物品名称
  1119. categoryCode: item.categoryCode, // 物品编码
  1120. categoryModel: item.modelType, // 物品型号
  1121. specification: item.specification, // 规格
  1122. brandNum: item.brandNum, // 牌号
  1123. batchNo: batchNo, // 批次号
  1124. minPackingQuantity: item.quantity, // 最小包装单元数量
  1125. packingQuantity: 1, // 包装数量
  1126. packingUnit: item.packingUnit, // 包装单位
  1127. measureQuantity: 0, // 计量数量
  1128. measureUnit: item.measuringUnit, // 计量单位
  1129. netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
  1130. weight: item.packingWeight, // 重量
  1131. weightUnit: item.weightUnit, // 重量单位
  1132. totalMoney: '', // 总价
  1133. price: item.price, // 单价
  1134. purpose: item.purpose, // 用途
  1135. isUnpack: item.isUnpack, // 是否允许拆包
  1136. warehouseId: item.warehouseId, // 仓库Id
  1137. warehouseName: item.warehouseName, // 仓库名称
  1138. warehouseIds: [item.warehouseId],
  1139. warehouseNames: [item.warehouseName]
  1140. };
  1141. });
  1142. this.$nextTick(() => {
  1143. this.listSaveArrs();
  1144. });
  1145. });
  1146. }
  1147. if (this.$route.query.detailId) {
  1148. storageApi
  1149. .getInboundDetailsById(this.$route.query.detailId)
  1150. .then(async (data) => {
  1151. this.formData.extInfo.assetType = data.extInfo.assetType.split(',');
  1152. this.formData.bizType = String(data.bizType);
  1153. const batchNo = await getCode('lot_number_code');
  1154. this.productList = data.outInDetailList.map(
  1155. (productItem, productIndex) => {
  1156. return {
  1157. ...productItem,
  1158. index: this.productList.length + productIndex,
  1159. isSave: true,
  1160. batchNo: batchNo, // 批次号
  1161. warehouseIds: [productItem.warehouseId], // 仓库Id
  1162. warehouseNames: [productItem.warehouseName], // 仓库名称
  1163. outInDetailRecordRequestList:
  1164. productItem.outInDetailRecordRequestList.map(
  1165. (packingItem, packingIndex) => {
  1166. return {
  1167. ...packingItem,
  1168. index:
  1169. this.productList.length +
  1170. productIndex +
  1171. '-' +
  1172. packingIndex, // 包装索引
  1173. batchNo: batchNo, // 批次号
  1174. parentIndex: this.productList.length + productIndex, // 物品索引
  1175. categoryName: productItem.categoryName,
  1176. categoryCode: productItem.categoryCode,
  1177. materialDetailList:
  1178. packingItem.materialDetailList.map(
  1179. (materialItem, materialIndex) => {
  1180. return {
  1181. ...materialItem,
  1182. index:
  1183. this.productList.length +
  1184. productIndex +
  1185. '-' +
  1186. packingIndex +
  1187. '——' +
  1188. materialIndex, // 包装索引
  1189. parentIndex:
  1190. this.productList.length +
  1191. productIndex +
  1192. '-' +
  1193. packingIndex, // 物品索引
  1194. batchNo: batchNo, // 批次号
  1195. categoryName: productItem.categoryName,
  1196. categoryCode: productItem.categoryCode
  1197. };
  1198. }
  1199. )
  1200. };
  1201. }
  1202. )
  1203. };
  1204. }
  1205. );
  1206. console.log('this.productList-----------', this.productList);
  1207. // 获取包装维度数据
  1208. const arr = [];
  1209. for (const key in this.productList) {
  1210. for (const k in this.productList[key]
  1211. .outInDetailRecordRequestList) {
  1212. arr.push({
  1213. ...this.productList[key].outInDetailRecordRequestList[k]
  1214. });
  1215. }
  1216. }
  1217. this.packingList = arr;
  1218. // 获取物料维度数据
  1219. let iArr = [];
  1220. arr.forEach((item) => {
  1221. item.materialDetailList.forEach((ele) => {
  1222. iArr.push({ ...ele });
  1223. });
  1224. });
  1225. this.materialList = iArr;
  1226. });
  1227. }
  1228. },
  1229. methods: {
  1230. changeCount(number) {
  1231. return new BigNumber(number).toString();
  1232. },
  1233. selectSupplier(val, row) {
  1234. row.supplierId = val;
  1235. row.supplierName = row.supplierListOptions.filter(
  1236. (item) => item.id == val
  1237. )[0].name;
  1238. },
  1239. async outboundRequisitionSelection(data, dimension, query) {
  1240. if (this.formData.bizType != 10) {
  1241. this.formData.sourceBizNo = query.sourceBizNo;
  1242. this.formData.bizType = query.bizType;
  1243. this.formData.extInfo.assetType = query.assetType.split(',');
  1244. } else {
  1245. console.log('query', query);
  1246. this.selWWData = query;
  1247. this.formData.sourceBizNo = query.sourceBizNo;
  1248. }
  1249. // const batchNo = await getCode('lot_number_code');
  1250. this.productList = data;
  1251. // this.productList = data.map((productItem, productIndex) => {
  1252. // return {
  1253. // ...productItem,
  1254. // index: this.productList.length + productIndex,
  1255. // isSave: true,
  1256. // batchNo: batchNo, // 批次号
  1257. // warehouseIds: [productItem.warehouseId], // 仓库Id
  1258. // warehouseNames: [productItem.warehouseName], // 仓库名称
  1259. // outInDetailRecordRequestList:
  1260. // productItem.outInDetailRecordRequestList.map(
  1261. // (packingItem, packingIndex) => {
  1262. // return {
  1263. // ...packingItem,
  1264. // index:
  1265. // this.productList.length +
  1266. // productIndex +
  1267. // '-' +
  1268. // packingIndex, // 包装索引
  1269. // batchNo: batchNo, // 批次号
  1270. // parentIndex: this.productList.length + productIndex, // 物品索引
  1271. // categoryName: productItem.categoryName,
  1272. // categoryCode: productItem.categoryCode,
  1273. // materialDetailList: packingItem.materialDetailList.map(
  1274. // (materialItem, materialIndex) => {
  1275. // return {
  1276. // ...materialItem,
  1277. // index:
  1278. // this.productList.length +
  1279. // productIndex +
  1280. // '-' +
  1281. // packingIndex +
  1282. // '——' +
  1283. // materialIndex, // 包装索引
  1284. // parentIndex:
  1285. // this.productList.length +
  1286. // productIndex +
  1287. // '-' +
  1288. // packingIndex, // 物品索引
  1289. // batchNo: batchNo, // 批次号
  1290. // categoryName: productItem.categoryName,
  1291. // categoryCode: productItem.categoryCode
  1292. // };
  1293. // }
  1294. // )
  1295. // };
  1296. // }
  1297. // )
  1298. // };
  1299. // });
  1300. // console.log('this.productList-----------', this.productList);
  1301. // // 获取包装维度数据
  1302. // const arr = [];
  1303. // for (const key in this.productList) {
  1304. // for (const k in this.productList[key].outInDetailRecordRequestList) {
  1305. // arr.push({
  1306. // ...this.productList[key].outInDetailRecordRequestList[k]
  1307. // });
  1308. // }
  1309. // }
  1310. // this.packingList = arr;
  1311. // // 获取物料维度数据
  1312. // let iArr = [];
  1313. // arr.forEach((item) => {
  1314. // item.materialDetailList.forEach((ele) => {
  1315. // iArr.push({ ...ele });
  1316. // });
  1317. // });
  1318. // this.materialList = iArr;
  1319. },
  1320. // 获取动态表头
  1321. getFieldModel() {
  1322. storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  1323. let newRes = res.map((m) => {
  1324. return {
  1325. prop: 'extField.' + m.prop,
  1326. label: m.label,
  1327. align: 'center',
  1328. showOverflowTooltip: true
  1329. };
  1330. });
  1331. this.newColumns = [...newRes];
  1332. });
  1333. },
  1334. // 初始化当前用户信息
  1335. async initUserInfo() {
  1336. const res = await warehouseDefinition.tree();
  1337. let info = JSON.parse(localStorage.getItem('info'));
  1338. let obj = res.find(
  1339. (item) => item.id === info.deptIds[info.deptIds.length - 1]
  1340. );
  1341. if (!obj) return;
  1342. this.formData.extInfo.deptCode = obj.id;
  1343. this.formData.extInfo.deptName = obj.name;
  1344. this.formData.extInfo.createUserName = info.name;
  1345. this.formData.createUserId = info.userId;
  1346. },
  1347. // 获取当前时间函数
  1348. getNowDate() {
  1349. let date = new Date(),
  1350. obj = {
  1351. year: date.getFullYear(), //获取完整的年份(4位)
  1352. month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  1353. strDate: date.getDate(), // 获取当前日(1-31)
  1354. hour: date.getHours(), //获取当前小时(0 ~ 23)
  1355. minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
  1356. second: date.getSeconds() //获取当前秒数(0 ~ 59)
  1357. };
  1358. Object.keys(obj).forEach((key) => {
  1359. if (obj[key] < 10) obj[key] = `0${obj[key]}`;
  1360. });
  1361. return obj;
  1362. },
  1363. // 赋值入库时间
  1364. getNowFormatDate() {
  1365. let obj = this.getNowDate();
  1366. this.formData.storageTime = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`;
  1367. },
  1368. // 获取物品列表
  1369. async getListItems() {
  1370. const { data } = await getTreeByGroup({ type: 2 });
  1371. this.goodsLists = data;
  1372. },
  1373. // 打开单据来源弹窗
  1374. openDocumentSourceDialog() {
  1375. console.log('打开单据来源弹窗');
  1376. this.$refs.outboundRequisitionDialogRef.open();
  1377. },
  1378. // 清除单据来源
  1379. clearSourceBizNo() {
  1380. this.formData.sourceBizNo = '';
  1381. },
  1382. // 返回
  1383. back() {
  1384. this.$router.go(-1);
  1385. },
  1386. // 添加产品
  1387. addProduct() {
  1388. if (this.formData.extInfo.assetType.length <= 0) {
  1389. return this.$message.error('请选择物品类型');
  1390. }
  1391. if (!this.formData.bizType) {
  1392. return this.$message.error('请选择入库类型');
  1393. }
  1394. this.visibleDialog = true;
  1395. },
  1396. // 键盘移动
  1397. moveFocus(event, index, key, type, row) {
  1398. let keyfield = [];
  1399. let listLength = 0;
  1400. switch (type) {
  1401. case '产品':
  1402. listLength = this.productList.length;
  1403. keyfield = [
  1404. 'batchNo',
  1405. 'minPackingQuantity',
  1406. 'packingQuantity',
  1407. 'price',
  1408. 'purpose'
  1409. ];
  1410. break;
  1411. case '包装':
  1412. listLength = this.showPackingList.length;
  1413. if (row.measureUnit != row.weightUnit) {
  1414. keyfield = [
  1415. 'packing_materielDesignation',
  1416. 'packing_clientCode',
  1417. 'packing_engrave',
  1418. 'packing_weight'
  1419. ];
  1420. } else {
  1421. keyfield = [
  1422. 'packing_materielDesignation',
  1423. 'packing_clientCode',
  1424. 'packing_engrave'
  1425. ];
  1426. }
  1427. break;
  1428. case '物料':
  1429. listLength = this.showMaterialList.length;
  1430. if (row.measureUnit != row.weightUnit) {
  1431. keyfield = [
  1432. 'material_materielDesignation',
  1433. 'material_clientCode',
  1434. 'material_engrave',
  1435. 'material_weight'
  1436. ];
  1437. } else {
  1438. keyfield = [
  1439. 'material_materielDesignation',
  1440. 'material_clientCode',
  1441. 'material_engrave'
  1442. ];
  1443. }
  1444. break;
  1445. }
  1446. if (event.keyCode === 13) {
  1447. // 回车
  1448. if (
  1449. index === listLength - 1 &&
  1450. key === keyfield[keyfield.length - 1]
  1451. ) {
  1452. // 最后一行最后一个
  1453. return;
  1454. }
  1455. this.$refs[key + index].blur();
  1456. if (key === keyfield[keyfield.length - 1]) {
  1457. // 当前行最后一个,跳转下一行第一个
  1458. if (this.$refs[keyfield[0] + (index + 1)].value == 0) {
  1459. this.$refs[keyfield[0] + (index + 1)].value = '';
  1460. }
  1461. this.$refs[keyfield[0] + (index + 1)].focus();
  1462. } else {
  1463. // 跳转下一个
  1464. const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
  1465. this.$nextTick(() => {
  1466. if (this.$refs[keyfield[nextkeyindex] + index].value == 0) {
  1467. this.$refs[keyfield[nextkeyindex] + index].value = '';
  1468. }
  1469. this.$refs[keyfield[nextkeyindex] + index].focus();
  1470. });
  1471. }
  1472. }
  1473. // 向上 =38
  1474. if (event.keyCode === 38) {
  1475. console.log('向上');
  1476. if (index === 0) {
  1477. // 第一行
  1478. console.log('第一行无法向上');
  1479. return;
  1480. }
  1481. this.$refs[key + index].blur();
  1482. this.$nextTick(() => {
  1483. if (this.$refs[key + (index - 1)].value == 0) {
  1484. this.$refs[key + (index - 1)].value = '';
  1485. }
  1486. this.$refs[key + (index - 1)].focus();
  1487. });
  1488. }
  1489. // 下 = 40
  1490. if (event.keyCode === 40) {
  1491. console.log('向下');
  1492. if (index === listLength - 1) {
  1493. // 最后一行
  1494. console.log('最后一行无法向下');
  1495. return;
  1496. }
  1497. this.$refs[key + index].blur();
  1498. this.$nextTick(() => {
  1499. if (this.$refs[key + (index + 1)].value == 0) {
  1500. this.$refs[key + (index + 1)].value = '';
  1501. }
  1502. this.$refs[key + (index + 1)].focus();
  1503. });
  1504. }
  1505. // 左 = 37
  1506. if (event.keyCode === 37) {
  1507. console.log('向左');
  1508. if (index === 0 && key === keyfield[0]) {
  1509. // 第一行第一个
  1510. console.log('第一行第一个无法向左');
  1511. return;
  1512. }
  1513. this.$refs[key + index].blur();
  1514. if (key === keyfield[0]) {
  1515. if (
  1516. this.$refs[keyfield[keyfield.length - 1] + (index - 1)].value == 0
  1517. ) {
  1518. this.$refs[keyfield[keyfield.length - 1] + (index - 1)].value =
  1519. '';
  1520. }
  1521. // 当前行第一个,跳转上一行最后一个
  1522. this.$refs[keyfield[keyfield.length - 1] + (index - 1)].focus();
  1523. } else {
  1524. // 跳转上一个
  1525. const prevkeyindex = keyfield.findIndex((k) => k === key) - 1;
  1526. this.$nextTick(() => {
  1527. if (this.$refs[keyfield[prevkeyindex] + index].value == 0) {
  1528. this.$refs[keyfield[prevkeyindex] + index].value = '';
  1529. }
  1530. this.$refs[keyfield[prevkeyindex] + index].focus();
  1531. });
  1532. }
  1533. }
  1534. // 右 = 39
  1535. if (event.keyCode === 39) {
  1536. console.log('向右');
  1537. if (
  1538. index === listLength - 1 &&
  1539. key === keyfield[keyfield.length - 1]
  1540. ) {
  1541. // 最后一行最后一个
  1542. console.log('最后一行最后一个无法向左');
  1543. return;
  1544. }
  1545. console.log(this.$refs);
  1546. this.$refs[key + index].blur();
  1547. if (key === keyfield[keyfield.length - 1]) {
  1548. // 当前行最后一个,跳转下一行第一个
  1549. if (this.$refs[keyfield[0] + (index + 1)].value == 0) {
  1550. this.$refs[keyfield[0] + (index + 1)].value = '';
  1551. }
  1552. this.$refs[keyfield[0] + (index + 1)].focus();
  1553. } else {
  1554. // 跳转下一个
  1555. const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
  1556. this.$nextTick(() => {
  1557. if (this.$refs[keyfield[nextkeyindex] + index].value == 0) {
  1558. this.$refs[keyfield[nextkeyindex] + index].value = '';
  1559. }
  1560. this.$refs[keyfield[nextkeyindex] + index].focus();
  1561. });
  1562. }
  1563. }
  1564. },
  1565. handleAvatarSuccess() {
  1566. this.$refs.fileUploadBtn.clearFiles(); //上传成功之后清除历史记录**加粗样式**
  1567. },
  1568. handleAvatarSuccess1() {
  1569. this.$refs.fileUploadBtn1.clearFiles(); //上传成功之后清除历史记录**加粗样式**
  1570. },
  1571. async onChange1(file) {
  1572. console.log(XLSX);
  1573. this.warehousingMaterialList = [];
  1574. this.resultArray = [];
  1575. const loading = this.$loading({
  1576. lock: true,
  1577. text: '加载中...'
  1578. });
  1579. /**
  1580. * 1. 使用原生api去读取好的文件
  1581. * */
  1582. // console.log("原始上传的文件", file);
  1583. // 读取文件不是立马能够读取到的,所以是异步的,使用Promise
  1584. let dataBinary = await new Promise((resolve) => {
  1585. // Web API构造函数FileReader,可实例化对象,去调用其身上方法,去读取解析文件信息
  1586. let reader = new FileReader(); // https://developer.mozilla.org/zh-CN/docs/Web/API/FileReader
  1587. // console.log("实例化对象有各种方法", reader);
  1588. reader.readAsBinaryString(file.raw); // 读取raw的File文件
  1589. reader.onload = (ev) => {
  1590. // console.log("文件解析流程进度事件", ev);
  1591. resolve(ev.target.result); // 将解析好的结果扔出去,以供使用
  1592. };
  1593. });
  1594. // console.log("读取出的流文件", dataBinary);
  1595. /**
  1596. * 2. 使用xlsx插件去解析已经读取好的二进制excel流文件
  1597. * */
  1598. let workBook = XLSX.read(dataBinary, {
  1599. type: 'binary',
  1600. cellDates: true
  1601. });
  1602. // excel中有很多的sheet,这里取了第一个sheet:workBook.SheetNames[0]
  1603. let firstWorkSheet = workBook.Sheets[workBook.SheetNames[0]];
  1604. // 分为第一行的数据,和第一行下方的数据
  1605. // const header = this.getHeaderRow(firstWorkSheet);
  1606. // console.log('读取的excel表头数据(第一行)', header);
  1607. const xlsxData = XLSX.utils.sheet_to_json(firstWorkSheet);
  1608. console.log('读取所有excel数据', xlsxData);
  1609. // let modelTypeList = xlsxData.map((item) => {
  1610. // return item['型号'];
  1611. // });
  1612. // let nameList = xlsxData.map((item) => {
  1613. // return item['物品名称'];
  1614. // });
  1615. let codeList = xlsxData.map((item) => {
  1616. return item['产品编号'];
  1617. });
  1618. this.formData.extInfo.assetType = ['9']; // 产品
  1619. this.formData.bizType = '1'; // 生产入库
  1620. outin
  1621. .getListByNameOrModeType({
  1622. // modelTypeList,
  1623. // nameList,
  1624. codeList,
  1625. categoryLevelId: '9'
  1626. })
  1627. .then(async (data) => {
  1628. console.log('查询到的备件数据', data);
  1629. const batchNo = await getCode('lot_number_code');
  1630. // 添加包装数量和最小包装单元
  1631. this.productList = data.map((item, index) => {
  1632. console.log(xlsxData);
  1633. let filterArray = xlsxData.filter(
  1634. (xlsxItem) => xlsxItem['产品编号'] == item.code
  1635. );
  1636. console.log(filterArray);
  1637. return {
  1638. index: this.productList.length + index,
  1639. categoryId: item.id, // 物品id
  1640. categoryName: item.name, // 物品名称
  1641. categoryCode: item.code, // 物品编码
  1642. categoryModel: item.modelType, // 物品型号
  1643. specification: item.specification, // 规格
  1644. brandNum: item.brandNum, // 牌号
  1645. batchNo: batchNo, // 批次号
  1646. minPackingQuantity: filterArray[0]['现存量'], // 最小包装单元数量
  1647. packingQuantity: 1, // 包装数量
  1648. packingUnit: item.packingUnit, // 包装单位
  1649. measureQuantity: 0, // 计量数量
  1650. measureUnit: item.measuringUnit, // 计量单位
  1651. netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
  1652. weight: 0, // 重量
  1653. weightUnit: item.weightUnit, // 重量单位
  1654. totalMoney: '', // 总价
  1655. price: item.price, // 单价
  1656. purpose: '', // 用途
  1657. isUnpack: false // 是否允许拆包
  1658. };
  1659. });
  1660. console.log(this.productList);
  1661. this.handleAvatarSuccess();
  1662. loading.close();
  1663. })
  1664. .catch(() => {
  1665. loading.close();
  1666. });
  1667. },
  1668. async onChange(file) {
  1669. console.log(XLSX);
  1670. this.warehousingMaterialList = [];
  1671. this.resultArray = [];
  1672. const loading = this.$loading({
  1673. lock: true,
  1674. text: '加载中...'
  1675. });
  1676. /**
  1677. * 1. 使用原生api去读取好的文件
  1678. * */
  1679. // console.log("原始上传的文件", file);
  1680. // 读取文件不是立马能够读取到的,所以是异步的,使用Promise
  1681. let dataBinary = await new Promise((resolve) => {
  1682. // Web API构造函数FileReader,可实例化对象,去调用其身上方法,去读取解析文件信息
  1683. let reader = new FileReader(); // https://developer.mozilla.org/zh-CN/docs/Web/API/FileReader
  1684. // console.log("实例化对象有各种方法", reader);
  1685. reader.readAsBinaryString(file.raw); // 读取raw的File文件
  1686. reader.onload = (ev) => {
  1687. // console.log("文件解析流程进度事件", ev);
  1688. resolve(ev.target.result); // 将解析好的结果扔出去,以供使用
  1689. };
  1690. });
  1691. // console.log("读取出的流文件", dataBinary);
  1692. /**
  1693. * 2. 使用xlsx插件去解析已经读取好的二进制excel流文件
  1694. * */
  1695. let workBook = XLSX.read(dataBinary, {
  1696. type: 'binary',
  1697. cellDates: true
  1698. });
  1699. // excel中有很多的sheet,这里取了第一个sheet:workBook.SheetNames[0]
  1700. let firstWorkSheet = workBook.Sheets[workBook.SheetNames[0]];
  1701. // 分为第一行的数据,和第一行下方的数据
  1702. // const header = this.getHeaderRow(firstWorkSheet);
  1703. // console.log('读取的excel表头数据(第一行)', header);
  1704. const xlsxData = XLSX.utils.sheet_to_json(firstWorkSheet);
  1705. console.log('读取所有excel数据', xlsxData);
  1706. // let modelTypeList = xlsxData.map((item) => {
  1707. // return item['型号'];
  1708. // });
  1709. // let nameList = xlsxData.map((item) => {
  1710. // return item['物品名称'];
  1711. // });
  1712. let codeList = xlsxData.map((item) => {
  1713. return item['产品编号'];
  1714. });
  1715. this.formData.extInfo.assetType = ['6']; //备品备件
  1716. this.formData.bizType = '2'; // 采购入库
  1717. outin
  1718. .getListByNameOrModeType({
  1719. // modelTypeList,
  1720. // nameList,
  1721. codeList,
  1722. categoryLevelId: '6'
  1723. })
  1724. .then(async (data) => {
  1725. console.log('查询到的备件数据', data);
  1726. const batchNo = await getCode('lot_number_code');
  1727. // 添加包装数量和最小包装单元
  1728. this.productList = data.map((item, index) => {
  1729. console.log(xlsxData);
  1730. let filterArray = xlsxData.filter(
  1731. (xlsxItem) => xlsxItem['产品编号'] == item.code
  1732. );
  1733. console.log(filterArray);
  1734. return {
  1735. index: this.productList.length + index,
  1736. categoryId: item.id, // 物品id
  1737. categoryName: item.name, // 物品名称
  1738. categoryCode: item.code, // 物品编码
  1739. categoryModel: item.modelType, // 物品型号
  1740. specification: item.specification, // 规格
  1741. brandNum: item.brandNum, // 牌号
  1742. batchNo: batchNo, // 批次号
  1743. minPackingQuantity: filterArray[0]['现存量'], // 最小包装单元数量
  1744. packingQuantity: 1, // 包装数量
  1745. packingUnit: item.packingUnit, // 包装单位
  1746. measureQuantity: 0, // 计量数量
  1747. measureUnit: item.measuringUnit, // 计量单位
  1748. netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
  1749. weight: 0, // 重量
  1750. weightUnit: item.weightUnit, // 重量单位
  1751. totalMoney: '', // 总价
  1752. price: item.price, // 单价
  1753. purpose: '', // 用途
  1754. isUnpack: false // 是否允许拆包
  1755. };
  1756. });
  1757. console.log(this.productList);
  1758. this.handleAvatarSuccess1();
  1759. loading.close();
  1760. })
  1761. .catch(() => {
  1762. loading.close();
  1763. });
  1764. },
  1765. // 入库
  1766. storage() {
  1767. let boolen = this.productList.every((item) => item.isSave);
  1768. if (!boolen) {
  1769. this.$message.warning('请先保存所有产品信息');
  1770. return;
  1771. }
  1772. // 处理包装数据
  1773. this.packingList = this.packingList.map((packingItem) => {
  1774. return {
  1775. ...packingItem,
  1776. materialDetailList: this.materialList.filter(
  1777. (item) => item.parentIndex === packingItem.index
  1778. ),
  1779. taskId: this.selWWData.taskId,
  1780. workOrderId: this.selWWData.workOrderId
  1781. };
  1782. });
  1783. // 处理产品数据
  1784. this.productList = this.productList.map((productItem) => {
  1785. return {
  1786. ...productItem,
  1787. outInDetailRecordRequestList: this.packingList.filter(
  1788. (item) => item.parentIndex === productItem.index
  1789. )
  1790. };
  1791. });
  1792. this.formData.outInDetailList = this.productList;
  1793. let obj = deepClone(this.formData);
  1794. // 处理物品类型assetType
  1795. obj.extInfo.assetType = obj.extInfo.assetType.join(',');
  1796. // 处理仓库id
  1797. let warehouseId = [];
  1798. let warehouseName = [];
  1799. let warehouseIds = this.productList
  1800. .map((item) => item.warehouseIds)
  1801. .flat();
  1802. let warehouseNames = this.productList
  1803. .map((item) => item.warehouseNames)
  1804. .flat();
  1805. warehouseIds.forEach((item, index) => {
  1806. if (!warehouseId.includes(item)) {
  1807. warehouseId.push(item);
  1808. warehouseName.push(warehouseNames[index]);
  1809. }
  1810. });
  1811. obj.warehouseIds = warehouseId;
  1812. obj.warehouseNames = warehouseName;
  1813. // 是否需要审核(0审核 1跳过审核)
  1814. if (obj.bizType == '12') {
  1815. obj.isSkip = 1;
  1816. } else {
  1817. obj.isSkip = 0;
  1818. }
  1819. // obj.isSkip = 1;
  1820. console.log(obj);
  1821. this.saveLoading = true;
  1822. storageApi
  1823. .storage(obj)
  1824. .then(async (res) => {
  1825. console.log('入库成功', res);
  1826. if (res.code == 0) {
  1827. try {
  1828. // 委外入库(非采购)
  1829. if (obj.bizType == '12') {
  1830. await storageApi.qualityInspectionTwo({
  1831. outInId: res.data[0]
  1832. });
  1833. } else {
  1834. await storageApi.submitTwo({ outInId: res.data[0] });
  1835. }
  1836. this.$message.success('入库成功');
  1837. this.saveLoading = false;
  1838. this.$router.push('/warehouseManagement/stockManagement');
  1839. } catch (error) {
  1840. this.saveLoading = false;
  1841. console.log('提交流程失败', error);
  1842. }
  1843. }
  1844. })
  1845. .catch((err) => {
  1846. console.log('入库失败', err);
  1847. this.saveLoading = false;
  1848. });
  1849. },
  1850. pickingHandleScroll() {
  1851. console.log('---------pickingHandleScroll------------');
  1852. if (this.showPackingList.length < this.packingList.length) {
  1853. if (this.packingList.length > this.pageSize) {
  1854. this.pickingPageNum += 1;
  1855. }
  1856. this.pickingFetchData();
  1857. }
  1858. },
  1859. pickingFetchData() {
  1860. const start = (this.pickingPageNum - 1) * this.pageSize;
  1861. const end = start + this.pageSize;
  1862. this.showPackingList = this.showPackingList.concat(
  1863. this.packingList.slice(start, end)
  1864. );
  1865. },
  1866. materielHandleScroll() {
  1867. console.log('---------materielHandleScroll------------');
  1868. if (this.showMaterialList.length < this.materialList.length) {
  1869. if (this.materialList.length > this.pageSize) {
  1870. this.materielPageNum += 1;
  1871. }
  1872. this.materielFetchData();
  1873. }
  1874. },
  1875. materielFetchData() {
  1876. const start = (this.materielPageNum - 1) * this.pageSize;
  1877. const end = start + this.pageSize;
  1878. this.showMaterialList = this.showMaterialList.concat(
  1879. this.materialList.slice(start, end)
  1880. );
  1881. console.log(this.showMaterialList);
  1882. },
  1883. // 日期选择
  1884. dateConfirm() {
  1885. this.packingListSelected.forEach((item) => {
  1886. this.$set(item, this.curDateType, this.batchTime);
  1887. });
  1888. this.batchTime = '';
  1889. this.dateVisible = false;
  1890. },
  1891. // 包装重量修改
  1892. packingWeightCahnge(value, row) {
  1893. // 修改物品重量
  1894. let filterPackingList = this.packingList.filter((item) => {
  1895. return item.parentIndex === row.parentIndex;
  1896. });
  1897. let productIndex = this.productList.findIndex((item) => {
  1898. return item.index === row.parentIndex;
  1899. });
  1900. let totalWeight = filterPackingList.reduce(
  1901. (accumulator, currentValue) => {
  1902. return this.$math.format(+accumulator + +currentValue.weight, 14);
  1903. },
  1904. 0
  1905. );
  1906. this.$set(this.productList[productIndex], 'weight', totalWeight);
  1907. // 修改拆分物料
  1908. this.materialList.map((item, index) => {
  1909. if (item.parentIndex === row.index) {
  1910. console.log(value / row.measureQuantity);
  1911. this.$set(
  1912. this.materialList[index],
  1913. 'weight',
  1914. this.$math.format(value / row.measureQuantity, 14) >= 0
  1915. ? this.$math.format(value / row.measureQuantity, 14)
  1916. : 0
  1917. );
  1918. }
  1919. });
  1920. },
  1921. // 物料重量修改
  1922. materialWeightCahnge(row) {
  1923. // 修改包装重量
  1924. let filterMaterialList = this.materialList.filter((item) => {
  1925. return item.parentIndex === row.parentIndex;
  1926. });
  1927. let packingIndex = this.packingList.findIndex((item) => {
  1928. return item.index === row.parentIndex;
  1929. });
  1930. let totalMaterialWeight = filterMaterialList.reduce(
  1931. (accumulator, currentValue) => {
  1932. return this.$math.format(+accumulator + +currentValue.weight, 14);
  1933. },
  1934. 0
  1935. );
  1936. this.$set(
  1937. this.packingList[packingIndex],
  1938. 'weight',
  1939. totalMaterialWeight
  1940. );
  1941. // 修改物品重量
  1942. let filterPackingList = this.packingList.filter((item) => {
  1943. return (
  1944. item.parentIndex === this.packingList[packingIndex].parentIndex
  1945. );
  1946. });
  1947. let productIndex = this.productList.findIndex((item) => {
  1948. return item.index === this.packingList[packingIndex].parentIndex;
  1949. });
  1950. let totalWeight = filterPackingList.reduce(
  1951. (accumulator, currentValue) => {
  1952. return this.$math.format(+accumulator + +currentValue.weight, 14);
  1953. },
  1954. 0
  1955. );
  1956. this.$set(this.productList[productIndex], 'weight', totalWeight);
  1957. },
  1958. // 包装质检结果修改
  1959. packingResultCahnge(value, row) {
  1960. // 修改物料质检结果( 1合格 2不合格)
  1961. this.materialList.map((item, index) => {
  1962. if (item.parentIndex === row.index) {
  1963. this.$set(this.materialList[index], 'result', value);
  1964. }
  1965. });
  1966. },
  1967. // 物料质量结果修改
  1968. materialResultCahnge(value, row) {
  1969. // 修改包装质检结果
  1970. let filterMaterialList = this.materialList.filter((item) => {
  1971. return item.parentIndex == row.parentIndex;
  1972. });
  1973. let packingIndex = this.packingList.findIndex((item) => {
  1974. return item.index == row.parentIndex;
  1975. });
  1976. let boolen = filterMaterialList.every((item) => {
  1977. return item.result == 1;
  1978. });
  1979. this.$set(this.packingList[packingIndex], 'result', boolen ? 1 : 2);
  1980. },
  1981. // 重量限制
  1982. weightInput(value, row, type) {
  1983. const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
  1984. const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
  1985. if (row.weight < 0) {
  1986. row.weight = 0;
  1987. } else if (row.weight > 999999) {
  1988. row.weight = 999999;
  1989. } else {
  1990. if (decimalCount > 1) {
  1991. // 如果小数点个数大于1,移除多余的小数点
  1992. const lastIndex = newValue.lastIndexOf('.');
  1993. row.weight =
  1994. newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1);
  1995. } else if (decimalCount === 1) {
  1996. // 如果小数点个数等于1,允许小数点的输入
  1997. row.weight = newValue;
  1998. } else {
  1999. row.weight = newValue === '' ? 0 : parseFloat(newValue); // 如果输入为空,则设为0
  2000. }
  2001. }
  2002. if (type === '包装') {
  2003. this.packingWeightCahnge(value, row);
  2004. } else {
  2005. this.materialWeightCahnge(row);
  2006. }
  2007. },
  2008. //计算金额
  2009. calcSumTotal(packingQuantity, minPackingQuantity, price, row) {
  2010. //最小包装单元,包装数量,单价
  2011. const total = {
  2012. packingQuantity: Number(packingQuantity > 0 ? packingQuantity : 0),
  2013. minPackingQuantity: Number(
  2014. minPackingQuantity > 0 ? minPackingQuantity : 0
  2015. ),
  2016. price: Number(price > 0 ? price : 0)
  2017. };
  2018. let number = Number(
  2019. this.$math.format(
  2020. total.packingQuantity * total.minPackingQuantity * total.price,
  2021. 14
  2022. )
  2023. );
  2024. row.totalMoney = number;
  2025. return number;
  2026. },
  2027. // 包装维度最小包装单元改变——>总重量
  2028. minPackingQuantityChange(row, value, index) {
  2029. console.log(value);
  2030. // if (row.measureUnit !== 'KG') {
  2031. // if (value.replace(/^(0+)|[^\d]+/g, '') > 999999) {
  2032. // this.$set(this.productList[index], 'minPackingQuantity', 999999);
  2033. // } else {
  2034. // this.$set(
  2035. // this.productList[index],
  2036. // 'minPackingQuantity',
  2037. // value.replace(/^(0+)|[^\d]+/g, '')
  2038. // );
  2039. // }
  2040. // } else {
  2041. // if (value < 0) {
  2042. // this.$set(this.productList[index], 'minPackingQuantity', 1);
  2043. // } else if (value > 9999) {
  2044. // this.$set(this.productList[index], 'minPackingQuantity', 9999);
  2045. // }
  2046. // }
  2047. if (value < 0) {
  2048. this.$set(this.productList[index], 'minPackingQuantity', 1);
  2049. } else if (value > 9999) {
  2050. this.$set(this.productList[index], 'minPackingQuantity', 9999);
  2051. }
  2052. if (row.packingQuantity >= 0 && value >= 0) {
  2053. this.packNum(row, row.packingQuantity, index);
  2054. }
  2055. },
  2056. // 包装数量过滤处理改变——>总重量
  2057. packNum(row, value, index) {
  2058. const total = {
  2059. minPackingQuantity: Number(
  2060. row.minPackingQuantity > 0
  2061. ? row.minPackingQuantity > 999999
  2062. ? 999999
  2063. : row.minPackingQuantity
  2064. : 0
  2065. ),
  2066. packingQuantity: Number(
  2067. row.packingQuantity > 0
  2068. ? row.packingQuantity > 999999
  2069. ? 999999
  2070. : row.packingQuantity
  2071. : 0
  2072. )
  2073. };
  2074. const totals = Number(
  2075. this.$math.format(
  2076. total.minPackingQuantity * total.packingQuantity,
  2077. 14
  2078. )
  2079. );
  2080. if (row.measureUnit == row.weightUnit) {
  2081. row.weight = Number(
  2082. this.$math.format(
  2083. total.minPackingQuantity *
  2084. 1 *
  2085. Number(total.packingQuantity).toFixed(2),
  2086. 14
  2087. )
  2088. );
  2089. } else {
  2090. row.weight = Number(
  2091. this.$math.format(
  2092. totals *
  2093. (row.netWeight > 0 ? Number(row.netWeight).toFixed(2) : 0),
  2094. 14
  2095. )
  2096. );
  2097. }
  2098. this.$set(this.productList[index], 'measureQuantity', totals);
  2099. // 清空仓库
  2100. this.$set(this.productList[index], 'warehouseId', '');
  2101. this.$set(this.productList[index], 'warehouseName', '');
  2102. if (value.replace(/^(0+)|[^\d]+/g, '') > 999999) {
  2103. this.$set(this.productList[index], 'packingQuantity', 999999);
  2104. } else {
  2105. this.$set(
  2106. this.productList[index],
  2107. 'packingQuantity',
  2108. value.replace(/^(0+)|[^\d]+/g, '')
  2109. );
  2110. }
  2111. // return (row.packingQuantity = value.replace(/^(0+)|[^\d]+/g, ''));
  2112. },
  2113. // 表格样式
  2114. rowClass({ row, column, rowIndex, columnIndex }) {
  2115. if (rowIndex === 1) {
  2116. return {
  2117. display: 'none',
  2118. background: '#EEEEEE'
  2119. };
  2120. }
  2121. return { background: '#0000' };
  2122. },
  2123. // 添加物品明细
  2124. async addGoods(data) {
  2125. const batchNo = await getCode('lot_number_code');
  2126. const supplierList = await storageApi.contactQueryByCategoryIdsAPI({
  2127. categoryIds: data.map((item) => item.id)
  2128. });
  2129. console.log(supplierList);
  2130. let productList = data.map((item, index) => {
  2131. return {
  2132. index: this.productList.length + index,
  2133. categoryId: item.id, // 物品id
  2134. categoryName: item.name, // 物品名称
  2135. categoryCode: item.code, // 物品编码
  2136. categoryModel: item.modelType, // 物品型号
  2137. specification: item.specification, // 规格
  2138. brandNum: item.brandNum, // 牌号
  2139. batchNo: batchNo, // 批次号
  2140. supplierListOptions: supplierList[item.id], // 供应商列表
  2141. supplierId: '', // 供应商id
  2142. supplierName: '', // 供应商名称
  2143. approvalNumber: item.approvalNumber, // 批准文号
  2144. packingSpecification: item.packingSpecification, // 包装规格
  2145. minPackingQuantity: '', // 最小包装单元数量
  2146. packingQuantity: '', // 包装数量
  2147. packingUnit: item.packingUnit, // 包装单位
  2148. measureQuantity: 0, // 计量数量
  2149. measureUnit: item.measuringUnit, // 计量单位
  2150. netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
  2151. weight: 0, // 重量
  2152. weightUnit: item.weightUnit, // 重量单位
  2153. totalMoney: '', // 总价
  2154. price: item.price, // 单价
  2155. purpose: '', // 用途
  2156. isUnpack: item.isUnpack // 是否允许拆包
  2157. };
  2158. });
  2159. this.productList = this.productList.concat(productList);
  2160. },
  2161. // 物品保存验证表单(批量)
  2162. validateForm() {
  2163. return new Promise(async (resolve, reject) => {
  2164. let list = this.productList.map(async (row, index) => {
  2165. let fileds = [
  2166. `productList.${index}.batchNo`,
  2167. `productList.${index}.minPackingQuantity`,
  2168. `productList.${index}.packingQuantity`,
  2169. `productList.${index}.warehouseId`
  2170. ];
  2171. console.log(fileds);
  2172. if (row.isSave) {
  2173. return Promise.resolve(true);
  2174. } else {
  2175. return await Promise.all(
  2176. fileds.map(
  2177. (item) =>
  2178. new Promise(async (res, rej) => {
  2179. this.$refs.productListRef.validateField(item, (err) => {
  2180. if (err) {
  2181. rej(err);
  2182. } else {
  2183. res(true);
  2184. }
  2185. });
  2186. })
  2187. )
  2188. );
  2189. }
  2190. });
  2191. console.log(list);
  2192. Promise.all(list)
  2193. .then(() => {
  2194. console.log('保存成功!');
  2195. resolve();
  2196. })
  2197. .catch((err) => {
  2198. console.log('保存失败!');
  2199. this.$message.error('请填入必填项!');
  2200. reject(err);
  2201. });
  2202. });
  2203. },
  2204. // 产品批量保存
  2205. async listSaveArrs() {
  2206. this.validateForm()
  2207. .then(async () => {
  2208. // 批量获取包装编码并处理
  2209. let packingCodePrams = this.productList.map((row) => {
  2210. if (row.isSave) {
  2211. return {};
  2212. } else {
  2213. return {
  2214. assetCode: row.categoryCode + row.index,
  2215. batchNum: row.batchNo,
  2216. num: row.packingQuantity
  2217. };
  2218. }
  2219. });
  2220. let filterPackingCodePrams = packingCodePrams.filter(
  2221. (item) => item.assetCode
  2222. );
  2223. let { data } = await storageApi.getAssetNum(filterPackingCodePrams);
  2224. let packingCodeList = [];
  2225. packingCodePrams.forEach((item, index) => {
  2226. packingCodeList[index] = data.filter(
  2227. (ite) => ite.assetCode == item.assetCode
  2228. );
  2229. });
  2230. // 批量生成包装
  2231. this.productList.map((row, index) => {
  2232. if (!row.isSave) {
  2233. this.generateWrappers(row, index, packingCodeList[index]);
  2234. this.$set(this.productList[index], 'isSave', true);
  2235. }
  2236. });
  2237. // 加载虚拟列表数据(分页)
  2238. // this.pickingFetchData();
  2239. // this.materielFetchData();
  2240. })
  2241. .catch((err) => {
  2242. console.log(err);
  2243. });
  2244. },
  2245. // 物品保存验证表单(单独)
  2246. validateFormIndividually(index) {
  2247. return new Promise(async (resolve) => {
  2248. console.log(index);
  2249. let fileds = [
  2250. `productList.${index}.batchNo`,
  2251. `productList.${index}.minPackingQuantity`,
  2252. `productList.${index}.packingQuantity`,
  2253. `productList.${index}.warehouseId`
  2254. ];
  2255. Promise.all(
  2256. fileds.map(
  2257. (item) =>
  2258. new Promise(async (res, rej) => {
  2259. this.$refs.productListRef.validateField(item, (err) => {
  2260. if (err) {
  2261. rej(err);
  2262. } else {
  2263. res(true);
  2264. }
  2265. });
  2266. })
  2267. )
  2268. )
  2269. .then(() => {
  2270. resolve();
  2271. })
  2272. .catch(() => {
  2273. this.$message.error('请填入必填项!');
  2274. });
  2275. });
  2276. },
  2277. // 产品编辑
  2278. listEdit(row) {
  2279. console.log(row);
  2280. this.$set(row, 'isSave', false);
  2281. // 重新计算重量
  2282. const totals = Number(
  2283. this.$math.format(row.minPackingQuantity * row.packingQuantity, 14)
  2284. );
  2285. if (row.measureUnit == row.weightUnit) {
  2286. row.weight = Number(
  2287. this.$math.format(
  2288. row.minPackingQuantity *
  2289. 1 *
  2290. Number(row.packingQuantity).toFixed(2),
  2291. 14
  2292. )
  2293. );
  2294. } else {
  2295. row.weight = Number(
  2296. this.$math.format(
  2297. totals *
  2298. (row.netWeight > 0 ? Number(row.netWeight).toFixed(2) : 0),
  2299. 14
  2300. )
  2301. );
  2302. }
  2303. console.log(row);
  2304. this.deletePackingAndMaterial(row);
  2305. },
  2306. // 根据产品信息删除包装和物料
  2307. deletePackingAndMaterial(row) {
  2308. // 删除包装(去掉不相同的包装)
  2309. this.packingList = this.packingList.filter(
  2310. (item) => item.parentIndex !== row.index
  2311. );
  2312. this.showPackingList = this.showPackingList.filter(
  2313. (item) => item.parentIndex !== row.index
  2314. );
  2315. this.pickingPageNum = Math.ceil(
  2316. this.showPackingList.length / this.pageSize
  2317. );
  2318. console.log('包装当前页数');
  2319. console.log(this.pickingPageNum);
  2320. // 删除物料(获取相同物料)
  2321. let packingIndexs = this.packingList.map((item) => item.index);
  2322. this.materialList = this.materialList.filter((item) =>
  2323. packingIndexs.includes(item.parentIndex)
  2324. );
  2325. this.showMaterialList = this.showMaterialList.filter((item) =>
  2326. packingIndexs.includes(item.parentIndex)
  2327. );
  2328. this.materielPageNum = Math.ceil(
  2329. this.showMaterialList.length / this.pageSize
  2330. );
  2331. console.log('物料当前页数');
  2332. console.log(this.showMaterialList.length);
  2333. console.log(this.pageSize);
  2334. console.log(this.materielPageNum);
  2335. },
  2336. // 产品保存操作
  2337. listSave(row, index) {
  2338. this.validateFormIndividually(index).then(async () => {
  2339. console.log('保存成功');
  2340. // 获取包装编码列表
  2341. const { data } = await storageApi.getAssetNum([
  2342. {
  2343. assetCode: row.categoryCode + row.index,
  2344. batchNum: row.batchNo,
  2345. num: row.packingQuantity
  2346. }
  2347. ]);
  2348. this.generateWrappers(row, index, data);
  2349. this.$set(this.productList[index], 'isSave', true);
  2350. // 加载虚拟列表数据(分页)
  2351. // this.pickingFetchData();
  2352. // this.materielFetchData();
  2353. });
  2354. },
  2355. //入库明细删除
  2356. listDel(row, index) {
  2357. this.productList.splice(index, 1);
  2358. this.deletePackingAndMaterial(row);
  2359. },
  2360. // 打开仓库弹框
  2361. handleWareHouse(row, idx) {
  2362. if (idx > -1) {
  2363. if (row.packingQuantity > 0) {
  2364. this.$refs.wareHouseDailogRef.open(row.packingQuantity, idx);
  2365. } else {
  2366. this.$message.error('请先填写包装数量!');
  2367. }
  2368. } else {
  2369. let boolen = this.productList.every(
  2370. (item) =>
  2371. item.packingQuantity == this.productList[0].packingQuantity
  2372. );
  2373. if (boolen) {
  2374. if (row.packingQuantity > 0) {
  2375. this.$refs.wareHouseDailogRef.open(row.packingQuantity, idx);
  2376. } else {
  2377. this.$message.error('请先填写包装数量!');
  2378. }
  2379. } else {
  2380. this.$message.error('请保证产品包装数量一致!');
  2381. }
  2382. }
  2383. },
  2384. wareHouseSelection(argum, idx) {
  2385. console.log(argum);
  2386. console.log(idx);
  2387. // 方便包装遍历获取仓库id和名称
  2388. let warehouseIds = [];
  2389. let warehouseNames = [];
  2390. argum.forEach((item) => {
  2391. for (let index = 0; index < item.packingQuantity; index++) {
  2392. warehouseIds.push(item.warehouseId);
  2393. warehouseNames.push(item.warehouseName);
  2394. }
  2395. });
  2396. console.log(warehouseIds);
  2397. console.log(warehouseNames);
  2398. if (idx > -1) {
  2399. this.$set(
  2400. this.productList[idx],
  2401. 'warehouseId',
  2402. argum.map((item) => item.warehouseId).join(',')
  2403. );
  2404. this.$set(
  2405. this.productList[idx],
  2406. 'warehouseName',
  2407. argum.map((item) => item.warehouseName).join(',')
  2408. );
  2409. this.$set(this.productList[idx], 'warehouseIds', warehouseIds);
  2410. this.$set(this.productList[idx], 'warehouseNames', warehouseNames);
  2411. } else {
  2412. this.productList.map((item, index) => {
  2413. this.$set(
  2414. this.productList[index],
  2415. 'warehouseId',
  2416. argum.map((item) => item.warehouseId).join(',')
  2417. );
  2418. this.$set(
  2419. this.productList[index],
  2420. 'warehouseName',
  2421. argum.map((item) => item.warehouseName).join(',')
  2422. );
  2423. this.$set(this.productList[index], 'warehouseIds', warehouseIds);
  2424. this.$set(
  2425. this.productList[index],
  2426. 'warehouseNames',
  2427. warehouseNames
  2428. );
  2429. });
  2430. }
  2431. this.$forceUpdate();
  2432. },
  2433. // 生成包装
  2434. generateWrappers(row, productIndex, packingCodeList) {
  2435. let packingList = [];
  2436. let obj = this.getNowDate();
  2437. let productionDate = '';
  2438. let purchaseDate = '';
  2439. if (this.formData.bizType == '1') {
  2440. // 生产入库
  2441. productionDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`;
  2442. this.curDateType = 'productionDate';
  2443. } else if (this.formData.bizType == '2') {
  2444. // 采购入库
  2445. purchaseDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`;
  2446. this.curDateType = 'purchaseDate';
  2447. }
  2448. for (let index = 0; index < row.packingQuantity; index++) {
  2449. let item = {
  2450. index: row.index + '-' + index, // 包装索引
  2451. warehouseId: row.warehouseIds[index], // 仓库id
  2452. warehouseName: row.warehouseNames[index], // 仓库名称
  2453. categoryName: row.categoryName, // 产品名称
  2454. categoryCode: row.categoryCode, // 产品编码
  2455. categoryModel: row.categoryModel, // 物品型号
  2456. specification: row.specification, // 规格
  2457. brandNum: row.brandNum, // 牌号
  2458. parentIndex: row.index, // 产品索引
  2459. batchNo: row.batchNo, // 批次号
  2460. packageNo: packingCodeList[index].onlyCode, // 包装编码
  2461. packingQuantity: 1, // 包装数量
  2462. packingUnit: row.packingUnit, // 包装单位
  2463. measureQuantity: row.minPackingQuantity, // 计量数量
  2464. measureUnit: row.measureUnit, // 计量单位
  2465. weight: Number(
  2466. this.$math.format(row.weight / row.packingQuantity, 14)
  2467. ), // 重量
  2468. weightUnit: row.weightUnit, // 重量单位
  2469. barcodes: '', // 发货条码
  2470. clientCode: '', // 客户代号
  2471. materielDesignation: '', // 物料代号
  2472. engrave: '', // 刻码
  2473. isUnpack: row.isUnpack, // 是否允许拆包
  2474. productionDate: productionDate, // 生产日期
  2475. purchaseDate: purchaseDate, // 采购时间
  2476. result: 1, // 结果(1合格 2不合格)
  2477. status: 2 // 状态(0=未质检 1待检 2已检)
  2478. };
  2479. packingList.push(item);
  2480. }
  2481. // 单独点击保存并插入对应位置(包装)
  2482. // if (productIndex > -1) {
  2483. if (productIndex == 0) {
  2484. this.packingList.splice(productIndex, 0, ...packingList);
  2485. } else {
  2486. let packingIndex = this.packingList.findLastIndex(
  2487. (item) => item.parentIndex === productIndex - 1
  2488. );
  2489. this.packingList.splice(packingIndex + 1, 0, ...packingList);
  2490. }
  2491. // } else {
  2492. // // 批量点击生成包装
  2493. // this.packingList = this.packingList.concat(packingList);
  2494. // }
  2495. // 单独点击保存并插入对应位置(物料)
  2496. let materialList = packingList
  2497. .map((item) => {
  2498. if (item.isUnpack) {
  2499. return this.generateMaterial(item);
  2500. } else {
  2501. return [];
  2502. }
  2503. })
  2504. .flat();
  2505. console.log(materialList);
  2506. if (materialList.length > 0) {
  2507. // if (productIndex > -1) {
  2508. if (productIndex == 0) {
  2509. this.materialList.splice(0, 0, ...materialList);
  2510. } else {
  2511. let preLastPackingIndex = this.packingList.findLastIndex((ite) => {
  2512. return ite.parentIndex <= productIndex - 1 && ite.isUnpack;
  2513. });
  2514. // console.log('preLastPackingIndex-------', preLastPackingIndex);
  2515. // console.log(this.packingList);
  2516. // console.log(this.packingList[preLastPackingIndex]);
  2517. // console.log(this.materialList);
  2518. // console.log(this.packingList[preLastPackingIndex].index);
  2519. let preLastMaterialIndex = this.materialList.findLastIndex(
  2520. (ite) => {
  2521. return (
  2522. ite.parentIndex == this.packingList[preLastPackingIndex].index
  2523. );
  2524. }
  2525. );
  2526. // console.log('preLastMaterialIndex-------', preLastMaterialIndex);
  2527. this.materialList.splice(
  2528. preLastMaterialIndex + 1,
  2529. 0,
  2530. ...materialList
  2531. );
  2532. }
  2533. // } else {
  2534. // this.materialList = this.materialList.concat(materialList);
  2535. // }
  2536. console.log(this.materialList);
  2537. }
  2538. },
  2539. // 生成物料
  2540. generateMaterial(row) {
  2541. let materialList = [];
  2542. for (let index = 0; index < row.measureQuantity; index++) {
  2543. materialList.push({
  2544. materialCode: row.packageNo + index.toString().padStart(4, '0'), // 物料编码
  2545. index: row.index + '——' + index, // 包装索引
  2546. warehouseId: row.warehouseId, // 仓库id
  2547. warehouseName: row.warehouseName, // 仓库名称
  2548. categoryName: row.categoryName, // 产品名称
  2549. categoryCode: row.categoryCode, // 产品编码
  2550. categoryModel: row.categoryModel, // 物品型号
  2551. specification: row.specification, // 规格
  2552. brandNum: row.brandNum, // 牌号
  2553. parentIndex: row.index, // 产品索引
  2554. batchNo: row.batchNo, // 批次号
  2555. packageNo: row.packageNo, // 包装编码
  2556. measureQuantity: 1, // 计量数量
  2557. measureUnit: row.measureUnit, // 计量单位
  2558. weight: Number(
  2559. this.$math.format(row.weight / row.packingQuantity, 14)
  2560. ), // 重量
  2561. weightUnit: row.weightUnit, // 重量单位
  2562. barcodes: '', // 发货条码
  2563. clientCode: '', // 客户代号
  2564. materielDesignation: '', // 物料代号
  2565. engrave: '', // 刻码
  2566. result: 1, // 结果(1合格 2不合格)
  2567. status: 2 // 状态(0=未质检 1待检 2已检)
  2568. });
  2569. }
  2570. return materialList;
  2571. },
  2572. // 设置时间
  2573. dateSetting() {
  2574. if (!this.packingListSelected.length) {
  2575. return this.$message.error(`请选择${this.title}明细!`);
  2576. }
  2577. this.dateVisible = true;
  2578. },
  2579. // 选择包装列表
  2580. handleSelectionChange(val) {
  2581. this.packingListSelected = val;
  2582. },
  2583. // 选择质检结果改变质检状态
  2584. changeWrapStatus(resultValue, row, type) {
  2585. console.log(resultValue);
  2586. switch (resultValue) {
  2587. case 0:
  2588. // 清空质检状态
  2589. row.status = 0;
  2590. break;
  2591. default:
  2592. // 默认已检质检状态
  2593. row.status = 2;
  2594. break;
  2595. }
  2596. if (type === '包装') {
  2597. this.packingResultCahnge(resultValue, row);
  2598. } else {
  2599. this.materialResultCahnge(resultValue, row);
  2600. }
  2601. }
  2602. }
  2603. };
  2604. </script>
  2605. <style lang="scss" scoped>
  2606. .inbound_details {
  2607. margin-top: 10px;
  2608. .el-form-item {
  2609. margin-bottom: 0 !important;
  2610. }
  2611. }
  2612. .el-form-item {
  2613. margin-bottom: 5px;
  2614. }
  2615. .right_control {
  2616. display: flex;
  2617. > button {
  2618. margin-left: 20px;
  2619. }
  2620. }
  2621. .storage_btn {
  2622. margin-top: 20px;
  2623. display: flex;
  2624. align-content: center;
  2625. justify-content: center;
  2626. }
  2627. .el-date-editor.el-input,
  2628. .el-date-editor.el-input__inner {
  2629. width: 100% !important;
  2630. }
  2631. .red_color {
  2632. color: red;
  2633. }
  2634. .wareHouse_style {
  2635. text-overflow: ellipsis;
  2636. overflow: hidden;
  2637. word-break: break-all;
  2638. white-space: nowrap;
  2639. }
  2640. </style>