add.vue 53 KB

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