- 新增 tradeEndConfirmSendEmail.js(独立文件降冲突),含纯函数 buildSettleEmailSendPayload 便于单测 - tradeEndConfirmList.js showToolName 加按钮,受 pageData.canSendEmail + ContractDocUrl 控制,跳过"多空组合" - cshtml 引入新脚本;后端零改动(复用 SwapEndConfirmService.BatchSendSettleEmail -> bond-oms Java) - 安全: 新按钮不引入新增 XSS/CSRF 暴露; CSRF token 缺失为全站既有问题,与批量按钮同源
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
// 结算确认书:单行发送邮件(复用 /swaptrade2/BatchSendSettleEmail 服务端代理 → bond-oms Java 发信)
|
|
// 单独成文件,降低与 tradeEndConfirmList.js 的并发修改冲突;核心发送逻辑与网格渲染解耦,便于单测。
|
|
|
|
// 纯函数:根据加密平仓流水ID构造请求负载(不依赖 $.ajax / DOM),便于单元验证。
|
|
function buildSettleEmailSendPayload(encryptId) {
|
|
return { url: "/swaptrade2/BatchSendSettleEmail", swapFlowEventIds: encryptId };
|
|
}
|
|
|
|
// 单行发送结算确认书邮件;encryptId 为空、或与批量 SendEmailEitherReport 一致地跳过"多空组合"时早退。
|
|
function sendSettleEmail(encryptId, structureType) {
|
|
if (!encryptId) {
|
|
main.message("缺少平仓流水ID");
|
|
return;
|
|
}
|
|
if (structureType === "多空组合") {
|
|
main.message("多空组合不支持发送结算确认书");
|
|
return;
|
|
}
|
|
var payload = buildSettleEmailSendPayload(encryptId);
|
|
$.ajax({
|
|
type: "post",
|
|
url: payload.url,
|
|
data: { swapFlowEventIds: payload.swapFlowEventIds },
|
|
dataType: "json",
|
|
success: function (res) {
|
|
if (res && res.success) {
|
|
main.message(res.msg || "发送成功");
|
|
SearchClick();
|
|
} else {
|
|
main.message((res && (res.msg || res.message)) || "发送失败");
|
|
}
|
|
},
|
|
error: function (xhr) {
|
|
main.message("发送请求失败(HTTP " + xhr.status + "),请检查服务");
|
|
console.error("[单行发送结算确认书] 请求失败:", xhr);
|
|
},
|
|
beforeSend: function () { main.waitMe(true); },
|
|
complete: function () { main.waitMe(false); }
|
|
});
|
|
}
|