index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. <template>
  2. <div class="tenant">
  3. <!-- <Banner /> -->
  4. <div class="content">
  5. <byTable
  6. :source="sourceList.data"
  7. :pagination="sourceList.pagination"
  8. :config="config"
  9. :loading="loading"
  10. highlight-current-row
  11. :selectConfig="selectConfig"
  12. :table-events="{
  13. //element talbe事件都能传
  14. select: select,
  15. }"
  16. :action-list="[]"
  17. @get-list="getList"
  18. >
  19. <template #slotName="{ item }">
  20. {{ item.createTime }}
  21. </template>
  22. </byTable>
  23. </div>
  24. <el-dialog
  25. title="出库"
  26. v-model="dialogVisible"
  27. width="800"
  28. v-loading="submitLoading"
  29. destroy-on-close
  30. >
  31. <byForm
  32. :formConfig="formConfig"
  33. :formOption="formOption"
  34. v-model="formData.data"
  35. :rules="submitType == 5 ? rulesOne : submitType == 4 ? rulesTwo : rules"
  36. ref="byform"
  37. >
  38. <template #countryId>
  39. <div>
  40. <el-select
  41. v-model="formData.data.countryId"
  42. placeholder="国家"
  43. @change="(val) => getCityData(val, '20', true)"
  44. :disabled="submitType == 4"
  45. >
  46. <el-option
  47. v-for="item in countryData"
  48. :label="item.chineseName"
  49. :value="item.id"
  50. >
  51. </el-option>
  52. </el-select>
  53. </div>
  54. </template>
  55. <template #provinceId>
  56. <div>
  57. <selectCity
  58. placeholder="省/洲"
  59. @change="(val) => getCityData(val, '30', true)"
  60. addressId="provinceId"
  61. addressName="provinceName"
  62. v-model="formData.data"
  63. :data="provinceData"
  64. :disabled="submitType == 4"
  65. >
  66. </selectCity>
  67. </div>
  68. </template>
  69. <template #cityId>
  70. <div>
  71. <selectCity
  72. placeholder="城市"
  73. addressId="cityId"
  74. addressName="cityName"
  75. v-model="formData.data"
  76. :data="cityData"
  77. :disabled="submitType == 4"
  78. >
  79. </selectCity>
  80. </div>
  81. </template>
  82. <template #products>
  83. <div style="width: 100%">
  84. <el-table :data="formData.data.jdOrderDetailsList">
  85. <el-table-column prop="productCustomCode" label="物品编码" />
  86. <el-table-column prop="productName" label="物品名称" />
  87. <!-- <el-table-column
  88. prop="productSpec"
  89. label="规格型号"
  90. v-if="submitType == 5"
  91. /> -->
  92. <el-table-column prop="waitQuantity" label="应出库" />
  93. <el-table-column
  94. prop="receiptQuantity"
  95. label="已出库"
  96. v-if="submitType != 5"
  97. />
  98. <el-table-column
  99. prop="quantity"
  100. label="本次出库"
  101. min-width="150"
  102. v-if="submitType != 5"
  103. >
  104. <template #default="{ row, $index }">
  105. <el-form-item
  106. :prop="'jdOrderDetailsList.' + $index + '.quantity'"
  107. :rules="rules.quantity"
  108. :inline-message="true"
  109. >
  110. <el-input-number
  111. v-model="row.quantity"
  112. :precision="2"
  113. :controls="false"
  114. :min="0"
  115. onmousewheel="return false;"
  116. />
  117. </el-form-item>
  118. </template>
  119. </el-table-column>
  120. <el-table-column
  121. prop="quantity"
  122. label="调仓数量"
  123. min-width="150"
  124. v-if="submitType == 5"
  125. >
  126. <template #default="{ row, $index }">
  127. <el-form-item
  128. :prop="'jdOrderDetailsList.' + $index + '.quantity'"
  129. :rules="rules.quantity"
  130. :inline-message="true"
  131. >
  132. <el-input-number
  133. v-model="row.quantity"
  134. :precision="2"
  135. :controls="false"
  136. :min="0"
  137. onmousewheel="return false;"
  138. />
  139. </el-form-item>
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. </div>
  144. </template>
  145. </byForm>
  146. <template #footer>
  147. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  148. <el-button
  149. type="primary"
  150. @click="submitForm('byform')"
  151. size="large"
  152. :loading="submitLoading"
  153. >
  154. 确 定
  155. </el-button>
  156. </template>
  157. </el-dialog>
  158. <el-dialog
  159. v-model="openProduct"
  160. title="选择产品"
  161. width="70%"
  162. append-to-body
  163. >
  164. <InventoryInquiry
  165. :selectStatus="true"
  166. :warehouseId="formData.data.outWarehouseId"
  167. @cancel="openProduct = false"
  168. @select="select"
  169. :key="formData.data.outWarehouseId"
  170. ></InventoryInquiry>
  171. <!-- <template #footer>
  172. <span class="dialog-footer">
  173. <el-button @click="openProduct = false">取消</el-button>
  174. </span>
  175. </template> -->
  176. </el-dialog>
  177. </div>
  178. </template>
  179. <script setup>
  180. import { ElMessage, ElMessageBox } from "element-plus";
  181. import byTable from "@/components/byTable/index";
  182. import byForm from "@/components/byForm/index";
  183. import InventoryInquiry from "@/views/purchaseSales/outAndInWarehouse/inventoryInquiry/index";
  184. import { computed } from "vue";
  185. import selectCity from "@/components/selectCity/index.vue";
  186. const loading = ref(false);
  187. const submitLoading = ref(false);
  188. const sourceList = ref({
  189. data: [],
  190. pagination: {
  191. total: 3,
  192. pageNum: 1,
  193. pageSize: 10,
  194. type: "2",
  195. },
  196. });
  197. const productUnit = ref([]);
  198. const warehouseList = ref([]);
  199. const logisticsData = ref([]);
  200. let openProduct = ref(false);
  201. let dialogVisible = ref(false);
  202. let modalType = ref("add");
  203. let rules = ref({
  204. type: [
  205. { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
  206. ],
  207. warehouseId: [
  208. { required: true, message: "请选择仓库名称", trigger: "change" },
  209. ],
  210. outWarehouseId: [
  211. { required: true, message: "请选择调出仓库", trigger: "change" },
  212. ],
  213. inWarehouseId: [
  214. { required: true, message: "请选择调入仓库", trigger: "change" },
  215. ],
  216. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  217. logisticsCompanyCode: [
  218. { required: true, message: "请选择物流/快递公司", trigger: "change" },
  219. ],
  220. logisticsCode: [
  221. { required: true, message: "请输入物流/快递单号", trigger: "blur" },
  222. ],
  223. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  224. contacts: [{ required: true, message: "请输入收件人", trigger: "blur" }],
  225. phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
  226. });
  227. let rulesTwo = ref({
  228. type: [
  229. { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
  230. ],
  231. warehouseId: [
  232. { required: true, message: "请选择仓库名称", trigger: "change" },
  233. ],
  234. outWarehouseId: [
  235. { required: true, message: "请选择调出仓库", trigger: "change" },
  236. ],
  237. inWarehouseId: [
  238. { required: true, message: "请选择调入仓库", trigger: "change" },
  239. ],
  240. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  241. logisticsCompanyCode: [
  242. { required: true, message: "请选择物流/快递公司", trigger: "change" },
  243. ],
  244. logisticsCode: [
  245. { required: true, message: "请输入物流/快递单号", trigger: "blur" },
  246. ],
  247. // countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  248. // contacts: [{ required: true, message: "请输入收件人", trigger: "blur" }],
  249. // phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
  250. });
  251. let rulesOne = ref({
  252. type: [
  253. { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
  254. ],
  255. warehouseId: [
  256. { required: true, message: "请选择仓库名称", trigger: "change" },
  257. ],
  258. outWarehouseId: [
  259. { required: true, message: "请选择调出仓库", trigger: "change" },
  260. ],
  261. inWarehouseId: [
  262. { required: true, message: "请选择调入仓库", trigger: "change" },
  263. ],
  264. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  265. });
  266. const { proxy } = getCurrentInstance();
  267. const selectConfig = reactive([
  268. {
  269. label: "数据来源",
  270. prop: "businessType",
  271. data: [],
  272. },
  273. {
  274. label: "出库状态",
  275. prop: "status",
  276. data: [],
  277. },
  278. ]);
  279. const outboundType = ref([
  280. {
  281. label: "未出库",
  282. value: "0",
  283. },
  284. {
  285. label: "部分出库",
  286. value: "1",
  287. },
  288. {
  289. label: "出库完成",
  290. value: "2",
  291. },
  292. ]);
  293. const config = computed(() => {
  294. return [
  295. {
  296. attrs: {
  297. label: "数据来源",
  298. prop: "businessType",
  299. },
  300. render(type) {
  301. const current = businessType.find((x) => x.value == type);
  302. if (current) {
  303. return current.label;
  304. }
  305. },
  306. },
  307. {
  308. attrs: {
  309. label: "关联单号",
  310. prop: "businessCode",
  311. },
  312. },
  313. {
  314. attrs: {
  315. label: "操作人",
  316. prop: "operatorName",
  317. },
  318. },
  319. {
  320. attrs: {
  321. label: "操作时间",
  322. prop: "createTime",
  323. },
  324. },
  325. {
  326. attrs: {
  327. label: "出库状态",
  328. prop: "status",
  329. },
  330. render(status) {
  331. return status == 0 ? "未出库" : status == 1 ? "部分出库" : "出库完成";
  332. },
  333. },
  334. {
  335. attrs: {
  336. label: "操作",
  337. width: "120",
  338. align: "center",
  339. fixed: "right",
  340. },
  341. // 渲染 el-button,一般用在最后一列。
  342. renderHTML(row) {
  343. return [
  344. row.status < 2
  345. ? {
  346. attrs: {
  347. label: "出库",
  348. type: "primary",
  349. text: true,
  350. disabled: row.status > 1,
  351. },
  352. el: "button",
  353. click() {
  354. outBound(row);
  355. },
  356. }
  357. : {},
  358. {
  359. attrs: {
  360. label: "结束",
  361. type: "primary",
  362. text: true,
  363. disabled: false,
  364. },
  365. el: "button",
  366. click() {
  367. ElMessageBox.confirm(`您确定执行此操作吗?`, "提示", {
  368. confirmButtonText: "确定",
  369. cancelButtonText: "取消",
  370. type: "warning",
  371. }).then(() => {
  372. // 删除
  373. proxy
  374. .post("/stockWait/edit", {
  375. ...row,
  376. status: 3,
  377. })
  378. .then((res) => {
  379. ElMessage({
  380. message: "操作成功",
  381. type: "success",
  382. });
  383. getList();
  384. });
  385. });
  386. },
  387. },
  388. ];
  389. },
  390. },
  391. ];
  392. });
  393. let formData = reactive({
  394. data: {},
  395. });
  396. const formOption = reactive({
  397. inline: true,
  398. labelWidth: 100,
  399. itemWidth: 100,
  400. rules: [],
  401. });
  402. const byform = ref(null);
  403. let formConfig = ref([]);
  404. const businessType = [
  405. { label: "生产任务出库", value: "7" },
  406. { label: "销售订单出库", value: "6" },
  407. { label: "京东订单出库", value: "5" },
  408. { label: "采购退货出库", value: "4" },
  409. ];
  410. const configData = computed(() => [
  411. [
  412. {
  413. type: "title",
  414. title: "基础信息",
  415. },
  416. {
  417. type: "select",
  418. prop: "businessType",
  419. label: "数据来源",
  420. required: true,
  421. disabled: true,
  422. itemWidth: 25,
  423. data: businessType,
  424. },
  425. {
  426. type: "input",
  427. prop: "businessCode",
  428. label: "关联单号",
  429. required: true,
  430. disabled: true,
  431. itemWidth: 30,
  432. },
  433. {
  434. type: "select",
  435. prop: "warehouseId",
  436. label: "仓库名称",
  437. itemWidth: 100,
  438. data: warehouseList.value,
  439. style: {
  440. width: "53%",
  441. },
  442. },
  443. {
  444. type: "select",
  445. prop: "logisticsCompanyCode",
  446. label: "物流/快递信息",
  447. placeholder: "物流/快递公司",
  448. itemWidth: 25,
  449. style: {
  450. width: "100%",
  451. },
  452. data: logisticsData.value,
  453. filterable: true,
  454. },
  455. {
  456. type: "input",
  457. prop: "logisticsCode",
  458. label: " ",
  459. placeholder: "物流/快递单号",
  460. itemWidth: 60,
  461. style: {
  462. width: "46%",
  463. },
  464. },
  465. {
  466. type: "input",
  467. prop: "contacts",
  468. label: "收件人",
  469. itemWidth: 25,
  470. placeholder: "收件人",
  471. disabled: true,
  472. },
  473. {
  474. type: "input",
  475. prop: "phone",
  476. label: "联系电话",
  477. itemWidth: 60,
  478. placeholder: "联系电话",
  479. disabled: true,
  480. style: {
  481. width: "46%",
  482. },
  483. },
  484. {
  485. type: "slot",
  486. slotName: "countryId",
  487. prop: "countryId",
  488. label: "收货信息",
  489. itemWidth: 33.33,
  490. disabled: true,
  491. },
  492. {
  493. type: "slot",
  494. slotName: "provinceId",
  495. label: " ",
  496. itemWidth: 33.33,
  497. disabled: true,
  498. },
  499. {
  500. type: "slot",
  501. slotName: "cityId",
  502. prop: "cityId",
  503. label: " ",
  504. itemWidth: 33.33,
  505. disabled: true,
  506. },
  507. {
  508. type: "input",
  509. itemType: "textarea",
  510. prop: "areaDetail",
  511. disabled: true,
  512. },
  513. {
  514. type: "title",
  515. title: "出库明细",
  516. },
  517. {
  518. type: "slot",
  519. slotName: "products",
  520. },
  521. ],
  522. [
  523. {
  524. type: "title",
  525. title: "基础信息",
  526. },
  527. {
  528. type: "select",
  529. prop: "businessType",
  530. label: "数据来源",
  531. required: true,
  532. disabled: true,
  533. itemWidth: 25,
  534. data: businessType,
  535. },
  536. {
  537. type: "input",
  538. prop: "businessCode",
  539. label: "关联单号",
  540. required: true,
  541. disabled: true,
  542. itemWidth: 30,
  543. },
  544. {
  545. type: "select",
  546. prop: "warehouseId",
  547. label: "仓库名称",
  548. itemWidth: 100,
  549. data: warehouseList.value,
  550. style: {
  551. width: "53%",
  552. },
  553. },
  554. {
  555. type: "select",
  556. prop: "logisticsCompanyCode",
  557. label: "物流/快递信息",
  558. placeholder: "物流/快递公司",
  559. itemWidth: 25,
  560. style: {
  561. width: "100%",
  562. },
  563. data: logisticsData.value,
  564. filterable: true,
  565. },
  566. {
  567. type: "input",
  568. prop: "logisticsCode",
  569. label: " ",
  570. placeholder: "物流/快递单号",
  571. itemWidth: 60,
  572. style: {
  573. width: "46%",
  574. },
  575. },
  576. {
  577. type: "slot",
  578. slotName: "countryId",
  579. prop: "countryId",
  580. label: "收货信息",
  581. itemWidth: 33.33,
  582. },
  583. {
  584. type: "slot",
  585. slotName: "provinceId",
  586. label: " ",
  587. itemWidth: 33.33,
  588. },
  589. {
  590. type: "slot",
  591. slotName: "cityId",
  592. prop: "cityId",
  593. label: " ",
  594. itemWidth: 33.33,
  595. },
  596. {
  597. type: "input",
  598. itemType: "textarea",
  599. prop: "areaDetail",
  600. },
  601. {
  602. type: "title",
  603. title: "出库明细",
  604. },
  605. {
  606. type: "slot",
  607. slotName: "products",
  608. },
  609. ],
  610. [
  611. {
  612. type: "title",
  613. title: "调仓信息",
  614. },
  615. {
  616. type: "select",
  617. prop: "outWarehouseId",
  618. label: "调出仓库",
  619. itemWidth: 33,
  620. disabled: false,
  621. data: warehouseList.value,
  622. },
  623. {
  624. type: "select",
  625. prop: "inWarehouseId",
  626. label: "调入仓库",
  627. itemWidth: 33,
  628. disabled: false,
  629. data: warehouseList.value,
  630. },
  631. {
  632. type: "input",
  633. label: "预约号",
  634. prop: "reservationCode",
  635. placeholder: "请输入",
  636. itemWidth: 33,
  637. },
  638. {
  639. type: "input",
  640. prop: "remark",
  641. label: "调拨说明",
  642. itemType: "textarea",
  643. disabled: false,
  644. },
  645. {
  646. type: "select",
  647. prop: "logisticsCompanyCode",
  648. itemWidth: 50,
  649. label: "物流/快递信息",
  650. placeholder: "物流/快递公司",
  651. style: {
  652. width: "100%",
  653. },
  654. data: logisticsData.value,
  655. filterable: true,
  656. },
  657. {
  658. type: "input",
  659. prop: "logisticsCode",
  660. label: " ",
  661. placeholder: "物流/快递单号",
  662. itemWidth: 50,
  663. },
  664. {
  665. type: "title",
  666. title: "调仓明细",
  667. },
  668. {
  669. type: "slot",
  670. slotName: "products",
  671. },
  672. ],
  673. ]);
  674. const getList = async (req) => {
  675. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  676. loading.value = true;
  677. proxy
  678. .post("/stockWait/pageByWdly", sourceList.value.pagination)
  679. .then((message) => {
  680. sourceList.value.data = message.rows.map((x) => ({
  681. ...x,
  682. ...JSON.parse(x.victoriatouristJson),
  683. quantity: Number(x.quantity) - Number(x.receiptQuantity),
  684. }));
  685. sourceList.value.pagination.total = message.total;
  686. setTimeout(() => {
  687. loading.value = false;
  688. }, 200);
  689. });
  690. };
  691. const openModal = () => {
  692. dialogVisible.value = true;
  693. modalType.value = "add";
  694. formData.data = {};
  695. };
  696. const submitForm = () => {
  697. byform.value.handleSubmit((valid) => {
  698. if (submitType.value == 4) {
  699. const list = formData.data.jdOrderDetailsList;
  700. const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
  701. if (total > 0) {
  702. const data = {
  703. id: formData.data.id,
  704. businessType: formData.data.businessType,
  705. warehouseId: formData.data.warehouseId,
  706. logisticsCompanyCode: formData.data.logisticsCompanyCode,
  707. logisticsCode: formData.data.logisticsCode,
  708. countryId: formData.data.countryId,
  709. provinceId: formData.data.provinceId,
  710. cityId: formData.data.cityId,
  711. areaDetail: formData.data.areaDetail,
  712. stockWaitDetailsList: list.map((x) => ({
  713. id: x.id,
  714. quantity: x.quantity,
  715. productId: x.productId,
  716. })),
  717. };
  718. submitLoading.value = true;
  719. proxy.post("/purchaseBack/backOuts", data).then(
  720. (res) => {
  721. ElMessage({
  722. message: "操作成功",
  723. type: "success",
  724. });
  725. dialogVisible.value = false;
  726. submitLoading.value = false;
  727. getList();
  728. },
  729. (err) => (submitLoading.value = false)
  730. );
  731. } else {
  732. return ElMessage({
  733. message: "出库数量不能为0!",
  734. type: "info",
  735. });
  736. }
  737. } else if (submitType.value == 5) {
  738. if (formData.data.inWarehouseId === formData.data.outWarehouseId) {
  739. return ElMessage({
  740. message: "调出和调入仓库不可一致",
  741. type: "info",
  742. });
  743. }
  744. const list = formData.data.jdOrderDetailsList;
  745. for (let i = 0; i < list.length; i++) {
  746. const e = list[i];
  747. if (!(e.quantity > 0)) {
  748. return ElMessage({
  749. message: "调仓数量不能为0!",
  750. type: "info",
  751. });
  752. }
  753. if (e.quantity > e.waitQuantity) {
  754. return ElMessage({
  755. message: "调仓数量不能大于应出库数量!",
  756. type: "info",
  757. });
  758. }
  759. }
  760. submitLoading.value = true;
  761. proxy.post("/jdOrder/outbound", formData.data).then(
  762. (res) => {
  763. ElMessage({
  764. message: "操作成功",
  765. type: "success",
  766. });
  767. dialogVisible.value = false;
  768. submitLoading.value = false;
  769. getList();
  770. },
  771. (err) => (submitLoading.value = false)
  772. );
  773. } else if (submitType.value == 6) {
  774. const list = formData.data.jdOrderDetailsList;
  775. const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
  776. if (total > 0) {
  777. const data = {
  778. id: formData.data.id,
  779. businessId: formData.data.businessId,
  780. businessType: formData.data.businessType,
  781. warehouseId: formData.data.warehouseId,
  782. logisticsCompanyCode: formData.data.logisticsCompanyCode,
  783. logisticsCode: formData.data.logisticsCode,
  784. countryId: formData.data.countryId,
  785. provinceId: formData.data.provinceId,
  786. cityId: formData.data.cityId,
  787. areaDetail: formData.data.areaDetail,
  788. type: "2", //2是出库
  789. stockWaitDetailsList: list.map((x) => ({
  790. id: x.id,
  791. quantity: x.quantity,
  792. productId: x.productId,
  793. })),
  794. };
  795. submitLoading.value = true;
  796. proxy.post("/stockWait/addByWdly", data).then(
  797. (res) => {
  798. ElMessage({
  799. message: "操作成功",
  800. type: "success",
  801. });
  802. dialogVisible.value = false;
  803. submitLoading.value = false;
  804. getList();
  805. },
  806. (err) => (submitLoading.value = false)
  807. );
  808. } else {
  809. return ElMessage({
  810. message: "出库数量不能为0!",
  811. type: "info",
  812. });
  813. }
  814. }
  815. });
  816. };
  817. const submitType = ref("-1");
  818. const outBound = (row) => {
  819. submitType.value = row.businessType;
  820. if (row.businessType == 4) {
  821. modalType.value = "other";
  822. formConfig.value = configData.value[0];
  823. proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
  824. res.jdOrderDetailsList = res.stockWaitDetailsList.map((x) => ({
  825. ...x,
  826. waitQuantity: x.quantity,
  827. quantity: undefined,
  828. }));
  829. res.businessType = res.businessType + "";
  830. if (res.purchaseBackInfo) {
  831. res.contacts = res.purchaseBackInfo.contacts
  832. ? res.purchaseBackInfo.contacts
  833. : "";
  834. res.phone = res.purchaseBackInfo.phone
  835. ? res.purchaseBackInfo.phone
  836. : "";
  837. res.countryId = res.purchaseBackInfo.countryId
  838. ? res.purchaseBackInfo.countryId
  839. : "44";
  840. res.provinceId = res.purchaseBackInfo.provinceId
  841. ? res.purchaseBackInfo.provinceId
  842. : "";
  843. res.cityId = res.purchaseBackInfo.cityId
  844. ? res.purchaseBackInfo.cityId
  845. : "";
  846. res.areaDetail = res.purchaseBackInfo.detailedAddress
  847. ? res.purchaseBackInfo.detailedAddress
  848. : "";
  849. }
  850. formData.data = res;
  851. getCityData(formData.data.countryId, "20");
  852. if (res.provinceId) {
  853. getCityData(formData.data.provinceId, "30");
  854. }
  855. dialogVisible.value = true;
  856. });
  857. } else if (row.businessType == 5) {
  858. modalType.value = "add";
  859. formConfig.value = configData.value[2];
  860. proxy.post("/jdOrder/detail", { id: row.businessId }).then((res) => {
  861. res.jdOrderDetailsList = res.jdOrderDetailsList.map((x) => ({
  862. waitQuantity: x.quantity,
  863. quantity: undefined,
  864. productId: x.productId,
  865. id: x.id,
  866. productCustomCode: x.productCustomCode,
  867. productName: x.productName,
  868. productSpec: x.productSpec,
  869. }));
  870. formData.data = {
  871. id: row.businessId,
  872. outWarehouseId: "",
  873. inWarehouseId: "",
  874. jdOrderDetailsList: res.jdOrderDetailsList,
  875. };
  876. dialogVisible.value = true;
  877. });
  878. } else if (row.businessType == 6) {
  879. modalType.value = "edit";
  880. formConfig.value = configData.value[1];
  881. proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
  882. res.jdOrderDetailsList = res.stockWaitDetailsList.map((x) => ({
  883. ...x,
  884. waitQuantity: x.quantity,
  885. quantity: undefined,
  886. }));
  887. res.businessType = res.businessType + "";
  888. formData.data = res;
  889. dialogVisible.value = true;
  890. proxy
  891. .post("/orderInfo/detail", {
  892. id: row.businessId,
  893. })
  894. .then((res) => {
  895. formData.data.countryId = res.countryId ? res.countryId : "44";
  896. getCityData(formData.data.countryId, "20");
  897. formData.data.provinceId = res.provinceId ? res.provinceId : "";
  898. formData.data.cityId = res.cityId ? res.cityId : "";
  899. formData.data.areaDetail = res.detailedAddress
  900. ? res.detailedAddress
  901. : "";
  902. if (formData.data.provinceId) {
  903. getCityData(formData.data.provinceId, "30");
  904. }
  905. });
  906. });
  907. }
  908. };
  909. const warehouseType = ref([]);
  910. const handleRemove = (index) => {
  911. formData.data.jdOrderDetailsList.splice(index, 1);
  912. return ElMessage({
  913. message: "删除成功",
  914. type: "success",
  915. });
  916. };
  917. getList();
  918. const getDict = () => {
  919. proxy.getDictOne(["unit"]).then((res) => {
  920. productUnit.value = res["unit"].map((x) => ({
  921. label: x.dictValue,
  922. value: x.dictKey,
  923. }));
  924. });
  925. proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  926. if (res.rows && res.rows.length > 0) {
  927. warehouseList.value = res.rows.map((item) => {
  928. return {
  929. label: item.name,
  930. value: item.id,
  931. };
  932. });
  933. }
  934. });
  935. proxy.post("/companyInfo/list", { pageNum: 1, pageSize: 999 }).then((res) => {
  936. logisticsData.value = res.reverse();
  937. logisticsData.value = logisticsData.value.map((x) => ({
  938. label: x.name,
  939. value: x.code,
  940. }));
  941. });
  942. };
  943. getDict();
  944. const countryData = ref([]);
  945. const provinceData = ref([]);
  946. const cityData = ref([]);
  947. const getCityData = (id, type, flag) => {
  948. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  949. if (type === "20") {
  950. provinceData.value = res;
  951. if (flag) {
  952. formData.data.provinceId = "";
  953. formData.data.provinceName = "";
  954. formData.data.cityId = "";
  955. formData.data.cityName = "";
  956. }
  957. } else if (type === "30") {
  958. cityData.value = res;
  959. if (flag) {
  960. formData.data.cityId = "";
  961. formData.data.cityName = "";
  962. }
  963. } else {
  964. countryData.value = res;
  965. }
  966. });
  967. };
  968. getCityData("0");
  969. onMounted(() => {
  970. selectConfig[0].data = businessType;
  971. selectConfig[1].data = outboundType.value;
  972. });
  973. </script>
  974. <style lang="scss" scoped>
  975. .tenant {
  976. padding: 20px;
  977. }
  978. </style>