fix(zszq-trs): 结算确认书列表新增每行发送邮件按钮,复用 BatchSendSettleEmail
- 新增 tradeEndConfirmSendEmail.js(独立文件降冲突),含纯函数 buildSettleEmailSendPayload 便于单测 - tradeEndConfirmList.js showToolName 加按钮,受 pageData.canSendEmail + ContractDocUrl 控制,跳过"多空组合" - cshtml 引入新脚本;后端零改动(复用 SwapEndConfirmService.BatchSendSettleEmail -> bond-oms Java) - 安全: 新按钮不引入新增 XSS/CSRF 暴露; CSRF token 缺失为全站既有问题,与批量按钮同源
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
</script>
|
||||
<script src="~/Scripts/app/tradeHelper.js?v=@HtmlUtil.JsVersion"></script>
|
||||
<script src="~/Scripts/app/swaptrade/tradeEndConfirmList.js?v=@HtmlUtil.JsVersion"></script>
|
||||
<script src="~/Scripts/app/swaptrade/tradeEndConfirmSendEmail.js?v=@HtmlUtil.JsVersion"></script>
|
||||
}
|
||||
|
||||
<div class="searchdiv">
|
||||
|
||||
@@ -26,6 +26,11 @@ function showToolName(cellValue, options, rowObject) {
|
||||
//var disabled = pageData.canGenerate == true ? "" : "disabled";
|
||||
//html += "<input type=\"button\" class=\"wentiEdit\" title='修改支付日期' onclick=\"ModifyPayDate('{0}','{1}')\" style=\"width: 120px!important;\" value=\"{2}\" {3}/>"
|
||||
// .template(rowObject.swap_flow_event.EncryptId, rowObject.swap_flow_event.PayDate, "修改支付日期", disabled);
|
||||
if (rowObject.ContractDocUrl && pageData.canSendEmail) {
|
||||
html +=
|
||||
"<input type=\"button\" class=\"wentiEdit\" title='发送结算确认书邮件到客户' onclick=\"sendSettleEmail('{0}','{1}')\" value=\"{2}\" />"
|
||||
.template(rowObject.swap_flow_event.EncryptId, rowObject.trade.StructureType, "发送Email");
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// 结算确认书:单行发送邮件(复用 /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); }
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user