add.vue 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198
  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="result" width="120">
  900. <template slot-scope="{ row }">
  901. <DictSelection
  902. dictName="质检结果"
  903. clearable
  904. v-model="row.result"
  905. />
  906. </template>
  907. </el-table-column>
  908. <el-table-column label="质检状态" prop="status" width="120">
  909. <template slot-scope="{ row }">
  910. <DictSelection
  911. dictName="质检状态"
  912. clearable
  913. v-model="row.status"
  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="materielCode"
  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="result" width="120">
  1062. <template slot-scope="{ row }">
  1063. <DictSelection
  1064. dictName="质检结果"
  1065. clearable
  1066. v-model="row.result"
  1067. />
  1068. </template>
  1069. </el-table-column>
  1070. <el-table-column label="质检状态" prop="status" width="120">
  1071. <template slot-scope="{ row }">
  1072. <DictSelection
  1073. dictName="质检状态"
  1074. clearable
  1075. v-model="row.status"
  1076. />
  1077. </template>
  1078. </el-table-column>
  1079. </el-table>
  1080. </div>
  1081. </div>
  1082. <div class="center mt20">
  1083. <el-button type="primary" @click="handleSave" :loading="saveLoading"
  1084. >保存</el-button
  1085. >
  1086. <el-button @click="$router.go(-1)">返回</el-button>
  1087. </div>
  1088. </el-card>
  1089. <selectType
  1090. :visibleDialog.sync="visibleDialog"
  1091. :title="title"
  1092. :tableHeader="tableHeader"
  1093. :bizScene="formData.bizType"
  1094. :type="[selectEquiType]"
  1095. :loadTree.sync="loadTree"
  1096. @selectTableData="onSelectTableData"
  1097. />
  1098. <WareHouseDailog
  1099. ref="wareHouseDailogRef"
  1100. @houseData="houseData"
  1101. ></WareHouseDailog>
  1102. <ReturnSelect
  1103. ref="returnSelectRef"
  1104. :tableHeader="tableHeader"
  1105. :curDateType="curDateType"
  1106. ></ReturnSelect>
  1107. <el-dialog :visible.sync="dateVisible" title="选择日期" width="400px">
  1108. <el-date-picker
  1109. size="small"
  1110. v-model="batchTime"
  1111. type="datetime"
  1112. style="width: 320px"
  1113. value-format="yyyy-MM-dd HH:mm:ss"
  1114. placeholder="选择日期"
  1115. >
  1116. </el-date-picker>
  1117. <div style="text-align: right; margin-top: 20px">
  1118. <el-button @click="dateVisible = false">取消</el-button>
  1119. <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
  1120. >确认</el-button
  1121. >
  1122. </div>
  1123. </el-dialog>
  1124. <!-- 销售订单 -->
  1125. <picker ref="pickerRef" @success="pickerSuccess" />
  1126. </div>
  1127. </template>
  1128. <script>
  1129. import picker from './components/picker.vue';
  1130. import outin from '@/api/warehouseManagement/outin';
  1131. import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
  1132. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  1133. import selectUpload from '@/components/selectUpload';
  1134. import upload from '@/components/uploadImg';
  1135. import {
  1136. warehousingType,
  1137. sceneState,
  1138. emergencyState,
  1139. materialType
  1140. } from '@/utils/dict/index';
  1141. // import { getInfo, warehousingAdd, getAssetNum } from '@/api/stockManagement';
  1142. import selectTree from '@/components/selectTree';
  1143. import selectType from '../components/selectType.vue';
  1144. import WareHouseDailog from '../components/WareHouseDailog.vue';
  1145. import ReturnSelect from './components/ReturnSelect.vue';
  1146. // import supplier from '@/api/main/supplier';
  1147. // import org from '@/api/main/org';
  1148. // import user from '@/api/main/user';
  1149. import { tableHeader } from '../common';
  1150. import { getCode } from '@/api/codeManagement/index.js';
  1151. import { number } from 'echarts/core';
  1152. import { purchaseorderGetById, contactlink } from '@/api/mes';
  1153. export default {
  1154. components: {
  1155. selectUpload,
  1156. selectTree,
  1157. selectType,
  1158. WareHouseDailog,
  1159. upload,
  1160. ReturnSelect,
  1161. picker
  1162. },
  1163. data() {
  1164. return {
  1165. isWeight: true,
  1166. resultArray: [],
  1167. isDetail: false,
  1168. contactList: [],
  1169. pickerRow: {},
  1170. fromUserList: [],
  1171. codeList: [],
  1172. materialType,
  1173. warehousingType,
  1174. sceneState,
  1175. emergencyState,
  1176. saveLoading: false,
  1177. visibleDialog: false,
  1178. curDateType: 'manufactureTime',
  1179. materialCodeReqListSelected: [],
  1180. // warehouseList: [], //仓库数组
  1181. // warehouse: {},
  1182. title: '',
  1183. tableData2: [],
  1184. uploadList: [],
  1185. supplierList: [],
  1186. warehousingMaterialList: [],
  1187. activeName: 'a',
  1188. loadTree: true,
  1189. selectEquiType: '',
  1190. batchTime: '',
  1191. dateVisible: false,
  1192. treeList: [],
  1193. staffList: [],
  1194. formData: {
  1195. extInfo: {
  1196. assetType: '', //物品类型
  1197. deptCode: '', //部门code
  1198. deptName: '', //部门名称
  1199. verifyDeptCode: '', //审核部门编码
  1200. verifyDeptName: '', //审核部门名称
  1201. deliveryName: '', //送货人名称
  1202. deliveryPhone: '', //送货人电话
  1203. documentSource: '', //销售订单
  1204. urgent: '', //紧急状态
  1205. supplierId: '', //供应商ID
  1206. supplierName: '', //供应商名称
  1207. createUserName: '', //创建人名字
  1208. contentImage: [] //图片数组
  1209. },
  1210. fromUser: '', //送货人
  1211. bizType: '', //物品类型
  1212. verifyId: '', //审核人Id
  1213. verifyName: '', //审核人名称
  1214. createUserId: '',
  1215. remark: ''
  1216. },
  1217. rules: {
  1218. 'extInfo.assetType': {
  1219. required: true,
  1220. message: '请选择物品类型',
  1221. trigger: 'change'
  1222. },
  1223. bizType: {
  1224. required: true,
  1225. message: '请选择入库场景',
  1226. trigger: 'change'
  1227. }
  1228. }
  1229. };
  1230. },
  1231. computed: {
  1232. // 条码信息
  1233. materialCodeReqList() {
  1234. return this.warehousingMaterialList
  1235. .map((i) => i.warehouseLedgerDetails || [])
  1236. .flat();
  1237. },
  1238. tableHeader() {
  1239. return tableHeader(this.selectEquiType);
  1240. }
  1241. },
  1242. created() {
  1243. if (this.$route.query.id) {
  1244. // this._getInfo()
  1245. } else {
  1246. let obj = localStorage.getItem('orgInfo')
  1247. ? JSON.parse(localStorage.getItem('orgInfo'))
  1248. : {};
  1249. this.formData.createUserName = obj.name;
  1250. this.formData.extInfo.deptName = obj.dept?.name;
  1251. this.formData.deptCode = obj.dept?.code;
  1252. }
  1253. this.initData();
  1254. },
  1255. methods: {
  1256. weightInput(value, row) {
  1257. const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
  1258. const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
  1259. if (decimalCount > 1) {
  1260. // 如果小数点个数大于1,移除多余的小数点
  1261. const lastIndex = newValue.lastIndexOf('.');
  1262. row.weight =
  1263. newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1);
  1264. } else if (decimalCount === 1) {
  1265. // 如果小数点个数等于1,允许小数点的输入
  1266. row.weight = newValue;
  1267. } else {
  1268. row.weight = newValue === '' ? 0 : parseFloat(newValue); // 如果输入为空,则设为0
  1269. }
  1270. },
  1271. handleIsDetail(event) {
  1272. if (event) {
  1273. const list = this.materialCodeReqList;
  1274. let resultArray = [];
  1275. list.forEach((item) => {
  1276. for (let i = 1; i <= Number(item.minPackingCount); i++) {
  1277. resultArray.push({
  1278. onlyCode: item.onlyCode,
  1279. no: item.onlyCode + i.toString().padStart(4, '0'),
  1280. assetCode: item.assetCode,
  1281. assetName: item.assetName,
  1282. batchNo: item.batchNo,
  1283. minPackingCount: 1,
  1284. measuringUnit: item.measuringUnit,
  1285. materielCode: item.materielCode,
  1286. clientCode: item.clientCode,
  1287. weight: item.weight / Number(item.minPackingCount),
  1288. weightUnit: item.weightUnit,
  1289. engrave: item.engrave,
  1290. result: item.result,
  1291. status: item.status
  1292. });
  1293. }
  1294. });
  1295. this.resultArray = resultArray;
  1296. } else {
  1297. this.resultArray = [];
  1298. }
  1299. },
  1300. //包装明细保存
  1301. packCout(row) {
  1302. //true保存==》反之
  1303. if (!row.isPack) {
  1304. row.isPack = true;
  1305. const code = row.assetCode;
  1306. const batchNo = row.batchNo;
  1307. //做防护,防止weight字符串类型
  1308. this.materialCodeReqList.forEach((ele) => {
  1309. ele.weight = Number(ele.weight);
  1310. });
  1311. // const count = this.materialCodeReqList.reduce(
  1312. // (acc, curr) => acc + curr.weight,
  1313. // 0
  1314. // );
  1315. this.isWeight = false;
  1316. this.warehousingMaterialList.forEach((item) => {
  1317. if (item.assetCode == code && item.batchNo == batchNo) {
  1318. let arr = [];
  1319. for (const key in this.materialCodeReqList) {
  1320. if (
  1321. this.materialCodeReqList[key].assetCode == item.assetCode &&
  1322. this.materialCodeReqList[key].batchNo == item.batchNo
  1323. ) {
  1324. arr.push({ ...this.materialCodeReqList[key] });
  1325. }
  1326. }
  1327. const count = arr.reduce((acc, curr) => acc + curr.weight, 0);
  1328. this.$set(item, 'weight', count);
  1329. }
  1330. });
  1331. this.$nextTick(() => {
  1332. this.isWeight = true;
  1333. });
  1334. } else {
  1335. row.isPack = false;
  1336. }
  1337. // setTimeout(() => {
  1338. // }, 100);
  1339. },
  1340. packNum(row, value) {
  1341. const total = {
  1342. packingCount: Number(row.minPackingCount),
  1343. outInNum: Number(row.outInNum)
  1344. };
  1345. if (row.measuringUnit == row.weightUnit) {
  1346. row.weight = total.packingCount * 1 * total.outInNum.toFixed(2);
  1347. } else {
  1348. const totals = total.packingCount * total.outInNum;
  1349. row.weight = totals * row.netWeight.toFixed(2);
  1350. }
  1351. return (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''));
  1352. },
  1353. async searchContact(id) {
  1354. const data = await contactlink({ contactId: id });
  1355. this.contactList = data.data;
  1356. },
  1357. async pickerSuccess(row) {
  1358. this.pickerRow = row;
  1359. this.formData.extInfo.documentSource = row.orderNo;
  1360. this.formData.clientName = row.partaName;
  1361. this.formData.clientCode = row.partaId;
  1362. this.formData.extInfo.supplierName = row.partbName;
  1363. this.formData.extInfo.supplierId = row.partbId;
  1364. await this.searchContact(row.partbId);
  1365. const data = await purchaseorderGetById(row.id);
  1366. if (this.warehousingMaterialList.length == 0) {
  1367. let list = data.data.productList.map((item) => {
  1368. return {
  1369. ...item,
  1370. assetName: item.productName,
  1371. assetCode: item.productCode,
  1372. categoryId: item.productCategoryId
  1373. };
  1374. });
  1375. this.onSelectTableData(list);
  1376. }
  1377. },
  1378. onClear() {
  1379. this.formData.extInfo.documentSource = '';
  1380. this.pickerRow = {};
  1381. this.formData.clientName = '';
  1382. this.formData.clientCode = '';
  1383. this.formData.extInfo.supplierName = '';
  1384. this.formData.extInfo.supplierId = '';
  1385. this.$forceUpdate();
  1386. },
  1387. handlePicker() {
  1388. this.$refs.pickerRef.open();
  1389. },
  1390. codeListValue(val) {
  1391. this.formData.extInfo.assetType = val.id;
  1392. this.$forceUpdate();
  1393. this.title = val?.name;
  1394. this.selectEquiType = val?.id;
  1395. },
  1396. //计算生产设备重量
  1397. deviceWeight(row, num) {
  1398. if (row) {
  1399. return Number(row * num);
  1400. } else {
  1401. return row;
  1402. }
  1403. },
  1404. //计算金额
  1405. calcSumTotal(PackingCount, outInNum, univalence) {
  1406. //最小包装单元,包装数量,单价
  1407. const total = {
  1408. PackingCount: Number(PackingCount),
  1409. outInNum: Number(outInNum),
  1410. univalence: Number(univalence == undefined ? 0 : univalence)
  1411. };
  1412. return total.PackingCount * total.outInNum * total.univalence;
  1413. },
  1414. handleRowUnit(row) {
  1415. return row.measuringUnit;
  1416. // if (this.formData.extInfo.assetType == 1) {
  1417. // return row.weightUnit;
  1418. // } else if (this.formData.extInfo.assetType == 4) {
  1419. // return row.measuringUnit;
  1420. // } else {
  1421. // return row.measuringUnit;
  1422. // }
  1423. },
  1424. changeVerfy(it) {
  1425. this.formData.verifyName = it.name;
  1426. },
  1427. //选择供应啥的操作
  1428. ChangeSupplier(data) {
  1429. this.formData.extInfo.supplierName = data.dictValue;
  1430. },
  1431. ChangeSuppliers(data) {
  1432. this.formData.clientName = data.dictValue;
  1433. },
  1434. rowClass({ row, column, rowIndex, columnIndex }) {
  1435. if (rowIndex === 1) {
  1436. return {
  1437. display: 'none',
  1438. background: '#EEEEEE',
  1439. border: 'none'
  1440. };
  1441. }
  1442. return { background: '#EEEEEE', border: 'none' };
  1443. },
  1444. calcSum(a, b, c, row) {
  1445. if (
  1446. (Number.isNaN(+a) && a !== '') ||
  1447. (Number.isNaN(+b) && b !== '') ||
  1448. (Number.isNaN(+c) && c !== '')
  1449. ) {
  1450. return '';
  1451. }
  1452. return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit];
  1453. // return a * b * c;
  1454. },
  1455. // 部门 点击事件
  1456. async auditorDeptClick(data) {
  1457. this.formData.extInfo.verifyDeptCode = data?.id;
  1458. this.formData.extInfo.verifyDeptName = data?.name;
  1459. this.formData.verifyId = '';
  1460. this.formData.verifyName = '';
  1461. this.$refs.formName.validateField('verifyDeptName');
  1462. if (data) {
  1463. this.getStaffList(data);
  1464. }
  1465. },
  1466. async getStaffList(data) {
  1467. let res = await warehouseDefinition.getUserPage({
  1468. groupId: data.id,
  1469. size: 9999,
  1470. page: 1
  1471. });
  1472. this.staffList = res.list;
  1473. },
  1474. // 详情接口
  1475. // async _getInfo () {
  1476. // const res = await getInfo({ id: this.$route.query.id })
  1477. // if (res?.success) {
  1478. // this.warehousingMaterialList = res.data.warehouseLedgerInfos.map(i => {
  1479. // i.isSave = true
  1480. // return i
  1481. // })
  1482. // this.formData = res.data.outInWarehouse
  1483. // this.uploadList = this.formData.contentImage
  1484. // }
  1485. // },
  1486. chooseAssets(row, index) {
  1487. this.$refs.returnSelectRef.open(row, (res) => {
  1488. row.outInNum = res.length;
  1489. this.$set(
  1490. row,
  1491. 'selfWarehouseLedgerDetails',
  1492. res.map((i) => {
  1493. delete i.updateTime;
  1494. delete i.createTime;
  1495. return i;
  1496. })
  1497. );
  1498. });
  1499. },
  1500. // 仓库编辑
  1501. handleWareHouse(row, idx) {
  1502. this.$refs.wareHouseDailogRef.open(row, idx);
  1503. },
  1504. // 入库操作
  1505. listEdit(row) {
  1506. this.$set(row, 'isSave', false);
  1507. row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
  1508. row.warehouseLedgerDetails = [];
  1509. },
  1510. listSave(row, index) {
  1511. const fileds = [
  1512. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  1513. `warehousingMaterialList.${index}.batchNo`,
  1514. `warehousingMaterialList.${index}.houseList`
  1515. ];
  1516. if (this.formData.bizType == 1) {
  1517. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  1518. } else if (this.formData.bizType == 2) {
  1519. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  1520. }
  1521. if (this.formData.bizType != 5) {
  1522. fileds.push(
  1523. ...[
  1524. `warehousingMaterialList.${index}.outInNum`,
  1525. `warehousingMaterialList.${index}.minPackingCount`
  1526. ]
  1527. );
  1528. } else if (
  1529. this.warehousingMaterialList.some(
  1530. (i) => !i.selfWarehouseLedgerDetails?.length
  1531. )
  1532. ) {
  1533. this.$message.error('请选择资产编号!');
  1534. return;
  1535. }
  1536. Promise.all(
  1537. fileds.map(
  1538. (item) =>
  1539. new Promise(async (resolve, rej) => {
  1540. this.$refs.warehousingMaterialListRef.validateField(
  1541. item,
  1542. (err) => {
  1543. if (err) {
  1544. rej(err);
  1545. } else {
  1546. resolve();
  1547. }
  1548. }
  1549. );
  1550. })
  1551. )
  1552. )
  1553. .then((res) => {
  1554. this.$set(row, 'isSave', true);
  1555. if (this.formData.bizType != 5) {
  1556. this.createMaterialCode(row);
  1557. } else {
  1558. // 退还
  1559. this.createMaterialCodeReturn(row);
  1560. }
  1561. })
  1562. .catch((err) => {
  1563. this.$message.error('请填入必填项!');
  1564. });
  1565. },
  1566. listSaveArrs() {
  1567. const rows = this.warehousingMaterialList;
  1568. const indexes = Array.from(
  1569. { length: this.warehousingMaterialList.length },
  1570. (_, index) => index
  1571. );
  1572. rows.forEach((row, i) => {
  1573. const index = indexes[i];
  1574. const fileds = [
  1575. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  1576. `warehousingMaterialList.${index}.batchNo`,
  1577. `warehousingMaterialList.${index}.houseList`
  1578. ];
  1579. if (this.formData.bizType == 1) {
  1580. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  1581. } else if (this.formData.bizType == 2) {
  1582. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  1583. }
  1584. if (this.formData.bizType != 5) {
  1585. fileds.push(
  1586. ...[
  1587. `warehousingMaterialList.${index}.outInNum`,
  1588. `warehousingMaterialList.${index}.minPackingCount`
  1589. ]
  1590. );
  1591. } else if (
  1592. this.warehousingMaterialList.some(
  1593. (i) => !i.selfWarehouseLedgerDetails?.length
  1594. )
  1595. ) {
  1596. this.$message.error('请选择资产编号!');
  1597. return;
  1598. }
  1599. Promise.all(
  1600. fileds.map(
  1601. (item) =>
  1602. new Promise(async (resolve, rej) => {
  1603. this.$refs.warehousingMaterialListRef.validateField(
  1604. item,
  1605. (err) => {
  1606. if (err) {
  1607. rej(err);
  1608. } else {
  1609. resolve();
  1610. }
  1611. }
  1612. );
  1613. })
  1614. )
  1615. )
  1616. .then((res) => {
  1617. this.$set(row, 'isSave', true);
  1618. if (this.formData.bizType != 5) {
  1619. this.createMaterialCode(row);
  1620. } else {
  1621. // 退还
  1622. this.createMaterialCodeReturn(row);
  1623. }
  1624. })
  1625. .catch((err) => {
  1626. // this.$message.error('请填入必填项!');
  1627. });
  1628. });
  1629. },
  1630. // listSaveArrs() {
  1631. // console.log(this.warehousingMaterialList);
  1632. // },
  1633. // 批量设置生产日期
  1634. handleSelectionChange(val) {
  1635. this.materialCodeReqListSelected = val;
  1636. },
  1637. dateSetting() {
  1638. if (!this.materialCodeReqListSelected.length) {
  1639. return this.$message.error(`请选择${this.title}明细!`);
  1640. }
  1641. this.dateVisible = true;
  1642. },
  1643. dateConfirm() {
  1644. this.materialCodeReqListSelected.forEach((item) => {
  1645. this.$set(item, this.curDateType, this.batchTime);
  1646. });
  1647. this.dateVisible = false;
  1648. },
  1649. //入库明细删除
  1650. listDel(row, index) {
  1651. this.warehousingMaterialList.splice(index, 1);
  1652. this.resultArray = [];
  1653. this.isDetail = false;
  1654. },
  1655. // 入库明细生成条码信息
  1656. async createMaterialCode(row) {
  1657. // 添加相同物品、批次号重新更新明细 原料编码
  1658. const list = this.warehousingMaterialList.filter(
  1659. (i) =>
  1660. i.assetCode === row.assetCode &&
  1661. i.batchNo === row.batchNo &&
  1662. i.isSave
  1663. );
  1664. const num = list.reduce((num, pre) => {
  1665. num += row.isUnpack
  1666. ? pre.outInNum * pre.minPackingCount
  1667. : pre.outInNum - 0;
  1668. return num;
  1669. }, 0);
  1670. const nums = list.reduce((num, pre) => {
  1671. num += pre.outInNum * pre.minPackingCount;
  1672. return num;
  1673. }, 0);
  1674. const res = await outin.getAssetNum({
  1675. assetCode: row.assetCode,
  1676. batchNum: row.batchNo,
  1677. num: num
  1678. });
  1679. // row.measuringUnit == 'PCS' ? nums :
  1680. list.forEach((item) => {
  1681. if (item.warehouseLedgerDetails?.length) {
  1682. item.warehouseLedgerDetails.forEach((i) => {
  1683. i.onlyCode = res.shift().onlyCode;
  1684. });
  1685. } else {
  1686. this.$set(
  1687. item,
  1688. 'warehouseLedgerDetails',
  1689. Array.from(
  1690. new Array(
  1691. item.isUnpack
  1692. ? item.outInNum * item.minPackingCount
  1693. : // : item.measuringUnit == 'PCS'
  1694. // ? +item.outInNum * parseInt(item.minPackingCount)
  1695. +item.outInNum
  1696. ),
  1697. (val, idx) => {
  1698. return {
  1699. ...item,
  1700. onlyCode: res.shift().onlyCode,
  1701. bizStatus: 1,
  1702. contentImage: []
  1703. };
  1704. }
  1705. )
  1706. );
  1707. }
  1708. });
  1709. // 添加相同物品,重复批次号 重新更新明细 包装编码
  1710. const batchList = this.warehousingMaterialList.filter(
  1711. (i) => i.batchNo === row.batchNo && i.isSave
  1712. );
  1713. if (batchList.length) {
  1714. const num = batchList.reduce((num, pre) => {
  1715. num += +pre.outInNum;
  1716. return num;
  1717. }, 0);
  1718. const res1 = await outin.getAssetNum({
  1719. batchNum: row.batchNo,
  1720. num
  1721. });
  1722. if (res1) {
  1723. batchList.forEach((item) => {
  1724. let num = res1.shift()?.num;
  1725. let minPackingCount = item.minPackingCount;
  1726. if (item.warehouseLedgerDetails?.length) {
  1727. item.warehouseLedgerDetails.forEach((i, index) => {
  1728. this.$set(i, 'num', num);
  1729. if (item.measuringUnit == item.weightUnit) {
  1730. this.$set(i, 'weight', item.minPackingCount);
  1731. } else {
  1732. this.$set(
  1733. i,
  1734. 'weight',
  1735. 1 * item.minPackingCount * item.netWeight
  1736. );
  1737. }
  1738. this.$set(i, 'weightUtil', item.weightUnit);
  1739. this.$set(i, 'packingCount', 1);
  1740. this.$set(i, 'packingUnit ', item.packingUnit);
  1741. this.$set(i, 'minPackingCount ', item.minPackingCount);
  1742. this.$set(i, 'measuringUnit', item.measuringUnit);
  1743. this.$set(i, 'isPack', false);
  1744. if (this.formData.extInfo.assetType == 1) {
  1745. this.$set(i, 'status', '0');
  1746. } else {
  1747. this.$set(i, 'result', '0');
  1748. this.$set(i, 'status', '1');
  1749. }
  1750. if (!item.isUnpack) {
  1751. if (index < item.warehouseLedgerDetails.length - 1) {
  1752. num = res1.shift()?.num;
  1753. }
  1754. } else {
  1755. // 拆包的包装编码一致
  1756. minPackingCount--;
  1757. if (
  1758. minPackingCount === 0 &&
  1759. index < item.warehouseLedgerDetails.length - 1
  1760. ) {
  1761. minPackingCount = item.minPackingCount;
  1762. num = res1.shift()?.num;
  1763. }
  1764. }
  1765. });
  1766. }
  1767. });
  1768. }
  1769. }
  1770. },
  1771. // 入库明细生成条码信息 退还
  1772. async createMaterialCodeReturn(row) {
  1773. // 添加相同物品重新更新明细 原料编码
  1774. const list = this.warehousingMaterialList.filter(
  1775. (i) => i.batchNo === row.batchNo && i.isSave
  1776. );
  1777. // 退还
  1778. const res = await getAssetNum({
  1779. batchNo: row.batchNo,
  1780. num: list.reduce((num, pre) => {
  1781. num += pre.selfWarehouseLedgerDetails.length;
  1782. return num;
  1783. }, 0)
  1784. });
  1785. if (res?.success) {
  1786. list.forEach((item) => {
  1787. let num = res.data.shift().num;
  1788. let minPackingCount = item.minPackingCount;
  1789. if (item.warehouseLedgerDetails?.length) {
  1790. item.warehouseLedgerDetails.forEach((i, index) => {
  1791. Object.assign(i, {
  1792. num,
  1793. batchNo: item.batchNo,
  1794. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  1795. cargoSpaceId: item.cargoSpaceId, //货位id
  1796. shelfId: item.shelfId, //货架id
  1797. shelfCode: item.shelfCode, //货架名称
  1798. areaId: item.areaId, //库区id
  1799. areaName: item.areaName, //库区名称
  1800. warehouseId: item.warehouseId, //仓库id
  1801. warehouseName: item.warehouseName //仓库名称
  1802. });
  1803. if (!item.isUnpack) {
  1804. // 拆包的包装编码一致
  1805. if (index < item.warehouseLedgerDetails.length - 1) {
  1806. num = res.data.shift()?.num;
  1807. }
  1808. } else {
  1809. minPackingCount--;
  1810. if (
  1811. minPackingCount === 0 &&
  1812. index < item.warehouseLedgerDetails.length - 1
  1813. ) {
  1814. minPackingCount = item.minPackingCount;
  1815. num = res1.data.shift()?.num;
  1816. }
  1817. }
  1818. });
  1819. } else {
  1820. this.$set(
  1821. item,
  1822. 'warehouseLedgerDetails',
  1823. item.selfWarehouseLedgerDetails.map((val, idx) => {
  1824. let obj = {
  1825. ...val,
  1826. bizStatus: 1,
  1827. minPackingCount: item.minPackingCount,
  1828. batchNo: item.batchNo,
  1829. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  1830. cargoSpaceId: item.cargoSpaceId, //货位id
  1831. shelfId: item.shelfId, //货架id
  1832. shelfCode: item.shelfCode, //货架名称
  1833. areaId: item.areaId, //库区id
  1834. areaName: item.areaName, //库区名称
  1835. warehouseId: item.warehouseId, //仓库id
  1836. warehouseName: item.warehouseName, //仓库名称
  1837. materialId: item.materialId,
  1838. num
  1839. };
  1840. if (!item.isUnpack) {
  1841. // 拆包的包装编码一致
  1842. if (idx < item.warehouseLedgerDetails.length - 1) {
  1843. num = res.data.shift()?.num;
  1844. }
  1845. } else {
  1846. minPackingCount--;
  1847. if (
  1848. minPackingCount === 0 &&
  1849. idx < item.warehouseLedgerDetails.length - 1
  1850. ) {
  1851. minPackingCount = item.minPackingCount;
  1852. num = res1.data.shift()?.num;
  1853. }
  1854. }
  1855. return obj;
  1856. })
  1857. );
  1858. }
  1859. });
  1860. }
  1861. },
  1862. handleSave() {
  1863. this.$refs.formName.validate(async (valid) => {
  1864. if (valid) {
  1865. if (!this.warehousingMaterialList?.length) {
  1866. return this.$message.error('请添加入库明细!');
  1867. } else if (
  1868. this.warehousingMaterialList.some((item) => !item.isSave)
  1869. ) {
  1870. return this.$message.error('请保存入库明细!');
  1871. }
  1872. this.formatWarehouseMaterialList();
  1873. let arr = this.warehousingMaterialList.map((item) => {
  1874. return {
  1875. netWeight: item.netWeight,
  1876. num: item.num,
  1877. batchNo: item.batchNo,
  1878. categoryId:
  1879. this.formData.bizType == 2
  1880. ? item.categoryId
  1881. ? item.categoryId
  1882. : item.id
  1883. : item.id,
  1884. count: parseInt(item.outInNum) * parseInt(item.minPackingCount),
  1885. minPackingCount: item.minPackingCount,
  1886. packingCount: item.outInNum,
  1887. price: item.univalence,
  1888. outInDetailRecordAddPOList: item.warehouseLedgerDetails,
  1889. position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
  1890. remark: '',
  1891. pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
  1892. pathName: `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`,
  1893. totalMoney:
  1894. item.outInNum * item.minPackingCount * item.univalence,
  1895. weightUnit: item.weightUnit,
  1896. customCode: item.customCode,
  1897. supplierCode: item.supplierCode,
  1898. weight: item.weight
  1899. };
  1900. });
  1901. arr.forEach((item) => {
  1902. if (item.outInDetailRecordAddPOList.length > 0) {
  1903. let list = item.outInDetailRecordAddPOList.map((it) => {
  1904. return this.formatOutInDetailRecordAddPO(it, item);
  1905. });
  1906. item.outInDetailRecordAddPOList = list;
  1907. }
  1908. });
  1909. let obj = { ...this.formData, type: 1 };
  1910. obj.sourceBizNo = this.formData.extInfo.documentSource;
  1911. obj.outInDetailAddPOList = arr;
  1912. console.log('=====>', obj);
  1913. this.saveLoading = true;
  1914. try {
  1915. const res = await outin.save(obj);
  1916. if (res.code == 0) {
  1917. await outin.outApproves({ outInId: res.data });
  1918. this.$message.success('保存成功!');
  1919. }
  1920. } catch (error) {
  1921. console.error('保存失败:', error);
  1922. }
  1923. this.saveLoading = false;
  1924. this.$router.push('/warehouseManagement/stockManagement');
  1925. }
  1926. });
  1927. },
  1928. formatWarehouseMaterialList() {
  1929. for (let key in this.warehousingMaterialList) {
  1930. for (let k in this.warehousingMaterialList[key].houseList) {
  1931. let house = this.warehousingMaterialList[key].houseList[k];
  1932. this.warehousingMaterialList[key].warehouseName =
  1933. house.warehouseName;
  1934. this.warehousingMaterialList[key].areaName = house.areaName;
  1935. this.warehousingMaterialList[key].shelfCode = house.shelfCode;
  1936. this.warehousingMaterialList[key].cargoSpaceCode =
  1937. house.cargoSpaceCode;
  1938. this.warehousingMaterialList[key].warehouseId = house.warehouseId;
  1939. this.warehousingMaterialList[key].areaId = house.areaId;
  1940. this.warehousingMaterialList[key].shelfId = house.shelfId;
  1941. this.warehousingMaterialList[key].cargoSpaceId = house.cargoSpaceId;
  1942. this.warehousingMaterialList[key].num = house.num;
  1943. }
  1944. }
  1945. },
  1946. formatOutInDetailRecordAddPO(it, item) {
  1947. return {
  1948. code: it.onlyCode,
  1949. dateType: this.curDateType === 'manufactureTime' ? 2 : 1,
  1950. dateValue: it[this.curDateType],
  1951. minUnit: it.minPackingCount,
  1952. minPositionId: it.cargoSpaceId,
  1953. name: it.assetName,
  1954. pathIds: item.pathIds,
  1955. unit: it.unit,
  1956. packageNo: it.num,
  1957. clientCode: it.clientCode,
  1958. materielCode: it.materielCode,
  1959. weight: it.weight,
  1960. weightUtil: it.weightUtil,
  1961. engrave: it.engrave,
  1962. materialDetails: this.materialDetails(it.onlyCode),
  1963. packingCount: it.packingCount,
  1964. status: it.status,
  1965. result: it.result
  1966. };
  1967. },
  1968. materialDetails(onlyCode) {
  1969. return this.resultArray.filter((item) => item.onlyCode === onlyCode);
  1970. },
  1971. async getOrderCode() {
  1972. const data = await getCode('in_warehouse');
  1973. return data;
  1974. },
  1975. //添加明细
  1976. async onSelectTableData(val) {
  1977. const res = await getCode('lot_number_code');
  1978. this.warehousingMaterialList.push(
  1979. ...val.map((next) => {
  1980. next.batchNo = res;
  1981. let cur = {};
  1982. next.realInventoryAmount = next.realInventoryAmount || 0;
  1983. cur = {
  1984. ...next,
  1985. cargoSpaceCode: '', //货位编码
  1986. cargoSpaceId: '', //货位id
  1987. shelfId: '', //货架id
  1988. shelfCode: '', //货架名称
  1989. areaId: '', //库区id
  1990. areaName: '', //库区名称
  1991. warehouseId: '', //仓库id
  1992. warehouseName: '', //仓库名称
  1993. assetType: this.formData.extInfo.assetType,
  1994. expirationDate: '',
  1995. outInNum: '',
  1996. minPackingCount: '',
  1997. bizStatus: 1,
  1998. contentImage: [],
  1999. warehouseLedgerDetails: [],
  2000. houseList: []
  2001. };
  2002. return cur;
  2003. })
  2004. );
  2005. },
  2006. async initData() {
  2007. const { data } = await getTreeByGroup({ type: 1 });
  2008. this.codeList = data;
  2009. // .map((item) => {
  2010. // return { dictCode: item.id, dictValue: item.name };
  2011. // });
  2012. const res = await warehouseDefinition.tree();
  2013. this.treeList = this.$util.toTreeData({
  2014. data: res,
  2015. idField: 'id',
  2016. parentIdField: 'parentId'
  2017. });
  2018. // const res111 = await warehouseDefinition.list();
  2019. // this.warehouseList = res111.list;
  2020. let res22 = await warehouseDefinition.getUserPage({
  2021. size: -1,
  2022. page: 1
  2023. });
  2024. this.fromUserList = res22.list;
  2025. const info = JSON.parse(localStorage.getItem('info'));
  2026. let obj = res.find(
  2027. (item) => item.id === info.deptId[info.deptId.length - 1]
  2028. );
  2029. if (!obj) return;
  2030. this.formData.extInfo.deptCode = obj.id;
  2031. this.formData.extInfo.deptName = obj.name;
  2032. this.formData.extInfo.createUserName = info.name;
  2033. this.formData.createUserId = info.id;
  2034. // this.treeList = res;
  2035. // this.formData.extInfo.deptCode =
  2036. // this.getTreeList().then((res) => {
  2037. // if (res?.success) {
  2038. // this.treeList = res.data;
  2039. // }
  2040. // });
  2041. // this.getSupplier().then((res) => {
  2042. // if (res?.success) {
  2043. // this.supplierList = res.data.items;
  2044. // }
  2045. // });
  2046. // this.getStaffList();
  2047. },
  2048. addStock() {
  2049. // this.$refs.wareHouseDailogRef.open({});
  2050. // return;
  2051. if (!this.title) return this.$message.error('请选择入库产品类型');
  2052. if (!this.formData.bizType)
  2053. return this.$message.error('请选择入库场景');
  2054. this.visibleDialog = true;
  2055. },
  2056. handleChange(data) {
  2057. this.title = data?.dictValue;
  2058. this.selectEquiType = data?.dictCode;
  2059. },
  2060. handleChanges(code) {
  2061. const data = this.codeList.find((item) => item.dictCode == code);
  2062. this.title = data?.dictValue;
  2063. this.selectEquiType = data?.dictCode;
  2064. },
  2065. getSupplier() {
  2066. return new Promise((resolve, reject) => {
  2067. supplier.list({ page: 1, size: 999 }).then((res) => {
  2068. if (res.success) {
  2069. resolve(res);
  2070. }
  2071. });
  2072. });
  2073. },
  2074. getTreeList() {
  2075. return new Promise((resolve, reject) => {
  2076. org.tree().then((res) => {
  2077. if (res.success) {
  2078. resolve(res);
  2079. }
  2080. });
  2081. });
  2082. },
  2083. upload(data) {
  2084. this.formData.contentImage = data;
  2085. this.$refs.formName.validateField('contentImage');
  2086. },
  2087. houseData(argum, idx) {
  2088. this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
  2089. }
  2090. }
  2091. };
  2092. </script>
  2093. <style lang="scss" scoped>
  2094. ::v-deep.form-table {
  2095. .el-form-item {
  2096. margin-bottom: 0;
  2097. }
  2098. .el-input__inner {
  2099. padding: 0 10px;
  2100. }
  2101. ::-webkit-scrollbar {
  2102. width: 8px;
  2103. height: 8px;
  2104. background-color: transparent;
  2105. }
  2106. }
  2107. .p20 {
  2108. padding: 20px;
  2109. }
  2110. .el-select,
  2111. .el-date-editor {
  2112. width: 100%;
  2113. }
  2114. .el-form-item {
  2115. margin-bottom: 22px;
  2116. }
  2117. .material {
  2118. margin-top: 20px;
  2119. .flex {
  2120. display: flex;
  2121. justify-content: space-between;
  2122. font-size: 14px;
  2123. align-items: center;
  2124. .red {
  2125. color: #ff4949;
  2126. }
  2127. }
  2128. }
  2129. .mt10 {
  2130. margin-top: 10px;
  2131. }
  2132. .mt20 {
  2133. margin-top: 20px;
  2134. }
  2135. .center {
  2136. text-align: center;
  2137. }
  2138. .switch_left li {
  2139. border-right: 1px solid rgba(222, 222, 222, 1);
  2140. border-left: 1px solid rgba(222, 222, 222, 1);
  2141. }
  2142. </style>