110 lines
4.1 KiB
Plaintext
110 lines
4.1 KiB
Plaintext
@{
|
|
ViewBag.Title = "互换持仓 | 互换持仓明细导入";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var pageObj = new
|
|
{
|
|
valueDate = valuedateBLL.ValueDate.ToString("yyyy-MM-dd"),
|
|
};
|
|
}
|
|
|
|
@section JS
|
|
{
|
|
<script type="text/javascript">
|
|
const page = @Json.Serialize(pageObj);
|
|
$(function () {
|
|
main.setTradeDatePicker(page.valueDate, "");
|
|
});
|
|
//ESC按键关闭窗口
|
|
$(document).keyup(function (event) {
|
|
(event.keyCode === 27) && closeMe();
|
|
});
|
|
function UploadFile(options) {
|
|
if (!options || !options.url || !options.inputId) {
|
|
throw '[UploadFile]参数错误';
|
|
}
|
|
let file = $('#' + options.inputId).prop('files');
|
|
if (!file || !file[0]) return;
|
|
file = file[0];
|
|
|
|
let ValueDate = $("#ValueDate").val();
|
|
|
|
var formData = new FormData();
|
|
formData.append("file", file, file.name);
|
|
formData.append("upload_file", true);
|
|
formData.append("ValueDate", ValueDate);
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: options.url,
|
|
xhr: function () {
|
|
var myXhr = $.ajaxSettings.xhr();
|
|
if (myXhr.upload) {
|
|
myXhr.upload.addEventListener('progress', options.progressFn, false);
|
|
}
|
|
return myXhr;
|
|
},
|
|
beforeSend() {
|
|
main.waitMe("show");
|
|
},
|
|
success: options.success,
|
|
error(error) {
|
|
main.alert("导入失败:" + error.statusText);
|
|
},
|
|
complete(result) {
|
|
main.waitMe("hide");
|
|
$('#' + options.inputId).val('');
|
|
},
|
|
async: true,
|
|
data: formData,
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
timeout: 0 //永不超时 ,导入不限制超时时间
|
|
});
|
|
}
|
|
|
|
function uploadEodMannual(url) {
|
|
let ValueDate = $("#ValueDate").val();
|
|
if (!ValueDate) {
|
|
return main.alert("请选择结算日期!");
|
|
}
|
|
let fileName = $("#openFile").val();
|
|
if (!fileName) {
|
|
return main.alert("请选择要导入的文件!");
|
|
}
|
|
let index = fileName.lastIndexOf(".");
|
|
let fileEx = index > 0 ? fileName.substr(index).toLowerCase() : '';
|
|
if (fileEx !== '.xlsx') {
|
|
return main.alert("只能上传.xlsx类型的文件!");
|
|
}
|
|
function success(data) {
|
|
if (data.success) {
|
|
_reloadData = 'reloadData';
|
|
main.alert(!data.totalNum ? '导入成功!' : "共 {0} 条数据,导入成功 {1} 条数据!".template(data.totalNum, data.successNum));
|
|
} else {
|
|
main.alert("导入失败:" + data.msg);
|
|
}
|
|
}
|
|
main.confirm("确定导入?", UploadFile.bind(null, { inputId: 'openFile', url: url, success: success }));
|
|
}
|
|
|
|
</script>
|
|
}
|
|
|
|
<form id="tradeUploadForm" method="post" class="yc-panel" onsubmit="return false;" style="padding-bottom:30px;">
|
|
<h4 class="mb-4">互换持仓明细导入</h4>
|
|
<div class="mb-4">
|
|
<span class="mr-1"> 结算日期:</span>
|
|
<input type="text" class="datepicker" id="ValueDate" value="@(valuedateBLL.ValueDate.ToString("yyyy-MM-dd"))" name="ValueDate" placeholder="请输入结算日期" autocomplete="off">
|
|
</div>
|
|
<div class="mb-4">
|
|
<input type="file" id="openFile" name="file" accept=".xlsx" />
|
|
</div>
|
|
<div class="mb-4">
|
|
@MyControls.Btn("互换持仓明细导入", "uploadEodMannual('/eod_trade_value/UploadEodTradeSwapMannual')")
|
|
<a class="btn btn-primary" href="~/App_Docs/导入模板/互换持仓导入模板_国君.xlsx" target="_blank">
|
|
下载互换持仓导入模板
|
|
</a>
|
|
</div>
|
|
</form>
|