[緊急應變] 緊急聯絡匯出程序修正

This commit is contained in:
dev01 2023-07-25 13:24:01 +08:00
parent 36f18506e2
commit 77e2535f89
14 changed files with 44 additions and 10 deletions

View File

@ -107,7 +107,7 @@ namespace FrontendWebApi.ApiControllers
[HttpPost] [HttpPost]
[Route("api/EmergencyContact/PDF")] [Route("api/EmergencyContact/PDF")]
public async Task<ActionResult<ApiResult<string>>> ExportPDF(export post) public async Task<ActionResult<ApiResult<string>>> ExportPDF([FromBody] export post)
{ {
//var grouping = JsonConvert.DeserializeObject<export>(post); //var grouping = JsonConvert.DeserializeObject<export>(post);
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();
@ -182,7 +182,7 @@ namespace FrontendWebApi.ApiControllers
[HttpPost] [HttpPost]
[Route("api/EmergencyContact/Excel")] [Route("api/EmergencyContact/Excel")]
public async Task<ActionResult<ApiResult<string>>> ExportExcel(export post) public async Task<ActionResult<ApiResult<string>>> ExportExcel([FromBody] export post)
{ {
//var guid = Guid.NewGuid().ToString(); //var guid = Guid.NewGuid().ToString();
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();

View File

@ -32,8 +32,6 @@
</div> </div>
<div class="pr-3 row col"> <div class="pr-3 row col">
<div class="frame-wrap" id="groupinglist"> <div class="frame-wrap" id="groupinglist">
</div> </div>
</div> </div>
<div class="card border mb-g w-100 mb-5" id="emergency_setting_card"> <div class="card border mb-g w-100 mb-5" id="emergency_setting_card">
@ -201,8 +199,7 @@
} }
//選擇組別 //選擇組別
function SelectGrouping(grouping, e) function SelectGrouping(grouping, e) {
{
if ($(e).hasClass("btn-outline-success")) { if ($(e).hasClass("btn-outline-success")) {
$(e).removeClass("btn-outline-success").addClass("btn-success"); $(e).removeClass("btn-outline-success").addClass("btn-success");
selectgroupidlist.push(grouping); selectgroupidlist.push(grouping);
@ -218,8 +215,7 @@
} }
//全選所有組別 //全選所有組別
function Allgroupingselect() function Allgroupingselect() {
{
if (Allgroupingbool) { if (Allgroupingbool) {
$('#groupinglist').find(".btn-success").removeClass("btn-success").addClass("btn-outline-success"); $('#groupinglist').find(".btn-success").removeClass("btn-success").addClass("btn-outline-success");
selectgroupidlist = []; selectgroupidlist = [];
@ -249,7 +245,27 @@
disaster: $('#Disasterlist').find('.btn-success').html(), disaster: $('#Disasterlist').find('.btn-success').html(),
groupidlist: selectgroupidlist groupidlist: selectgroupidlist
} }
window.location = "/EmergencyContact/ExportPDF?post=" + JSON.stringify(send_data);
var url = "/api/EmergencyContact/PDF";
$.ajax({
method: "POST",
contentType:"application/json; chatset='utf-8'",
headers: { "Authorization": "Bearer " + localStorage.getItem('JWT-Authorization') },
url: url,
data: JSON.stringify(send_data),
success: (res, text, xhr) => {
if (res.code == "9999") {
toast_error(res.msg);
return;
}
if(res.data && res.code == "0000"){
window.open(location.origin + "/" + res.data)
} else {
toast_error("系統發生錯誤,請再重新嘗試");
}
}
})
} }
} }
@ -269,7 +285,25 @@
disaster: $('#Disasterlist').find('.btn-success').html(), disaster: $('#Disasterlist').find('.btn-success').html(),
groupidlist: selectgroupidlist groupidlist: selectgroupidlist
} }
window.location = "/EmergencyContact/ExportExcel?post=" + JSON.stringify(send_data); var url = "/api/EmergencyContact/Excel";
$.ajax({
method: "POST",
contentType: "application/json; chatset='utf-8'",
headers: { "Authorization": "Bearer " + localStorage.getItem('JWT-Authorization') },
url: url,
data: JSON.stringify(send_data),
success: (res, text, xhr) => {
if (res.code == "9999") {
toast_error(res.msg);
return;
}
if(res.data && res.code == "0000"){
window.open(location.origin + "/" + res.data)
} else {
toast_error("系統發生錯誤,請再重新嘗試");
}
}
})
} }
} }