update copy

This commit is contained in:
lb 2023-07-07 16:13:49 +08:00
parent 1080660be3
commit 7828a1cc4e
7 changed files with 53 additions and 37 deletions

View File

@ -107,7 +107,7 @@ export default {
domProps: { domProps: {
title: opt.label ?? opt.name, 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'], class: ['operate--btn'],
on: { click: this.emit.bind(null, opt) }, on: { click: this.emit.bind(null, opt) },
}, },
@ -126,7 +126,7 @@ export default {
domProps: { domProps: {
title: opt.label ?? opt.name, 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'], class: ['operate--btn'],
on: { click: this.emit.bind(null, opt) }, on: { click: this.emit.bind(null, opt) },
}, },

View File

@ -328,11 +328,17 @@ export default {
}); });
} }
case "copy": { case "copy": {
return this.$http this.$confirm("是否复制该记录?", "提示", {
.post(this.urls.copyUrl, data, { confirmButtonText: "确定",
headers: { cancelButtonText: "取消",
"Content-Type": "application/json", type: "warning",
}, })
.then(() => {
return this.$http.post(this.urls.copyUrl, data, {
headers: {
"Content-Type": "application/json",
},
});
}) })
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code === 0) { if (res.code === 0) {
@ -351,12 +357,13 @@ export default {
} }
}) })
.catch((errMsg) => { .catch((errMsg) => {
this.$message({ errMsg !== 'cancel' && this.$message({
message: errMsg, message: errMsg,
type: "error", type: "error",
duration: 1500, duration: 1500,
}); });
}); });
break;
} }
case "change-category": { case "change-category": {
return this.$http.put(this.urls.base, data).then(({ data: res }) => { return this.$http.put(this.urls.base, data).then(({ data: res }) => {

View File

@ -336,8 +336,8 @@ export default {
this.openDialog(data, true); this.openDialog(data, true);
break; break;
} }
case 'toggle-attachment-dialog': { case "toggle-attachment-dialog": {
alert('查看附件') alert("查看附件");
break; break;
} }
case "view-blender-batch-details": { case "view-blender-batch-details": {
@ -398,27 +398,35 @@ export default {
}); });
} }
case "copy": { case "copy": {
//
let shouldShowOverlay = false; let shouldShowOverlay = false;
let payload = ""; this.$confirm("是否复制该记录?", "提示", {
console.log("copying...", type, data); confirmButtonText: "确定",
if (typeof data === "object") { cancelButtonText: "取消",
const head = data.head; type: "warning",
const copyOpt = })
("options" in head && Array.isArray(head.options) && head.options.find((item) => item.name === "copy")) || .then(() => {
null; //
if (copyOpt && "showOverlay" in copyOpt && copyOpt.showOverlay) { let payload = "";
this.overlayVisible = true; console.log("copying...", type, data);
shouldShowOverlay = true; if (typeof data === "object") {
payload = data.id; const head = data.head;
} const copyOpt =
} else payload = data; ("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 return this.$http.post(this.urls.copyUrl, payload, {
.post(this.urls.copyUrl, payload, { headers: {
headers: { "Content-Type": "application/json",
"Content-Type": "application/json", },
}, });
}) })
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code === 0) { if (res.code === 0) {
@ -438,13 +446,14 @@ export default {
if (shouldShowOverlay) this.overlayVisible = false; if (shouldShowOverlay) this.overlayVisible = false;
}) })
.catch((errMsg) => { .catch((errMsg) => {
this.$message({ errMsg !== 'cancel' && this.$message({
message: errMsg, message: errMsg,
type: "error", type: "error",
duration: 1500, duration: 1500,
}); });
if (shouldShowOverlay) this.overlayVisible = false; if (shouldShowOverlay) this.overlayVisible = false;
}); });
break;
} }
case "change-category": { case "change-category": {
return this.$http.put(this.urls.base, data).then(({ data: res }) => { return this.$http.put(this.urls.base, data).then(({ data: res }) => {

View File

@ -18,7 +18,7 @@ export default function () {
prop: "operations", prop: "operations",
name: "操作", name: "操作",
fixed: "right", fixed: "right",
width: 120, width: 128,
subcomponent: TableOperaionComponent, 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" }], options: [ { name: "copy", label: "复制", icon: "copy-document" }, { name: "edit", label: "编辑", icon: "edit-outline" }, { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:blenderStep:delete" }],
}, },

View File

@ -7,12 +7,12 @@ export default function () {
const tableProps = [ const tableProps = [
{ type: "index", label: "序号" }, { type: "index", label: "序号" },
{ width: 90, prop: "code", label: "原料编码" }, { width: 90, prop: "code", label: "原料编码" },
{ width: 240, prop: "description", label: "原料描述" }, { width: 320, prop: "description", label: "原料描述" },
{ width: 90, prop: "name", label: "中文名称" }, { width: 160, prop: "name", label: "中文名称" },
{ width: 120, prop: "maxSize", label: "原料最大尺寸", filter: val => val ?? '-' }, { 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 */} }, { width: 90, prop: "typeDictValue", label: "类型", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} },
{ prop: "baseMaterialCode", label: "基础原料编码" }, // { prop: "baseMaterialCode", label: "基础原料编码" },
{ prop: "baseMaterialDescription", label: "基础原料描述" }, // { prop: "baseMaterialDescription", label: "基础原料描述" },
// { prop: "type", label: "原料类型" }, // { prop: "type", label: "原料类型" },
{ width: 90, prop: "density", label: "堆积密度" }, { width: 90, prop: "density", label: "堆积密度" },
// { prop: "brandsOwner", label: "品牌" }, // { prop: "brandsOwner", label: "品牌" },

View File

@ -18,7 +18,7 @@ export default function () {
prop: "operations", prop: "operations",
name: "操作", name: "操作",
fixed: "right", fixed: "right",
width: 120, width: 128,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ options: [
{ name: "copy", label: "复制", icon: "copy-document", showOverlay: true, emitFull: true }, // showOverlay 和 emitFull 需同时使用 { name: "copy", label: "复制", icon: "copy-document", showOverlay: true, emitFull: true }, // showOverlay 和 emitFull 需同时使用

View File

@ -18,7 +18,7 @@ export default function () {
prop: "operations", prop: "operations",
name: "操作", name: "操作",
fixed: "right", fixed: "right",
width: 120, width: 128,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ options: [
{ name: "copy", label: "复制", icon: "copy-document" }, { name: "copy", label: "复制", icon: "copy-document" },