add.vue 53 KB

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