outbound.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926
  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="6">
  13. <el-form-item label="出库场景" prop="bizType">
  14. <el-select
  15. filterable
  16. placeholder="请选择"
  17. v-model="formData.bizType"
  18. clearable
  19. @change="handleBizSceneChange"
  20. :disabled="!!(productList && productList.length)"
  21. >
  22. <el-option
  23. v-for="item in outputSceneState"
  24. :key="item.code"
  25. :value="item.code"
  26. :label="item.label"
  27. ></el-option>
  28. </el-select> </el-form-item
  29. ></el-col>
  30. <el-col :span="6">
  31. <el-form-item label="单据来源" prop="documentSource">
  32. <el-input
  33. placeholder="请选择"
  34. v-model="formData.extInfo.documentSource"
  35. @click.native="openDocumentSourceDialog"
  36. >
  37. <el-button
  38. @click="clearDocumentSource"
  39. slot="append"
  40. icon="el-icon-circle-close"
  41. ></el-button>
  42. </el-input>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="6">
  46. <el-form-item label="出库物品类型" prop="extInfo.assetType">
  47. <el-select
  48. style="width: 100%"
  49. multiple
  50. :disabled="!!(productList && productList.length)"
  51. v-model="formData.extInfo.assetType"
  52. placeholder="请选择"
  53. >
  54. <el-option
  55. v-for="item in goodsLists"
  56. :key="item.id"
  57. :label="item.name"
  58. :value="item.id"
  59. >
  60. </el-option>
  61. </el-select>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="6">
  65. <el-form-item label="出库登记人">
  66. <el-input
  67. placeholder="登记人"
  68. disabled
  69. v-model="formData.extInfo.createUserName"
  70. clearable /></el-form-item
  71. ></el-col>
  72. <el-col :span="6">
  73. <el-form-item label="领料人部门" prop="verifyDeptName">
  74. <selectTree
  75. ref="tree"
  76. class="form-ipt"
  77. size="medium"
  78. style="width: 100%"
  79. clearable
  80. :options="treeList"
  81. :props="{
  82. value: 'code',
  83. label: 'name',
  84. children: 'children'
  85. }"
  86. @getValue="auditorDeptClick"
  87. />
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="6">
  91. <el-form-item label="领料人" prop="fromId">
  92. <el-select
  93. v-model="formData.fromId"
  94. filterable
  95. placeholder="请选择领料人"
  96. >
  97. <el-option
  98. v-for="item in llrLsit"
  99. :key="item.id"
  100. :label="item.name"
  101. :value="item.id"
  102. @click.native="userSlected(item)"
  103. >
  104. </el-option>
  105. </el-select> </el-form-item
  106. ></el-col>
  107. <!-- <el-col :span="6">
  108. <el-form-item label="领料人联系方式" prop="fromUserPhone">
  109. <el-input
  110. placeholder="请输入"
  111. disabled
  112. v-model="formData.extInfo.fromUserPhone"
  113. clearable /></el-form-item
  114. ></el-col> -->
  115. <el-col :span="12">
  116. <el-form-item label="备注" prop="remark">
  117. <el-input
  118. v-model="formData.remark"
  119. placeholder="请详细说明"
  120. ></el-input>
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. </el-form>
  125. <div>
  126. <el-button
  127. style="margin-bottom: 20px; float: right; margin-right: 20px"
  128. type="primary"
  129. @click="addStock"
  130. >添加</el-button
  131. >
  132. </div>
  133. <div class="material">
  134. <div>
  135. <header-title title="物品清单"></header-title>
  136. <div class="mt10 form-table">
  137. <el-table
  138. ref="productListTable"
  139. :data="productList"
  140. tooltip-effect="dark"
  141. :max-height="300"
  142. :header-cell-style="rowClass"
  143. border
  144. >
  145. <el-table-column label="序号" type="index" width="50">
  146. </el-table-column>
  147. <el-table-column
  148. label="编码"
  149. prop="categoryCode"
  150. align="center"
  151. :show-overflow-tooltip="true"
  152. ></el-table-column>
  153. <el-table-column
  154. label="名称"
  155. align="center"
  156. prop="categoryName"
  157. :show-overflow-tooltip="true"
  158. ></el-table-column>
  159. <el-table-column
  160. v-if="clientEnvironmentId == 4"
  161. label="级别"
  162. prop="level"
  163. align="center"
  164. >
  165. </el-table-column>
  166. <el-table-column
  167. label="型号"
  168. align="center"
  169. prop="categoryModel"
  170. :show-overflow-tooltip="true"
  171. ></el-table-column>
  172. <el-table-column
  173. label="规格"
  174. align="center"
  175. prop="specification"
  176. :show-overflow-tooltip="true"
  177. ></el-table-column>
  178. <el-table-column
  179. label="牌号"
  180. align="center"
  181. prop="brandNum"
  182. :show-overflow-tooltip="true"
  183. ></el-table-column>
  184. <el-table-column
  185. label="批次号"
  186. prop="batchNo"
  187. align="center"
  188. :show-overflow-tooltip="true"
  189. >
  190. </el-table-column>
  191. <el-table-column
  192. label="最小包装单元"
  193. align="center"
  194. width="120"
  195. prop="minPackingQuantity"
  196. >
  197. <template slot-scope="{ row, $index }">
  198. {{ row.minPackingQuantity }} {{ row.measureUnit }} /{{
  199. row.packingUnit
  200. }}
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. label="包装数量"
  205. prop="packingQuantity"
  206. align="center"
  207. >
  208. <template slot-scope="{ row, $index }">
  209. {{ row.packingQuantity }} {{ row.packingUnit }}
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. label="计量数量"
  214. prop="measureQuantity"
  215. width="100"
  216. align="center"
  217. >
  218. </el-table-column>
  219. <el-table-column
  220. label="计量单位"
  221. prop="measureUnit"
  222. align="center"
  223. >
  224. <template slot-scope="{ row, $index }">
  225. <template>
  226. {{ row.measureUnit }}
  227. </template>
  228. </template>
  229. </el-table-column>
  230. <el-table-column
  231. label="重量"
  232. prop="weight"
  233. align="center"
  234. :show-overflow-tooltip="true"
  235. >
  236. </el-table-column>
  237. <el-table-column
  238. label="重量单位"
  239. prop="weightUnit"
  240. align="center"
  241. :show-overflow-tooltip="true"
  242. >
  243. </el-table-column>
  244. <el-table-column label="单价" prop="price" align="center">
  245. <template slot-scope="{ row }">
  246. <template>
  247. {{ row.price ? row.price : '-' + '元' }}/{{
  248. row.measureUnit
  249. }}
  250. </template>
  251. </template>
  252. </el-table-column>
  253. <el-table-column
  254. label="金额"
  255. align="center"
  256. prop="contentImage"
  257. :show-overflow-tooltip="true"
  258. >
  259. <template slot-scope="{ row, $index }">
  260. {{ row.totalMoney ? row.totalMoney : 0 }}
  261. </template>
  262. </el-table-column>
  263. <el-table-column
  264. v-if="clientEnvironmentId == 4"
  265. label="采购原因"
  266. align="center"
  267. prop="purpose"
  268. :show-overflow-tooltip="true"
  269. ></el-table-column>
  270. <el-table-column
  271. label="仓库"
  272. prop="warehouseName"
  273. :show-overflow-tooltip="true"
  274. >
  275. </el-table-column>
  276. </el-table>
  277. </div>
  278. <header-title class="mt20" title="包装清单"></header-title>
  279. <div class="mt10 form-table">
  280. <el-table
  281. ref="showPackingListTable"
  282. :data="showPackingList"
  283. tooltip-effect="dark"
  284. :max-height="300"
  285. :row-class-name="tableRowClassName"
  286. :header-cell-style="rowClass"
  287. border
  288. v-el-table-infinite-scroll="pickingHandleScroll"
  289. >
  290. <el-table-column label="序号" type="index" width="50">
  291. </el-table-column>
  292. <el-table-column
  293. label="编码"
  294. prop="categoryCode"
  295. :show-overflow-tooltip="true"
  296. ></el-table-column>
  297. <el-table-column
  298. label="名称"
  299. prop="categoryName"
  300. :show-overflow-tooltip="true"
  301. ></el-table-column>
  302. <el-table-column
  303. label="批次号"
  304. prop="batchNo"
  305. :show-overflow-tooltip="true"
  306. ></el-table-column>
  307. <el-table-column
  308. label="发货条码"
  309. prop="barcodes"
  310. :show-overflow-tooltip="true"
  311. ></el-table-column>
  312. <el-table-column
  313. label="包装编码"
  314. prop="packageNo"
  315. :show-overflow-tooltip="true"
  316. ></el-table-column>
  317. <el-table-column
  318. label="包装数量"
  319. prop="packingQuantity"
  320. :show-overflow-tooltip="true"
  321. ></el-table-column>
  322. <el-table-column
  323. label="包装单位"
  324. prop="packingUnit"
  325. :show-overflow-tooltip="true"
  326. ></el-table-column>
  327. <el-table-column
  328. label="计量数量"
  329. prop="measureQuantity"
  330. :show-overflow-tooltip="true"
  331. ></el-table-column>
  332. <el-table-column
  333. label="计量单位"
  334. prop="measureUnit"
  335. :show-overflow-tooltip="true"
  336. ></el-table-column>
  337. <el-table-column
  338. label="物料代号"
  339. prop="materielDesignation"
  340. :show-overflow-tooltip="true"
  341. >
  342. </el-table-column>
  343. <el-table-column
  344. label="客户代号"
  345. prop="clientCode"
  346. :show-overflow-tooltip="true"
  347. >
  348. </el-table-column>
  349. <el-table-column
  350. label="刻码"
  351. prop="engrave"
  352. :show-overflow-tooltip="true"
  353. >
  354. </el-table-column>
  355. <el-table-column
  356. label="重量"
  357. prop="weight"
  358. :show-overflow-tooltip="true"
  359. >
  360. </el-table-column>
  361. <el-table-column
  362. label="重量单位"
  363. prop="weightUnit"
  364. :show-overflow-tooltip="true"
  365. >
  366. </el-table-column>
  367. <el-table-column
  368. label="质检结果"
  369. prop="result"
  370. :show-overflow-tooltip="true"
  371. >
  372. <template slot-scope="{ row }">
  373. <span>{{ qualityResults[row.result] }}</span>
  374. </template>
  375. </el-table-column>
  376. <el-table-column
  377. label="质检状态"
  378. prop="status"
  379. :show-overflow-tooltip="true"
  380. >
  381. <template slot-scope="{ row }">
  382. <span>{{ qualityStatus[row.status] }}</span>
  383. </template>
  384. </el-table-column>
  385. <el-table-column
  386. label="生产日期"
  387. prop="productionDate"
  388. :show-overflow-tooltip="true"
  389. >
  390. </el-table-column>
  391. <el-table-column
  392. label="采购日期"
  393. prop="purchaseDate"
  394. :show-overflow-tooltip="true"
  395. >
  396. </el-table-column>
  397. </el-table>
  398. </div>
  399. </div>
  400. <div class="mt20">
  401. <header-title class="mt20" title="物料明细"></header-title>
  402. <el-table
  403. ref="multipleTable"
  404. :data="showMaterialList"
  405. tooltip-effect="dark"
  406. :max-height="300"
  407. :row-class-name="tableRowClassName"
  408. :header-cell-style="rowClass"
  409. border
  410. style="width: 100%"
  411. stripe
  412. height="300px"
  413. v-el-table-infinite-scroll="materielHandleScroll"
  414. >
  415. <el-table-column label="序号" type="index" width="50">
  416. </el-table-column>
  417. <el-table-column
  418. label="编码"
  419. prop="categoryCode"
  420. :show-overflow-tooltip="true"
  421. ></el-table-column>
  422. <el-table-column
  423. label="名称"
  424. prop="categoryName"
  425. :show-overflow-tooltip="true"
  426. ></el-table-column>
  427. <el-table-column label="批次号" prop="batchNo"></el-table-column>
  428. <el-table-column
  429. label="物料编码"
  430. prop="materialCode"
  431. :show-overflow-tooltip="true"
  432. ></el-table-column>
  433. <el-table-column
  434. label="发货条码"
  435. prop="barcodes"
  436. :show-overflow-tooltip="true"
  437. ></el-table-column>
  438. <el-table-column
  439. label="计量数量"
  440. prop="minPackingQuantity"
  441. ></el-table-column>
  442. <el-table-column
  443. label="计量单位"
  444. prop="measureUnit"
  445. ></el-table-column>
  446. <el-table-column label="物料代号" prop="materielDesignation">
  447. </el-table-column>
  448. <el-table-column label="客户代号" prop="clientCode">
  449. </el-table-column>
  450. <el-table-column label="刻码" prop="engrave"> </el-table-column>
  451. <el-table-column width="100" label="重量" prop="weight">
  452. </el-table-column>
  453. <el-table-column label="重量单位" prop="weightUnit">
  454. </el-table-column>
  455. <el-table-column label="质检结果" prop="result" width="120">
  456. <template slot-scope="{ row }">
  457. <span>{{ qualityResults[row.result] }}</span>
  458. </template>
  459. </el-table-column>
  460. <el-table-column label="质检状态" prop="status" width="120">
  461. <template slot-scope="{ row }">
  462. <span>{{ qualityStatus[row.status] }}</span>
  463. </template>
  464. </el-table-column>
  465. </el-table>
  466. </div>
  467. </div>
  468. </el-card>
  469. <AssetsDialog
  470. ref="assetsDialogRef"
  471. :treeIds="formData.extInfo.assetType"
  472. @detailData="detailData"
  473. />
  474. </div>
  475. </template>
  476. <script>
  477. import storageApi from '@/api/warehouseManagement/index.js';
  478. import elTableInfiniteScroll from 'el-table-infinite-scroll';
  479. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  480. import { getTreeByGroup } from '@/api/classifyManage';
  481. import { outputSceneState } from '@/utils/dict/index';
  482. import selectTree from '@/components/selectTree';
  483. import AssetsDialog from './components/AssetsDialog.vue';
  484. import { deepClone } from '@/components/FormGenerator/utils/index';
  485. import { mapGetters } from 'vuex';
  486. export default {
  487. components: {
  488. selectTree,
  489. AssetsDialog
  490. },
  491. props: {
  492. form: { type: Object, default: {} },
  493. bizType: { type: Number, default: 1 },
  494. sourceBizNo: { type: String, default: '' },
  495. type: { type: String, default: '正常出库' }
  496. },
  497. directives: {
  498. 'el-table-infinite-scroll': elTableInfiniteScroll
  499. },
  500. data() {
  501. return {
  502. goodsLists: [], // 商品列表
  503. qualityStatus: {
  504. 0: '未质检',
  505. 1: '已质检'
  506. }, // 质检状态 0未检 1已检
  507. qualityResults: {
  508. 1: '合格',
  509. 2: '不合格'
  510. }, // 质检结果 1合格 2不合格
  511. productList: [], // 产品列表
  512. showPackingList: [], // 展示的包装列表
  513. packingList: [], // 包装列表
  514. showMaterialList: [], // 展示物料列表
  515. materialList: [], // 物料列表
  516. extInfo: {}, // 扩展信息
  517. pageSize: 20,
  518. pickingPageNum: 1,
  519. materielPageNum: 1,
  520. dimension: '3',
  521. outputSceneState,
  522. treeList: [],
  523. formData: {
  524. extInfo: {
  525. assetType: [], //物品类型id
  526. assetTypeName: '', //物品类型名称
  527. deptCode: '', //部门code
  528. deptName: '', //部门名称
  529. verifyDeptCode: '', //审核部门编码
  530. verifyDeptName: '', //审核部门名称
  531. deliveryName: '', //送货人名称
  532. fromUserPhone: '', //送货人电话
  533. sourceBizNo: '', //销售订单
  534. urgent: '', //紧急状态
  535. supplierId: '', //供应商ID
  536. supplierName: '', //供应商名称
  537. createUserName: '', //创建人名字
  538. contentImage: [] //图片数组
  539. },
  540. fromUser: '', //送货人
  541. bizType: '', //物品类型
  542. verifyId: '', //审核人Id
  543. verifyName: '', //审核人名称
  544. createUserId: '',
  545. remark: ''
  546. },
  547. rules: {
  548. bizType: {
  549. required: true,
  550. message: '请选择出库场景',
  551. trigger: 'change'
  552. },
  553. fromId: {
  554. required: true,
  555. message: '请选择领料人',
  556. trigger: 'change'
  557. }
  558. },
  559. llrLsit: []
  560. };
  561. },
  562. computed: {
  563. ...mapGetters(['user']),
  564. clientEnvironmentId() {
  565. return this.$store.state.user.info.clientEnvironmentId;
  566. }
  567. },
  568. created() {
  569. this.getListItems();
  570. this.initUserInfo();
  571. this.initDeptData();
  572. },
  573. methods: {
  574. userSlected(data) {
  575. this.formData.fromId = data.id;
  576. this.formData.fromUser = data.name;
  577. this.formData.fromUserPhone = data.phone;
  578. },
  579. openDocumentSourceDialog() {
  580. console.log('打开单据来源弹窗');
  581. },
  582. clearDocumentSource() {
  583. console.log('清空');
  584. },
  585. pickingHandleScroll() {
  586. console.log('---------pickingHandleScroll------------');
  587. if (this.showPackingList.length < this.packingList.length) {
  588. if (this.packingList.length > this.pageSize) {
  589. this.pickingPageNum += 1;
  590. }
  591. this.pickingFetchData();
  592. }
  593. },
  594. pickingFetchData() {
  595. const start = (this.pickingPageNum - 1) * this.pageSize;
  596. const end = start + this.pageSize;
  597. this.showPackingList = this.showPackingList.concat(
  598. this.packingList.slice(start, end)
  599. );
  600. },
  601. materielHandleScroll() {
  602. console.log('---------materielHandleScroll------------');
  603. if (this.showMaterialList.length < this.materialList.length) {
  604. if (this.materialList.length > this.pageSize) {
  605. this.materielPageNum += 1;
  606. }
  607. this.materielFetchData();
  608. }
  609. },
  610. materielFetchData() {
  611. const start = (this.materielPageNum - 1) * this.pageSize;
  612. const end = start + this.pageSize;
  613. this.showMaterialList = this.showMaterialList.concat(
  614. this.materialList.slice(start, end)
  615. );
  616. console.log(this.showMaterialList);
  617. },
  618. // 获取物品列表
  619. async getListItems() {
  620. const { data } = await getTreeByGroup({ type: 2 });
  621. this.goodsLists = data;
  622. },
  623. // 打开单据来源弹窗
  624. openDocumentSourceDialog() {
  625. console.log('打开单据来源弹窗');
  626. },
  627. tableRowClassName({ row, rowIndex }) {
  628. console.log(row);
  629. if (row.result == 1) {
  630. return 'warning-row';
  631. } else {
  632. return '';
  633. }
  634. },
  635. detailData(data, dimension) {
  636. this.dimension = dimension;
  637. this.productList = data.map((productItem) => {
  638. return {
  639. ...productItem,
  640. outInDetailRecordRequestList:
  641. productItem.outInDetailRecordRequestList.map((packingItem) => {
  642. return {
  643. ...packingItem,
  644. workOrderId:
  645. this.type === '自选领用出库'
  646. ? this.form.detailList[0].workOrderId
  647. : '',
  648. pickOrderId:
  649. this.type === '自选领用出库'
  650. ? this.form.detailList[0].pickOrderId
  651. : '',
  652. taskId:
  653. this.type === '自选领用出库'
  654. ? this.form.detailList[0].taskId
  655. : '',
  656. categoryName: productItem.categoryName,
  657. categoryCode: productItem.categoryCode,
  658. materialDetailList: packingItem.materialDetailList.map(
  659. (materialItem) => {
  660. return {
  661. ...materialItem,
  662. categoryName: productItem.categoryName,
  663. categoryCode: productItem.categoryCode
  664. };
  665. }
  666. )
  667. };
  668. })
  669. };
  670. });
  671. // 获取包装维度数据
  672. const arr = [];
  673. for (const key in this.productList) {
  674. for (const k in this.productList[key].outInDetailRecordRequestList) {
  675. arr.push({
  676. ...this.productList[key].outInDetailRecordRequestList[k]
  677. });
  678. }
  679. }
  680. this.packingList = arr;
  681. // 获取物料维度数据
  682. let iArr = [];
  683. arr.forEach((item) => {
  684. item.materialDetailList.forEach((ele) => {
  685. iArr.push({ ...ele });
  686. });
  687. });
  688. this.materialList = iArr;
  689. this.formData.outInDetailList = this.productList;
  690. },
  691. async getReturnStorage() {
  692. return new Promise((resolve) => {
  693. this.$refs.formName.validate(async (valid) => {
  694. if (valid) {
  695. if (!this.productList?.length) {
  696. return this.$message.error('请添加出库明细!');
  697. }
  698. let obj = deepClone({ ...this.formData, type: 2 });
  699. obj.extInfo.sourceBizNo = obj.sourceBizNo;
  700. obj.fromType = obj.type;
  701. // 处理物品类型assetType
  702. obj.extInfo.assetType = obj.extInfo.assetType.join(',');
  703. // 处理仓库id
  704. let warehouseId = [];
  705. let warehouseName = [];
  706. let warehouseIds = this.productList
  707. .map((item) => item.warehouseId)
  708. .flat();
  709. let warehouseNames = this.productList
  710. .map((item) => item.warehouseName)
  711. .flat();
  712. warehouseIds.forEach((item, index) => {
  713. if (!warehouseId.includes(item)) {
  714. warehouseId.push(item);
  715. warehouseName.push(warehouseNames[index]);
  716. }
  717. });
  718. obj.warehouseIds = warehouseId;
  719. obj.warehouseNames = warehouseName;
  720. console.log('2222', obj);
  721. let isPass = false;
  722. // 1按数量计费 2按重量计费
  723. if (this.form.pricingWay == 2) {
  724. if (this.materialList.length > 0) {
  725. // 判断物料
  726. isPass = this.materialCodeReqList.every(
  727. (item) => item.weight > 0
  728. );
  729. } else {
  730. // 判断包装重量是否全部大于0
  731. isPass = this.packingList.every((item) => item.weight > 0);
  732. }
  733. } else {
  734. isPass = true;
  735. }
  736. if (isPass) {
  737. resolve(obj);
  738. } else {
  739. this.$message.error('委外发货重量不能为空');
  740. }
  741. } else {
  742. this.$message.error('请选择领料人!');
  743. }
  744. });
  745. });
  746. },
  747. onClear() {
  748. this.formData.sourceBizNo = '';
  749. this.warehousingMaterialList = [];
  750. this.$refs.trees.valueTitle = '';
  751. this.formData.clientName = '';
  752. this.formData.clientUser = '';
  753. this.formData.clientPhone = '';
  754. this.$forceUpdate();
  755. },
  756. rowClass({ row, column, rowIndex, columnIndex }) {
  757. if (rowIndex === 1) {
  758. return {
  759. display: 'none',
  760. background: '#EEEEEE'
  761. };
  762. }
  763. return { background: '#0000' };
  764. },
  765. // 部门点击事件
  766. async auditorDeptClick(data) {
  767. console.log(data);
  768. this.formData.extInfo.verifyDeptCode = data?.id;
  769. this.formData.extInfo.verifyDeptName = data?.name;
  770. this.formData.verifyId = '';
  771. this.formData.verifyName = '';
  772. this.$refs.formName.validateField('verifyDeptName');
  773. if (data) {
  774. this.getStaffList(data);
  775. }
  776. },
  777. async getStaffList(data) {
  778. let res = await warehouseDefinition.getUserPage({
  779. groupId: data.id,
  780. size: 9999,
  781. page: 1
  782. });
  783. this.llrLsit = res.list;
  784. },
  785. // 初始化用户信息
  786. async initUserInfo() {
  787. const res = await warehouseDefinition.tree();
  788. // let info = JSON.parse(localStorage.getItem('info'));
  789. console.log('用户信息', this.user);
  790. console.log(this.form);
  791. let obj = res.find(
  792. (item) =>
  793. item.id ===
  794. this.user.info.deptIds[this.user.info.deptIds.length - 1]
  795. );
  796. console.log('obj', obj);
  797. if (!obj) return;
  798. this.formData.extInfo.deptCode = obj.id;
  799. this.formData.extInfo.deptName = obj.name;
  800. this.formData.extInfo.createUserName = this.user.info.name;
  801. this.formData.createUserId = this.user.info.userId;
  802. // 物品类型
  803. this.formData.extInfo.assetType =
  804. this.form.categoryLevelTopId.split(',');
  805. // 出库类型
  806. this.formData.bizType = this.bizType;
  807. // 添加单据来源
  808. this.formData.sourceBizNo = this.sourceBizNo;
  809. // 将出库状态改成出库状态 2出库 1入库
  810. this.formData.type = 2;
  811. console.log('this.formData', this.formData);
  812. },
  813. // 初始化部门数据
  814. async initDeptData() {
  815. const res = await warehouseDefinition.tree();
  816. this.treeList = this.$util.toTreeData({
  817. data: res,
  818. idField: 'id',
  819. parentIdField: 'parentId'
  820. });
  821. },
  822. addStock() {
  823. console.log(this.formData.extInfo.assetType);
  824. if (
  825. !(
  826. this.formData.extInfo.assetType &&
  827. this.formData.extInfo.assetType.length > 0
  828. )
  829. )
  830. return this.$message.error('请选择出库产品类型');
  831. if (!this.formData.bizType && this.formData.bizType !== 0)
  832. return this.$message.error('请选择出库场景');
  833. this.$refs.assetsDialogRef.open();
  834. },
  835. handleBizSceneChange() {
  836. if (this.formData.extInfo.assetType == 7) {
  837. this.formData.extInfo.sourceBizNo = '';
  838. }
  839. this.formData.sourceBizNo = '';
  840. }
  841. },
  842. watch: {
  843. packingList: {
  844. handler(newVal) {
  845. console.log('包装列表', newVal);
  846. console.log('当前包装列表加载页数', this.pickingPageNum);
  847. this.showPackingList = newVal.slice(
  848. 0,
  849. this.pageSize * (this.pickingPageNum > 0 ? this.pickingPageNum : 1)
  850. );
  851. },
  852. deep: true
  853. },
  854. materialList: {
  855. handler(newVal) {
  856. console.log('物料列表', newVal);
  857. console.log('当前物料列表加载页数', this.materielPageNum);
  858. this.showMaterialList = newVal.slice(
  859. 0,
  860. this.pageSize *
  861. (this.materielPageNum > 0 ? this.materielPageNum : 1)
  862. );
  863. },
  864. deep: true
  865. }
  866. }
  867. };
  868. </script>
  869. <style lang="scss" scoped>
  870. ::v-deep .el-row {
  871. display: flex;
  872. flex-wrap: wrap;
  873. }
  874. ::v-deep.form-table {
  875. .el-form-item {
  876. margin-bottom: 0;
  877. }
  878. .el-input__inner {
  879. padding: 0 10px;
  880. }
  881. }
  882. .p20 {
  883. padding: 20px;
  884. }
  885. .el-select,
  886. .el-date-editor {
  887. width: 100%;
  888. }
  889. .el-form-item {
  890. margin-bottom: 22px;
  891. }
  892. .material {
  893. margin-top: 20px;
  894. .flex {
  895. display: flex;
  896. justify-content: space-between;
  897. font-size: 14px;
  898. align-items: center;
  899. .red {
  900. color: #ff4949;
  901. }
  902. }
  903. }
  904. .mt10 {
  905. margin-top: 10px;
  906. }
  907. .mt20 {
  908. margin-top: 20px;
  909. }
  910. .center {
  911. text-align: center;
  912. }
  913. </style>