add.vue 51 KB

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