Files
zszq-trs/YLErpWeb/Views/trade/EodPositionRiskExport.cshtml
T
2024-05-09 14:06:26 +08:00

127 lines
4.3 KiB
Plaintext

@model EodPositionRisksReq
@{
Layout = "~/Views/Shared/_LayoutMini.cshtml";
var obj = new
{
title = ViewBag.Title,
url = ViewBag.Url,
processName = ViewBag.ProcessName
};
}
<style>
.layui-layer-title, .layui-layer-shade {
background-color: white !important;
color: black !important;
}
.layui-layer-btn0 {
min-width: 70px;
background: #e33333 !important;
border-radius: 5px !important;
border-color: #e33333 !important;
padding: 4px 12px;
outline: none !important;
color: #fff !important;
margin: 0 5px 1px 0;
}
.layui-layer-content {
margin: 0 10px;
}
</style>
@section JS{
<script type="text/javascript">
var page = @Json.Serialize(Model);
var obj = @Json.Serialize(obj);
var num = 0;
$(function () {
$("#status").hide();
asyncDownload(page);
});
function asyncDownload(postData) {
stopExport = true;
var start = dayjs(postData.StartDate);
var end = dayjs(postData.ValueDate);
if (start.format("YYYYMM") < end.format("YYYYMM")) {
postData.ValueDate = start.endOf('month').format("YYYY-MM-DD");//月末
}
else if (start.format("YYYYMMDD") > end.format("YYYYMMDD")) {
$("#msgDal").text("已导出"+num+"个文件");
layer.open({
type: 1,
title:"",
maxmin: false,
closeBtn: false,
area: [($(".main-content").innerWidth() - 50) + "px"],
content: $('#status'),
btn: ['关闭'],
yes: function () {
closePage();
}
});
return;
}
main.post(obj.url, postData);
main.waitMe(close);
parent.layer.closeAll();
main.open(
obj.title + "区间导出",
"/common/ProgressBar?processName=" + obj.processName +"&showStatus=true",
{
area: [($(".main-content").innerWidth()-50)+"px","180px"],
maxmin: false,
closeBtn: false,
btn:["结束进程并关闭"],
content: ["/common/ProgressBar?processName=" + obj.processName +"&showStatus=true", "no"],
end: function () {
num++;
if (!stopExport) {
setTimeout(() => {
postData.StartDate = start.add(1, 'month').startOf("month").format("YYYY-MM-DD");//下月
postData.ValueDate = end.format("YYYY-MM-DD");//下月
asyncDownload(postData);
}, 200);
} else {
main.post("/common/ProcessBarStop", { processName: obj.processName });
}
},
yes: function (index, layero) {
main.post("/common/ProcessBarStop", { processName: obj.processName }, { async: false });
debugger;
window.close();
}
});
}
function showMessage(mesg) {
}
var stopExport = false;
function ProcessInFinal(url) {
if (url) {
downLoadFile(url);
stopExport = false;
} else {
main.alert("导出失败");
stopExport = true;
}
}
function downLoadFile(downloadUrlStr) {
window.open(downloadUrlStr);
}
function closePage() {
window.close();
}
</script>
<div id="status" style="text-align-last: center; margin: 20px 0;">
<div>
<i class="fa fa-check-circle-o fa-5x" style="color:green;" aria-hidden="true"></i>
</div>
<div>
<span id="msg" style="font-size: large;">导出成功</span>
</div>
<div>
<span id="msgDal"></span>
</div>
</div>
}