diff --git a/Backend/Controllers/EmergencyContactController.cs b/Backend/Controllers/EmergencyContactController.cs index 1edf74a..92df8fd 100644 --- a/Backend/Controllers/EmergencyContactController.cs +++ b/Backend/Controllers/EmergencyContactController.cs @@ -27,7 +27,11 @@ namespace Backend.Controllers { return View(); } - + /// + /// 根據所選組別列出人員清單 + /// + /// 組別id + /// [HttpPost] public async Task EmergencyContactTable (List selectgroupidlist) { @@ -36,7 +40,7 @@ namespace Backend.Controllers try { Emergency_member_tables = await backendRepository.GetAllAsync($@" - select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id + select v.system_key groupingName,va.system_key departmentName,em.* from emergency_member em left join variable v on em.grouping = v.id left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department where em.grouping in @groupinglist and em.deleted = 0",new { groupinglist = selectgroupidlist }); apiResult.Code = "0000"; diff --git a/Backend/Controllers/EmergencyGroupingController.cs b/Backend/Controllers/EmergencyGroupingController.cs index a1c531f..23582bb 100644 --- a/Backend/Controllers/EmergencyGroupingController.cs +++ b/Backend/Controllers/EmergencyGroupingController.cs @@ -20,7 +20,10 @@ namespace Backend.Controllers { return View(); } - + /// + /// 取得部門資訊 + /// + /// [HttpPost] public async Task>> Getdepartlist() { @@ -45,7 +48,11 @@ namespace Backend.Controllers return apiResult; } - + /// + /// 新增/編輯人員租別 + /// + /// 人員編組參數 + /// [HttpPost] public async Task> SaveGrouping(SaveGrouping post) { @@ -54,7 +61,7 @@ namespace Backend.Controllers { if(post.id == 0) { - var value = await backendRepository.GetOneAsync("select td.system_value from variable td where td.system_type = 'grouping' order by td.system_value desc"); + var value = await backendRepository.GetOneAsync("select td.system_value from variable td where td.system_type = 'grouping' order by cast(td.system_value as SIGNED) desc"); var dictionary = new Dictionary() { {"@system_type", "grouping"}, @@ -91,7 +98,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 根據選擇的組別拿到人員清單 + /// + /// 組別id + /// [HttpPost] public async Task Emergency_member_table(int grouping) { @@ -100,7 +111,7 @@ namespace Backend.Controllers try { Emergency_member_tables = await backendRepository.GetAllAsync($@" - select v.system_key grouping_name,va.system_key department_name,* from emergency_member em left join variable v on em.grouping = v.id + select v.system_key grouping_name,va.system_key department_name,em.* from emergency_member em left join variable v on em.grouping = v.id left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department where em.grouping = {grouping} and em.deleted = 0"); apiResult.Code = "0000"; @@ -119,7 +130,11 @@ namespace Backend.Controllers }); return result; } - + /// + /// 根據災害類別id拿到對應人員組別 + /// + /// 災害類別id + /// [HttpPost] public async Task>> GetGroupingList (int system_parent_id) { @@ -140,7 +155,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 取得單一編組設定 + /// + /// 組別id + /// [HttpPost] public async Task> GetOneGrouping(int selectgroupid) { @@ -160,7 +179,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// variable的軟刪除 + /// + /// variable_id + /// [HttpPost] public async Task>DeleteOne(int selectgroupid) { @@ -180,7 +203,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 新增/編輯人員資訊 + /// + /// 人員資訊參數 + /// [HttpPost] public async Task>SaveMember(Emergency_member post) { @@ -208,7 +235,6 @@ namespace Backend.Controllers { var dictionary = new Dictionary() { - {"@grouping",post.grouping}, {"@full_name", post.full_name}, {"@department",post.department}, {"@phone",post.phone}, @@ -233,7 +259,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 取得單一人員資訊 + /// + /// 人員guid + /// [HttpPost] public async Task> GetOneMember(string guid) { @@ -253,7 +283,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 軟刪除單一人員 + /// + /// 人員guid + /// [HttpPost] public async Task> DeletedOneMember(string guid) { diff --git a/Backend/Controllers/EmergencySettingController.cs b/Backend/Controllers/EmergencySettingController.cs index e4ddb58..df63879 100644 --- a/Backend/Controllers/EmergencySettingController.cs +++ b/Backend/Controllers/EmergencySettingController.cs @@ -47,6 +47,11 @@ namespace Backend.Controllers return apiResult; } + /// + /// 根據災害類別id列出大步驟 + /// + /// 災害類別id + /// [HttpPost] public async Task>> GetSettingList(int system_parent_id) { @@ -69,7 +74,11 @@ namespace Backend.Controllers } - + /// + /// 新增/修改大步驟 + /// + /// 大步驟參數 + /// [HttpPost] public async Task> SaveSettingModal(SaveGrouping post) { @@ -79,7 +88,7 @@ namespace Backend.Controllers if (post.id == 0) { - var value = await backendRepository.GetOneAsync("select td.system_value from variable td where td.system_type = 'DisasterSetting' order by cast(td.system_value as int) desc"); + var value = await backendRepository.GetOneAsync("select td.system_value from variable td where td.system_type = 'DisasterSetting' order by cast(td.system_value as SIGNED) desc"); var dictionary = new Dictionary() { {"@system_type", "DisasterSetting"}, @@ -122,38 +131,35 @@ namespace Backend.Controllers {"@system_priority",post.priority} }; await backendRepository.UpdateOneByCustomTable(dictionary, "variable", $" id = {post.id}"); - if (post.verify == 0) + var haveVerify = await backendRepository.GetOneAsync("variable", $"system_type = 'Verify' and system_parent_id = '{post.id}'"); + if (haveVerify == null) { var dictionary2 = new Dictionary() - { - {"@system_value",0} - }; - await backendRepository.UpdateOneByCustomTable(dictionary2, "variable", $" system_type = 'Verify' and system_parent_id = '{post.id}'"); - } - else - { - var haveVerify = await backendRepository.GetOneAsync("variable", $"system_type = 'Verify' and system_parent_id = '{post.id}'"); - if (haveVerify == null) - { - var dictionary2 = new Dictionary() { {"@system_type", "Verify"}, {"@system_key","驗證開關"}, {"@system_remark","急救大步驟設定驗證開關"}, {"@system_priority",0}, {"@system_parent_id", post.id}, - {"@system_value", 1} + {"@system_value", post.verify} }; - await backendRepository.AddOneByCustomTable(dictionary2, "variable"); - } - else - { + await backendRepository.AddOneByCustomTable(dictionary2, "variable"); + } + if (post.verify == 0) + { + var dictionary2 = new Dictionary() + { + {"@system_value",0} + }; + await backendRepository.UpdateOneByCustomTable(dictionary2, "variable", $" system_type = 'Verify' and system_parent_id = '{post.id}'"); + } + else + { var dictionary2 = new Dictionary() { {"@system_value",1} }; - await backendRepository.UpdateOneByCustomTable(dictionary2, "variable", $" system_type = 'Verify' and system_parent_id = '{post.id}'"); - } + await backendRepository.UpdateOneByCustomTable(dictionary2, "variable", $" system_type = 'Verify' and system_parent_id = '{post.id}'"); } apiResult.Code = "0000"; apiResult.Msg = "儲存成功"; @@ -170,7 +176,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 新增/修改小步驟 + /// + /// 小步驟參數 + /// [HttpPost] public async Task> SaveSubSetting(EmergencySetting post) { @@ -226,7 +236,11 @@ namespace Backend.Controllers return apiResult; } - + /// + /// 根據大步驟id列出小步驟table + /// + /// 大步驟id + /// [HttpPost] public async Task Emergency_Setting_table(int selectsetting) { @@ -235,7 +249,7 @@ namespace Backend.Controllers try { Emergency_Setting_tables = await backendRepository.GetAllAsync($@" - select v.system_key big_setting_name,* from emergency_setting es left join variable v on es.big_setting = v.id + select v.system_key big_setting_name,es.* from emergency_setting es left join variable v on es.big_setting = v.id where es.big_setting = {selectsetting} and es.deleted = 0 "); apiResult.Code = "0000"; apiResult.Data = Emergency_Setting_tables; @@ -253,7 +267,11 @@ namespace Backend.Controllers }); return result; } - + /// + /// 讀取單一大步驟 + /// + /// 大步驟id + /// [HttpPost] public async Task> GetOnesetting(int selectsetting) { @@ -278,7 +296,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 刪除小步驟 + /// + /// 小步驟guid + /// [HttpPost] public async Task> DeletedOneSubSetting(string guid) { @@ -299,7 +321,11 @@ namespace Backend.Controllers return apiResult; } - + /// + /// 讀取單一小步驟 + /// + /// 小步驟guid + /// [HttpPost] public async Task> GetOneSubSetting(string guid) { @@ -320,6 +346,11 @@ namespace Backend.Controllers return apiResult; } + /// + /// 模擬演練按鈕,新增一筆紀錄到emergency_event + /// + /// emergency_event參數 + /// [HttpPost] public async Task> SaveAndOpenSimulationExercise(Eventpost eventpost) { @@ -331,7 +362,7 @@ namespace Backend.Controllers { {"@emergency_event_guid",newguid}, {"@disaster",eventpost.disaster}, - {"@building_guid", eventpost.build}, + {"@building_tag", eventpost.build}, {"@type",eventpost.type} }; await backendRepository.AddOneByCustomTable(dictionary, "emergency_event"); @@ -349,7 +380,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 根據災害類別id拿到相關大步驟設定 + /// + /// 災害類別id + /// [HttpPost] public async Task>> GetBigsetting(int disaster) { @@ -373,7 +408,7 @@ namespace Backend.Controllers apiResult.Data = list; apiResult.Code = "0000"; - apiResult.Msg = "新增成功"; + apiResult.Msg = "讀取成功"; } catch (Exception ex) { @@ -384,7 +419,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 根據大步驟id拿到相關小步驟設定 + /// + /// 大步驟id + /// [HttpPost] public async Task>> GetEmergencySetting(int selectsetting) { @@ -393,7 +432,7 @@ namespace Backend.Controllers try { Emergency_Setting_tables = await backendRepository.GetAllAsync($@" - select v.system_key big_setting_name,* from emergency_setting es left join variable v on es.big_setting = v.id + select v.system_key big_setting_name,es.* from emergency_setting es left join variable v on es.big_setting = v.id where es.big_setting = {selectsetting} and es.deleted = 0 order by es.priority"); apiResult.Code = "0000"; apiResult.Data = Emergency_Setting_tables; @@ -408,7 +447,11 @@ namespace Backend.Controllers return apiResult; } - + /// + /// 依據make_item來判斷是否新增一筆資料到emergency_item紀錄 + /// + /// emergency_item參數 + /// [HttpPost] public async Task> GetContentAndMakeItem(Emergencyitempost post) { @@ -417,9 +460,9 @@ namespace Backend.Controllers try { var Emergency_Setting_tables = await backendRepository.GetOneAsync($@" - select v.system_key big_setting_name,* from emergency_setting es left join variable v on es.big_setting = v.id + select v.system_key big_setting_name,es.* from emergency_setting es left join variable v on es.big_setting = v.id where es.emergency_guid = '{post.emergency_guid}'"); - + if(post.make_item == 1) { var haveguid = await backendRepository.GetOneAsync($"select emergency_item_guid from emergency_item where event_guid = '{post.event_guid}' and big_setting = '{post.big_setting}' and step_setting = '{post.step_setting}'"); @@ -456,7 +499,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 根據執行與否更新emergency_item紀錄 + /// + /// choose => 0:執行;1:不執行 + /// [HttpPost] public async Task> NextStep (Itempost item) { @@ -495,7 +542,11 @@ namespace Backend.Controllers } return apiResult; } - + /// + /// 列出目前執行的emergency_event相關的emergency_item紀錄 + /// + /// emergency_event的guid + /// [HttpPost] public async Task Dohistorytotable (string eventguid) { @@ -520,7 +571,11 @@ namespace Backend.Controllers }); return result; } - + /// + /// 指揮官身分驗證 + /// + /// 指揮官密碼 + /// [HttpPost] public async Task> CheckVerifybool(string pass) { diff --git a/Backend/Views/EmergencySetting/Index.cshtml b/Backend/Views/EmergencySetting/Index.cshtml index b2983dc..6458b64 100644 --- a/Backend/Views/EmergencySetting/Index.cshtml +++ b/Backend/Views/EmergencySetting/Index.cshtml @@ -1197,8 +1197,8 @@ var url = "/EmergencySetting/GetContentAndMakeItem"; var send_data = { emergency_guid: smallsetting, - big_setting: $('#li_' + smallsetting).find('.abc').html(), - step_setting: $('#t' + setting + '_tab').find('.text-secondary').html(), + big_setting: $('#t' + setting + '_tab').find('.text-secondary').html(), + step_setting: $('#li_' + smallsetting).find('.abc').html(), event_guid: SimulationExerciseGuid, make_item: has }; diff --git a/Backend/Views/Shared/_Layout.cshtml b/Backend/Views/Shared/_Layout.cshtml index 9587242..958a6ec 100644 --- a/Backend/Views/Shared/_Layout.cshtml +++ b/Backend/Views/Shared/_Layout.cshtml @@ -152,7 +152,7 @@ } - @*@if (ViewBag.role.Contains("EmergencySettingIndex") + @if (ViewBag.role.Contains("EmergencySettingIndex") || ViewBag.role.Contains("EmergencyGroupingIndex") || ViewBag.role.Contains("RescueDeviceFireExtinguisher") || ViewBag.role.Contains("RescueDeviceAED")) @@ -179,7 +179,7 @@ } - @if (ViewBag.role.Contains("RescueDeviceFireExtinguisher")) + @*@if (ViewBag.role.Contains("RescueDeviceFireExtinguisher")) {
  • @@ -194,10 +194,10 @@ AED裝置設定
  • - } + }*@ - }*@ + } @*@if (ViewBag.role.Contains("EmergencyDeviceMenuIndex") || ViewBag.role.Contains("EmergencyContactIndex")