From 7828a1cc4ea91c19f499887249d4f892088110e7 Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 7 Jul 2023 16:13:49 +0800 Subject: [PATCH] update copy --- .../operationComponent.js | 4 +- src/views/atomViews/ListView.vue | 19 ++++--- src/views/atomViews/ListViewWithHead.vue | 53 +++++++++++-------- src/views/modules/pms/firingStep/config.js | 2 +- src/views/modules/pms/material/config.js | 8 +-- src/views/modules/pms/shapeStep/config.js | 2 +- src/views/modules/pms/testingStep/config.js | 2 +- 7 files changed, 53 insertions(+), 37 deletions(-) diff --git a/src/components/noTemplateComponents/operationComponent.js b/src/components/noTemplateComponents/operationComponent.js index 7239cd2..e59e139 100644 --- a/src/components/noTemplateComponents/operationComponent.js +++ b/src/components/noTemplateComponents/operationComponent.js @@ -107,7 +107,7 @@ export default { domProps: { title: opt.label ?? opt.name, }, - style: { color: !shouldDisabled && (opt.color || this.colors[opt.name] || "#0b58ff"), padding: 0, margin: '5px 9px 5px 0' }, + style: { color: !shouldDisabled && (opt.color || this.colors[opt.name] || "#0b58ff"), padding: 0, margin: '5px 9px 5px 0', fontSize: '18px' }, class: ['operate--btn'], on: { click: this.emit.bind(null, opt) }, }, @@ -126,7 +126,7 @@ export default { domProps: { title: opt.label ?? opt.name, }, - style: { color: this.colors[opt] || "#0b58ff", padding: 0, margin: '5px 9px 5px 0' }, + style: { color: this.colors[opt] || "#0b58ff", padding: 0, margin: '5px 9px 5px 0', fontSize: '18px' }, class: ['operate--btn'], on: { click: this.emit.bind(null, opt) }, }, diff --git a/src/views/atomViews/ListView.vue b/src/views/atomViews/ListView.vue index f7b7b63..9a3e56c 100644 --- a/src/views/atomViews/ListView.vue +++ b/src/views/atomViews/ListView.vue @@ -328,11 +328,17 @@ export default { }); } case "copy": { - return this.$http - .post(this.urls.copyUrl, data, { - headers: { - "Content-Type": "application/json", - }, + this.$confirm("是否复制该记录?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + return this.$http.post(this.urls.copyUrl, data, { + headers: { + "Content-Type": "application/json", + }, + }); }) .then(({ data: res }) => { if (res.code === 0) { @@ -351,12 +357,13 @@ export default { } }) .catch((errMsg) => { - this.$message({ + errMsg !== 'cancel' && this.$message({ message: errMsg, type: "error", duration: 1500, }); }); + break; } case "change-category": { return this.$http.put(this.urls.base, data).then(({ data: res }) => { diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index 88ea7e8..e9dbeea 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -336,8 +336,8 @@ export default { this.openDialog(data, true); break; } - case 'toggle-attachment-dialog': { - alert('查看附件') + case "toggle-attachment-dialog": { + alert("查看附件"); break; } case "view-blender-batch-details": { @@ -398,27 +398,35 @@ 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; + this.$confirm("是否复制该记录?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + // + 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, payload, { - headers: { - "Content-Type": "application/json", - }, + return this.$http.post(this.urls.copyUrl, payload, { + headers: { + "Content-Type": "application/json", + }, + }); }) .then(({ data: res }) => { if (res.code === 0) { @@ -438,13 +446,14 @@ export default { if (shouldShowOverlay) this.overlayVisible = false; }) .catch((errMsg) => { - this.$message({ + errMsg !== 'cancel' && this.$message({ message: errMsg, type: "error", duration: 1500, }); if (shouldShowOverlay) this.overlayVisible = false; }); + break; } case "change-category": { return this.$http.put(this.urls.base, data).then(({ data: res }) => { diff --git a/src/views/modules/pms/firingStep/config.js b/src/views/modules/pms/firingStep/config.js index 72d0878..982a0fd 100644 --- a/src/views/modules/pms/firingStep/config.js +++ b/src/views/modules/pms/firingStep/config.js @@ -18,7 +18,7 @@ export default function () { prop: "operations", name: "操作", fixed: "right", - width: 120, + width: 128, subcomponent: TableOperaionComponent, options: [ { name: "copy", label: "复制", icon: "copy-document" }, { name: "edit", label: "编辑", icon: "edit-outline" }, { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:blenderStep:delete" }], }, diff --git a/src/views/modules/pms/material/config.js b/src/views/modules/pms/material/config.js index 0fa5fc9..053a3d6 100644 --- a/src/views/modules/pms/material/config.js +++ b/src/views/modules/pms/material/config.js @@ -7,12 +7,12 @@ export default function () { const tableProps = [ { type: "index", label: "序号" }, { width: 90, prop: "code", label: "原料编码" }, - { width: 240, prop: "description", label: "原料描述" }, - { width: 90, prop: "name", label: "中文名称" }, + { width: 320, prop: "description", label: "原料描述" }, + { width: 160, prop: "name", label: "中文名称" }, { width: 120, prop: "maxSize", label: "原料最大尺寸", filter: val => val ?? '-' }, { width: 90, prop: "typeDictValue", label: "类型", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} }, - { prop: "baseMaterialCode", label: "基础原料编码" }, - { prop: "baseMaterialDescription", label: "基础原料描述" }, + // { prop: "baseMaterialCode", label: "基础原料编码" }, + // { prop: "baseMaterialDescription", label: "基础原料描述" }, // { prop: "type", label: "原料类型" }, { width: 90, prop: "density", label: "堆积密度" }, // { prop: "brandsOwner", label: "品牌" }, diff --git a/src/views/modules/pms/shapeStep/config.js b/src/views/modules/pms/shapeStep/config.js index 52c4d6e..b40d0d2 100644 --- a/src/views/modules/pms/shapeStep/config.js +++ b/src/views/modules/pms/shapeStep/config.js @@ -18,7 +18,7 @@ export default function () { prop: "operations", name: "操作", fixed: "right", - width: 120, + width: 128, subcomponent: TableOperaionComponent, options: [ { name: "copy", label: "复制", icon: "copy-document", showOverlay: true, emitFull: true }, // showOverlay 和 emitFull 需同时使用 diff --git a/src/views/modules/pms/testingStep/config.js b/src/views/modules/pms/testingStep/config.js index 1ecd3c2..3f61b63 100644 --- a/src/views/modules/pms/testingStep/config.js +++ b/src/views/modules/pms/testingStep/config.js @@ -18,7 +18,7 @@ export default function () { prop: "operations", name: "操作", fixed: "right", - width: 120, + width: 128, subcomponent: TableOperaionComponent, options: [ { name: "copy", label: "复制", icon: "copy-document" },