add.vue 53 KB

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