fix: 审批时剪切板复制移到API调用之前,修复user activation过期问题

This commit is contained in:
taiyi 2026-07-14 21:20:33 +08:00
parent b16353ea22
commit ecb2f69223
2 changed files with 15 additions and 11 deletions

View File

@ -303,15 +303,7 @@ async function handleApprove(result) {
approve_result: result,
approve_opinion: approveOpinion.value || (result === "pass" ? "审批通过" : "审批驳回"),
};
if (orderInfo.value.orderStatus === "cancel_pending" || orderInfo.value.orderStatus === "cancel_fulfillment_pending") {
await cancelApproveOrder(orderInfo.value.orderId, payload);
toast.success(result === "pass" ? "取消审批已通过" : "已驳回取消申请");
} else {
await approveOrder(orderInfo.value.orderId, payload);
toast.success(result === "pass" ? "审批已通过" : "已驳回");
}
// ????????? user activation ?????
if (result === "pass" && orderInfo.value.orderStatus !== "cancel_pending" && orderInfo.value.orderStatus !== "cancel_fulfillment_pending") {
const text = buildCopyText();
if (text) {
@ -328,13 +320,21 @@ async function handleApprove(result) {
document.execCommand("copy");
document.body.removeChild(ta);
}
toast.success("采购信息已复制到剪切板");
} catch (e) {
console.warn("剪切板写入失败:", e);
console.warn("clipboard write failed:", e);
}
}
}
if (orderInfo.value.orderStatus === "cancel_pending" || orderInfo.value.orderStatus === "cancel_fulfillment_pending") {
await cancelApproveOrder(orderInfo.value.orderId, payload);
toast.success(result === "pass" ? "取消审批已通过" : "已驳回取消申请");
} else {
await approveOrder(orderInfo.value.orderId, payload);
toast.success(result === "pass" ? "审批已通过" : "已驳回");
}
await loadDetail();
} catch (error) {
toast.error(error.message || "审批操作失败");

View File

@ -2002,6 +2002,8 @@ async function handleApprovalPass() {
} catch {
const ta = document.createElement('textarea');
ta.value = copyText;
ta.style.position = 'fixed';
ta.style.left = '-9999px';
document.body.appendChild(ta);
ta.select();
document.execCommand('copy');
@ -2130,6 +2132,8 @@ async function handleCopySupplierText() {
//
const textarea = document.createElement('textarea');
textarea.value = supplierText.value;
textarea.style.position = 'fixed';
textarea.style.left = '-9999px';
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');