[Backend]緊急應變功能修整
This commit is contained in:
parent
0060be9c4d
commit
687b78984e
@ -27,7 +27,11 @@ namespace Backend.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根據所選組別列出人員清單
|
||||
/// </summary>
|
||||
/// <param name="selectgroupidlist">組別id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> EmergencyContactTable (List<int> selectgroupidlist)
|
||||
{
|
||||
@ -36,7 +40,7 @@ namespace Backend.Controllers
|
||||
try
|
||||
{
|
||||
Emergency_member_tables = await backendRepository.GetAllAsync<EmergencyContactTable>($@"
|
||||
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";
|
||||
|
@ -20,7 +20,10 @@ namespace Backend.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得部門資訊
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<List<KeyValue>>> Getdepartlist()
|
||||
{
|
||||
@ -45,7 +48,11 @@ namespace Backend.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增/編輯人員租別
|
||||
/// </summary>
|
||||
/// <param name="post">人員編組參數</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> SaveGrouping(SaveGrouping post)
|
||||
{
|
||||
@ -54,7 +61,7 @@ namespace Backend.Controllers
|
||||
{
|
||||
if(post.id == 0)
|
||||
{
|
||||
var value = await backendRepository.GetOneAsync<int>("select td.system_value from variable td where td.system_type = 'grouping' order by td.system_value desc");
|
||||
var value = await backendRepository.GetOneAsync<int>("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<string, object>()
|
||||
{
|
||||
{"@system_type", "grouping"},
|
||||
@ -91,7 +98,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根據選擇的組別拿到人員清單
|
||||
/// </summary>
|
||||
/// <param name="grouping">組別id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> Emergency_member_table(int grouping)
|
||||
{
|
||||
@ -100,7 +111,7 @@ namespace Backend.Controllers
|
||||
try
|
||||
{
|
||||
Emergency_member_tables = await backendRepository.GetAllAsync<Emergency_member_table>($@"
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根據災害類別id拿到對應人員組別
|
||||
/// </summary>
|
||||
/// <param name="system_parent_id">災害類別id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<List<KeyValueID>>> GetGroupingList (int system_parent_id)
|
||||
{
|
||||
@ -140,7 +155,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得單一編組設定
|
||||
/// </summary>
|
||||
/// <param name="selectgroupid">組別id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<SaveGrouping>> GetOneGrouping(int selectgroupid)
|
||||
{
|
||||
@ -160,7 +179,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// variable的軟刪除
|
||||
/// </summary>
|
||||
/// <param name="selectgroupid">variable_id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>>DeleteOne(int selectgroupid)
|
||||
{
|
||||
@ -180,7 +203,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增/編輯人員資訊
|
||||
/// </summary>
|
||||
/// <param name="post">人員資訊參數</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>>SaveMember(Emergency_member post)
|
||||
{
|
||||
@ -208,7 +235,6 @@ namespace Backend.Controllers
|
||||
{
|
||||
var dictionary = new Dictionary<string, object>()
|
||||
{
|
||||
{"@grouping",post.grouping},
|
||||
{"@full_name", post.full_name},
|
||||
{"@department",post.department},
|
||||
{"@phone",post.phone},
|
||||
@ -233,7 +259,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得單一人員資訊
|
||||
/// </summary>
|
||||
/// <param name="guid">人員guid</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<Emergency_member>> GetOneMember(string guid)
|
||||
{
|
||||
@ -253,7 +283,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 軟刪除單一人員
|
||||
/// </summary>
|
||||
/// <param name="guid">人員guid</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> DeletedOneMember(string guid)
|
||||
{
|
||||
|
@ -47,6 +47,11 @@ namespace Backend.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根據災害類別id列出大步驟
|
||||
/// </summary>
|
||||
/// <param name="system_parent_id">災害類別id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<List<KeyValueID>>> GetSettingList(int system_parent_id)
|
||||
{
|
||||
@ -69,7 +74,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增/修改大步驟
|
||||
/// </summary>
|
||||
/// <param name="post">大步驟參數</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> SaveSettingModal(SaveGrouping post)
|
||||
{
|
||||
@ -79,7 +88,7 @@ namespace Backend.Controllers
|
||||
if (post.id == 0)
|
||||
{
|
||||
|
||||
var value = await backendRepository.GetOneAsync<int>("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<int>("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<string, object>()
|
||||
{
|
||||
{"@system_type", "DisasterSetting"},
|
||||
@ -122,16 +131,6 @@ namespace Backend.Controllers
|
||||
{"@system_priority",post.priority}
|
||||
};
|
||||
await backendRepository.UpdateOneByCustomTable(dictionary, "variable", $" id = {post.id}");
|
||||
if (post.verify == 0)
|
||||
{
|
||||
var dictionary2 = new Dictionary<string, object>()
|
||||
{
|
||||
{"@system_value",0}
|
||||
};
|
||||
await backendRepository.UpdateOneByCustomTable(dictionary2, "variable", $" system_type = 'Verify' and system_parent_id = '{post.id}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
var haveVerify = await backendRepository.GetOneAsync<string>("variable", $"system_type = 'Verify' and system_parent_id = '{post.id}'");
|
||||
if (haveVerify == null)
|
||||
{
|
||||
@ -142,10 +141,18 @@ namespace Backend.Controllers
|
||||
{"@system_remark","急救大步驟設定驗證開關"},
|
||||
{"@system_priority",0},
|
||||
{"@system_parent_id", post.id},
|
||||
{"@system_value", 1}
|
||||
{"@system_value", post.verify}
|
||||
};
|
||||
await backendRepository.AddOneByCustomTable(dictionary2, "variable");
|
||||
}
|
||||
if (post.verify == 0)
|
||||
{
|
||||
var dictionary2 = new Dictionary<string, object>()
|
||||
{
|
||||
{"@system_value",0}
|
||||
};
|
||||
await backendRepository.UpdateOneByCustomTable(dictionary2, "variable", $" system_type = 'Verify' and system_parent_id = '{post.id}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
var dictionary2 = new Dictionary<string, object>()
|
||||
@ -154,7 +161,6 @@ namespace Backend.Controllers
|
||||
};
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增/修改小步驟
|
||||
/// </summary>
|
||||
/// <param name="post">小步驟參數</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> SaveSubSetting(EmergencySetting post)
|
||||
{
|
||||
@ -226,7 +236,11 @@ namespace Backend.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根據大步驟id列出小步驟table
|
||||
/// </summary>
|
||||
/// <param name="selectsetting">大步驟id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> Emergency_Setting_table(int selectsetting)
|
||||
{
|
||||
@ -235,7 +249,7 @@ namespace Backend.Controllers
|
||||
try
|
||||
{
|
||||
Emergency_Setting_tables = await backendRepository.GetAllAsync<EmergencySettingTable>($@"
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 讀取單一大步驟
|
||||
/// </summary>
|
||||
/// <param name="selectsetting">大步驟id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<SaveGrouping>> GetOnesetting(int selectsetting)
|
||||
{
|
||||
@ -278,7 +296,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刪除小步驟
|
||||
/// </summary>
|
||||
/// <param name="guid">小步驟guid</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> DeletedOneSubSetting(string guid)
|
||||
{
|
||||
@ -299,7 +321,11 @@ namespace Backend.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 讀取單一小步驟
|
||||
/// </summary>
|
||||
/// <param name="guid">小步驟guid</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<EmergencySetting>> GetOneSubSetting(string guid)
|
||||
{
|
||||
@ -320,6 +346,11 @@ namespace Backend.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模擬演練按鈕,新增一筆紀錄到emergency_event
|
||||
/// </summary>
|
||||
/// <param name="eventpost">emergency_event參數</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根據災害類別id拿到相關大步驟設定
|
||||
/// </summary>
|
||||
/// <param name="disaster">災害類別id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<List<SaveGrouping>>> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根據大步驟id拿到相關小步驟設定
|
||||
/// </summary>
|
||||
/// <param name="selectsetting">大步驟id</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<List<EmergencySettingTable>>> GetEmergencySetting(int selectsetting)
|
||||
{
|
||||
@ -393,7 +432,7 @@ namespace Backend.Controllers
|
||||
try
|
||||
{
|
||||
Emergency_Setting_tables = await backendRepository.GetAllAsync<EmergencySettingTable>($@"
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 依據make_item來判斷是否新增一筆資料到emergency_item紀錄
|
||||
/// </summary>
|
||||
/// <param name="post">emergency_item參數</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<EmergencyitemWithguid>> GetContentAndMakeItem(Emergencyitempost post)
|
||||
{
|
||||
@ -417,7 +460,7 @@ namespace Backend.Controllers
|
||||
try
|
||||
{
|
||||
var Emergency_Setting_tables = await backendRepository.GetOneAsync<EmergencyitemWithguid>($@"
|
||||
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)
|
||||
@ -456,7 +499,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根據執行與否更新emergency_item紀錄
|
||||
/// </summary>
|
||||
/// <param name="item">choose => 0:執行;1:不執行</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> NextStep (Itempost item)
|
||||
{
|
||||
@ -495,7 +542,11 @@ namespace Backend.Controllers
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列出目前執行的emergency_event相關的emergency_item紀錄
|
||||
/// </summary>
|
||||
/// <param name="eventguid">emergency_event的guid</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> Dohistorytotable (string eventguid)
|
||||
{
|
||||
@ -520,7 +571,11 @@ namespace Backend.Controllers
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 指揮官身分驗證
|
||||
/// </summary>
|
||||
/// <param name="pass">指揮官密碼</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<bool>> CheckVerifybool(string pass)
|
||||
{
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -152,7 +152,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
@*@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 @@
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.role.Contains("RescueDeviceFireExtinguisher"))
|
||||
@*@if (ViewBag.role.Contains("RescueDeviceFireExtinguisher"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "3" && ViewData["SubNum"] == "3" ? "active" : "")">
|
||||
<a asp-controller="RescueDevice" asp-action="FireExtinguisher" title="滅火器設定" data-filter-tags="utilities disabled item">
|
||||
@ -194,10 +194,10 @@
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">AED裝置設定</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}*@
|
||||
</ul>
|
||||
</li>
|
||||
}*@
|
||||
}
|
||||
|
||||
@*@if (ViewBag.role.Contains("EmergencyDeviceMenuIndex")
|
||||
|| ViewBag.role.Contains("EmergencyContactIndex")
|
||||
|
Loading…
Reference in New Issue
Block a user