diff --git a/FrontendWebApi/ApiControllers/EmergencyContactController.cs b/FrontendWebApi/ApiControllers/EmergencyContactController.cs index b8b4fba..4417dc9 100644 --- a/FrontendWebApi/ApiControllers/EmergencyContactController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyContactController.cs @@ -107,7 +107,7 @@ namespace FrontendWebApi.ApiControllers [HttpPost] [Route("api/EmergencyContact/PDF")] - public async Task>> ExportPDF(export post) + public async Task>> ExportPDF([FromBody] export post) { //var grouping = JsonConvert.DeserializeObject(post); ApiResult apiResult = new ApiResult(); @@ -182,7 +182,7 @@ namespace FrontendWebApi.ApiControllers [HttpPost] [Route("api/EmergencyContact/Excel")] - public async Task>> ExportExcel(export post) + public async Task>> ExportExcel([FromBody] export post) { //var guid = Guid.NewGuid().ToString(); ApiResult apiResult = new ApiResult(); diff --git a/FrontendWebApi/Views/EmergencyContact/Index.cshtml b/FrontendWebApi/Views/EmergencyContact/Index.cshtml index 0a05b26..bbd3c77 100644 --- a/FrontendWebApi/Views/EmergencyContact/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyContact/Index.cshtml @@ -32,8 +32,6 @@
- -
@@ -201,8 +199,7 @@ } //選擇組別 - function SelectGrouping(grouping, e) - { + function SelectGrouping(grouping, e) { if ($(e).hasClass("btn-outline-success")) { $(e).removeClass("btn-outline-success").addClass("btn-success"); selectgroupidlist.push(grouping); @@ -218,8 +215,7 @@ } //全選所有組別 - function Allgroupingselect() - { + function Allgroupingselect() { if (Allgroupingbool) { $('#groupinglist').find(".btn-success").removeClass("btn-success").addClass("btn-outline-success"); selectgroupidlist = []; @@ -249,7 +245,27 @@ disaster: $('#Disasterlist').find('.btn-success').html(), 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(), 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("系統發生錯誤,請再重新嘗試"); + } + } + }) } } diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131117.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131117.pdf new file mode 100644 index 0000000..94e65be Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131117.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131124.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131124.pdf new file mode 100644 index 0000000..1bf50b0 Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131124.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131732.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131732.pdf new file mode 100644 index 0000000..a947c05 Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131732.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131814.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131814.pdf new file mode 100644 index 0000000..58d656a Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131814.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131831.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131831.pdf new file mode 100644 index 0000000..db01ce5 Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131831.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131933.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131933.pdf new file mode 100644 index 0000000..5a67b87 Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131933.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131944.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131944.pdf new file mode 100644 index 0000000..7d49111 Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131944.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131948.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131948.pdf new file mode 100644 index 0000000..c576fce Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131948.pdf differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132239.xlsx b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132239.xlsx new file mode 100644 index 0000000..06e73b4 Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132239.xlsx differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132246.xlsx b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132246.xlsx new file mode 100644 index 0000000..bc12b3b Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132246.xlsx differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132319.xlsx b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132319.xlsx new file mode 100644 index 0000000..989e864 Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132319.xlsx differ diff --git a/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132328.pdf b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132328.pdf new file mode 100644 index 0000000..af2c25b Binary files /dev/null and b/FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132328.pdf differ