add.vue 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <el-form
  5. :model="formData"
  6. ref="formName"
  7. label-width="110px"
  8. :rules="rules"
  9. >
  10. <el-row :gutter="20">
  11. <!-- <el-col :span="8">
  12. <el-form-item label="出库单号" prop="bizNum">
  13. <el-input :value="formData.bizNum" disabled /></el-form-item
  14. ></el-col> -->
  15. <el-col :span="8">
  16. <el-form-item label="出库场景" prop="bizType">
  17. <el-select
  18. filterable
  19. placeholder="请选择"
  20. v-model="formData.bizType"
  21. clearable
  22. @change="handleBizSceneChange"
  23. :disabled="
  24. !!(warehousingMaterialList && warehousingMaterialList.length)
  25. "
  26. >
  27. <el-option
  28. v-for="item in outputSceneState"
  29. :key="item.code"
  30. :value="item.code + ''"
  31. :label="item.label"
  32. ></el-option>
  33. </el-select> </el-form-item
  34. ></el-col>
  35. <el-col :span="8">
  36. <el-form-item
  37. :label="
  38. formData.bizType == 3
  39. ? '销售发货单'
  40. : formData.bizType == 4
  41. ? '领料单'
  42. : formData.bizType == 1
  43. ? '采购退货单'
  44. : '来源单据'
  45. "
  46. prop="sourceBizNo"
  47. :rules="[
  48. { required: true, message: '请选择来源单据', trigger: 'change' }
  49. ]"
  50. v-if="formData.extInfo.assetType == 7 && formData.bizType == 4"
  51. >
  52. <el-select
  53. filterable
  54. v-model="formData.sourceBizNo"
  55. :disabled="
  56. !!(formData.sourceBizNo && warehousingMaterialList.length)
  57. "
  58. clearable
  59. placeholder="请输入"
  60. @change="handleDocumentSourceChange"
  61. >
  62. <el-option
  63. v-for="item in options"
  64. :key="item"
  65. :label="item"
  66. :value="item"
  67. >
  68. </el-option> </el-select
  69. ></el-form-item>
  70. <el-form-item
  71. :label="
  72. formData.bizType == 3
  73. ? '销售发货单'
  74. : formData.bizType == 4
  75. ? '领料单'
  76. : formData.bizType == 1
  77. ? '采购退货单'
  78. : '来源单据'
  79. "
  80. v-else
  81. prop="sourceBizNo"
  82. >
  83. <el-input
  84. @input="$forceUpdate()"
  85. placeholder="请输入"
  86. @change="handleDocumentSourceChange"
  87. v-model="formData.sourceBizNo"
  88. @click.native="
  89. formData.bizType == 4
  90. ? handlePickorder()
  91. : formData.bizType == 3
  92. ? handleEom()
  93. : null
  94. "
  95. >
  96. <el-button
  97. v-if="formData.bizType == 4 || formData.bizType == 3"
  98. slot="append"
  99. icon="el-icon-circle-close"
  100. @click.stop="onClear"
  101. ></el-button>
  102. </el-input>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="8">
  106. <el-form-item label="出库物品类型" prop="extInfo.assetType">
  107. <!-- <DictSelection
  108. dictName="类型用途"
  109. :disabled="
  110. !!(warehousingMaterialList && warehousingMaterialList.length)
  111. "
  112. clearable
  113. v-model="formData.extInfo.assetType"
  114. @itemChange="handleChange"
  115. /> -->
  116. <!-- <el-select
  117. :disabled="
  118. !!(warehousingMaterialList && warehousingMaterialList.length)
  119. "
  120. clearable
  121. v-model="formData.extInfo.assetType"
  122. @change="handleChanges"
  123. >
  124. <el-option
  125. v-for="(item, index) in codeList"
  126. :key="index"
  127. :label="item.dictValue"
  128. :value="item.dictCode"
  129. ></el-option>
  130. </el-select> -->
  131. <selectTree
  132. ref="trees"
  133. class="form-ipt"
  134. :isBindPlan="
  135. !!(warehousingMaterialList && warehousingMaterialList.length)
  136. "
  137. size="medium"
  138. style="width: 100%"
  139. clearable
  140. :options="codeList"
  141. :props="{
  142. value: 'id',
  143. label: 'name',
  144. children: 'children'
  145. }"
  146. @getValue="codeListValue"
  147. :isAll="false"
  148. />
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="8" v-if="formData.bizType == 3">
  152. <el-form-item label="客户名称">
  153. <el-input
  154. placeholder="客户名称"
  155. disabled
  156. v-model="formData.clientName"
  157. clearable /></el-form-item
  158. ></el-col>
  159. <el-col :span="8" v-if="formData.bizType == 3">
  160. <el-form-item label="客户联系人">
  161. <el-input
  162. placeholder="客户联系人"
  163. disabled
  164. v-model="formData.clientUser"
  165. clearable /></el-form-item
  166. ></el-col>
  167. <el-col :span="8" v-if="formData.bizType == 3">
  168. <el-form-item label="客户电话">
  169. <el-input
  170. placeholder="客户电话"
  171. disabled
  172. v-model="formData.clientPhone"
  173. clearable /></el-form-item
  174. ></el-col>
  175. <el-col :span="8">
  176. <el-form-item label="权属部门" prop="deptName">
  177. <el-input
  178. placeholder="权属部门"
  179. disabled
  180. v-model="formData.extInfo.deptName"
  181. clearable
  182. />
  183. </el-form-item>
  184. <!-- <selectTree
  185. ref="tree"
  186. style="width: 100%"
  187. size="medium"
  188. :initStr="formData.deptName"
  189. clearable
  190. :options="treeList"
  191. :props="{
  192. value: 'code',
  193. label: 'name',
  194. children: 'children'
  195. }"
  196. @getValue="deptClick"
  197. /> -->
  198. </el-col>
  199. <el-col :span="8">
  200. <el-form-item label="出库登记人">
  201. <el-input
  202. placeholder="登记人"
  203. disabled
  204. v-model="formData.extInfo.createUserName"
  205. clearable /></el-form-item
  206. ></el-col>
  207. <!-- <el-col :span="8">
  208. <el-form-item label="出库时间" prop="outInTime">
  209. <el-date-picker
  210. v-model="formData.outInTime"
  211. clearable
  212. type="datetime"
  213. value-format="yyyy-MM-dd HH:mm:ss"
  214. placeholder="选择日期"
  215. >
  216. </el-date-picker></el-form-item
  217. ></el-col> -->
  218. <el-col :span="8">
  219. <el-form-item label="领料人部门" prop="verifyDeptName">
  220. <selectTree
  221. ref="tree"
  222. class="form-ipt"
  223. size="medium"
  224. style="width: 100%"
  225. clearable
  226. :options="treeList"
  227. :props="{
  228. value: 'code',
  229. label: 'name',
  230. children: 'children'
  231. }"
  232. @getValue="auditorDeptClick"
  233. />
  234. </el-form-item>
  235. </el-col>
  236. <el-col :span="8">
  237. <el-form-item label="领料人" prop="fromUser">
  238. <el-select
  239. v-model="formData.fromUser"
  240. filterable
  241. placeholder="请选择领料人"
  242. >
  243. <el-option
  244. v-for="item in llrLsit"
  245. :key="item.id"
  246. :label="item.name"
  247. :value="item.id"
  248. @click.native="
  249. () => (formData.extInfo.fromUserPhone = item.phone)
  250. "
  251. >
  252. </el-option>
  253. </el-select> </el-form-item
  254. ></el-col>
  255. <el-col :span="8">
  256. <el-form-item label="领料人联系方式" prop="fromUserPhone">
  257. <el-input
  258. placeholder="请输入"
  259. disabled
  260. v-model="formData.extInfo.fromUserPhone"
  261. clearable /></el-form-item
  262. ></el-col>
  263. <!-- <el-col :span="8">
  264. <el-form-item label="紧急状态" prop="urgent">
  265. <el-select
  266. filterable
  267. placeholder="请选择"
  268. v-model="formData.extInfo.urgent"
  269. clearable
  270. >
  271. <el-option
  272. v-for="item in emergencyState"
  273. :key="item.code"
  274. :value="item.code"
  275. :label="item.label"
  276. ></el-option>
  277. </el-select> </el-form-item
  278. ></el-col> -->
  279. <!-- <el-col :span="8">
  280. <el-form-item label="审核人" prop="verifyId">
  281. <el-select
  282. filterable
  283. class="form-ipt"
  284. style="width: 100%"
  285. v-model="formData.verifyId"
  286. placeholder="请选择"
  287. >
  288. <el-option
  289. v-for="item in staffList"
  290. :key="item.id"
  291. :label="item.name"
  292. :value="item.id"
  293. @click.native="() => (formData.verifyName = item.name)"
  294. >
  295. </el-option>
  296. </el-select>
  297. </el-form-item>
  298. </el-col> -->
  299. <!-- <el-col :span="24">
  300. <el-form-item label="附件" prop="contentImage">
  301. <selectUpload @getImgs="upload" :initData="uploadList" />
  302. </el-form-item>
  303. </el-col> -->
  304. <el-col :span="24">
  305. <el-form-item label="备注" prop="remark">
  306. <el-input
  307. v-model="formData.remark"
  308. clearable
  309. type="textarea"
  310. placeholder="请详细说明"
  311. :rows="4"
  312. ></el-input>
  313. </el-form-item>
  314. </el-col>
  315. </el-row>
  316. </el-form>
  317. <div class="material">
  318. <div style="width: 100%; text-align: right"
  319. ><el-button type="primary" @click="addStock">添加</el-button></div
  320. >
  321. <div v-if="dimension != 4">
  322. <div class="flex">
  323. <div><span class="red">*</span>物品清单</div>
  324. <div>
  325. <!-- <el-button type="primary" @click="addStock">添加</el-button> -->
  326. </div>
  327. </div>
  328. <div class="mt10 form-table">
  329. <el-form
  330. ref="warehousingMaterialListRef"
  331. :model="{ warehousingMaterialList: warehousingMaterialList }"
  332. :show-message="false"
  333. >
  334. <el-table
  335. ref="multipleTable"
  336. :data="warehousingMaterialList"
  337. tooltip-effect="dark"
  338. style="width: 100%"
  339. :max-height="300"
  340. stripe
  341. :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
  342. >
  343. <el-table-column label="序号" type="index" width="50">
  344. </el-table-column>
  345. <el-table-column
  346. label="编码"
  347. prop="assetCode"
  348. ></el-table-column>
  349. <el-table-column
  350. label="名称"
  351. width="200"
  352. prop="assetName"
  353. ></el-table-column>
  354. <el-table-column
  355. v-for="(item, index) in tableHeader"
  356. :key="index"
  357. align="center"
  358. :label="item.label"
  359. width="150"
  360. :prop="item.prop"
  361. >
  362. <template slot-scope="{ row }">
  363. <template v-if="item.formatter">{{
  364. item.formatter(row)
  365. }}</template>
  366. <template v-else>{{ row[item.prop] }}</template>
  367. </template>
  368. </el-table-column>
  369. <el-table-column
  370. label="批次号"
  371. prop="batchNo"
  372. ></el-table-column>
  373. <el-table-column label="最小包装单元" width="120">
  374. <template slot-scope="{ row }">
  375. {{ row.minPackingCount }}{{ row.measuringUnit }}/{{
  376. row.minUnit
  377. }}
  378. </template>
  379. </el-table-column>
  380. <el-table-column label="包装数量" prop="availableCountBase">
  381. <template slot-scope="{ row }">
  382. {{ row.packingCountBase }}{{ row.minUnit }}
  383. </template>
  384. </el-table-column>
  385. <el-table-column
  386. label="计量数量"
  387. prop="availableCountBase"
  388. ></el-table-column>
  389. <el-table-column
  390. label="计量单位"
  391. prop="measuringUnit"
  392. ></el-table-column>
  393. <el-table-column label="重量" prop="weight"></el-table-column>
  394. <el-table-column
  395. label="重量单位"
  396. prop="weightUnit"
  397. ></el-table-column>
  398. <el-table-column
  399. label="仓库"
  400. width="300"
  401. prop="pathName"
  402. ></el-table-column>
  403. <!-- <el-table-column
  404. label="出库数量"
  405. prop=""
  406. align="center"
  407. width="350px"
  408. >
  409. <template slot-scope="{ row, $index }">
  410. <el-row :gutter="4">
  411. <el-col :span="9" v-if="!row.isUnpack">
  412. <el-input type="text" disabled :value="row.outInNum">
  413. <template slot="append">
  414. {{ row.minPackUnit }}
  415. </template>
  416. </el-input>
  417. </el-col>
  418. <el-col :span="6">
  419. <el-button type="text" @click="handleSetting(row, $index)"
  420. >出库明细选择</el-button
  421. ></el-col
  422. >
  423. </el-row>
  424. </template>
  425. </el-table-column> -->
  426. <el-table-column label="操作" width="200">
  427. <template slot-scope="{ row, $index }">
  428. <el-button type="text" @click="listDel(row, $index)"
  429. >删除</el-button
  430. >
  431. </template>
  432. </el-table-column>
  433. </el-table>
  434. </el-form>
  435. </div>
  436. <div class="flex" style="margin-top: 20px">
  437. <div><span class="red">*</span>包装清单</div>
  438. </div>
  439. <div class="mt10 form-table">
  440. <BatchDetail
  441. :assetType="formData.extInfo.assetType"
  442. :data="batchDetailsVOList"
  443. />
  444. </div>
  445. </div>
  446. <!-- <div class="flex" style="margin-top: 20px">
  447. <div><span class="red">*</span>包装清单</div>
  448. </div>
  449. <div class="mt10 form-table">
  450. <BatchDetail
  451. :assetType="formData.extInfo.assetType"
  452. :codeObj="{ name: '包装编码', prop: 'code' }"
  453. :nameObj="{ name: '名称', prop: 'name' }"
  454. />
  455. </div> -->
  456. <div class="mt20">
  457. <el-tabs v-model="activeName" type="card">
  458. <el-tab-pane :label="`${title}明细`" name="a">
  459. <el-table
  460. ref="multipleTable"
  461. :data="materialCodeReqList"
  462. tooltip-effect="dark"
  463. style="width: 100%"
  464. :max-height="300"
  465. stripe
  466. :header-cell-style="rowClass"
  467. >
  468. <el-table-column label="序号" type="index" width="50">
  469. </el-table-column>
  470. <el-table-column
  471. :label="`编码`"
  472. min-width="100"
  473. prop="assetCode"
  474. ></el-table-column>
  475. <el-table-column label="名称" prop="name" width="200">
  476. </el-table-column>
  477. <el-table-column label="批次号" prop="batchNo">
  478. </el-table-column>
  479. <el-table-column
  480. v-if="dimension == 4"
  481. label="包装编码"
  482. min-width="100"
  483. prop="onlyCode"
  484. ></el-table-column>
  485. <el-table-column
  486. v-for="(item, index) in tableHeader"
  487. :key="index"
  488. align="center"
  489. :label="item.label"
  490. width="150"
  491. :prop="item.prop"
  492. >
  493. <template slot-scope="{ row }">
  494. <template v-if="item.formatter">{{
  495. item.formatter(row)
  496. }}</template>
  497. <template v-else>{{ row[item.prop] }}</template>
  498. </template>
  499. </el-table-column>
  500. <el-table-column
  501. label="物料编码"
  502. width="250"
  503. prop="no"
  504. ></el-table-column>
  505. <!-- <el-table-column label="生产日期" width="200">
  506. <template slot-scope="{ row }">
  507. <span v-if="row.dateType === 2">
  508. {{ row.produceTime }}
  509. </span>
  510. </template>
  511. </el-table-column>
  512. <el-table-column label="采购日期" width="200">
  513. <template slot-scope="{ row }">
  514. <span v-if="row.dateType === 1">
  515. {{ row.procureTime }}
  516. </span>
  517. </template>
  518. </el-table-column> -->
  519. <el-table-column label="计量数量" prop="">
  520. <template slot-scope="{ row }">1</template>
  521. </el-table-column>
  522. <el-table-column
  523. label="计量单位"
  524. prop="measuringUnit"
  525. ></el-table-column>
  526. <el-table-column label="物料代号" prop="meterielCode">
  527. </el-table-column>
  528. <el-table-column
  529. label="客户代号"
  530. prop="clientCode"
  531. ></el-table-column>
  532. <el-table-column label="刻码" prop="engrave"></el-table-column>
  533. <el-table-column label="重量" prop="weight"></el-table-column>
  534. <el-table-column
  535. label="重量单位"
  536. prop="weightUnit"
  537. ></el-table-column>
  538. <!-- <el-table-column
  539. label="货位"
  540. prop="pathName"
  541. show-overflow-tooltip
  542. >
  543. </el-table-column>
  544. <el-table-column label="转消耗" prop="">
  545. <template slot-scope="{ row }">
  546. <el-checkbox v-model="row.isTransferAsset"></el-checkbox>
  547. </template>
  548. </el-table-column> -->
  549. </el-table>
  550. </el-tab-pane>
  551. </el-tabs>
  552. </div>
  553. </div>
  554. <div class="center mt20">
  555. <el-button type="primary" @click="handleNewSave" :loading="saveLoading"
  556. >保存</el-button
  557. >
  558. <el-button @click="$router.go(-1)">返回</el-button>
  559. </div>
  560. </el-card>
  561. <AssetsDialog
  562. ref="assetsDialogRef"
  563. :title="title"
  564. :warehousingMaterialList="selectionList"
  565. :assetType="formData.extInfo.assetType"
  566. @detailData="detailData"
  567. />
  568. <!-- @selectTableData="onSelectTableData" -->
  569. <!-- 选桶号 -->
  570. <detailSelect
  571. ref="detailSelectRef"
  572. :title="title"
  573. :tableHeader="tableHeader"
  574. />
  575. <!-- 转资产 -->
  576. <!-- <TurnToAsset ref="turnToAssetRef" /> -->
  577. <!-- 选择仓库 -->
  578. <WareHouseDailog ref="wareHouseDailogRef"></WareHouseDailog>
  579. <!-- 选领料单 -->
  580. <pickOrder ref="pickOrderRef" @success="pickOrderRow" />
  581. <!-- 销售订单 -->
  582. <eom ref="eomRef" @success="eomSuccess" />
  583. </div>
  584. </template>
  585. <script>
  586. import outin from '@/api/warehouseManagement/outin';
  587. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  588. import {
  589. getTreeByPid,
  590. getTreeByGroup,
  591. getProductList
  592. } from '@/api/classifyManage';
  593. import selectUpload from '@/components/selectUpload';
  594. import upload from '@/components/uploadImg';
  595. import pickOrder from './components/pickOrder.vue';
  596. import {
  597. warehousingType,
  598. outputSceneState,
  599. emergencyState,
  600. materialType
  601. } from '@/utils/dict/index';
  602. import selectTree from '@/components/selectTree';
  603. import AssetsDialog from '../components/AssetsDialog.vue';
  604. import outputType from '../components/outputType.vue';
  605. // import TurnToAsset from '../components/TurnToAsset/index.vue'
  606. import WareHouseDailog from '../components/WareHouseDailog.vue';
  607. // import supplier from '@/api/main/supplier';
  608. // import org from '@/api/main/org';
  609. // import user from '@/api/main/user';
  610. import { tableHeader } from '../common';
  611. import detailSelect from './components/detailSelect';
  612. import eom from './components/eom.vue';
  613. import BatchDetail from './components/batchDetail.vue';
  614. export default {
  615. components: {
  616. BatchDetail,
  617. pickOrder,
  618. selectUpload,
  619. selectTree,
  620. AssetsDialog,
  621. WareHouseDailog,
  622. upload,
  623. detailSelect,
  624. // TurnToAsset,
  625. outputType,
  626. eom
  627. },
  628. data() {
  629. return {
  630. dimension: '3',
  631. llList: [],
  632. codeList: [],
  633. materialType,
  634. warehousingType,
  635. outputSceneState,
  636. emergencyState,
  637. saveLoading: false,
  638. title: '',
  639. tableData2: [],
  640. uploadList: [],
  641. fromUserList: [], //人员数组
  642. warehousingMaterialList: [],
  643. activeName: 'a',
  644. treeList: [],
  645. staffList: [],
  646. formData: {
  647. extInfo: {
  648. assetType: '', //物品类型
  649. deptCode: '', //部门code
  650. deptName: '', //部门名称
  651. verifyDeptCode: '', //审核部门编码
  652. verifyDeptName: '', //审核部门名称
  653. deliveryName: '', //送货人名称
  654. fromUserPhone: '', //送货人电话
  655. sourceBizNo: '', //销售订单
  656. urgent: '', //紧急状态
  657. supplierId: '', //供应商ID
  658. supplierName: '', //供应商名称
  659. createUserName: '', //创建人名字
  660. contentImage: [] //图片数组
  661. },
  662. fromUser: '', //送货人
  663. bizType: '', //物品类型
  664. verifyId: '', //审核人Id
  665. verifyName: '', //审核人名称
  666. createUserId: '',
  667. remark: ''
  668. },
  669. rules: {
  670. // 'extInfo.assetType': {
  671. // required: true,
  672. // message: '请选择出库产品类型',
  673. // trigger: 'change'
  674. // },
  675. bizType: {
  676. required: true,
  677. message: '请选择出库场景',
  678. trigger: 'change'
  679. },
  680. fromUser: {
  681. required: true,
  682. message: '请选择领料人',
  683. trigger: 'change'
  684. }
  685. // verifyDeptName: {
  686. // required: true,
  687. // message: '请选择领料部门',
  688. // trigger: 'blur'
  689. // }
  690. },
  691. llrLsit: [],
  692. options: [],
  693. loading: false,
  694. onSelectTableDataVal: [],
  695. batchDetailsVOList: [],
  696. materialCodeReqList: [],
  697. selectionList: [],
  698. // shouldTriggerPickorder: true,
  699. materialObj: {},
  700. wlParams: {}
  701. };
  702. },
  703. computed: {
  704. tableHeader() {
  705. return tableHeader(this.formData.extInfo.assetType);
  706. }
  707. // 条码信息
  708. // materialCodeReqList() {
  709. // return this.warehousingMaterialList
  710. // .map((i) => i.warehouseLedgerDetails || [])
  711. // .flat();
  712. // }
  713. },
  714. created() {
  715. this.initData();
  716. },
  717. methods: {
  718. detailData(data, dimension) {
  719. this.dimension = dimension;
  720. console.log('总数居', data);
  721. this.onSelectTableDataVal = data.realTimeInventoryVOList;
  722. this.warehousingMaterialList = data.realTimeInventoryVOList.map(
  723. (next) => {
  724. delete next.updateTime;
  725. delete next.createTime;
  726. return {
  727. ...next,
  728. realInventoryAmount: 0,
  729. assetType: this.formData.extInfo.assetType,
  730. outInNum: '',
  731. assetCode: next.code,
  732. assetName: next.name,
  733. bizStatus: 2,
  734. contactCode: next.contactCode
  735. };
  736. }
  737. );
  738. // this.batchDetailsVOList = data.batchDetailsVOList;
  739. if (dimension == 4) {
  740. this.materialCodeReqList = data.wlList;
  741. this.selectionList = data.wlList;
  742. let params = {
  743. realTimeInventoryNewPOList: data.realTimeInventoryVOList
  744. };
  745. for (const item of params.realTimeInventoryNewPOList) {
  746. item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
  747. for (const detail of item.inventoryDetailsNewPOList) {
  748. detail.outInMaterialDetailsAddPOList = [];
  749. for (const wlItem of data.wlList) {
  750. if (detail.id === wlItem.recordId) {
  751. detail.outInMaterialDetailsAddPOList.push({
  752. ...wlItem
  753. });
  754. }
  755. }
  756. }
  757. }
  758. this.wlParams = params;
  759. this.materialObj = data;
  760. } else if (dimension == 3) {
  761. //包装维度出库
  762. const list = data.realTimeInventoryVOList;
  763. //获取包装维度
  764. let packArr = [];
  765. for (const item of list) {
  766. if (item.inventoryDetailsVOList.length != 0) {
  767. for (const iterator of item.inventoryDetailsVOList) {
  768. packArr.push({ ...iterator, batchNo: iterator.batchNum });
  769. }
  770. }
  771. }
  772. this.batchDetailsVOList = packArr.map((item) => {
  773. return {
  774. ...item,
  775. packingCountBase:
  776. dimension == 4 || dimension == 3 ? 1 : item.packingCountBase,
  777. weight: 0
  778. };
  779. });
  780. //物料维度数据
  781. let meteArr = [];
  782. for (const item of packArr) {
  783. if (item.materialDetailsVOList.length != 0) {
  784. for (const iterator of item.materialDetailsVOList) {
  785. meteArr.push({
  786. ...iterator
  787. });
  788. }
  789. }
  790. }
  791. this.materialCodeReqList = meteArr;
  792. //再次打开选择上
  793. this.selectionList = list;
  794. //send数据
  795. this.wlParams = { realTimeInventoryNewPOList: list };
  796. this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
  797. item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
  798. item.inventoryDetailsNewPOList.forEach((ite) => {
  799. ite.weight = 0;
  800. ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
  801. });
  802. });
  803. } else {
  804. // else if (dimension == 2) {
  805. // this.batchDetailsVOList = data.wlList;
  806. // this.selectionList = data.wlList;
  807. // }
  808. //物品维度出库
  809. const list = data.realTimeInventoryVOList;
  810. //获取包装维度
  811. let packArr = [];
  812. for (const item of list) {
  813. if (item.inventoryDetailsVOList.length != 0) {
  814. for (const iterator of item.inventoryDetailsVOList) {
  815. packArr.push({ ...iterator, batchNo: iterator.batchNum });
  816. }
  817. }
  818. }
  819. this.batchDetailsVOList = packArr.map((item) => {
  820. return {
  821. ...item,
  822. packingCountBase: dimension == 3 ? 1 : item.packingCountBase,
  823. weight: 0
  824. };
  825. });
  826. console.log(
  827. 'batchDetailsVOList------------',
  828. this.batchDetailsVOList
  829. );
  830. //物料维度数据
  831. let meteArr = [];
  832. for (const item of packArr) {
  833. if (item.materialDetailsVOList.length != 0) {
  834. for (const iterator of item.materialDetailsVOList) {
  835. meteArr.push({
  836. ...iterator
  837. });
  838. }
  839. }
  840. }
  841. this.materialCodeReqList = meteArr;
  842. //再次打开选择上
  843. this.selectionList = list;
  844. //send数据
  845. this.wlParams = { realTimeInventoryNewPOList: list };
  846. this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
  847. item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
  848. item.inventoryDetailsNewPOList.forEach((ite) => {
  849. ite.weight = 0;
  850. ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
  851. });
  852. });
  853. }
  854. },
  855. handleNewSave() {
  856. this.$refs.formName.validate(async (valid) => {
  857. if (valid) {
  858. if (!this.warehousingMaterialList?.length) {
  859. return this.$message.error('请添加出库明细!');
  860. }
  861. let obj = { ...this.formData, type: 2 };
  862. obj.extInfo.sourceBizNo = obj.sourceBizNo;
  863. // obj.fromId=
  864. obj.fromType = obj.type;
  865. this.saveLoading = true;
  866. obj = { ...obj, ...this.wlParams };
  867. if (this.dimension == 4) {
  868. obj.num = this.materialObj.wlList.length;
  869. } else {
  870. obj.num = this.materialCodeReqList.length;
  871. }
  872. console.log('2222', obj);
  873. try {
  874. const res = await outin.saveNew(obj);
  875. if (res.code == 0) {
  876. await await outin.outApprove({ outInId: res.data });
  877. this.$message.success('保存成功!');
  878. }
  879. this.$router.push('/warehouseManagement/outgoingManagement');
  880. if (res?.success) {
  881. this.$message.success('保存成功!');
  882. this.$router.go(-1);
  883. }
  884. this.saveLoading = false;
  885. } catch (error) {
  886. this.saveLoading = false;
  887. }
  888. }
  889. });
  890. },
  891. onClear() {
  892. this.formData.sourceBizNo = '';
  893. this.warehousingMaterialList = [];
  894. this.$refs.trees.valueTitle = '';
  895. this.formData.clientName = '';
  896. this.formData.clientUser = '';
  897. this.formData.clientPhone = '';
  898. this.title = '';
  899. this.$forceUpdate();
  900. },
  901. async eomSuccess(row) {
  902. console.log(row);
  903. this.formData.extInfo.assetType = 9;
  904. this.$refs.trees.valueTitle = '产品';
  905. this.title = '产品';
  906. this.formData.sourceBizNo = row.orderNo;
  907. this.formData.sid = row.id;
  908. this.formData.fromId = row.id;
  909. this.formData.clientName = row.contactName;
  910. this.formData.clientUser = row.linkName;
  911. this.formData.clientPhone = row.linkPhone;
  912. console.log('==sasa', row.tableData);
  913. this.onSelectTableData(await this.serachMainCode(row.tableData), 1);
  914. this.$forceUpdate();
  915. },
  916. async serachMainCode(arr) {
  917. let newArr = [];
  918. // 使用 Promise.all 来等待所有异步操作完成
  919. await Promise.all(
  920. arr.map(async (item) => {
  921. const data = await getProductList({
  922. pageNum: 1,
  923. size: 10,
  924. categoryLevelId: item.productCategoryId,
  925. code: item.code
  926. });
  927. newArr.push(data.list); // 将结果存储到 newArr 中
  928. })
  929. );
  930. let re = [];
  931. for (const item of newArr) {
  932. for (const it of item) {
  933. re.push(it);
  934. }
  935. }
  936. return re.map((item) => {
  937. return {
  938. ...item,
  939. minUnit: item.packingUnit,
  940. assetCode: item.code,
  941. assetName: item.name
  942. };
  943. });
  944. },
  945. async pickOrderRow(row) {
  946. this.formData.sid = row.id;
  947. row.tableData = [];
  948. this.formData.sourceBizNo = row.code;
  949. for (const key in row.orderInfoList) {
  950. if (row.orderInfoList[key].bomDetailDTOS.length != 0) {
  951. for (const i in row.orderInfoList[key].bomDetailDTOS) {
  952. row.tableData.push({
  953. ...row.orderInfoList[key].bomDetailDTOS[i],
  954. code: row.orderInfoList[key].bomDetailDTOS[i].categoryCode,
  955. name: row.orderInfoList[key].bomDetailDTOS[i].categoryName,
  956. modelType: row.orderInfoList[key].bomDetailDTOS[i].model,
  957. id: row.orderInfoList[key].bomDetailDTOS[i].categoryId
  958. });
  959. }
  960. }
  961. if (row.orderInfoList[key].instanceList.length != 0) {
  962. for (const j in row.orderInfoList[key].instanceList) {
  963. row.tableData.push({
  964. ...row.orderInfoList[key].instanceList[j],
  965. code: row.orderInfoList[key].instanceList[j].categoryCode,
  966. name: row.orderInfoList[key].instanceList[j].categoryName,
  967. modelType: row.orderInfoList[key].instanceList[j].model,
  968. id: row.orderInfoList[key].instanceList[j].instanceId
  969. });
  970. }
  971. }
  972. }
  973. const uniqueItems = [];
  974. const uniqueIds = new Set();
  975. row.tableData.forEach((item) => {
  976. if (!uniqueIds.has(item.code)) {
  977. uniqueIds.add(item.code);
  978. uniqueItems.push(item);
  979. }
  980. });
  981. row.tableData = uniqueItems;
  982. console.log(row);
  983. this.onSelectTableData(await this.serachMainCode(row.tableData), 1);
  984. this.selectTop(row);
  985. this.$forceUpdate();
  986. },
  987. async selectTop(row) {
  988. let list = row.tableData;
  989. let arr = [];
  990. for (const it of list) {
  991. arr.push({
  992. categoryLevelId: it.rootCategoryLevelId,
  993. code: it.code,
  994. count: it.demandQuantity
  995. });
  996. }
  997. const data = await outin.getDetailByCode(arr);
  998. console.log('===', data);
  999. },
  1000. handleEom() {
  1001. this.$refs.eomRef.open();
  1002. },
  1003. handlePickorder() {
  1004. this.$refs.pickOrderRef.open();
  1005. },
  1006. async handleDocumentSourceChange() {
  1007. // this.formData.sourceBizNo = '';
  1008. if (!this.formData.sourceBizNo) {
  1009. if (this.formData.bizType == 4) {
  1010. this.warehousingMaterialList = [];
  1011. }
  1012. return;
  1013. }
  1014. if (
  1015. !(this.formData.extInfo.assetType == 7 && this.formData.bizType == 4)
  1016. ) {
  1017. return;
  1018. }
  1019. const loading = this.$loading({ fullscreen: true });
  1020. const res = await getSparePartsInfo({
  1021. code: this.formData.sourceBizNo
  1022. });
  1023. if (res?.success && res.data.length) {
  1024. const curMap = {
  1025. assetId: 'classificationId',
  1026. assetCode: 'informationCode', //编码
  1027. assetName: 'informationName', //名称
  1028. materialId: 'classificationId',
  1029. materialName: 'informationName',
  1030. batchNo: '', //批次号
  1031. unit: 'measuringUnit', //单位
  1032. minPackUnit: 'packingUnit' //最小包装单位
  1033. };
  1034. res.data.forEach((item) => {
  1035. let obj = {};
  1036. for (const key in curMap) {
  1037. obj[key] = curMap[key] ? item[curMap[key]] : '';
  1038. }
  1039. obj.curId =
  1040. obj.assetCode +
  1041. (obj.measurementUnit || '') +
  1042. (obj.minPackUnit || '') +
  1043. (obj.unit || '');
  1044. console.log(obj.curId);
  1045. const index = this.warehousingMaterialList.findIndex(
  1046. (i) => i.curId === obj.curId
  1047. );
  1048. if (index === -1) {
  1049. Object.assign(obj, item);
  1050. obj.sparePartsNum = item.num;
  1051. this.warehousingMaterialList.push(obj);
  1052. } else {
  1053. this.warehousingMaterialList[index].sparePartsNum = item.num;
  1054. }
  1055. });
  1056. }
  1057. loading.close();
  1058. },
  1059. // 备品备件来源单号
  1060. async remoteMethod(code) {
  1061. // if (code !== '') {
  1062. // this.loading = true
  1063. const res = await getDocumentSource({ code });
  1064. if (res?.success) {
  1065. this.options = res.data;
  1066. }
  1067. // this.loading = false
  1068. // } else {
  1069. // this.options = []
  1070. // }
  1071. },
  1072. rowClass({ row, column, rowIndex, columnIndex }) {
  1073. if (rowIndex === 1) {
  1074. return {
  1075. display: 'none',
  1076. background: '#EEEEEE',
  1077. border: 'none'
  1078. };
  1079. }
  1080. return { background: '#EEEEEE', border: 'none' };
  1081. },
  1082. // 部门 点击事件
  1083. async auditorDeptClick(data) {
  1084. console.log(data);
  1085. this.formData.extInfo.verifyDeptCode = data?.id;
  1086. this.formData.extInfo.verifyDeptName = data?.name;
  1087. this.formData.verifyId = '';
  1088. this.formData.verifyName = '';
  1089. this.$refs.formName.validateField('verifyDeptName');
  1090. if (data) {
  1091. this.getStaffList(data);
  1092. }
  1093. },
  1094. async getStaffList(data) {
  1095. let res = await warehouseDefinition.getUserPage({
  1096. groupId: data.id,
  1097. size: 9999,
  1098. page: 1
  1099. });
  1100. this.llrLsit = res.list;
  1101. },
  1102. // // 转资产
  1103. // turnToAssets (row) {
  1104. // this.$refs.turnToAssetRef
  1105. // .open(row.transferCurVal)
  1106. // .then(({ code, name }) => {
  1107. // row.transferType = name
  1108. // row.materialId = code
  1109. // row.materialName = name.split('/').pop()
  1110. // row.transferType = name
  1111. // this.$set(row, 'transferCurVal', code)
  1112. // })
  1113. // },
  1114. handleSetting(row) {
  1115. row.bizTypes = this.formData.bizType;
  1116. row.type = this.formData.bizType == 3 ? 1 : 0;
  1117. this.$refs.detailSelectRef
  1118. .open(row, row.warehouseLedgerDetails || [])
  1119. .then((res) => {
  1120. console.log(res);
  1121. console.log(row);
  1122. this.$set(
  1123. row,
  1124. 'warehouseLedgerDetails',
  1125. (res || []).map((item) => {
  1126. delete item.updateTime;
  1127. delete item.createTime;
  1128. this.$set(item, 'isTransferAsset', false);
  1129. item.isUnpack = row.isUnpack;
  1130. return item;
  1131. })
  1132. );
  1133. this.$set(row, 'outInNum', res.length);
  1134. this.$set(row, 'minPackUnit', res[0].minPackUnit);
  1135. this.$set(
  1136. row,
  1137. 'selfSum',
  1138. row.warehouseLedgerDetails.reduce((sum, pre) => {
  1139. if (row.isUnpack) {
  1140. return ++sum;
  1141. }
  1142. return sum + pre.measurementUnit;
  1143. }, 0)
  1144. );
  1145. });
  1146. },
  1147. // 仓库编辑
  1148. handleWareHouse(row) {
  1149. this.$refs.wareHouseDailogRef.open(row);
  1150. },
  1151. // 出库操作
  1152. listEdit(row) {
  1153. this.$set(row, 'isSave', false);
  1154. },
  1155. //出库明细删除
  1156. listDel(row, index) {
  1157. this.warehousingMaterialList.splice(index, 1);
  1158. if (this.warehousingMaterialList.length == 0) {
  1159. this.formData.sourceBizNo = '';
  1160. this.formData.extInfo.clientName = '';
  1161. this.formData.extInfo.clientUser = '';
  1162. this.formData.extInfo.clientUserPhone = '';
  1163. }
  1164. // 从 this.batchDetailsVOList 中删除满足条件的对象
  1165. this.removeItemsFromArray(
  1166. this.batchDetailsVOList,
  1167. (item) => item.code.substr(0, 12) === row.code
  1168. );
  1169. // 从 this.materialCodeReqList 中删除满足条件的对象
  1170. this.removeItemsFromArray(
  1171. this.materialCodeReqList,
  1172. (item) => item.assetCode === row.code
  1173. );
  1174. },
  1175. // 删除数组中满足条件的对象
  1176. removeItemsFromArray(arr, condition) {
  1177. for (let i = arr.length - 1; i >= 0; i--) {
  1178. if (condition(arr[i])) {
  1179. arr.splice(i, 1);
  1180. }
  1181. }
  1182. },
  1183. // 出库明细生成条码信息
  1184. async createMaterialCode(row) {
  1185. let arr = [];
  1186. const res = await getAssetNum({
  1187. assetCode: row.assetCode,
  1188. num: row.outInNum || 1
  1189. });
  1190. if (res?.success) {
  1191. delete row.createTime;
  1192. arr = Array.from(new Array(res.data.length), (val, idx) => ({
  1193. ...row,
  1194. num: res.data[idx],
  1195. bizStatus: 2,
  1196. isTransferAsset: false
  1197. }));
  1198. }
  1199. return arr;
  1200. },
  1201. handleSave() {
  1202. this.$refs.formName.validate(async (valid) => {
  1203. if (valid) {
  1204. if (!this.warehousingMaterialList?.length) {
  1205. return this.$message.error('请添加出库明细!');
  1206. } else if (
  1207. this.warehousingMaterialList.some(
  1208. (item) => !item.warehouseLedgerDetails?.length
  1209. )
  1210. ) {
  1211. return this.$message.error('请完善出库明细数据!');
  1212. }
  1213. console.log('qqqq===>', this.warehousingMaterialList);
  1214. let arr = this.warehousingMaterialList.map((item) => {
  1215. return {
  1216. batchNo: item.batchNo,
  1217. categoryId: item.id,
  1218. count: item.outInNum,
  1219. num: item.outInNum,
  1220. minPackingCount: item.selfSum,
  1221. packingCount: item.outInNum,
  1222. outInDetailRecordAddPOList: item.warehouseLedgerDetails,
  1223. ...item
  1224. // position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
  1225. // // pathIds: item.categoryLevelPathId.toString(),
  1226. // pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
  1227. // totalMoney:
  1228. // item.outInNum * item.minPackingCount * item.univalence
  1229. };
  1230. });
  1231. arr.forEach((item) => {
  1232. item.warehouseId =
  1233. item.warehouseLedgerDetails[0].pathIds.split(',')[0];
  1234. delete item.id;
  1235. delete item.warehouseLedgerDetails;
  1236. if (item.outInDetailRecordAddPOList.length > 0) {
  1237. let list = item.outInDetailRecordAddPOList.map((it) => {
  1238. return {
  1239. positionId: it.positionId,
  1240. code: it.sourceBizNo,
  1241. dateType: it.dateType,
  1242. dateValue: it.dateValue,
  1243. minUnit: it.minUnit,
  1244. batchNo: it.sourceBatchNo,
  1245. position: it.pathName,
  1246. // minPositionId: it.cargoSpaceId,
  1247. minPositionId: it.minPositionId,
  1248. name: it.name,
  1249. pathIds: it.pathIds,
  1250. unit: it.unit,
  1251. packageNo: it.packageNo,
  1252. minPackingCount: it.minPackingCount,
  1253. procureTime: it.procureTime,
  1254. produceTime: it.produceTime
  1255. // num: it.minPackingCount
  1256. };
  1257. });
  1258. item.outInDetailRecordAddPOList = list;
  1259. }
  1260. });
  1261. let obj = { ...this.formData, type: 2 };
  1262. for (const key in arr) {
  1263. arr[key].count = arr[key].outInNum;
  1264. }
  1265. obj.outInDetailAddPOList = arr;
  1266. obj.extInfo.sourceBizNo = obj.sourceBizNo;
  1267. obj.fromType = obj.type;
  1268. this.saveLoading = true;
  1269. // console.log('明细', this.warehousingMaterialList);
  1270. // const categoryLevelId = this.$refs.assetsDialogRef.materialType;
  1271. // let newObj = {
  1272. // inOutAddPO: {
  1273. // ...this.formData,
  1274. // ...this.formData.extInfo,
  1275. // bizStatus: 2
  1276. // },
  1277. // warehouseLedgerInfos: this.handelArr(
  1278. // this.warehousingMaterialList,
  1279. // categoryLevelId
  1280. // )
  1281. // };
  1282. // delete newObj.inOutAddPO.extInfo;
  1283. console.log('2222', obj);
  1284. const res = await outin.save(obj);
  1285. if (res.code == 0) {
  1286. this.$message.success('保存成功!');
  1287. }
  1288. this.saveLoading = false;
  1289. this.$router.push('/warehouseManagement/outgoingManagement');
  1290. if (res?.success) {
  1291. this.$message.success('保存成功!');
  1292. this.$router.go(-1);
  1293. }
  1294. }
  1295. });
  1296. },
  1297. handelArr(arr, id) {
  1298. for (const key in arr) {
  1299. arr[key].inLedgerId = arr[key].id;
  1300. arr[key].categoryLevelId = id;
  1301. for (const k in arr[key].warehouseLedgerDetails) {
  1302. arr[key].warehouseLedgerDetails[k].ledgerDetailId =
  1303. arr[key].warehouseLedgerDetails[k].id;
  1304. arr[key].warehouseLedgerDetails[k].inDetailId = arr[key].inLedgerId;
  1305. arr[key].warehouseLedgerDetails[k].isTransferAsset = arr[key]
  1306. .warehouseLedgerDetails[k].isTransferAsset
  1307. ? 1
  1308. : 0;
  1309. arr[key].warehouseLedgerDetails[k].bizStatus = 2;
  1310. }
  1311. }
  1312. return arr;
  1313. // let newArr = arr.map((item) => {
  1314. // return { ...item, ledgerId: item.id };
  1315. // });
  1316. // newArr.map((item) => {
  1317. // item.warehouseLedgerDetails.map((ite) => {
  1318. // return { ...ite, ledgerDetailId: ite.id, ledgerId: item.id };
  1319. // });
  1320. // });
  1321. // return newArr;
  1322. },
  1323. //添加明细
  1324. onSelectTableData(val, e) {
  1325. // if (e == 1) {
  1326. // this.llList = val;
  1327. // } else {
  1328. // this.llList = [];
  1329. // }
  1330. // .concat(this.llList)
  1331. // if (this.warehousingMaterialList.length != 0) {
  1332. // val = this.warehousingMaterialList.concat(val);
  1333. // }
  1334. this.onSelectTableDataVal = val;
  1335. this.warehousingMaterialList = val.map((next) => {
  1336. delete next.updateTime;
  1337. delete next.createTime;
  1338. return {
  1339. ...next,
  1340. realInventoryAmount: 0,
  1341. // cargoSpaceCode: '', //货位编码
  1342. // cargoSpaceId: '', //货位id
  1343. // shelfId: '', //货架id
  1344. // shelfCode: '', //货架名称
  1345. // areaId: '', //库区id
  1346. // areaName: '', //库区名称
  1347. // warehouseId: '', //仓库id
  1348. // warehouseName: '', //仓库名称
  1349. assetType: this.formData.extInfo.assetType,
  1350. outInNum: '',
  1351. assetCode: next.code,
  1352. assetName: next.name,
  1353. bizStatus: 2,
  1354. contactCode: next.contactCode
  1355. };
  1356. });
  1357. console.log('sasasasa===>>>', this.warehousingMaterialList);
  1358. },
  1359. codeListValue(val) {
  1360. console.log(val);
  1361. this.formData.extInfo.assetType = val.id;
  1362. this.$forceUpdate();
  1363. this.title = val?.name;
  1364. this.selectEquiType = val?.id;
  1365. console.log(this.title);
  1366. },
  1367. async initData() {
  1368. const { data } = await getTreeByGroup({ type: 2 });
  1369. this.codeList = data;
  1370. const res = await warehouseDefinition.tree();
  1371. this.treeList = this.$util.toTreeData({
  1372. data: res,
  1373. idField: 'id',
  1374. parentIdField: 'parentId'
  1375. });
  1376. let res22 = await warehouseDefinition.getUserPage({
  1377. size: -1,
  1378. page: 1
  1379. });
  1380. this.fromUserList = res22.list;
  1381. // const res111 = await warehouseDefinition.list();
  1382. // this.warehouseList = res111.list;
  1383. console.log('res=====', res);
  1384. const info = JSON.parse(localStorage.getItem('info'));
  1385. console.log('info=====', info);
  1386. let obj = res.find(
  1387. (item) => item.id === info.deptId[info.deptId.length - 1]
  1388. );
  1389. console.log('obj=====', obj);
  1390. this.formData.extInfo.deptName = obj.name;
  1391. this.formData.extInfo.deptCode = obj.id;
  1392. this.formData.extInfo.createUserName = info.name;
  1393. this.formData.createUserId = info.userId;
  1394. },
  1395. addStock() {
  1396. if (!this.title) return this.$message.error('请选择出库产品类型');
  1397. if (!this.formData.bizType && this.formData.bizType !== 0)
  1398. return this.$message.error('请选择出库场景');
  1399. // if (this.formData.bizType == 4&& !this.formData.sourceBizNo) {
  1400. // return this.$message.error('请选择来源单据');
  1401. // }
  1402. this.$refs.assetsDialogRef.open();
  1403. },
  1404. handleChange(data) {
  1405. this.title = data?.dictValue;
  1406. if (this.formData.bizType == 4) {
  1407. this.formData.sourceBizNo = '';
  1408. }
  1409. },
  1410. handleChanges(code) {
  1411. const data = this.codeList.find((item) => item.dictCode == code);
  1412. this.title = data?.dictValue;
  1413. this.selectEquiType = data?.dictCode;
  1414. if (this.formData.bizType == 4) {
  1415. this.formData.sourceBizNo = '';
  1416. }
  1417. },
  1418. handleBizSceneChange() {
  1419. if (this.formData.extInfo.assetType == 7) {
  1420. this.formData.extInfo.sourceBizNo = '';
  1421. }
  1422. this.formData.sourceBizNo = '';
  1423. },
  1424. getSupplier() {
  1425. return new Promise((resolve, reject) => {
  1426. supplier.list({ page: 1, size: 999 }).then((res) => {
  1427. if (res.success) {
  1428. resolve(res);
  1429. }
  1430. });
  1431. });
  1432. },
  1433. upload(data) {
  1434. this.formData.contentImage = data;
  1435. this.$refs.formName.validateField('contentImage');
  1436. },
  1437. deptClick(data) {
  1438. this.formData.deptName = data?.name;
  1439. this.formData.deptCode = data?.code;
  1440. }
  1441. }
  1442. };
  1443. </script>
  1444. <style lang="scss" scoped>
  1445. ::v-deep.form-table {
  1446. .el-form-item {
  1447. margin-bottom: 0;
  1448. }
  1449. .el-input__inner {
  1450. padding: 0 10px;
  1451. }
  1452. }
  1453. .p20 {
  1454. padding: 20px;
  1455. }
  1456. .el-select,
  1457. .el-date-editor {
  1458. width: 100%;
  1459. }
  1460. .el-form-item {
  1461. margin-bottom: 22px;
  1462. }
  1463. .material {
  1464. margin-top: 20px;
  1465. .flex {
  1466. display: flex;
  1467. justify-content: space-between;
  1468. font-size: 14px;
  1469. align-items: center;
  1470. .red {
  1471. color: #ff4949;
  1472. }
  1473. }
  1474. }
  1475. .mt10 {
  1476. margin-top: 10px;
  1477. }
  1478. .mt20 {
  1479. margin-top: 20px;
  1480. }
  1481. .center {
  1482. text-align: center;
  1483. }
  1484. </style>