From 4ef75b055ef3118e6b5fb31d802e080da0269b3d Mon Sep 17 00:00:00 2001 From: lb Date: Tue, 11 Apr 2023 10:53:15 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9E=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=BB=84=E4=BB=B6;=20update=20=E6=9B=B4=E6=96=B0=E9=85=8D?= =?UTF-8?q?=E6=96=B9bom=E7=9A=84=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DialogUpload.vue | 188 +++++++++++++++++++++++ src/views/atomViews/ListViewWithHead.vue | 185 +++++++++++++--------- src/views/modules/pms/bom/config.js | 1 + 3 files changed, 302 insertions(+), 72 deletions(-) create mode 100644 src/components/DialogUpload.vue diff --git a/src/components/DialogUpload.vue b/src/components/DialogUpload.vue new file mode 100644 index 0000000..961eced --- /dev/null +++ b/src/components/DialogUpload.vue @@ -0,0 +1,188 @@ + + + + + diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index 22134d0..c3922c2 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -4,23 +4,54 @@ - - - - - + - + + @@ -30,6 +61,7 @@ import BaseSearchForm from "@/components/BaseSearchForm.vue"; import DialogWithMenu from "@/components/DialogWithMenu.vue"; import DialogJustForm from "@/components/DialogJustForm.vue"; import DialogCarPayload from "@/components/DialogCarPayload.vue"; +import DialogUpload from "@/components/DialogUpload.vue"; import moment from "moment"; const DIALOG_WITH_MENU = "DialogWithMenu"; @@ -38,7 +70,7 @@ const DIALOG_CARPAYLOAD = "DialogCarPayload"; export default { name: "ListViewWithHead", - components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload }, + components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload }, props: { tableConfig: { type: Object, @@ -109,6 +141,7 @@ export default { dataList: [], tableLoading: false, refreshLayoutKey: null, + uploadDialogVisible: false, }; }, inject: ["urls"], @@ -123,9 +156,9 @@ export default { const params = queryParams ? { ...queryParams, page: this.page, limit: this.size } : { - page: this.page, - limit: this.size, - }; + page: this.page, + limit: this.size, + }; if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) { this.listQueryExtra.map((nameOrObj) => { @@ -138,18 +171,15 @@ export default { }); } - // if (this.urls.pageIsPostApi) { - // } else { - // 默认是 get 方式请求 page this.$http[this.urls.pageIsPostApi ? "post" : "get"]( this.urls.page, this.urls.pageIsPostApi ? { - ...params, - } + ...params, + } : { - params, - } + params, + } ) .then(({ data: res }) => { console.log("[http response] res is: ", res); @@ -245,7 +275,7 @@ export default { } }); }) - .catch((err) => { }); + .catch((err) => {}); } case "edit": { this.openDialog(data); /** data is ==> id */ @@ -300,7 +330,7 @@ export default { break; } case "to-bom-detail": { - console.log('to-bom-detail', data) + console.log("to-bom-detail", data); // 查看配方详情 return this.$router.push({ name: "pms-bomDetails", @@ -381,40 +411,39 @@ export default { }); } case "detach": { - - return this.$confirm('是否下发?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this.$http - .post(this.urls.detach, data /* { id: data } */, { headers: { "Content-Type": "application/json" } }) - .then(({ data: res }) => { - if (res.code === 0) { - this.$message({ - message: "下发成功", - type: "success", - duration: 1500, - onClose: () => { - this.getList(); - }, - }); - } else { - this.$message({ - message: `${res.code}: ${res.msg}`, - type: "error", - duration: 1500, - }); - } + return this.$confirm("是否下发?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + this.$http + .post(this.urls.detach, data /* { id: data } */, { headers: { "Content-Type": "application/json" } }) + .then(({ data: res }) => { + if (res.code === 0) { + this.$message({ + message: "下发成功", + type: "success", + duration: 1500, + onClose: () => { + this.getList(); + }, + }); + } else { + this.$message({ + message: `${res.code}: ${res.msg}`, + type: "error", + duration: 1500, + }); + } + }); + }) + .catch(() => { + this.$message({ + type: "warning", + message: "已取消下发", }); - }).catch(() => { - this.$message({ - type: 'warning', - message: '已取消下发' }); - }); - - } case "to-car-history": { return this.$router.push({ @@ -431,19 +460,21 @@ export default { } case "sync": { // 同步单个料仓数据 - this.$http.post(this.urls.syncSingleUrl, data, { - headers: { - "Content-Type": "application/json" - } - }).then(({ data: res }) => { - if (res.code === 0) { - this.$message({ - message: '同步成功', - type: 'success' - }); - this.getList(); - } - }) + this.$http + .post(this.urls.syncSingleUrl, data, { + headers: { + "Content-Type": "application/json", + }, + }) + .then(({ data: res }) => { + if (res.code === 0) { + this.$message({ + message: "同步成功", + type: "success", + }); + this.getList(); + } + }); } } }, @@ -461,7 +492,9 @@ export default { case "新增": this.openDialog(); break; - + case "导入": + this.openUploadDialog(); + break; case "手动添加": { this.openDialog(); return; @@ -502,9 +535,9 @@ export default { case "同步": case "全部同步": this.$http.post(this.urls.syncUrl).then(({ data: res }) => { - console.log('全部同步', res) + console.log("全部同步", res); if (res.code === 0) { - this.$message({ message: '同步成功', type: 'success' }) + this.$message({ message: "同步成功", type: "success" }); this.getList(); } }); @@ -540,6 +573,14 @@ export default { this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info, extraParams); }); }, + + openUploadDialog() { + this.uploadDialogVisible = true; + + this.$nextTick(() => { + this.$refs["upload-dialog"].init(); + }); + }, }, }; diff --git a/src/views/modules/pms/bom/config.js b/src/views/modules/pms/bom/config.js index c4c99ed..516e466 100644 --- a/src/views/modules/pms/bom/config.js +++ b/src/views/modules/pms/bom/config.js @@ -251,6 +251,7 @@ export default function () { copyUrl: "/pms/bom/copy", subase: "/pms/bomMaterial", subpage: "/pms/bomMaterial/page", + importOrderUrl: '/pms/order/importExcelBom', // 导入的api }, }; }