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

@@ -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 }) => {