From ea46739942b39816cca3dd26b4419614717799d8 Mon Sep 17 00:00:00 2001 From: lb Date: Sun, 23 Apr 2023 15:06:39 +0800 Subject: [PATCH] update 2023.4.23 --- src/views/atomViews/ListViewWithHead.vue | 66 +++++++++++++++++------ src/views/modules/pms/bom/config.js | 29 +++++----- src/views/modules/pms/order/index.vue | 4 +- src/views/modules/pms/shapeStep/config.js | 2 +- 4 files changed, 68 insertions(+), 33 deletions(-) diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index db9bd0e..9cce7b7 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -1,6 +1,6 @@ @@ -31,6 +32,7 @@ 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 Overlay from '@/components/Overlay.vue'; import moment from "moment"; const DIALOG_WITH_MENU = "DialogWithMenu"; @@ -39,7 +41,7 @@ const DIALOG_CARPAYLOAD = "DialogCarPayload"; export default { name: "ListViewWithHead", - components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload }, + components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload, Overlay }, props: { tableConfig: { type: Object, @@ -110,6 +112,7 @@ export default { tableLoading: false, refreshLayoutKey: null, uploadDialogVisible: false, + overlayVisible: false, }; }, inject: ["urls"], @@ -312,8 +315,22 @@ export default { }); } case "copy": { + // + let shouldShowOverlay = false + let payload = '' + console.log('copying...', type, data) + if (typeof data === 'object') { + const head = data.head + const copyOpt = ('options' in head && Array.isArray(head.options) && head.options.find(item => item.name === 'copy')) || null + if (copyOpt && 'showOverlay' in copyOpt && copyOpt.showOverlay) { + this.overlayVisible = true + shouldShowOverlay = true + payload = data.id + } + } else payload = data + return this.$http - .post(this.urls.copyUrl, data, { + .post(this.urls.copyUrl, payload, { headers: { "Content-Type": "application/json", }, @@ -333,6 +350,7 @@ export default { duration: 1500, }); } + if (shouldShowOverlay) this.overlayVisible = false }) .catch((errMsg) => { this.$message({ @@ -340,6 +358,7 @@ export default { type: "error", duration: 1500, }); + if (shouldShowOverlay) this.overlayVisible = false }); } case "change-category": { @@ -431,21 +450,38 @@ export default { break; } case "sync": { + let shouldShowOverlay = false + let payload = '' + console.log('sync...', type, data) + if (typeof data === 'object') { + const head = data.head + const syncOpt = ('options' in head && Array.isArray(head.options) && head.options.find(item => item.name === 'sync')) || null + if (syncOpt && 'showOverlay' in syncOpt && syncOpt.showOverlay) { + this.overlayVisible = true + shouldShowOverlay = true + payload = data.id + } + } else payload = data + + this.$message({ + message: '正在发起同步...', + type: "success", + }); + // 同步单个料仓数据 this.$http - .post(this.urls.syncSingleUrl, data, { + .post(this.urls.syncSingleUrl, payload, { headers: { "Content-Type": "application/json", }, }) .then(({ data: res }) => { - if (res.code === 0) { - this.$message({ - message: "同步成功", - type: "success", - }); - this.getList(); - } + this.$message({ + message: res.msg, + type: res.code === 0 ? "success" : 'error', + }); + this.getList(); + if (shouldShowOverlay) this.overlayVisible = false }); } } @@ -507,11 +543,9 @@ export default { case "同步": case "全部同步": this.$http.post(this.urls.syncUrl).then(({ data: res }) => { - console.log("全部同步", res); - if (res.code === 0) { - this.$message({ message: "同步成功", type: "success" }); - this.getList(); - } + console.log("同步", res); + this.$message({ message: res.msg, type: res.code === 0 ? "success" : 'error' }); + this.getList(); }); break; } diff --git a/src/views/modules/pms/bom/config.js b/src/views/modules/pms/bom/config.js index a623b37..1289e61 100644 --- a/src/views/modules/pms/bom/config.js +++ b/src/views/modules/pms/bom/config.js @@ -27,18 +27,19 @@ export default function () { actionName: "to-bom-detail", emitFullData: true, }, - // { - // prop: "operations", - // name: "操作", - // fixed: "right", - // width: 120, - // subcomponent: TableOperaionComponent, - // options: [ - // { name: "copy", label: "复制", icon: "copy-document" }, - // { name: "edit", label: "编辑", icon: "edit-outline" }, - // { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" }, - // ], - // }, + { + prop: "operations", + name: "操作", + fixed: "right", + width: 120, + subcomponent: TableOperaionComponent, + options: [ + { name: "sync", label: "同步", icon: "refresh", emitFull: true, showOverlay: true } + // { name: "copy", label: "复制", icon: "copy-document" }, + // { name: "edit", label: "编辑", icon: "edit-outline" }, + // { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" }, + ], + }, ]; const headFormFields = [ @@ -71,9 +72,8 @@ export default function () { // }, // { // button: { - // // type: "plain", + // type: "plain", // name: "同步", - // type: 'primary' // }, // }, ]; @@ -265,6 +265,7 @@ export default function () { subpage: "/pms/bomMaterial/page", importUrl: "/pms/order/importExcelBom", // 导入的api templateUrl: "/importTemplates/bomImport.xlsx", + syncSingleUrl: "/pms/trans/bomSync" }, }; } diff --git a/src/views/modules/pms/order/index.vue b/src/views/modules/pms/order/index.vue index 292b2fe..5f71fb0 100644 --- a/src/views/modules/pms/order/index.vue +++ b/src/views/modules/pms/order/index.vue @@ -28,7 +28,7 @@ :dialog-config="dialogConfigs" @refresh-tables="handleRefreshTable" /> - + /> --> diff --git a/src/views/modules/pms/shapeStep/config.js b/src/views/modules/pms/shapeStep/config.js index 0fb1883..11ff0f1 100644 --- a/src/views/modules/pms/shapeStep/config.js +++ b/src/views/modules/pms/shapeStep/config.js @@ -21,7 +21,7 @@ export default function () { width: 120, subcomponent: TableOperaionComponent, options: [ - { name: "copy", label: "复制", icon: "copy-document" }, + { name: "copy", label: "复制", icon: "copy-document", showOverlay: true, emitFull: true }, // showOverlay 和 emitFull 需同时使用 { name: "edit", label: "编辑", icon: "edit-outline" }, { name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:shapeStep:delete" }], },