add.vue 50 KB

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