28,390
社区成员
发帖
与我相关
我的任务
分享
// 导出按钮
$("[name=FileOutputButton]").click(function () {
var form = $("form#FileOutput");
//略...
form.submit();
});
@using (Html.BeginForm("C05_01_FileOutput", "C05", FormMethod.Post, new { id = "FileOutput" }))
{
@Html.HiddenFor(model => model.YEARS);
@Html.HiddenFor(model => model.RECORDING_MONTH);
@Html.HiddenFor(model => model.InsertUpdateFlg);
}
public ActionResult C05_01_FileOutput(xxx form)
{
//检索数据
......
//保存地址
string tmpPath = Request.MapPath("~/template");
tmpPath = Path.Combine(tmpPath + "/C05_01.xlsx");
string tmpDLPath = Request.MapPath("~/Tmp");
//文件输出
FinancialDB.fileOutput(form, tmpPath,ref tmpDLPath);
//返回文件
return File(new FileStream(tmpDLPath, FileMode.Open), "application/octet-stream", Server.UrlEncode("C05_01.xlsx"));
}
$("[name=FileOutputButton]").click(function () {
var form = $("form#FileOutput");
var years = year[0].options[year[0].options.selectedIndex].value;
var month=recordingMonth[0].options[recordingMonth[0].options.selectedIndex].value;
window.open('/C05/C05_01_FileOutput?year='+years+"&month="+month);
});