add.vue 75 KB

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