index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  5. <el-tab-pane label="待生成" name="待生成"></el-tab-pane>
  6. <el-tab-pane label="待出库" name="待出库"></el-tab-pane>
  7. <el-tab-pane label="已出库" name="已出库"></el-tab-pane>
  8. <el-tab-pane label="全部" name=""></el-tab-pane>
  9. </el-tabs>
  10. <avue-crud
  11. v-show="activeName == '待生成'"
  12. ref="crud2"
  13. :option="option2"
  14. :table-loading="loading2"
  15. :data="dataList2"
  16. :page.sync="page2"
  17. :search.sync="query"
  18. @search-change="searchChange2"
  19. @search-reset="searchReset2"
  20. @refresh-change="refreshChange2"
  21. @on-load="onLoad2"
  22. >
  23. <template slot="menu" slot-scope="{ row, index }">
  24. <el-button size="small" type="text" @click="rowEdit(row)">生成发货单</el-button>
  25. </template>
  26. <template slot="claimNo" slot-scope="{ row }">
  27. <span style="color: #1e9fff; cursor: pointer" @click="rowEdit(row)">
  28. {{ row.claimNo }}
  29. </span>
  30. </template>
  31. </avue-crud>
  32. <avue-crud
  33. v-show="activeName != '待生成'"
  34. :option="option"
  35. :search.sync="search"
  36. v-model="form"
  37. :table-loading="loading"
  38. :data="dataList"
  39. ref="crud"
  40. :key="key"
  41. @on-load="onLoad"
  42. @search-change="searchChange"
  43. @row-del="rowDel"
  44. @expand-change="expandChange"
  45. @refresh-change="refreshChange"
  46. :page.sync="page"
  47. >
  48. <template slot-scope="{ row }" slot="expand">
  49. <avue-crud
  50. :data="row.itemData"
  51. :option="itemOption"
  52. :table-loading="row.itemLoading"
  53. :cell-style="cellStyle"
  54. class="itemTable"
  55. ></avue-crud>
  56. </template>
  57. <template slot-scope="{ type, size, row, index }" slot="menu">
  58. <el-button
  59. :size="size"
  60. :disabled="row.statusName != '待出库'"
  61. :type="type"
  62. @click="$refs.crud.rowDel(row, index)"
  63. >撤销生成发货单</el-button
  64. >
  65. </template>
  66. <template slot="corpNameSearch">
  67. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  68. </template>
  69. <template slot-scope="{ row, index }" slot="billno">
  70. <span style="color: #409eff; cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.billno }} </span>
  71. </template>
  72. <template slot-scope="{ row, index }" slot="ordNo">
  73. <span style="color: #409eff; cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }} </span>
  74. </template>
  75. </avue-crud>
  76. </basic-container>
  77. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  78. <el-dialog
  79. title="发货"
  80. :visible.sync="dialogVisible"
  81. append-to-body
  82. close-on-click-modal
  83. close-on-press-escape
  84. width="40%"
  85. >
  86. <div class="elForm">
  87. <el-form :model="dialogForm" label-position="right">
  88. <el-col :span="24">
  89. <el-form-item label="收货人姓名:" label-width="100px">
  90. <span>{{ dialogForm.contacts }}</span>
  91. </el-form-item>
  92. <el-form-item label="收货人电话:" label-width="100px">
  93. <span>{{ dialogForm.phone }}</span>
  94. </el-form-item>
  95. <el-form-item label="收货人地址:" label-width="100px">
  96. <span>{{ dialogForm.recAddress }}</span>
  97. </el-form-item>
  98. </el-col>
  99. <el-form-item label="配送方式" label-width="100px">
  100. <el-select
  101. v-model="dialogForm.shipType"
  102. @change="courierTypeChange"
  103. style="width: 90%"
  104. placeholder="请选择运输类型"
  105. >
  106. <el-option
  107. v-for="item in courierTypeList"
  108. :key="item.dictKey"
  109. :label="item.dictValue"
  110. :value="item.dictValue"
  111. >
  112. </el-option>
  113. </el-select>
  114. </el-form-item>
  115. <el-form-item label="货运公司" label-width="100px">
  116. <el-select
  117. v-model="dialogForm.logisticsCorpName"
  118. filterable
  119. allow-create
  120. default-first-option
  121. style="width: 90%"
  122. placeholder="请选择货运公司"
  123. >
  124. <el-option
  125. v-for="item in courierList"
  126. :key="item.dictKey"
  127. :label="item.dictValue"
  128. :value="item.dictValue"
  129. >
  130. </el-option>
  131. </el-select>
  132. </el-form-item>
  133. <el-form-item label="货运单号" label-width="100px">
  134. <el-input v-model="dialogForm.expressNo" style="width: 90%" placeholder="请输入货运单号"></el-input>
  135. </el-form-item>
  136. </el-form>
  137. </div>
  138. <span slot="footer" class="dialog-footer">
  139. <el-button size="small" @click="dialogVisible = false">取 消</el-button>
  140. <el-button size="small" type="primary" @click="confirmShipment">确认发货</el-button>
  141. </span>
  142. </el-dialog>
  143. <el-dialog
  144. title="生成发货单"
  145. :visible.sync="generateVisible"
  146. append-to-body
  147. close-on-click-modal
  148. close-on-press-escape
  149. width="60%"
  150. >
  151. <div>
  152. <avue-crud v-if="generateVisible" :data="generateData" :option="generateOption">
  153. <template slot-scope="{ row, index }" slot="sendNum">
  154. <el-input-number
  155. v-model="row.sendNum"
  156. placeholder="请输入发货数量"
  157. :controls="false"
  158. :precision="0"
  159. :min="0"
  160. :max="Number(row.inventory)"
  161. size="small"
  162. style="width: 100%"
  163. ></el-input-number>
  164. </template>
  165. </avue-crud>
  166. </div>
  167. <span slot="footer" class="dialog-footer">
  168. <el-button size="small" @click="generateVisible = false">取 消</el-button>
  169. <el-button size="small" type="primary" @click="generate">生成发货</el-button>
  170. </span>
  171. </el-dialog>
  172. </div>
  173. </template>
  174. <script>
  175. // @ts-nocheck
  176. import {
  177. getOutboundList,
  178. getList,
  179. remove,
  180. getGoodsInfo,
  181. getDetails,
  182. shipments,
  183. tireStockDescList,
  184. submitShip,
  185. } from "@/api/salesManagement/outboundWorkOrder";
  186. import detailsPage from "./detailsPage";
  187. import { getWorkDicts } from "@/api/system/dictbiz";
  188. export default {
  189. name: "index",
  190. components: {
  191. detailsPage,
  192. },
  193. data() {
  194. return {
  195. loading2: false,
  196. generateForm: {},
  197. generateVisible: false,
  198. generateData: [],
  199. generateOption: {
  200. align: "center",
  201. header: false,
  202. border: true,
  203. menu: false,
  204. column: [
  205. {
  206. label: "发货仓库名称",
  207. prop: "storageName",
  208. width: 200,
  209. overHidden: true,
  210. },
  211. {
  212. label: "批次号",
  213. prop: "dot",
  214. width: 100,
  215. overHidden: true,
  216. },
  217. {
  218. label: "采购订单号",
  219. prop: "poNo",
  220. width: 100,
  221. overHidden: true,
  222. },
  223. {
  224. label: "库存",
  225. prop: "inventory",
  226. width: 100,
  227. overHidden: true,
  228. },
  229. {
  230. label: "发货数量",
  231. prop: "sendNum",
  232. width: 100,
  233. overHidden: true,
  234. },
  235. {
  236. label: "库区",
  237. prop: "reservoirArea",
  238. width: 100,
  239. overHidden: true,
  240. },
  241. ],
  242. },
  243. activeName: "待生成",
  244. statusNameData: [], // 状态字典
  245. dialogVisible: false,
  246. dialogForm: {},
  247. courierTypeList: [],
  248. courierList: [],
  249. detailsOpen: false,
  250. loading: false,
  251. search: {},
  252. query: {},
  253. form: {},
  254. dataList: [],
  255. detailData: {},
  256. page: {
  257. pageSize: 20,
  258. currentPage: 1,
  259. total: 0,
  260. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
  261. },
  262. page2: {
  263. pageSize: 20,
  264. currentPage: 1,
  265. total: 0,
  266. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
  267. },
  268. key: 0,
  269. itemOption: {
  270. align: "center",
  271. header: false,
  272. border: true,
  273. menu: false,
  274. column: [
  275. {
  276. label: "商品名称",
  277. prop: "goodsName",
  278. disabled: true,
  279. width: 200,
  280. overHidden: true,
  281. // props: {
  282. // label: 'cname',
  283. // value: 'id'
  284. // },
  285. // dicUrl: '/api/gubersail-admin/goodsDesc/goodsListAll'
  286. },
  287. {
  288. label: "商品编码",
  289. disabled: true,
  290. prop: "goodsNo",
  291. width: 100,
  292. },
  293. {
  294. label: "品牌",
  295. prop: "brandName",
  296. overHidden: true,
  297. },
  298. {
  299. label: "规格型号",
  300. prop: "propertyName",
  301. disabled: true,
  302. width: 100,
  303. },
  304. {
  305. label: "花纹",
  306. prop: "pattern",
  307. disabled: true,
  308. width: 100,
  309. },
  310. {
  311. label: "仓库",
  312. prop: "storageName",
  313. overHidden: true,
  314. },
  315. {
  316. label: "商品描述",
  317. prop: "goodsDescription",
  318. disabled: true,
  319. },
  320. {
  321. label: "批次号",
  322. prop: "dot",
  323. type: "select",
  324. disabled: true,
  325. dicData: [],
  326. props: {
  327. label: "dot",
  328. value: "dot",
  329. },
  330. dicUrl: "/api/gubersail-admin/tireStockDesc/dotList",
  331. },
  332. ],
  333. },
  334. option: {
  335. viewBtn: false,
  336. editBtn: false,
  337. delBtn: false,
  338. addBtn: false,
  339. index: true,
  340. span: 8,
  341. border: true,
  342. height: "auto",
  343. searchMenuPosition: "right",
  344. align: "center",
  345. size: "small",
  346. menuWidth: 120,
  347. searchSpan: 8,
  348. searchIcon: true,
  349. searchIndex: 2,
  350. highlightCurrentRow: true,
  351. expand: true,
  352. expandWidth: 60,
  353. dialogWidth: "70%",
  354. summaryText: "合计",
  355. showSummary: true,
  356. sumColumnList: [
  357. {
  358. name: "goodsTotalNum",
  359. type: "sum",
  360. decimals: 0,
  361. },
  362. ],
  363. column: [
  364. {
  365. label: "出库单号",
  366. prop: "billno",
  367. search: true,
  368. overHidden: true,
  369. },
  370. {
  371. label: "来源单号",
  372. prop: "ordNo",
  373. search: true,
  374. overHidden: true,
  375. },
  376. {
  377. label: "业务来源",
  378. prop: "bsType",
  379. search: true,
  380. overHidden: true,
  381. type: "select",
  382. dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_Source",
  383. props: {
  384. label: "dictValue",
  385. value: "dictKey",
  386. },
  387. },
  388. {
  389. label: "业务对象",
  390. prop: "customerName",
  391. search: true,
  392. overHidden: true,
  393. cell: true,
  394. width: 140,
  395. // filterable:true,
  396. // type: 'select',
  397. // remote:true,
  398. // props: {
  399. // label: 'cname',
  400. // value: 'cname',
  401. // res: 'data.records'
  402. // },
  403. // dicUrl: '/api/gubersail-admin/corpsDesc/list?current=1&size=20&corpType=KH&cname={{key}}',
  404. },
  405. // {
  406. // label: "仓库",
  407. // prop: "storageName",
  408. // search: true,
  409. // overHidden: true,
  410. // filterable: true,
  411. // type: "select",
  412. // props: {
  413. // label: "cname",
  414. // value: "cname",
  415. // },
  416. // dicUrl: "/api/gubersail-admin/storageDesc/listAll",
  417. // },
  418. // , {
  419. // label: '商品种类',
  420. // prop: "numberRows",
  421. // overHidden: true,
  422. // }
  423. {
  424. label: "订单数量",
  425. prop: "goodsTotalNum",
  426. search: false,
  427. overHidden: true,
  428. // width: 120,
  429. },
  430. {
  431. label: "实际数量",
  432. prop: "sendTotalNum",
  433. search: false,
  434. overHidden: true,
  435. // width: 120,
  436. },
  437. {
  438. label: "状态",
  439. prop: "statusName",
  440. // search: true,
  441. overHidden: true,
  442. // type: "select",
  443. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=outbound_work_order_status",
  444. // props: {
  445. // label: "dictValue",
  446. // value: "dictKey",
  447. // },
  448. },
  449. {
  450. label: "业务日期",
  451. prop: "businesDate",
  452. overHidden: true,
  453. searchProp: "businesDateList",
  454. type: "date",
  455. search: true,
  456. width: 100,
  457. unlinkPanels: true,
  458. searchRange: true,
  459. searchDefaultTime: ["00:00:00", "23:59:59"],
  460. format: "yyyy-MM-dd",
  461. valueFormat: "yyyy-MM-dd HH:mm:ss",
  462. },
  463. {
  464. label: "库管",
  465. prop: "stockClerkName",
  466. type: "select",
  467. search: true,
  468. props: {
  469. label: "realName",
  470. value: "realName",
  471. },
  472. dicUrl: "/api/blade-user/stockClerkList",
  473. overHidden: true,
  474. },
  475. {
  476. label: "制单人",
  477. prop: "createUserName",
  478. searchProp: "createUser",
  479. overHidden: true,
  480. width: 100,
  481. filterable: true,
  482. remote: true,
  483. type: "select",
  484. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  485. props: {
  486. label: "account",
  487. value: "id",
  488. res: "data.records",
  489. },
  490. },
  491. {
  492. label: "制单日期",
  493. prop: "createTime",
  494. searchProp: "createTimeList",
  495. type: "date",
  496. overHidden: true,
  497. width: 100,
  498. searchRange: true,
  499. searchDefaultTime: ["00:00:00", "23:59:59"],
  500. format: "yyyy-MM-dd",
  501. valueFormat: "yyyy-MM-dd HH:mm:ss",
  502. },
  503. {
  504. label: "更新人",
  505. prop: "updateUserName",
  506. searchProp: "updateUser",
  507. overHidden: true,
  508. width: 100,
  509. filterable: true,
  510. remote: true,
  511. type: "select",
  512. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  513. props: {
  514. label: "account",
  515. value: "id",
  516. res: "data.records",
  517. },
  518. },
  519. {
  520. label: "更新日期",
  521. prop: "updateTime",
  522. searchProp: "updateTimeList",
  523. type: "date",
  524. overHidden: true,
  525. width: 100,
  526. searchRange: true,
  527. searchDefaultTime: ["00:00:00", "23:59:59"],
  528. format: "yyyy-MM-dd",
  529. valueFormat: "yyyy-MM-dd HH:mm:ss",
  530. },
  531. ],
  532. },
  533. option2: {
  534. height: "auto",
  535. calcHeight: 30,
  536. menuWidth: 120,
  537. tip: false,
  538. searchShow: true,
  539. searchMenuSpan: 12,
  540. border: true,
  541. index: true,
  542. addBtn: false,
  543. viewBtn: false,
  544. editBtn: false,
  545. delBtn: false,
  546. // selection: true,
  547. searchIcon: true,
  548. align: "center",
  549. searchIndex: 3,
  550. column: [
  551. {
  552. label: "订单编号",
  553. prop: "ordNo",
  554. search: true,
  555. overHidden: true,
  556. },
  557. {
  558. label: "客户名称",
  559. prop: "customerName",
  560. search: true,
  561. overHidden: true,
  562. },
  563. {
  564. label: "订单数量",
  565. prop: "goodsNum",
  566. overHidden: true,
  567. },
  568. {
  569. label: "已出库数量",
  570. prop: "outGoodsTotalShipNum",
  571. overHidden: true,
  572. },
  573. {
  574. label: "未出库数量",
  575. prop: "sendNum",
  576. overHidden: true,
  577. },
  578. {
  579. label: "商品名称",
  580. prop: "goodsName",
  581. overHidden: true,
  582. },
  583. ],
  584. },
  585. };
  586. },
  587. async created() {
  588. // 状态字段获取
  589. this.getWorkDicts("outbound_work_order_status").then((res) => {
  590. this.statusNameData = res.data.data;
  591. });
  592. this.key++;
  593. let i = 0;
  594. this.option.column.forEach((item) => {
  595. if (item.search) i++;
  596. });
  597. if (i % 3 !== 0) {
  598. const num = 3 - Number(i % 3);
  599. this.option.searchMenuSpan = num * 8;
  600. this.option.searchMenuPosition = "right";
  601. }
  602. if (this.$route.query.id) {
  603. this.detailData = {
  604. id: this.$route.query.id,
  605. };
  606. this.detailsOpen = true;
  607. }
  608. console.log(this.$route.query);
  609. },
  610. activated() {
  611. if (this.$route.query.id) {
  612. this.detailData = {
  613. id: this.$route.query.id,
  614. };
  615. this.detailsOpen = true;
  616. }
  617. setTimeout(() => {
  618. if (this.$route.query.srcId) {
  619. this.$store.commit("DOMIO_IN_DETAIL");
  620. this.detailsOpen = true;
  621. }
  622. }, 100);
  623. },
  624. methods: {
  625. check(row) {
  626. this.form = row;
  627. this.detailsOpen = true;
  628. },
  629. backToList(type) {
  630. this.form = {};
  631. this.detailsOpen = false;
  632. if (type === 0) {
  633. this.detailData = {};
  634. }
  635. if (this.$route.query.srcId) {
  636. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  637. this.$router.push({
  638. path: "/tirePartsMall/salesManagement/outboundWorkOrder/index",
  639. });
  640. }
  641. this.onLoad(this.page, this.search);
  642. this.$store.commit("DOMIO_OUT_DETAIL");
  643. },
  644. //刷新
  645. refreshChange() {
  646. this.onLoad(this.page, this.search);
  647. },
  648. rowDel(form, index) {
  649. console.log(form);
  650. this.$confirm("是否撤销生成发货单?", "提示", {
  651. confirmButtonText: "确定",
  652. cancelButtonText: "取消",
  653. type: "warning",
  654. })
  655. .then(() => {
  656. remove(form.id).then((res) => {
  657. this.$message({
  658. type: "success",
  659. message: "操作成功!",
  660. });
  661. this.dataList.splice(index, 1);
  662. this.onLoad(this.page);
  663. });
  664. })
  665. .catch(() => {});
  666. },
  667. searchChange(params, done) {
  668. this.page.currentPage = 1;
  669. done();
  670. this.onLoad(this.page, params);
  671. },
  672. handleClick(tab, event) {
  673. console.log(tab.name, event);
  674. if (tab.name == "待生成") {
  675. // this.query.statusName = tab.name;
  676. this.onLoad2(this.page2, this.query);
  677. } else {
  678. // this.search.statusName = tab.name;
  679. this.onLoad(this.page, this.search);
  680. }
  681. },
  682. onLoad(page, params = {}) {
  683. var obj2 = this.deepClone(this.search);
  684. params = {
  685. ...params,
  686. current: page.currentPage,
  687. size: page.pageSize,
  688. bizTypeName: "FHGD",
  689. ...Object.assign(params, this.search),
  690. statusName:this.activeName==3?'':this.activeName,
  691. };
  692. this.loading = true;
  693. this.dataList.forEach((item) => {
  694. this.$refs.crud.toggleRowExpansion(item, false);
  695. });
  696. getList(params)
  697. .then((res) => {
  698. if (res.data.data.records) {
  699. res.data.data.records.forEach((e) => {
  700. e.itemLoading = true;
  701. });
  702. }
  703. this.dataList = res.data.data.records;
  704. this.page.total = res.data.data.total;
  705. this.$nextTick(() => {
  706. this.$refs.crud.doLayout();
  707. this.$refs.crud.dicInit();
  708. });
  709. this.loading = false;
  710. })
  711. .finally(() => {
  712. // if(this.search.statusName==''){
  713. // this.search.statusName='待出库'
  714. // }
  715. this.search = obj2;
  716. console.log(this.search);
  717. this.loading = false;
  718. });
  719. },
  720. editOpen(row, status) {
  721. this.form = row;
  722. this.detailData = {
  723. id: row.id,
  724. status: status,
  725. };
  726. this.detailsOpen = true;
  727. },
  728. expandChange(row) {
  729. if (!row.itemData) {
  730. getDetails({ id: row.id })
  731. .then((res) => {
  732. this.dataList[row.$index].itemData = res.data.data.shipItemsList;
  733. })
  734. .finally(() => {
  735. this.dataList[row.$index].itemLoading = false;
  736. });
  737. }
  738. },
  739. // 发货按钮
  740. deliverGoods(row) {
  741. // 获取运输类型
  742. getWorkDicts("deliveryMethod").then((res) => {
  743. this.courierTypeList = res.data.data;
  744. });
  745. // 获取快递公司
  746. getWorkDicts("tyre_express_company").then((res) => {
  747. this.courierList = res.data.data;
  748. });
  749. this.dialogForm = row;
  750. this.dialogVisible = true;
  751. },
  752. courierTypeChange() {
  753. this.dialogForm.courierCorporation = null;
  754. },
  755. // 发货
  756. confirmShipment() {
  757. for (let courierCompanies of this.courierList) {
  758. if (courierCompanies.dictValue === this.dialogForm.logisticsCorpName) {
  759. this.dialogForm.logisticsCorpId = courierCompanies.dictKey;
  760. break;
  761. }
  762. }
  763. const requestBody = {
  764. id: this.dialogForm.id,
  765. logisticsCorpId: this.dialogForm.logisticsCorpId,
  766. logisticsCorpName: this.dialogForm.logisticsCorpName,
  767. shipType: this.dialogForm.shipType,
  768. expressNo: this.dialogForm.expressNo,
  769. };
  770. shipments(requestBody).then((res) => {
  771. console.log(res);
  772. this.$message.success("发货成功");
  773. this.dialogVisible = false;
  774. });
  775. },
  776. /**
  777. * @param {{ currentPage: any; pageSize: any; }} page
  778. */
  779. onLoad2(page, params = {}) {
  780. let obj = {};
  781. obj = {
  782. ...Object.assign(params, this.query),
  783. };
  784. this.loading2 = true;
  785. getOutboundList(page.currentPage, page.pageSize, obj)
  786. .then((res) => {
  787. this.dataList2 = res.data.data.records;
  788. this.page2.total = res.data.data.total;
  789. this.$nextTick(() => {
  790. this.$refs.crud2.doLayout();
  791. });
  792. })
  793. .finally(() => {
  794. this.loading2 = false;
  795. });
  796. },
  797. refreshChange2() {
  798. this.onLoad2(this.page2, this.query);
  799. },
  800. searchChange2(params, done) {
  801. done();
  802. this.page2.currentPage = 1;
  803. this.onLoad2(this.page2, params);
  804. },
  805. rowEdit(row) {
  806. this.generateForm = row;
  807. this.generateData = [];
  808. let obj = {
  809. goodsId: row.goodsId,
  810. };
  811. tireStockDescList(obj).then((res) => {
  812. res.data.data.forEach((item) => {
  813. this.generateData.push({
  814. ...row,
  815. storageId: item.storageId,
  816. storageName: item.storageName,
  817. dot: item.dot,
  818. poNo: item.poNo,
  819. inventory: item.balanceQuantity,
  820. sendNum: 0,
  821. costpriePrice: item.inventoryCostPrice,
  822. reservoirAreaId: item.reservoirAreaId,
  823. reservoirArea: item.reservoirArea,
  824. });
  825. });
  826. });
  827. console.log(this.generateData);
  828. this.generateVisible = true;
  829. },
  830. sendNumChange(row, index) {
  831. let sum = 0;
  832. for (let item of this.generateData) {
  833. sum += Number(item.sendNum);
  834. }
  835. if (sum > row.goodsNum) {
  836. return this.$message.error("发货数量合计不能超过订单数量:"+row.goodsNum);
  837. }
  838. },
  839. generate() {
  840. if (this.generateData.filter((item) => item.sendNum > 0).length == 0) {
  841. return this.$message.error("发货数量不能为0");
  842. }
  843. let sum = 0;
  844. for (let item of this.generateData) {
  845. sum += Number(item.sendNum);
  846. }
  847. if (sum > this.generateForm.sendNum){
  848. return this.$message.error("发货数量合计不能超过订单数量:"+this.generateForm.sendNum);
  849. }
  850. let obj = {
  851. ...this.generateForm,
  852. shipItemsList: this.generateData.filter((item) => item.sendNum > 0),
  853. };
  854. const loading = this.$loading({
  855. lock: true,
  856. text: "加载中",
  857. spinner: "el-icon-loading",
  858. background: "rgba(255,255,255,0.7)",
  859. });
  860. submitShip(obj)
  861. .then((res) => {
  862. this.generateVisible = false;
  863. this.$message.success("操作成功");
  864. this.refreshChange();
  865. this.refreshChange2();
  866. })
  867. .finally(() => {
  868. loading.close();
  869. });
  870. },
  871. },
  872. };
  873. </script>
  874. <style scoped>
  875. .bottomBox {
  876. padding: 3px 6px;
  877. border-radius: 12px;
  878. color: #fff;
  879. font-size: 10px;
  880. }
  881. </style>