add.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444
  1. <template>
  2. <div class="content-height p20 warehouseAdd">
  3. <header>
  4. <span class="title">{{ formData.code }} {{ formData.name }}</span>
  5. <div>
  6. <el-button @click="$router.go(-1)">返回</el-button>
  7. <el-button type="primary" @click="submit" :loading="loading"
  8. >保存</el-button
  9. >
  10. </div>
  11. </header>
  12. <el-divider></el-divider>
  13. <div class="area">
  14. <div class="mt20 reservoirArea">
  15. <span>库区</span>
  16. <el-button
  17. type="primary"
  18. icon="el-icon-plus"
  19. size="small"
  20. @click="addArea"
  21. >添加库区
  22. </el-button>
  23. </div>
  24. <div class="mt10">
  25. <el-form :model="areaForm" ref="areaFormName" class="areaForm">
  26. <el-table
  27. ref="multipleTable"
  28. :data="areaForm.warehouseAreasSaveList"
  29. tooltip-effect="dark"
  30. style="width: 100%"
  31. stripe
  32. :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
  33. >
  34. <el-table-column label="库区编号" prop="code" min-width="120">
  35. <template slot-scope="{ row, $index }">
  36. <el-form-item
  37. :prop="'warehouseAreasSaveList.' + $index + '.code'"
  38. :rules="areaRules.code"
  39. v-if="row.isEdit"
  40. >
  41. <el-input
  42. placeholder="请输入"
  43. clearable
  44. v-model="row.code"
  45. ></el-input>
  46. </el-form-item>
  47. <span v-else>{{ row.code }}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="库区名称" min-width="120">
  51. <template slot-scope="scope">
  52. <el-form-item
  53. :prop="'warehouseAreasSaveList.' + scope.$index + '.name'"
  54. :rules="areaRules.name"
  55. v-if="scope.row.isEdit"
  56. id="reservoirAreaRef"
  57. >
  58. <el-input
  59. placeholder="请输入"
  60. clearable
  61. v-model="scope.row.name"
  62. ></el-input>
  63. </el-form-item>
  64. <span v-else>{{ scope.row.name }}</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="库区类型" min-width="120">
  68. <template slot-scope="scope">
  69. <el-form-item
  70. :prop="'warehouseAreasSaveList.' + scope.$index + '.type'"
  71. :rules="areaRules.type"
  72. id="reservoirAreaRef"
  73. v-if="scope.row.isEdit"
  74. >
  75. <el-select
  76. v-model="scope.row.type"
  77. placeholder="请选择"
  78. clearable
  79. >
  80. <el-option
  81. v-for="(item, idx) in warehouseDefinition_areaType"
  82. :key="idx"
  83. :value="item.code"
  84. :label="item.label"
  85. ></el-option>
  86. </el-select>
  87. </el-form-item>
  88. <span v-else>{{
  89. scope.row.type | filterAreaType(warehouseDefinition_areaType)
  90. }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="库区属性" min-width="120">
  94. <template slot-scope="scope">
  95. <el-form-item
  96. :prop="
  97. 'warehouseAreasSaveList.' + scope.$index + '.attribute'
  98. "
  99. :rules="areaRules.attribute"
  100. v-if="scope.row.isEdit"
  101. >
  102. <el-select
  103. v-model="scope.row.attribute"
  104. placeholder="请选择"
  105. clearable
  106. >
  107. <el-option
  108. v-for="(item, idx) in warehouseDefinition_areaAttribute"
  109. :key="idx"
  110. :value="item.code"
  111. :label="item.label"
  112. ></el-option>
  113. </el-select>
  114. </el-form-item>
  115. <span v-else>{{
  116. scope.row.attribute
  117. | filterAreaType(warehouseDefinition_areaAttribute)
  118. }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="库区位置" min-width="120">
  122. <template slot-scope="scope">
  123. <el-form-item
  124. :prop="'warehouseAreasSaveList.' + scope.$index + '.address'"
  125. :rules="areaRules.address"
  126. v-if="scope.row.isEdit"
  127. >
  128. <el-input
  129. placeholder="请输入"
  130. clearable
  131. v-model="scope.row.address"
  132. ></el-input>
  133. </el-form-item>
  134. <span v-else>{{ scope.row.address }}</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="库区长(cm)" min-width="120">
  138. <template slot-scope="scope">
  139. <el-form-item
  140. :prop="
  141. 'warehouseAreasSaveList.' + scope.$index + '.areaLength'
  142. "
  143. :rules="areaRules.areaLength"
  144. v-if="scope.row.isEdit"
  145. >
  146. <el-input
  147. placeholder="请输入"
  148. type="number"
  149. clearable
  150. @mousewheel.native.prevent
  151. v-model.number="scope.row.areaLength"
  152. ></el-input>
  153. </el-form-item>
  154. <span v-else>{{ scope.row.areaLength }}</span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="库区宽(cm)" min-width="120">
  158. <template slot-scope="scope">
  159. <el-form-item
  160. :prop="'warehouseAreasSaveList.' + scope.$index + '.areaWide'"
  161. :rules="areaRules.areaWide"
  162. v-if="scope.row.isEdit"
  163. >
  164. <el-input
  165. placeholder="请输入"
  166. type="number"
  167. clearable
  168. @mousewheel.native.prevent
  169. v-model.number="scope.row.areaWide"
  170. ></el-input>
  171. </el-form-item>
  172. <span v-else>{{ scope.row.areaWide }}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="库区高(cm)" min-width="120">
  176. <template slot-scope="scope">
  177. <el-form-item
  178. :prop="'warehouseAreasSaveList.' + scope.$index + '.areaHigh'"
  179. :rules="areaRules.areaHigh"
  180. v-if="scope.row.isEdit"
  181. >
  182. <el-input
  183. placeholder="请输入"
  184. type="number"
  185. @mousewheel.native.prevent
  186. v-model.number="scope.row.areaHigh"
  187. clearable
  188. ></el-input>
  189. </el-form-item>
  190. <span v-else>{{ scope.row.areaHigh }}</span>
  191. </template>
  192. </el-table-column>
  193. <el-table-column label="货架数量" min-width="120">
  194. <template slot-scope="scope">
  195. <el-form-item
  196. :prop="'warehouseAreasSaveList.' + scope.$index + '.num'"
  197. :rules="areaRules.num"
  198. v-if="scope.row.isEdit"
  199. >
  200. <el-input
  201. placeholder="请输入"
  202. type="number"
  203. @mousewheel.native.prevent
  204. @input="
  205. (value) =>
  206. (scope.row.num = value.replace(/^(0+)|[^\d]+/g, ''))
  207. "
  208. v-model.number="scope.row.num"
  209. clearable
  210. ></el-input>
  211. </el-form-item>
  212. <span v-else>{{ scope.row.num }}</span>
  213. </template>
  214. </el-table-column>
  215. <!-- <el-table-column label="库区条码">
  216. <template slot-scope="scope">
  217. <el-form-item
  218. :prop="
  219. 'warehouseAreasSaveList.' + scope.$index + 'areaBarcode'
  220. "
  221. v-if="scope.row.isEdit"
  222. >
  223. <el-input
  224. placeholder="自动生成"
  225. disabled
  226. v-model="scope.row.areaBarcode"
  227. ></el-input>
  228. </el-form-item>
  229. <span v-else>{{ scope.row.areaBarcode }}</span>
  230. </template>
  231. </el-table-column> -->
  232. <el-table-column label="备注" min-width="120">
  233. <template slot-scope="scope">
  234. <el-form-item
  235. :prop="
  236. 'warehouseAreasSaveList.' + scope.$index + 'areaRemark'
  237. "
  238. v-if="scope.row.isEdit"
  239. >
  240. <el-input
  241. placeholder="请输入"
  242. type="textarea"
  243. clearable
  244. :rows="1"
  245. v-model="scope.row.areaRemark"
  246. ></el-input>
  247. </el-form-item>
  248. <span v-else>{{ scope.row.areaRemark }}</span>
  249. </template>
  250. </el-table-column>
  251. <el-table-column label="操作" fixed="right" width="150">
  252. <template slot-scope="{ row, $index }">
  253. <el-button
  254. type="text"
  255. v-if="row.isEdit"
  256. @click="saveArea($index)"
  257. >保存</el-button
  258. >
  259. <el-button type="text" v-else @click="addShelf(row, $index)"
  260. >添加货架</el-button
  261. >
  262. <el-button type="text" @click="remove($index, row)"
  263. >删除库区</el-button
  264. >
  265. </template>
  266. </el-table-column>
  267. </el-table>
  268. </el-form>
  269. </div>
  270. </div>
  271. <!-- <div
  272. class="area"
  273. v-if="
  274. areaForm.areaGoodsshelvesList &&
  275. areaForm.areaGoodsshelvesList.length !== 0
  276. "
  277. > -->
  278. <div class="area">
  279. <div class="mt20 reservoirArea">
  280. <span>货架</span>
  281. </div>
  282. <div class="mt10">
  283. <el-form :model="areaForm" ref="areaCoodsForm" class="areaForm">
  284. <el-table
  285. ref="multipleTable"
  286. :data="areaForm.areaGoodsshelvesList"
  287. tooltip-effect="dark"
  288. style="width: 100%"
  289. stripe
  290. :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
  291. >
  292. <el-table-column
  293. label="库区编号"
  294. prop="warehouseAreaCode"
  295. ></el-table-column>
  296. <el-table-column
  297. label="货架编号"
  298. prop="goodsshelvesCode"
  299. min-width="120"
  300. >
  301. <template slot-scope="{ row, $index }">
  302. <el-form-item
  303. :prop="'areaGoodsshelvesList.' + $index + '.goodsshelvesCode'"
  304. :rules="areaCoodsRules.goodsshelvesCode"
  305. v-if="row.isEdit"
  306. >
  307. <el-input
  308. placeholder="请输入"
  309. clearable
  310. v-model="row.goodsshelvesCode"
  311. ></el-input>
  312. </el-form-item>
  313. <span v-else>{{ row.goodsshelvesCode }}</span>
  314. </template>
  315. </el-table-column>
  316. <el-table-column label="货架行数" min-width="120">
  317. <template slot-scope="scope">
  318. <el-form-item
  319. :prop="
  320. 'areaGoodsshelvesList.' + scope.$index + '.goodsshelvesLine'
  321. "
  322. :rules="areaCoodsRules.goodsshelvesLine"
  323. v-if="scope.row.isEdit"
  324. >
  325. <el-input
  326. placeholder="请输入"
  327. type="number"
  328. @input="
  329. (value) =>
  330. (scope.row.goodsshelvesLine = value.replace(
  331. /^(0+)|[^\d]+/g,
  332. ''
  333. ))
  334. "
  335. @mousewheel.native.prevent
  336. v-model.number="scope.row.goodsshelvesLine"
  337. clearable
  338. ></el-input>
  339. </el-form-item>
  340. <span v-else>{{ scope.row.goodsshelvesLine }}</span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column label="货架列数" min-width="120">
  344. <template slot-scope="scope">
  345. <el-form-item
  346. :prop="
  347. 'areaGoodsshelvesList.' +
  348. scope.$index +
  349. '.goodsshelvesColumn'
  350. "
  351. :rules="areaCoodsRules.goodsshelvesColumn"
  352. v-if="scope.row.isEdit"
  353. >
  354. <el-input
  355. placeholder="请输入"
  356. type="number"
  357. @input="
  358. (value) =>
  359. (scope.row.goodsshelvesColumn = value.replace(
  360. /^(0+)|[^\d]+/g,
  361. ''
  362. ))
  363. "
  364. @mousewheel.native.prevent
  365. v-model.number="scope.row.goodsshelvesColumn"
  366. clearable
  367. ></el-input>
  368. </el-form-item>
  369. <span v-else>{{ scope.row.goodsshelvesColumn }}</span>
  370. </template>
  371. </el-table-column>
  372. <el-table-column label="货架长(cm)" min-width="120">
  373. <template slot-scope="scope">
  374. <el-form-item
  375. :prop="
  376. 'areaGoodsshelvesList.' +
  377. scope.$index +
  378. '.goodsshelvesLength'
  379. "
  380. :rules="areaCoodsRules.goodsshelvesLength"
  381. v-if="scope.row.isEdit"
  382. >
  383. <el-input
  384. placeholder="请输入"
  385. type="number"
  386. @mousewheel.native.prevent
  387. v-model.number="scope.row.goodsshelvesLength"
  388. clearable
  389. ></el-input>
  390. </el-form-item>
  391. <span v-else>{{ scope.row.goodsshelvesLength }}</span>
  392. </template>
  393. </el-table-column>
  394. <el-table-column label="货架宽(cm)" min-width="120">
  395. <template slot-scope="scope">
  396. <el-form-item
  397. :prop="
  398. 'areaGoodsshelvesList.' + scope.$index + '.goodsshelvesWide'
  399. "
  400. :rules="areaCoodsRules.goodsshelvesWide"
  401. v-if="scope.row.isEdit"
  402. >
  403. <el-input
  404. placeholder="请输入"
  405. type="number"
  406. @mousewheel.native.prevent
  407. v-model.number="scope.row.goodsshelvesWide"
  408. clearable
  409. ></el-input>
  410. </el-form-item>
  411. <span v-else>{{ scope.row.goodsshelvesWide }}</span>
  412. </template>
  413. </el-table-column>
  414. <el-table-column label="货架高(cm)" min-width="120">
  415. <template slot-scope="scope">
  416. <el-form-item
  417. :prop="
  418. 'areaGoodsshelvesList.' + scope.$index + '.goodsshelvesHigh'
  419. "
  420. :rules="areaCoodsRules.goodsshelvesHigh"
  421. v-if="scope.row.isEdit"
  422. >
  423. <el-input
  424. placeholder="请输入"
  425. type="number"
  426. @mousewheel.native.prevent
  427. v-model.number="scope.row.goodsshelvesHigh"
  428. clearable
  429. ></el-input>
  430. </el-form-item>
  431. <span v-else>{{ scope.row.goodsshelvesHigh }}</span>
  432. </template>
  433. </el-table-column>
  434. <el-table-column label="货位数量" prop="" min-width="120">
  435. <template slot-scope="{ row }">
  436. {{
  437. Number.isNaN(row.goodsshelvesLine * row.goodsshelvesColumn)
  438. ? ''
  439. : row.goodsshelvesLine * row.goodsshelvesColumn
  440. }}
  441. </template>
  442. </el-table-column>
  443. <el-table-column label="是否规则" prop="isRegular" min-width="120">
  444. <template slot-scope="{ row }">
  445. <el-select v-model="row.isRegular" v-if="row.isEdit">
  446. <el-option
  447. v-for="item in warehouseDefinition_isRegular"
  448. :key="item.code"
  449. :value="item.code"
  450. :label="item.label"
  451. ></el-option>
  452. </el-select>
  453. <template v-else>
  454. {{
  455. row.isRegular
  456. | filterAreaType(warehouseDefinition_isRegular)
  457. }}
  458. </template>
  459. </template>
  460. </el-table-column>
  461. <!-- <el-table-column
  462. label="货架条码"
  463. prop="goodsshelvesBarcode"
  464. ></el-table-column> -->
  465. <el-table-column label="备注" min-width="120">
  466. <template slot-scope="scope">
  467. <el-form-item
  468. :prop="
  469. 'areaGoodsshelvesList.' +
  470. scope.$index +
  471. '.goodsshelvesRemark'
  472. "
  473. v-if="scope.row.isEdit"
  474. >
  475. <el-input
  476. placeholder="请输入"
  477. v-model="scope.row.goodsshelvesRemark"
  478. clearable
  479. ></el-input>
  480. </el-form-item>
  481. <span v-else>{{ scope.row.goodsshelvesRemark }}</span>
  482. </template>
  483. </el-table-column>
  484. <el-table-column label="操作" fixed="right" min-width="120">
  485. <template slot-scope="{ $index, row }">
  486. <el-button
  487. type="text"
  488. v-if="row.isEdit"
  489. @click="saveGoods($index, row)"
  490. >保存</el-button
  491. >
  492. <el-button type="text" @click="removeGoods($index, row)"
  493. >删除货架</el-button
  494. >
  495. </template>
  496. </el-table-column>
  497. </el-table>
  498. </el-form>
  499. </div>
  500. </div>
  501. <!-- <div
  502. class="area"
  503. v-if="
  504. areaForm.allocationReqList && areaForm.allocationReqList.length !== 0
  505. "
  506. > -->
  507. <div class="area">
  508. <div class="mt20 reservoirArea">
  509. <span>货位</span>
  510. <!-- <el-button type="primary" @click="reuse">复用</el-button> -->
  511. </div>
  512. <div class="mt10">
  513. <el-form :model="areaForm" ref="allocationForm" class="areaForm">
  514. <el-table
  515. ref="multipleTable"
  516. :data="areaForm.allocationReqList"
  517. tooltip-effect="dark"
  518. style="width: 100%"
  519. stripe
  520. :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
  521. >
  522. <!-- <el-table-column type="selection" width="55"> </el-table-column> -->
  523. <el-table-column label="货架编号" prop="warehouseAreaGoodsCode">
  524. <template slot-scope="{ row }">
  525. {{ getWarehouseAreaGoodsCode(row) }}
  526. </template>
  527. </el-table-column>
  528. <el-table-column
  529. label="货位编号"
  530. prop="goodsAllocationCode"
  531. min-width="120"
  532. >
  533. <template slot-scope="{ row, $index }">
  534. <el-form-item
  535. :prop="'allocationReqList.' + $index + '.goodsAllocationCode'"
  536. :rules="areaLocationRules.goodsAllocationCode"
  537. v-if="row.isEdit"
  538. >
  539. <el-input
  540. placeholder="请输入"
  541. clearable
  542. v-model="row.goodsAllocationCode"
  543. ></el-input>
  544. </el-form-item>
  545. <span v-else>{{ row.goodsAllocationCode }}</span>
  546. </template></el-table-column
  547. >
  548. <el-table-column label="货位长(cm)" min-width="120">
  549. <template slot-scope="scope">
  550. <el-form-item
  551. :prop="
  552. 'allocationReqList.' +
  553. scope.$index +
  554. '.goodsAllocationLength'
  555. "
  556. :rules="areaLocationRules.allocationReq"
  557. v-if="scope.row.isEdit"
  558. >
  559. <el-input
  560. placeholder="请输入"
  561. type="number"
  562. @mousewheel.native.prevent
  563. @blur="
  564. onBlur(
  565. scope.row,
  566. 'goodsAllocationLength',
  567. 'goodsshelvesLength'
  568. )
  569. "
  570. v-model.number="scope.row.goodsAllocationLength"
  571. clearable
  572. ></el-input>
  573. </el-form-item>
  574. <span v-else>{{ scope.row.goodsAllocationLength }}</span>
  575. </template>
  576. </el-table-column>
  577. <el-table-column label="货位宽(cm)" min-width="120">
  578. <template slot-scope="scope">
  579. <el-form-item
  580. :prop="
  581. 'allocationReqList.' + scope.$index + '.goodsAllocationWide'
  582. "
  583. v-if="scope.row.isEdit"
  584. :rules="areaLocationRules.allocationReq"
  585. >
  586. <el-input
  587. placeholder="请输入"
  588. type="number"
  589. @mousewheel.native.prevent
  590. v-model.number="scope.row.goodsAllocationWide"
  591. @blur="
  592. onBlur(
  593. scope.row,
  594. 'goodsAllocationWide',
  595. 'goodsshelvesWide'
  596. )
  597. "
  598. clearable
  599. ></el-input>
  600. </el-form-item>
  601. <span v-else>{{ scope.row.goodsAllocationWide }}</span>
  602. </template>
  603. </el-table-column>
  604. <el-table-column label="货位高(cm)" min-width="120">
  605. <template slot-scope="scope">
  606. <el-form-item
  607. :prop="
  608. 'allocationReqList.' + scope.$index + '.goodsAllocationHigh'
  609. "
  610. v-if="scope.row.isEdit"
  611. :rules="areaLocationRules.allocationReq"
  612. >
  613. <el-input
  614. placeholder="请输入"
  615. @blur="
  616. onBlur(
  617. scope.row,
  618. 'goodsAllocationHigh',
  619. 'goodsshelvesHigh'
  620. )
  621. "
  622. type="number"
  623. @mousewheel.native.prevent
  624. v-model.number="scope.row.goodsAllocationHigh"
  625. clearable
  626. ></el-input>
  627. </el-form-item>
  628. <span v-else>{{ scope.row.goodsAllocationHigh }}</span>
  629. </template>
  630. </el-table-column>
  631. <el-table-column label="限重(kg)" min-width="120">
  632. <template slot-scope="scope">
  633. <el-form-item
  634. :prop="'allocationReqList.' + scope.$index + '.weightLimit'"
  635. v-if="scope.row.isEdit"
  636. >
  637. <el-input
  638. placeholder="请输入"
  639. type="number"
  640. @mousewheel.native.prevent
  641. v-model.number="scope.row.weightLimit"
  642. clearable
  643. ></el-input>
  644. </el-form-item>
  645. <span v-else>{{ scope.row.weightLimit }}</span>
  646. </template>
  647. </el-table-column>
  648. <el-table-column label="基本货位容积(cm³)" min-width="120">
  649. <template slot-scope="scope">
  650. <el-form-item
  651. :prop="'allocationReqList.' + scope.$index + '.volumeUnit'"
  652. v-if="scope.row.isEdit"
  653. >
  654. <el-input
  655. placeholder="请输入"
  656. type="number"
  657. @mousewheel.native.prevent
  658. v-model.number="scope.row.volumeUnit"
  659. disabled
  660. ></el-input>
  661. </el-form-item>
  662. <span v-else>{{ scope.row.volumeUnit }}</span>
  663. </template>
  664. </el-table-column>
  665. <!-- <el-table-column
  666. label="货位条码"
  667. prop="allocationBarcode"
  668. ></el-table-column> -->
  669. </el-table>
  670. </el-form>
  671. </div>
  672. </div>
  673. </div>
  674. </template>
  675. <script>
  676. // import selectTree from '@/components/selectTree';
  677. // import {
  678. // warehouseDefinition_areaType,
  679. // warehouseDefinition_areaAttribute,
  680. // warehouseDefinition_isRegular,
  681. // useDictLabelFilter
  682. // } from '@/utils/dict/index'
  683. // import {
  684. // warehouseGoodsshelvesSave,
  685. // warehouseDetails,
  686. // existGoods
  687. // } from '@/api/stockManagement/warehouseDefinition';
  688. // import { pushZero } from '@/utils/index';
  689. // import { throttle } from 'lodash';
  690. export default {
  691. // components: { selectTree },
  692. // filters: {
  693. // filterAreaType: useDictLabelFilter
  694. // },
  695. data() {
  696. // const msg = throttle(
  697. // () => this.$message.error('货架总体积不能大于库区体积!'),
  698. // 500
  699. // );
  700. const allocationReqValidator = (column, value, callback) => {
  701. if (!value) {
  702. callback(new Error('不能为空!'));
  703. } else {
  704. // 货位体积限制
  705. const index = +column.field.split('.')[1];
  706. const row = this.areaForm.allocationReqList[index];
  707. const parent = this.areaForm.areaGoodsshelvesList.find(
  708. (t) => t.code === row.goodsshelvesCode
  709. );
  710. let sameParentSavedSum = this.areaForm.allocationReqList
  711. .filter((t) => t.warehouseAreaGoodsCode === row.goodsshelvesCode)
  712. .reduce((sum, item) => {
  713. if (!item.isEdit) {
  714. sum +=
  715. item.goodsAllocationLength *
  716. item.goodsAllocationWide *
  717. item.goodsAllocationHigh;
  718. }
  719. return sum;
  720. }, 0);
  721. if (parent) {
  722. const max =
  723. parent.goodsshelvesLength *
  724. parent.goodsshelvesWide *
  725. parent.goodsshelvesHigh;
  726. if (
  727. max - sameParentSavedSum <
  728. row.goodsAllocationLength *
  729. row.goodsAllocationWide *
  730. row.goodsAllocationHigh
  731. ) {
  732. msg();
  733. callback(new Error('货架总体积不能大于库区体积!'));
  734. return;
  735. }
  736. }
  737. callback();
  738. }
  739. };
  740. return {
  741. warehouseDefinition_isRegular,
  742. warehouseDefinition_areaType,
  743. warehouseDefinition_areaAttribute,
  744. loading: false,
  745. areaForm: {
  746. warehouseAreasSaveList: [], //库区
  747. areaGoodsshelvesList: [], //货架
  748. allocationReqList: [] //货位
  749. },
  750. areaCoodsRules: {
  751. goodsshelvesCode: {
  752. required: true,
  753. message: '请输入货架编号',
  754. trigger: 'blur'
  755. },
  756. goodsshelvesLine: {
  757. required: true,
  758. message: '请输入货架行',
  759. trigger: 'blur'
  760. },
  761. goodsshelvesColumn: {
  762. required: true,
  763. message: '请输入货架列',
  764. trigger: 'blur'
  765. },
  766. goodsshelvesLength: {
  767. required: true,
  768. message: '请输入货架长',
  769. trigger: 'blur'
  770. },
  771. goodsshelvesWide: {
  772. required: true,
  773. message: '请输入货架宽',
  774. trigger: 'blur'
  775. },
  776. goodsshelvesHigh: {
  777. required: true,
  778. message: '请输入货架高',
  779. trigger: 'blur'
  780. }
  781. },
  782. areaLocationRules: {
  783. goodsAllocationCode: {
  784. required: true,
  785. message: '请输入货位编号',
  786. trigger: 'blur'
  787. },
  788. allocationReq: {
  789. required: true,
  790. validator: allocationReqValidator,
  791. trigger: 'blur'
  792. }
  793. },
  794. isPageEdit: false,
  795. areaRules: {
  796. code: { required: true, message: '请输入库区编号', trigger: 'blur' },
  797. name: { required: true, message: '请输入库区名称', trigger: 'blur' },
  798. type: {
  799. required: true,
  800. message: '请选择库区类型',
  801. trigger: 'change'
  802. },
  803. attribute: {
  804. required: true,
  805. message: '请选择库区属性',
  806. trigger: 'change'
  807. },
  808. address: {
  809. required: true,
  810. message: '请输入库区位置',
  811. trigger: 'blur'
  812. },
  813. areaLength: {
  814. required: true,
  815. message: '请输入库区长',
  816. trigger: 'blur'
  817. },
  818. areaWide: {
  819. required: true,
  820. message: '请输入库区宽',
  821. trigger: 'blur'
  822. },
  823. areaHigh: {
  824. required: true,
  825. message: '请输入库区高',
  826. trigger: 'blur'
  827. },
  828. num: { required: true, message: '请输入货架数量', trigger: 'blur' }
  829. },
  830. areaDisabled: true,
  831. addressDisabled: true,
  832. ownerNameDisabled: true,
  833. areaList: [],
  834. inventoryList: [
  835. { value: '1', name: '物料库' },
  836. { value: '2', name: '产品库' },
  837. { value: '3', name: '设备库' }
  838. ],
  839. statusList: [
  840. { value: '0', name: '失效' },
  841. { value: '1', name: '生效' }
  842. ],
  843. formData: {
  844. code: '',
  845. name: '',
  846. inventoryType: '',
  847. factoryName: '',
  848. factoryId: '',
  849. ownerId: '',
  850. ownerName: '',
  851. contact: '',
  852. status: '',
  853. city: '',
  854. area: '',
  855. address: '',
  856. remarks: '',
  857. departmentCode: '',
  858. departmentName: ''
  859. },
  860. factoryList: [], //所属工厂
  861. staffList: [],
  862. multipleSelection: [],
  863. shelfObj: {},
  864. longWidthHeightBol: false,
  865. savedWarehouse: [],
  866. savedShelves: []
  867. };
  868. },
  869. computed: {},
  870. created() {
  871. // const { query } = this.$route;
  872. // this.formData.code = query.code;
  873. // this.formData.name = query.name;
  874. // this.formData.id = query.id;
  875. // this.getDetail(query.id);
  876. },
  877. methods: {
  878. async getDetail(id) {
  879. const res = await warehouseDetails({ id });
  880. if (res?.success) {
  881. this.areaForm = {
  882. warehouseAreasSaveList: res.data.warehouseAreasSaveList, //库区
  883. areaGoodsshelvesList: res.data.areaGoodsshelvesList, //货架
  884. allocationReqList: res.data.allocationReqList //货位
  885. };
  886. this.formData = res.data.warehouseSaveReq;
  887. //已保存库区货位 ,删除时判断
  888. this.savedWarehouse = res.data.warehouseAreasSaveList.map(
  889. (i) => i.id
  890. );
  891. this.savedShelves = res.data.areaGoodsshelvesList.map((i) => i.id);
  892. }
  893. },
  894. checkVolume() {
  895. let falg = true;
  896. let warehouseAreasSaveList = this.areaForm.warehouseAreasSaveList.map(
  897. (item) => {
  898. return {
  899. id: item.id,
  900. volumu: item.areaHigh * item.areaLength * item.areaWide
  901. };
  902. }
  903. );
  904. let areaGoodsshelvesList = this.areaForm.areaGoodsshelvesList.map(
  905. (item) => {
  906. return {
  907. id: item.warehouseAreaId,
  908. volumu:
  909. item.goodsshelvesHigh *
  910. item.goodsshelvesLength *
  911. item.goodsshelvesWide
  912. };
  913. }
  914. );
  915. warehouseAreasSaveList.forEach((item) => {
  916. let arr = areaGoodsshelvesList.filter((it) => it.id == item.id);
  917. let num = arr.reduce((val, it) => val + it.volumu, 0);
  918. if (num > item.volumu) {
  919. falg = false;
  920. }
  921. });
  922. return falg;
  923. },
  924. editInfo(index) {
  925. let obj = this.areaForm.warehouseAreasSaveList[index];
  926. if (obj.isEdit) {
  927. this.$set(
  928. this.areaForm.warehouseAreasSaveList[index],
  929. 'isEdit',
  930. false
  931. );
  932. } else {
  933. this.$set(
  934. this.areaForm.warehouseAreasSaveList[index],
  935. 'isEdit',
  936. true
  937. );
  938. }
  939. },
  940. addShelf(row, index) {
  941. this.$prompt('请输入', '添加货架数', {
  942. confirmButtonText: '确定',
  943. cancelButtonText: '取消',
  944. inputPattern: /[1-9]\d*/,
  945. inputErrorMessage: '请输入正整数'
  946. })
  947. .then(({ value }) => {
  948. row.num = +row.num + +value;
  949. let obj = this.areaForm.warehouseAreasSaveList[index];
  950. const pre =
  951. this.areaForm.areaGoodsshelvesList[
  952. this.areaForm.areaGoodsshelvesList.length - 1
  953. ];
  954. let preCode = 0;
  955. if (pre) {
  956. preCode = +(pre.goodsshelvesCode?.substr(1) || 0);
  957. }
  958. for (var i = 0; i < value; i++) {
  959. this.areaForm.areaGoodsshelvesList.push({
  960. warehouseAreaCode: obj.code,
  961. warehouseAreaId: obj.id,
  962. warehouseAreaName: obj.name,
  963. goodsshelvesCode: ``,
  964. goodsshelvesLine: '',
  965. goodsshelvesColumn: '',
  966. goodsshelvesLength: '',
  967. goodsshelvesWide: '',
  968. goodsshelvesHigh: '',
  969. isRegular: 1,
  970. // goodsshelvesBarcode: '',
  971. goodsshelvesRemark: '',
  972. warehouseName: this.formData.name,
  973. isEdit: true
  974. });
  975. }
  976. })
  977. .catch(() => {});
  978. // let obj = this.areaForm.warehouseAreasSaveList[index],
  979. // list = this.areaForm.areaGoodsshelvesList.filter(
  980. // item => item.warehouseAreaCode === obj.code
  981. // )
  982. // if (obj.id) {
  983. // if (list.length == obj.num)
  984. // return this.$message.error('添加货架数量达到上限')
  985. // let num = obj.num - list.length
  986. // for (var i = 0; i < num; i++) {
  987. // this.areaForm.areaGoodsshelvesList.push({
  988. // warehouseAreaCode: obj.code,
  989. // warehouseAreaId: obj.id,
  990. // warehouseAreaName: obj.name,
  991. // goodsshelvesCode: `C${pushZero(
  992. // this.areaForm.areaGoodsshelvesList.length + 1
  993. // )}`,
  994. // goodsshelvesLine: '',
  995. // goodsshelvesColumn: '',
  996. // goodsshelvesLength: '',
  997. // goodsshelvesWide: '',
  998. // goodsshelvesHigh: '',
  999. // // goodsshelvesBarcode: '',
  1000. // goodsshelvesRemark: '',
  1001. // warehouseName: this.formData.name,
  1002. // isEdit: true
  1003. // })
  1004. // }
  1005. // } else {
  1006. // this.saveArea(index)
  1007. // }
  1008. },
  1009. onBlur(item, name, name1) {
  1010. // name当前货位的长宽高,name1货架的长宽高
  1011. if (
  1012. item.goodsAllocationHigh &&
  1013. item.goodsAllocationLength &&
  1014. item.goodsAllocationWide
  1015. ) {
  1016. item.volumeUnit =
  1017. item.goodsAllocationHigh *
  1018. item.goodsAllocationLength *
  1019. item.goodsAllocationWide;
  1020. }
  1021. },
  1022. saveGoods(index, row) {
  1023. // 需要校验的字段 areaGoodsshelvesList
  1024. let list = Object.keys(this.areaCoodsRules),
  1025. obj = this.areaForm.areaGoodsshelvesList[index],
  1026. flag = true;
  1027. list.forEach((item) => {
  1028. this.$refs.areaCoodsForm.validateField(
  1029. 'areaGoodsshelvesList.' + index + '.' + item,
  1030. (valid) => {
  1031. if (valid) {
  1032. flag = false;
  1033. }
  1034. }
  1035. );
  1036. });
  1037. // 库区体积限制
  1038. const parent = this.areaForm.warehouseAreasSaveList.find(
  1039. (t) => t.code === row.warehouseAreaCode
  1040. );
  1041. if (
  1042. this.areaForm.areaGoodsshelvesList.filter(
  1043. (item) =>
  1044. item.goodsshelvesCode === row.goodsshelvesCode &&
  1045. row.warehouseAreaCode === item.warehouseAreaCode
  1046. ).length > 1
  1047. ) {
  1048. return this.$message.error('货架编号不能重复!');
  1049. }
  1050. const savedSum = this.areaForm.areaGoodsshelvesList
  1051. .filter((t) => t.warehouseAreaCode === row.warehouseAreaCode)
  1052. .reduce((sum, item) => {
  1053. if (!item.isEdit) {
  1054. sum +=
  1055. item.goodsshelvesLength *
  1056. item.goodsshelvesWide *
  1057. item.goodsshelvesHigh;
  1058. }
  1059. return sum;
  1060. }, 0);
  1061. if (parent) {
  1062. const max = parent.areaLength * parent.areaWide * parent.areaHigh;
  1063. if (
  1064. max - savedSum <
  1065. row.goodsshelvesLength * row.goodsshelvesWide * row.goodsshelvesHigh
  1066. ) {
  1067. return this.$message.error('货架总体积不能大于库区体积!');
  1068. }
  1069. }
  1070. if (flag) {
  1071. this.$set(obj, 'isEdit', false);
  1072. this.shelfObj = obj; //储存货架对象
  1073. let num = obj.goodsshelvesLine * obj.goodsshelvesColumn;
  1074. this.areaIndex = index;
  1075. this.generateAllocation(num, obj);
  1076. }
  1077. },
  1078. generateAllocation(num, obj) {
  1079. console.log('obj', obj);
  1080. const pre =
  1081. this.areaForm.allocationReqList[
  1082. this.areaForm.allocationReqList.length - 1
  1083. ];
  1084. for (var i = 0; i < num; i++) {
  1085. this.areaForm.allocationReqList.push({
  1086. // allocationBarcode: '',
  1087. allocationRemark: '',
  1088. allocationStatus: 1,
  1089. departmentName: this.formData.departmentName,
  1090. goodsAllocationCode: ``,
  1091. goodsAllocationHigh: '',
  1092. goodsAllocationLength: '',
  1093. goodsAllocationWide: '',
  1094. ownerName: this.formData.ownerName,
  1095. volumeUnit: '',
  1096. warehouseAreaGoodsCode: obj.goodsshelvesCode,
  1097. warehouseAreaGoodsId: obj.id,
  1098. warehouseAreaGoodsName: obj.name,
  1099. warehouseAreaId: obj.warehouseAreaId, //?
  1100. warehouseAreaName: obj.warehouseAreaName,
  1101. warehouseAreaCode: obj.warehouseAreaCode,
  1102. warehouseId: this.id, //?
  1103. warehouseName: this.formData.name,
  1104. weightLimit: '',
  1105. isEdit: true
  1106. });
  1107. }
  1108. },
  1109. saveArea(index) {
  1110. let flag = true;
  1111. Object.keys(this.areaRules).forEach((item) => {
  1112. this.$refs.areaFormName.validateField(
  1113. 'warehouseAreasSaveList.' + index + '.' + item,
  1114. (valid) => {
  1115. if (valid) {
  1116. // rej()
  1117. flag = false;
  1118. }
  1119. }
  1120. );
  1121. });
  1122. if (!flag) return;
  1123. if (
  1124. this.areaForm.warehouseAreasSaveList.filter(
  1125. (item) =>
  1126. item.code === this.areaForm.warehouseAreasSaveList[index].code
  1127. ).length > 1
  1128. ) {
  1129. return this.$message.error('库区编号不能重复!');
  1130. }
  1131. // let list = this.areaForm.areaGoodsshelvesList.filter(
  1132. // item =>
  1133. // item.warehouseAreaCode ===
  1134. // this.areaForm.warehouseAreasSaveList[index].code
  1135. // )
  1136. // if (list.length == this.areaForm.warehouseAreasSaveList[index].num) {
  1137. // // this.$message.error('添加货架数量达到上限')
  1138. // return
  1139. // }
  1140. this.$set(this.areaForm.warehouseAreasSaveList[index], 'isEdit', false);
  1141. let obj = this.areaForm.warehouseAreasSaveList[index];
  1142. let num = this.areaForm.warehouseAreasSaveList[index].num;
  1143. const pre =
  1144. this.areaForm.areaGoodsshelvesList[
  1145. this.areaForm.areaGoodsshelvesList.length - 1
  1146. ];
  1147. let preCode = 0;
  1148. if (pre) {
  1149. preCode = +(pre.goodsshelvesCode?.substr(1) || 0);
  1150. }
  1151. for (var i = 0; i < num; i++) {
  1152. this.areaForm.areaGoodsshelvesList.push({
  1153. warehouseAreaCode: obj.code,
  1154. warehouseAreaId: obj.id,
  1155. warehouseAreaName: obj.name,
  1156. warehouseAreaId: this.id,
  1157. goodsshelvesCode: ``,
  1158. goodsshelvesLine: '',
  1159. goodsshelvesColumn: '',
  1160. goodsshelvesLength: '',
  1161. goodsshelvesWide: '',
  1162. goodsshelvesHigh: '',
  1163. // goodsshelvesBarcode: '',
  1164. goodsshelvesRemark: '',
  1165. warehouseName: this.formData.name,
  1166. isEdit: true,
  1167. isRegular: 1
  1168. });
  1169. }
  1170. },
  1171. async removeGoods(idx, { id, goodsshelvesCode, warehouseAreaCode }) {
  1172. if (
  1173. this.areaForm.areaGoodsshelvesList.filter(
  1174. (item) => item.warehouseAreaCode === warehouseAreaCode
  1175. ).length === 1
  1176. ) {
  1177. return this.$message.error('至少保留一个货架!');
  1178. }
  1179. if (this.savedShelves.includes(id)) {
  1180. let list = this.areaForm.allocationReqList
  1181. .filter((item) => item.warehouseAreaGoodsCode === goodsshelvesCode)
  1182. .map((i) => i.id);
  1183. const res = await existGoods(list);
  1184. if (res?.success && res.data) {
  1185. return this.$message.error('此货架下货位有关联货物,无法删除!');
  1186. }
  1187. }
  1188. this.areaForm.allocationReqList =
  1189. this.areaForm.allocationReqList.filter(
  1190. (item) =>
  1191. item.warehouseAreaGoodsCode !== goodsshelvesCode ||
  1192. warehouseAreaCode !== item.warehouseAreaCode
  1193. );
  1194. let areasIndex = this.areaForm.warehouseAreasSaveList.findIndex(
  1195. (item) =>
  1196. item.code ===
  1197. this.areaForm.areaGoodsshelvesList[idx].warehouseAreaCode
  1198. );
  1199. this.areaForm.areaGoodsshelvesList.splice(idx, 1);
  1200. if (this.areaForm.warehouseAreasSaveList[areasIndex].num - 1 <= 0) {
  1201. this.areaForm.warehouseAreasSaveList.splice(areasIndex, 1);
  1202. } else {
  1203. this.$set(
  1204. this.areaForm.warehouseAreasSaveList[areasIndex],
  1205. 'num',
  1206. this.areaForm.warehouseAreasSaveList[areasIndex].num - 1
  1207. );
  1208. }
  1209. },
  1210. async remove(index, { id, code }) {
  1211. // 判断关联货物
  1212. console.log(this.savedWarehouse, id, this.savedWarehouse.includes(id));
  1213. if (this.savedWarehouse.includes(id)) {
  1214. let list = this.areaForm.areaGoodsshelvesList
  1215. .filter((item) => item.warehouseAreaCode === code)
  1216. .map((i) =>
  1217. this.areaForm.allocationReqList.filter(
  1218. (item) => item.warehouseAreaGoodsCode === i.goodsshelvesCode
  1219. )
  1220. )
  1221. .flat()
  1222. .map((i) => i.id);
  1223. const res = await existGoods(list);
  1224. if (res?.success && res.data) {
  1225. return this.$message.error('此库区下货位有关联货物,无法删除!');
  1226. }
  1227. }
  1228. // 货架code
  1229. let list = [];
  1230. this.areaForm.areaGoodsshelvesList.forEach((item) => {
  1231. if (item.warehouseAreaCode === code) {
  1232. list.push(item.goodsshelvesCode);
  1233. }
  1234. });
  1235. this.areaForm.areaGoodsshelvesList =
  1236. this.areaForm.areaGoodsshelvesList.filter(
  1237. (item) => item.warehouseAreaCode !== code
  1238. );
  1239. this.areaForm.allocationReqList =
  1240. this.areaForm.allocationReqList.filter(
  1241. (item) =>
  1242. !list.includes(item.warehouseAreaGoodsCode) ||
  1243. code !== item.warehouseAreaCode
  1244. );
  1245. this.areaForm.warehouseAreasSaveList.splice(index, 1);
  1246. },
  1247. addArea() {
  1248. const pre =
  1249. this.areaForm.warehouseAreasSaveList[
  1250. this.areaForm.warehouseAreasSaveList.length - 1
  1251. ];
  1252. let preCode = 0;
  1253. if (pre) {
  1254. preCode = +(pre.code?.substr(1) || 0);
  1255. }
  1256. this.areaForm.warehouseAreasSaveList.push({
  1257. code: ``,
  1258. name: '',
  1259. type: '',
  1260. attribute: '',
  1261. address: '',
  1262. areaLength: '',
  1263. areaWide: '',
  1264. areaHigh: '',
  1265. num: '',
  1266. // areaBarcode: '',
  1267. areaRemark: '',
  1268. warehouseName: this.formData.name,
  1269. warehouseCode: this.formData.code,
  1270. isEdit: true
  1271. });
  1272. },
  1273. submit() {
  1274. if (this.areaForm.warehouseAreasSaveList.length === 0) {
  1275. return this.$message.error('请添加库区');
  1276. }
  1277. if (this.areaForm.allocationReqList.length === 0) {
  1278. return this.$message.error('请添加货位');
  1279. }
  1280. if (this.areaForm.areaGoodsshelvesList.length === 0) {
  1281. return this.$message.error('请添加货架');
  1282. }
  1283. if (!this.checkVolume()) {
  1284. return this.$message.error('货架总体积不能大于库区体积!');
  1285. }
  1286. let obj = {};
  1287. for (const item of this.areaForm.allocationReqList) {
  1288. const area = this.areaForm.areaGoodsshelvesList.find((itm) => {
  1289. return (
  1290. itm.warehouseAreaName === item.warehouseAreaName &&
  1291. itm.goodsshelvesCode === item.warehouseAreaGoodsCode
  1292. );
  1293. });
  1294. const id = `${
  1295. area && area.warehouseAreaCode + '-' + item.warehouseAreaGoodsCode
  1296. }-${item.goodsAllocationCode}`;
  1297. if (obj[id]) {
  1298. return this.$message.error('货位编号不能重复!');
  1299. } else {
  1300. obj[id] = 1;
  1301. }
  1302. }
  1303. this.$refs.areaFormName.validate(async (valid) => {
  1304. if (valid) {
  1305. this.$refs.areaCoodsForm.validate(async (valid) => {
  1306. if (valid) {
  1307. this.$refs.allocationForm.validate(async (valid) => {
  1308. if (valid) {
  1309. let params = {
  1310. warehouseSaveReq: this.formData,
  1311. allocationReqList: this.areaForm.allocationReqList,
  1312. areaGoodsshelvesList: this.areaForm.areaGoodsshelvesList,
  1313. warehouseAreasSaveList:
  1314. this.areaForm.warehouseAreasSaveList
  1315. };
  1316. this.loading = true;
  1317. try {
  1318. let res = await warehouseGoodsshelvesSave(params);
  1319. if (res.success) {
  1320. this.$message.success('保存成功');
  1321. this.$router.push({
  1322. path: '/warehouseManagement/warehouseDefinition'
  1323. });
  1324. }
  1325. } catch (error) {}
  1326. this.loading = false;
  1327. }
  1328. });
  1329. }
  1330. });
  1331. }
  1332. });
  1333. },
  1334. // 货位组装货架编号
  1335. getWarehouseAreaGoodsCode(row) {
  1336. console.log(row);
  1337. const { warehouseAreaGoodsCode, warehouseAreaCode } = row;
  1338. const obj = this.areaForm.areaGoodsshelvesList.find((item) => {
  1339. return (
  1340. item.warehouseAreaCode === warehouseAreaCode &&
  1341. item.goodsshelvesCode === warehouseAreaGoodsCode
  1342. );
  1343. });
  1344. return obj && obj.warehouseAreaCode + '-' + warehouseAreaGoodsCode;
  1345. }
  1346. }
  1347. };
  1348. </script>
  1349. <style lang="scss" scoped>
  1350. .p20 {
  1351. padding: 20px;
  1352. }
  1353. .mt20 {
  1354. margin-top: 20px;
  1355. }
  1356. .mt10 {
  1357. margin-top: 10px;
  1358. }
  1359. ::v-deep .el-select {
  1360. width: 100%;
  1361. }
  1362. .el-form-item {
  1363. margin-bottom: 22px;
  1364. }
  1365. .areaForm {
  1366. .el-form-item {
  1367. margin-bottom: 0;
  1368. }
  1369. }
  1370. .warehouseAdd {
  1371. .el-row {
  1372. display: block;
  1373. }
  1374. header {
  1375. display: flex;
  1376. justify-content: space-between;
  1377. .title {
  1378. font-size: 20px;
  1379. color: #333;
  1380. font-weight: bold;
  1381. }
  1382. }
  1383. }
  1384. .reservoirArea {
  1385. display: flex;
  1386. justify-content: space-between;
  1387. span {
  1388. font-size: 14px;
  1389. }
  1390. }
  1391. .center {
  1392. text-align: center;
  1393. }
  1394. .el-select {
  1395. display: block;
  1396. }
  1397. ::v-deep input::-webkit-inner-spin-button {
  1398. -webkit-appearance: none;
  1399. }
  1400. </style>