add.vue 74 KB

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