add.vue 50 KB

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