add.vue 74 KB

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