1505 lines
72 KiB
Plaintext
1505 lines
72 KiB
Plaintext
@{
|
|
ViewData["MainNum"] = "3";
|
|
ViewData["SubNum"] = "1";
|
|
ViewData["Title"] = "步驟設定";
|
|
}
|
|
|
|
<ol class="breadcrumb page-breadcrumb">
|
|
<li class="breadcrumb-item"><a href="javascript:void(0);">首頁</a></li>
|
|
<li class="breadcrumb-item active">步驟設定</li>
|
|
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
|
|
</ol>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div id="panel-5" class="panel">
|
|
<div class="panel-container show">
|
|
<div class="panel-content">
|
|
<div class="subheader">
|
|
<h1 class="subheader-title">
|
|
<span>步驟設定</span>
|
|
</h1>
|
|
</div>
|
|
<div class="row mb-3 d-flex align-items-center px-3 justify-content-between">
|
|
<div class="pr-3 ">
|
|
<div class="btn-group btn-group-md" id="Disasterlist">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel-toolbar">
|
|
<div class="pr-3">
|
|
<select class="form-control" id="buildlist">
|
|
</select>
|
|
</div>
|
|
<a href="javascript:void(0)" class="btn btn-default rounded-pill mr-1 shadow-0" onclick="OnSimulationExercise();"> 摸擬演練 </a>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3 d-flex align-items-center px-3">
|
|
<div class="pr-3 ">
|
|
<button type="button" class="btn btn-outline-secondary waves-effect waves-themed mb-2" style="border: 1px dashed;" onclick="Addstep()"><span class="fal fa-plus mr-1"></span>新增</button>
|
|
</div>
|
|
<div class="pr-3 row col">
|
|
<div class="frame-wrap" id="settingList">
|
|
|
|
</div>
|
|
</div>
|
|
<div class="card border mb-g w-100 mb-5" id="emergency_setting_card">
|
|
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
|
<div class="card-title font-weight-bold">步驟設定</div>
|
|
<div class="text-right ">
|
|
<a href="javascript:;" class="btn btn-sm btn-success ml-auto waves-effect waves-themed" id="addUser-btn" onclick="AddSubSetting()"><span class="fal fa-plus mr-1"></span>新增</a>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="w-100">
|
|
<div class="col-12">
|
|
<table id="emergency_setting_table" class="table table-bordered table-hover m-0 text-center">
|
|
<thead class="thead-themed">
|
|
<tr>
|
|
<th>序</th>
|
|
<th>大步驟名稱</th>
|
|
<th>小步驟名稱</th>
|
|
<th>執行-步驟</th>
|
|
<th>顯示超連結文字</th>
|
|
<th>超連結URL</th>
|
|
<th>不執行-填寫原因</th>
|
|
<th>功能</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade modal-fullscreen example-modal-fullscreen" id="SimulationExercisemodal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
<div class="modal-content h-100 border-0 shadow-0 bg-fusion-800">
|
|
@*<button type="button" class="close p-sm-2 p-md-4 text-dark fs-xxl position-absolute pos-right mr-sm-2 mt-sm-1 z-index-space" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
|
</button>*@
|
|
<button type="button" class=" position-absolute pos-right mr-sm-3 mt-sm-3 z-index-space btn btn-danger waves-effect waves-themed" id="closemodal" onclick="Closemodal()">關閉流程</button>
|
|
<div class="modal-body bg-white">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12 text-center"><h1 class="mb-3">緊急應變措施 - 火災處置</h1></div>
|
|
<ul class="nav nav-tabs mb-3 w-100" role="tablist" id="bigsetting">
|
|
<li class="nav-item"> <a class="nav-link fs-xl py-3 px-5" data-toggle="tab" href="#" role="tab"> <i class="fal fa-check text-success"></i> <span class="hidden-sm-down ml-1 text-secondary">確認與通報</span> </a> </li>
|
|
<li class="nav-item"> <a class="nav-link fs-xl py-3 px-5" data-toggle="tab" href="#" role="tab"> <i class="fal fa-check text-success"></i> <span class="hidden-sm-down ml-1 text-secondary">通報火災授信總機</span> </a> </li>
|
|
<li class="nav-item"> <a class="nav-link fs-xl py-3 px-5" data-toggle="tab" href="#" role="tab"> <i class="fal fa-check text-success"></i> <span class="hidden-sm-down ml-1 text-secondary">通報防災中心</span> </a> </li>
|
|
<li class="nav-item"> <a class="nav-link fs-xl py-3 px-5" data-toggle="tab" href="#" role="tab"> <i class="fal fa-check text-success"></i> <span class="hidden-sm-down ml-1 text-secondary">疏導人群</span> </a> </li>
|
|
</ul>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-8 tab-content" id="small_setting">
|
|
<div class="tab-pane fade show active" id="export_modal" role="tabpanel" aria-labelledby="16_modal">
|
|
<div class="row">
|
|
<div class="pr-2" style="width:38.5%">
|
|
<div id="panel-1" class="panel">
|
|
<div class="panel-container show">
|
|
<div class="panel-content">
|
|
<ul class="list-group">
|
|
<li class="list-group-item active"> <i class="fal fa-check text-success"></i> 確認與通報</li>
|
|
<li class="list-group-item"> <i class="fal fa-check text-success"></i> 通報火災授信總機</li>
|
|
<li class="list-group-item"> <i class="fal fa-check text-success"></i> 通報防災中心</li>
|
|
<li class="list-group-item"> <i class="fal fa-check text-success"></i> 疏導人群</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="" style="width:61.5%">
|
|
<div id="panel-2" class="panel">
|
|
<div class="panel-hdr">
|
|
<h2>通報火災授信總機</h2>
|
|
</div>
|
|
<div class="panel-container show">
|
|
<div class="panel-content">
|
|
<div class="panel-tag">
|
|
All panels needs to have an unique ID in order to use the panel funtions. <code>.panel</code> is a container with no padding, <code>.panel-hdr</code> has a <code>min-height</code> value and default <code>flexbox</code> properties. The <code>.panel-toolbar</code> is inserted into <code>.panel-hdr</code> for extra elements. The <code>.panel-container</code> wraps <code>.panel-content</code> which has a predefined padding.
|
|
</div>
|
|
<p>
|
|
Default panel text.
|
|
</p>
|
|
</div>
|
|
<div class="panel-content py-2 border-faded border-left-0 border-right-0 border-bottom-0 text-muted d-flex justify-content-between">
|
|
<div class=""><button type="button" class="btn btn-danger waves-effect waves-themed mr-2"> 不通報 </button><input type="text" class=""></div>
|
|
<div><button type="button" class="btn btn-success waves-effect waves-themed"> 下一步 </button></div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div id="panel-12" class="panel">
|
|
<div class="panel-hdr border-faded border-top-0 border-right-0 border-left-0 shadow-0">
|
|
<h2></h2>
|
|
<div class="panel-toolbar pr-3 align-self-end">
|
|
<ul id="demo_panel-tabs" class="nav nav-tabs border-bottom-0 nav-tabs-clean" role="tablist">
|
|
<li class="nav-item">
|
|
<a class="nav-link text-dark active" data-toggle="tab" href="#tab_content" role="tab">緊急聯絡清單</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link text-dark" data-toggle="tab" href="#tab_dohistory" role="tab">操作歷史</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="panel-container show">
|
|
<div class="panel-content tab-content">
|
|
<div class="tab-pane fade show active" id="tab_content" role="tabpanel" aria-labelledby="tab_content">
|
|
<div class="row justify-content-between mb-2">
|
|
<div class="col-auto">
|
|
<span class="d-inline-block">組別</span>
|
|
<button type="button" class="btn btn-secondary waves-effect waves-themed d-inline-block ml-2" onclick="Allgroupingselect()"> 全選 </button>
|
|
</div>
|
|
<div class="col-auto">
|
|
@*<button type="button" class="btn btn-primary waves-effect waves-themed" onclick="OpenSendSMSModal()">發送簡訊</button>*@
|
|
</div>
|
|
</div>
|
|
<h2 id="button_grouping">
|
|
<button type="button" class="btn btn-success waves-effect waves-themed mb-2"> 主防災中心 </button>
|
|
<button type="button" class="btn btn-outline-success waves-effect waves-themed mb-2"> 通報聯絡班 </button>
|
|
<button type="button" class="btn btn-outline-success waves-effect waves-themed mb-2"> 外部救援引導班 </button>
|
|
<button type="button" class="btn btn-outline-success waves-effect waves-themed mb-2"> 滅火班 </button>
|
|
<button type="button" class="btn btn-outline-success waves-effect waves-themed mb-2"> 緊急救護班 </button>
|
|
<button type="button" class="btn btn-outline-success waves-effect waves-themed mb-2"> 安全防護班 </button>
|
|
</h2>
|
|
<table class="table table-bordered m-0" id="membertable">
|
|
<thead>
|
|
<tr>
|
|
<th>姓名</th>
|
|
<th>部門</th>
|
|
<th>電話</th>
|
|
<th>LineID</th>
|
|
<th>Email</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="tab-pane fade" id="tab_dohistory" role="tabpanel" aria-labelledby="tab_dohistory">
|
|
<table class="table table-bordered m-0" id="dohistorytable">
|
|
<thead>
|
|
<tr>
|
|
<th>項目</th>
|
|
<th>步驟</th>
|
|
<th>結果</th>
|
|
<th>時間</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="emergency-item-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
|
<div class="modal-dialog modal-dialog-centered " role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">
|
|
項目設定 - 新增
|
|
</h4>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="emergency-item-form">
|
|
<div class="row">
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_item_order_modal"><span class="text-danger">*</span>順序</label>
|
|
<input class="form-control" type="number" id="emergency_item_order_modal" min="1" />
|
|
</div>
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_item_step_modal"><span class="text-danger">*</span>大步驟名稱</label>
|
|
<input class="form-control" type="text" id="emergency_item_step_modal">
|
|
</div>
|
|
<div class="form-group col-6">
|
|
<div class="custom-control custom-checkbox">
|
|
<input type="checkbox" class="custom-control-input" id="icon_click">
|
|
<label class="custom-control-label" for="icon_click">是否需要驗證</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<div class="align-items-center " style="display:flex;flex-wrap: wrap;padding:1rem; " id="deletebtn">
|
|
<button type="button" class="btn btn-danger" onclick="DeletedGrouping()">刪除</button>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
|
<button type="button" class="btn btn-primary" onclick="SaveSettingModal()">儲存</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="emergency-verify-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
|
<div class="modal-dialog modal-dialog-centered " role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">
|
|
指揮官驗證
|
|
</h4>
|
|
@*<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
|
</button>*@
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="emergency-item-form">
|
|
<div class="row">
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_verify_modal"><span class="text-danger">*</span>指揮官密碼</label>
|
|
<input class="form-control" type="password" id="emergency_verify_input" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" onclick="PassVerify(false)">取消</button>
|
|
<button type="button" class="btn btn-primary" onclick="PassVerify(true)">確認</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="emergency-setting-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
|
<div class="modal-dialog modal-dialog-centered " role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">
|
|
小步驟 - 新增
|
|
</h4>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="emergency-setting-form">
|
|
<div class="row">
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_setting_name"><span class="text-danger">*</span>小步驟名稱</label>
|
|
<input class="form-control" type="text" id="emergency_setting_name" name="emergency_setting_name">
|
|
</div>
|
|
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_setting_noanswer"><span class="text-danger">*</span>不執行-填寫原因</label>
|
|
<div class="row mb-2" id="emergency_setting_noanswer">
|
|
<div class="col ">
|
|
<input type="radio" name="noanswer" id="noanswer_1" value="1" checked>
|
|
<label for="noanswer_1">
|
|
是
|
|
</label>
|
|
</div>
|
|
<div class="col">
|
|
<input type="radio" name="noanswer" id="noanswer_0" value="0">
|
|
<label for="noanswer_0">
|
|
否
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group col-12">
|
|
<label class="form-label" for="emergency_setting_set_doing"><span class="text-danger">*</span>執行-步驟</label>
|
|
<input class="form-control" type="text" id="emergency_setting_set_doing" name="emergency_setting_set_doing" />
|
|
</div>
|
|
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_setting_urltext">顯示超連結文字</label>
|
|
<input class="form-control" type="text" id="emergency_setting_urltext" name="emergency_setting_urltext" />
|
|
</div>
|
|
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_setting_urllink">超連結URL</label>
|
|
<input class="form-control" type="text" id="emergency_setting_urllink" name="emergency_setting_urllink" />
|
|
</div>
|
|
|
|
<div class="form-group col-6">
|
|
<label class="form-label" for="emergency_setting_priority">順序</label>
|
|
<input class="form-control" type="number" id="emergency_setting_priority" name="emergency_setting_priority" min="1" />
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
|
<button type="button" class="btn btn-primary" onclick="SaveSubSetting()">儲存</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="send-sms-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
|
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">
|
|
簡訊發送
|
|
</h4>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row mb-2">
|
|
<div class="col-auto">
|
|
<span class="d-inline-block">組別</span>
|
|
<button type="button" class="btn btn-secondary waves-effect waves-themed d-inline-block ml-2" onclick="AllSMSgroupingselect()">全選</button>
|
|
</div>
|
|
<div class="col" id="sms-grouping"></div>
|
|
</div>
|
|
<div class="row mb-2">
|
|
<div class="col-6">
|
|
<table class="table table-bordered m-0" id="smsMemberTable">
|
|
<thead>
|
|
<tr>
|
|
<th>姓名</th>
|
|
<th>部門</th>
|
|
<th>電話</th>
|
|
<th>LineID</th>
|
|
<th>Email</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="col-6">
|
|
<textarea class="form-control mt-3 mb-2" rows="5"></textarea>
|
|
<span>發訊人:@ViewBag.myUserInfo.Full_name</span>
|
|
</div>
|
|
</div>
|
|
<div class="row justify-content-between">
|
|
<div class="col-auto">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
|
</div>
|
|
<div class="col-auto row">
|
|
<div class="col-auto">
|
|
<input class="form-control" type="text" placeholder="請輸入指揮官密碼" />
|
|
</div>
|
|
<div class="col-auto">
|
|
<button type="button" class="btn btn-primary" onclick="SaveSubSetting()">儲存</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script>
|
|
var Selectadisaster;
|
|
var selectsetting;//大步驟
|
|
var selectsubsetting;//小步驟
|
|
var datalengh = 0;
|
|
var emergencySettingTable;
|
|
var SimulationExerciseGuid;
|
|
var SelectMemberDepart = new Array(0);
|
|
var Allgroupidlist = new Array(0);
|
|
var Allgroupingbool = false;
|
|
var SelectSMSMemberDepart = new Array(0);
|
|
var AllSMSgroupidlist = new Array(0);
|
|
var AllSMSgroupingbool = false;
|
|
var EmergencyContact;
|
|
var EmerNowsetting;
|
|
var Historytable;
|
|
var SmsMemberTable;
|
|
|
|
//新變數---------------------------
|
|
var EmerLastsetting; //-正在使用的tab
|
|
var Verifybool = false; //-驗證成功
|
|
var CloseVerify = false;
|
|
var ToVerifyType = 0;
|
|
$(function () {
|
|
EmergencyContact = $("#membertable").DataTable({
|
|
"columns": [
|
|
{
|
|
"data": "full_name"
|
|
},
|
|
{
|
|
"data": "departmentName"
|
|
},
|
|
{
|
|
"data": "phone"
|
|
},
|
|
{
|
|
"data": "lineid"
|
|
},
|
|
{
|
|
"data": "email"
|
|
}
|
|
],
|
|
'createdRow': function (row, data, dataIndex) {
|
|
$(row).attr('guid', data.emergency_guid);
|
|
},
|
|
"ajax": {
|
|
"url": "/EmergencyContact/EmergencyContactTable",
|
|
"type": "POST",
|
|
"data": function (d) {
|
|
d.selectgroupidlist = SelectMemberDepart
|
|
},
|
|
"dataSrc": function (rel) {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
data = rel.data.data;
|
|
if (data == null || data.length == 0) {
|
|
|
|
this.data = [];
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
});
|
|
|
|
SmsMemberTable = $("#smsMemberTable").DataTable({
|
|
"columns": [
|
|
{
|
|
"data": "full_name"
|
|
},
|
|
{
|
|
"data": "departmentName"
|
|
},
|
|
{
|
|
"data": "phone"
|
|
},
|
|
{
|
|
"data": "lineid"
|
|
},
|
|
{
|
|
"data": "email"
|
|
}
|
|
],
|
|
'createdRow': function (row, data, dataIndex) {
|
|
$(row).attr('guid', data.emergency_guid);
|
|
},
|
|
"ajax": {
|
|
"url": "/EmergencyContact/EmergencyContactTable",
|
|
"type": "POST",
|
|
"data": function (d) {
|
|
d.selectgroupidlist = SelectSMSMemberDepart
|
|
},
|
|
"dataSrc": function (rel) {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
data = rel.data.data;
|
|
if (data == null || data.length == 0) {
|
|
|
|
this.data = [];
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
});
|
|
|
|
emergencySettingTable = $("#emergency_setting_table").DataTable({
|
|
"columns": [
|
|
{
|
|
"data": "priority",
|
|
},
|
|
{
|
|
"data": "big_setting_name"
|
|
},
|
|
{
|
|
"data": "full_name"
|
|
},
|
|
{
|
|
"data": "set_doing"
|
|
},
|
|
{
|
|
"data": "url_text"
|
|
},
|
|
{
|
|
"data": "url_link"
|
|
},
|
|
{
|
|
"data": "not_answer"
|
|
},
|
|
{
|
|
"data": null,
|
|
"defaultContent": '<button class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>'
|
|
}
|
|
],
|
|
'createdRow': function (row, data, dataIndex) {
|
|
$(row).attr('guid', data.emergency_guid);
|
|
},
|
|
"ajax": {
|
|
"url": "/EmergencySetting/Emergency_Setting_table",
|
|
"type": "POST",
|
|
"data": function (d) {
|
|
d.selectsetting = selectsetting
|
|
},
|
|
"dataSrc": function (rel) {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
data = rel.data.data;
|
|
if (data == null || data.length == 0) {
|
|
|
|
this.data = [];
|
|
} else {
|
|
$.each(this.data, function (index, value) {
|
|
if (value.not_answer == 1) {
|
|
value.not_answer = "是";
|
|
} else {
|
|
value.not_answer = "否";
|
|
}
|
|
})
|
|
}
|
|
if (selectsetting == 0) {
|
|
$('#emergency_setting_card').hide();
|
|
} else {
|
|
$('#emergency_setting_card').show();
|
|
}
|
|
datalengh = this.data.length;
|
|
return data;
|
|
}
|
|
}
|
|
});
|
|
Historytable = $('#dohistorytable').DataTable({
|
|
"iDisplayLength": 5,
|
|
"order": [[3, 'desc']],
|
|
"columns": [
|
|
{
|
|
"data": "big_setting",
|
|
},
|
|
{
|
|
"data": "step_setting"
|
|
},
|
|
{
|
|
"data": "finished"
|
|
},
|
|
{
|
|
"data": "updated_at"
|
|
}
|
|
],
|
|
'createdRow': function (row, data, dataIndex) {
|
|
$(row).attr('guid', data.emergency_guid);
|
|
},
|
|
"ajax": {
|
|
"url": "/EmergencySetting/Dohistorytotable",
|
|
"type": "POST",
|
|
"data": function (d) {
|
|
d.eventguid = SimulationExerciseGuid
|
|
},
|
|
"dataSrc": function (rel) {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
data = rel.data.data;
|
|
if (data == null || data.length == 0) {
|
|
|
|
this.data = [];
|
|
} else {
|
|
$.each(this.data, function (index, value) {
|
|
if (value.finished == 0) {
|
|
value.finished = "未執行";
|
|
} else if (value.finished == 1) {
|
|
value.finished = "完成";
|
|
} else if (value.finished == 2) {
|
|
value.finished = "不執行";
|
|
if (value.reason != null) {
|
|
value.finished += "-" + value.reason;
|
|
}
|
|
}
|
|
|
|
|
|
if (value.updated_at == "0001-01-01 00:00:00") {
|
|
value.updated_at = "";
|
|
}
|
|
|
|
})
|
|
}
|
|
|
|
|
|
return data;
|
|
}
|
|
}
|
|
});
|
|
|
|
GetDisasterList();
|
|
GetBuild();
|
|
})
|
|
//取得棟別
|
|
function GetBuild() {
|
|
var url = "/BuildMenu/BuildInfoList";
|
|
var send_data = {};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
$('#buildlist').empty();
|
|
$.each(rel.data, function (index, val) {
|
|
$('#buildlist').append($("<option />").val(val.value).text(val.name));
|
|
});
|
|
return;
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
//取得災難類別
|
|
function GetDisasterList() {
|
|
var url = "/EmergencySetting/DisasterList";
|
|
var send_data = {};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
$('#Disasterlist').empty();
|
|
var Disasterstr = "";
|
|
$.each(rel.data, function (index, val) {
|
|
if (index == 0) {
|
|
Disasterstr += '<button type="button" class="btn btn-success waves-effect waves-themed" onclick = "SelectDisaster(' + val.value + ',this)"> ' + val.name + '</button>';
|
|
}
|
|
else {
|
|
Disasterstr += '<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick = "SelectDisaster(' + val.value + ',this)">' + val.name + '</button>';
|
|
}
|
|
});
|
|
$('#Disasterlist').append(Disasterstr);
|
|
$('#Disasterlist').find('.btn-success').trigger('click');
|
|
return;
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
//選擇災難類別
|
|
function SelectDisaster(Disaster, e) {
|
|
Selectadisaster = Disaster;
|
|
if ($("#Disasterlist").find('.btn').hasClass("btn-success")) {
|
|
$("#Disasterlist").find('.btn').removeClass("btn-success").addClass("btn-secondary");
|
|
}
|
|
$(e).removeClass("btn-secondary").addClass("btn-success");
|
|
GetSettingList();
|
|
selectsetting = 0;
|
|
emergencySettingTable.ajax.reload();
|
|
}
|
|
|
|
//取得大步驟列表
|
|
function GetSettingList() {
|
|
var url = "/EmergencySetting/GetSettingList";
|
|
var send_data = {
|
|
system_parent_id: Selectadisaster
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
var setting = "";
|
|
$('#settingList').empty();
|
|
$.each(rel.data, function (index, val) {
|
|
if (val.id == selectsetting) {
|
|
setting += '<div class="btn-group mb-2 mr-2" setting = "' + val.id + '">';
|
|
setting += '<button type="button" class="btn btn-success select" onclick="Selectsetting(' + val.id + ',this)">' + val.name + '</button>';
|
|
setting += '<button type="button" class="btn btn-success edit" ><i class="fal fa-pencil"></i></button>';
|
|
setting += '</div>';
|
|
} else {
|
|
setting += '<div class="btn-group mb-2 mr-2" setting = "' + val.id + '">';
|
|
setting += '<button type="button" class="btn btn-secondary select" onclick="Selectsetting(' + val.id + ',this)">' + val.name + '</button>';
|
|
setting += '<button type="button" class="btn btn-secondary edit" ><i class="fal fa-pencil"></i></button>';
|
|
setting += '</div>';
|
|
}
|
|
});
|
|
|
|
$('#settingList').append(setting);
|
|
emergencySettingTable.ajax.reload();
|
|
return;
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
//新增大步驟
|
|
function Addstep() {
|
|
selectsetting = 0;
|
|
$('#deletebtn').hide();
|
|
$("#emergency-item-form").trigger("reset");
|
|
var a = $('#settingList').find('.btn-group').length;
|
|
$('#emergency_item_order_modal').val(a + 1);
|
|
$('.modal-title').html("大步驟設定 - 新增");
|
|
$('#emergency-item-modal').modal();
|
|
}
|
|
|
|
//儲存大步驟
|
|
function SaveSettingModal() {
|
|
|
|
var ISO = 0;
|
|
if ($("#icon_click").is(':checked')) {
|
|
ISO = 1;
|
|
} else {
|
|
ISO = 0;
|
|
}
|
|
|
|
var url = "/EmergencySetting/SaveSettingModal";
|
|
var send_data = {
|
|
id: selectsetting,
|
|
priority: $('#emergency_item_order_modal').val(),
|
|
name: $('#emergency_item_step_modal').val(),
|
|
disaster: Selectadisaster,
|
|
verify: ISO
|
|
};
|
|
SaveSpinner(1);
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
SaveSpinner(0);
|
|
return;
|
|
}
|
|
else {
|
|
toast_ok(rel.msg);
|
|
GetSettingList();
|
|
$('#emergency-item-modal').modal('hide');
|
|
SaveSpinner(0);
|
|
return;
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
//選擇大步驟
|
|
function Selectsetting(id, e) {
|
|
selectsetting = id;
|
|
if ($("#settingList").find('.btn').hasClass("btn-success")) {
|
|
$("#settingList").find('.btn').removeClass("btn-success").addClass("btn-secondary");
|
|
}
|
|
$(e).parent('div').find('.btn').removeClass("btn-secondary").addClass("btn-success");
|
|
emergencySettingTable.ajax.reload();
|
|
}
|
|
|
|
//新增小步驟
|
|
function AddSubSetting() {
|
|
//console.log($('#groupinglist').find('.btn-success').parent('div').attr('grouping'));
|
|
selectsetting = $('#settingList').find('.btn-success').parent('div').attr('setting');
|
|
$("#emergency-setting-form").trigger("reset");
|
|
//console.log(datalengh);
|
|
$('.modal-title').html("小步驟 - 新增");
|
|
$('#emergency_setting_priority').val(datalengh + 1);
|
|
selectsubsetting = "";
|
|
$('#emergency-setting-modal').modal();
|
|
}
|
|
|
|
//儲存小步驟
|
|
function SaveSubSetting() {
|
|
//$("#emergency-member-form").valid()
|
|
if (true) {
|
|
var url = "/EmergencySetting/SaveSubSetting";
|
|
var send_data = {
|
|
emergency_guid: selectsubsetting,
|
|
big_setting: selectsetting,
|
|
full_name: $('#emergency_setting_name').val(),
|
|
set_doing: $('#emergency_setting_set_doing').val(),
|
|
url_text: $('#emergency_setting_urltext').val(),
|
|
url_link: $('#emergency_setting_urllink').val(),
|
|
not_answer: $('input[name="noanswer"]:checked').val(),
|
|
priority: $('#emergency_setting_priority').val()
|
|
};
|
|
SaveSpinner(1);
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
SaveSpinner(0);
|
|
return;
|
|
}
|
|
else {
|
|
toast_ok(rel.msg);
|
|
emergencySettingTable.ajax.reload();
|
|
$('#emergency-setting-modal').modal('hide');
|
|
SaveSpinner(0);
|
|
return;
|
|
}
|
|
}, 'json');
|
|
}
|
|
}
|
|
|
|
//編輯大步驟單一資料
|
|
$('#settingList').on("click", "button.edit", function () {
|
|
$('#deletebtn').show();
|
|
selectsetting = $(this).parents('div').attr('setting');
|
|
if ($("#settingList").find('.btn').hasClass("btn-success")) {
|
|
$("#settingList").find('.btn').removeClass("btn-success").addClass("btn-secondary");
|
|
}
|
|
$(this).parent('div').find('.btn').removeClass("btn-secondary").addClass("btn-success");
|
|
var url = "/EmergencySetting/GetOnesetting";
|
|
var send_data = {
|
|
selectsetting: selectsetting
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
$('.modal-title').html("大步驟設定 - 編輯");
|
|
$('#emergency_item_order_modal').val(rel.data.priority);
|
|
$('#emergency_item_step_modal').val(rel.data.name);
|
|
if (rel.data.verify == 1) {
|
|
$('#icon_click').prop('checked', true);
|
|
} else {
|
|
$('#icon_click').prop('checked', false);
|
|
}
|
|
$('#emergency-item-modal').modal();
|
|
return;
|
|
}
|
|
}, 'json');
|
|
emergencySettingTable.ajax.reload();
|
|
|
|
});
|
|
|
|
//刪除小步驟單一資料
|
|
$('#emergency_setting_table').on("click", "button.del-btn", function () {
|
|
var url = "/EmergencySetting/DeletedOneSubSetting";
|
|
selectsubsetting = $(this).parents('tr').attr('guid');
|
|
var send_data = {
|
|
guid: selectsubsetting
|
|
};
|
|
Swal.fire(
|
|
{
|
|
title: "刪除",
|
|
text: "你確定是否刪除此筆資料?",
|
|
type: "warning",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: "是",
|
|
cancelButtonText: "否"
|
|
}).then(function (result) {
|
|
if (result.value) {
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
toast_error(rel.msg);
|
|
}
|
|
else {
|
|
emergencySettingTable.ajax.reload();
|
|
toast_ok(rel.msg);
|
|
}
|
|
}, 'json');
|
|
}
|
|
})
|
|
})
|
|
|
|
//編輯小步驟單一資料
|
|
$('#emergency_setting_table').on("click", "button.edit-btn", function () {
|
|
var url = "/EmergencySetting/GetOneSubSetting";
|
|
selectsubsetting = $(this).parents('tr').attr('guid');
|
|
var send_data = {
|
|
guid: selectsubsetting
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
toast_error(rel.msg);
|
|
}
|
|
else {
|
|
$('#emergency_setting_name').val(rel.data.full_name);
|
|
$('#emergency_setting_noanswer').val(rel.data.not_answer);
|
|
$('#emergency_setting_set_doing').val(rel.data.set_doing);
|
|
$('#emergency_setting_urltext').val(rel.data.url_text);
|
|
$('#emergency_setting_urllink').val(rel.data.url_link);
|
|
$('#emergency_setting_priority').val(rel.data.priority);
|
|
$('.modal-title').html("小步驟 - 編輯");
|
|
$('#emergency-setting-modal').modal();
|
|
}
|
|
}, 'json');
|
|
});
|
|
|
|
//刪除編組列表
|
|
function DeletedGrouping() {
|
|
var send_data = {
|
|
selectgroupid: selectsetting
|
|
};
|
|
Swal.fire(
|
|
{
|
|
title: "刪除",
|
|
text: "你確定是否刪除此筆資料?",
|
|
type: "warning",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: "是",
|
|
cancelButtonText: "否"
|
|
}).then(function (result) {
|
|
if (result.value) {
|
|
if ($("#emergency_setting_table").find(".dataTables_empty").length != 1) {
|
|
Swal.fire(
|
|
{
|
|
title: "刪除失敗",
|
|
icon: 'warning',
|
|
html: '需先刪除所有相關人員才可進行刪除',
|
|
});
|
|
return;
|
|
} else {
|
|
var url = "/EmergencyGrouping/DeleteOne/";
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
toast_ok(rel.msg);
|
|
selectsetting = 0;
|
|
$('#emergency-item-modal').modal('hide');
|
|
GetSettingList();
|
|
}, 'json');
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
//開啟模擬演練
|
|
function OnSimulationExercise() {
|
|
Verifybool = false;
|
|
GetbuttonList();
|
|
//$('#closemodal').attr('disabled', true);
|
|
var url = "/EmergencySetting/SaveAndOpenSimulationExercise";
|
|
var send_data = {
|
|
build: $('#buildlist').val(),
|
|
disaster: Selectadisaster,
|
|
type: 1
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
SimulationExerciseGuid = rel.data;
|
|
GetBigsetting();
|
|
//$('#SimulationExercisemodal').modal();
|
|
return;
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
function GetBigsetting() //組成頁面
|
|
{
|
|
var url = "/EmergencySetting/GetBigsetting";
|
|
var send_data = {
|
|
disaster: Selectadisaster
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
var bigsetting = "";
|
|
var smallsetting = "";
|
|
$('#bigsetting').empty();
|
|
$.each(rel.data, function (index, val) {
|
|
//<li class="nav-item"> <a class="nav-link fs-xl py-3 px-5" data-toggle="tab" href="#" role="tab"> <i class="fal fa-check text-success"></i> <span class="hidden-sm-down ml-1 text-secondary">確認與通報</span> </a> </li>
|
|
|
|
if (index == 0) {
|
|
EmerLastsetting = 0;
|
|
bigsetting += '<li class="nav-item">';
|
|
bigsetting += '<a class="nav-link fs-xl py-3 px-5 active" mas="' + val.id + '" data-toggle="tab" href="#t' + val.id + '_modal" id="t' + val.id + '_tab" onclick="ChangeBigSetting(' + val.id + ',' + val.verify + ')" role="tab">';
|
|
bigsetting += '<span class="hidden-sm-down ml-1 text-secondary">';
|
|
bigsetting += val.name + '</span > </a > </li >';
|
|
|
|
smallsetting += '<div class="tab-pane fade show active" id="t' + val.id + '_modal" role="tabpanel" aria-labelledby="' + val.id + '_modal">';
|
|
smallsetting += '<div class="row">';
|
|
smallsetting += '<div class="pr-2" style="width:38.5%">';
|
|
smallsetting += '<div id="panel-1" class="panel">';
|
|
smallsetting += '<div class="panel-container show">';
|
|
smallsetting += '<div class="panel-content">';
|
|
smallsetting += '<ul class="list-group" id="list_' + val.id + '">';
|
|
smallsetting += '</ul>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
|
|
smallsetting += '<div class="" style="width:61.5%">';
|
|
smallsetting += '<div class="panel">';
|
|
smallsetting += '<div class="panel-hdr" id="hbr_' + val.id + '">';
|
|
smallsetting += '</div>';
|
|
smallsetting += '<div class="panel-container show">';
|
|
smallsetting += '<div class="panel-content">';
|
|
smallsetting += '<div class="panel-tag" id="tag_' + val.id + '">';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '<div class="panel-content py-2 border-faded border-left-0 border-right-0 border-bottom-0 text-muted d-flex justify-content-between" id="button_' + val.id + '">';
|
|
smallsetting += '<div class=""><button type="button" class="btn btn-danger waves-effect waves-themed mr-2"> 不通報 </button><input type="text" class=""></div>';
|
|
smallsetting += '<div><button type="button" class="btn btn-success waves-effect waves-themed"> 下一步 </button></div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
} else {
|
|
bigsetting += '<li class="nav-item">';
|
|
bigsetting += '<a class="nav-link fs-xl py-3 px-5" data-toggle="tab" href="#t' + val.id + '_modal" id="t' + val.id + '_tab" onclick="ChangeBigSetting(' + val.id + ',' + val.verify + ')" role="tab">';
|
|
bigsetting += '<span class="hidden-sm-down ml-1 text-secondary">';
|
|
bigsetting += val.name + '</span > </a > </li >';
|
|
smallsetting += '<div class="tab-pane fade" id="t' + val.id + '_modal" role="tabpanel" aria-labelledby="' + val.id + '_modal">';
|
|
smallsetting += '<div class="row">';
|
|
smallsetting += '<div class="pr-2" style="width:38.5%">';
|
|
smallsetting += '<div id="panel-1" class="panel">';
|
|
smallsetting += '<div class="panel-container show">';
|
|
smallsetting += '<div class="panel-content">';
|
|
smallsetting += '<ul class="list-group" id="list_' + val.id + '">';
|
|
smallsetting += '</ul>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
|
|
smallsetting += '<div class="" style="width:61.5%">';
|
|
smallsetting += '<div class="panel">';
|
|
smallsetting += '<div class="panel-hdr" id="hbr_' + val.id + '">';
|
|
smallsetting += '</div>';
|
|
smallsetting += '<div class="panel-container show">';
|
|
smallsetting += '<div class="panel-content">';
|
|
smallsetting += '<div class="panel-tag" id="tag_' + val.id + '">';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '<div class="panel-content py-2 border-faded border-left-0 border-right-0 border-bottom-0 text-muted d-flex justify-content-between" id="button_' + val.id + '">';
|
|
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
|
|
smallsetting += '</div>';
|
|
smallsetting += '</div>';
|
|
}
|
|
});
|
|
|
|
//console.log(smallsetting);
|
|
$('#bigsetting').append(bigsetting);
|
|
$('#small_setting').empty();
|
|
$('#small_setting').append(smallsetting);
|
|
|
|
|
|
|
|
$.each(rel.data, function (index, val) {
|
|
if (index == 0) {
|
|
GetEmergencySetting(val.id, true);
|
|
} else {
|
|
GetEmergencySetting(val.id, false);
|
|
}
|
|
})
|
|
|
|
$('#SimulationExercisemodal').modal();
|
|
|
|
return;
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
function GetEmergencySetting(setting, bool) //生成左邊按鈕
|
|
{
|
|
var url = "/EmergencySetting/GetEmergencySetting";
|
|
var send_data = {
|
|
selectsetting: setting
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
var includeli = "";
|
|
$.each(rel.data, function (index, val) {
|
|
if (index == 0) {
|
|
includeli += '<li class="list-group-item active" id="li_' + val.emergency_guid + '" > <a class="abc" onclick="GetContentAndMakeItem(\'' + val.emergency_guid + '\',this,' + setting + ')" >' + val.full_name + '</a></li>';
|
|
} else {
|
|
includeli += '<li class="list-group-item" id="li_' + val.emergency_guid + '"> <a class="abc" onclick="GetContentAndMakeItem(\'' + val.emergency_guid + '\',this,' + setting + ')" >' + val.full_name + '</a></li>';
|
|
}
|
|
|
|
});
|
|
$('#list_' + setting).append(includeli);
|
|
if (bool) {
|
|
$('#bigsetting').find('.active').children().trigger('click');
|
|
}
|
|
//console.log(rel);
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
function GetContentAndMakeItem(smallsetting, e, setting)//小項目,按鈕,大項目 //點選左邊按鈕
|
|
{
|
|
//SelectUseTab = $('#bigsetting').find('.active').attr('id');
|
|
var FirstNotSend = $('#list_' + EmerNowsetting).children().not('.send').first().attr('id'); //當前要執行的步驟
|
|
var touch = $(e).parent().attr('id');//觸碰的按鈕
|
|
var has;
|
|
if (FirstNotSend == touch) {
|
|
has = 1; //true
|
|
} else {
|
|
has = 0; //false
|
|
}
|
|
$(e).parent().parent().find('.active').removeClass('active');
|
|
$(e).parent().addClass('active');
|
|
|
|
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(),
|
|
event_guid: SimulationExerciseGuid,
|
|
make_item: has
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
console.log(rel);
|
|
var buttonstr = "";
|
|
|
|
if (rel.data.not_answer == 1) {
|
|
buttonstr += '<div><button type="button" class="btn btn-danger waves-effect waves-themed mr-2" onclick="NextStep(\'' + rel.data.emergency_item_guid + '\',1)"> 不執行 </button>';
|
|
buttonstr += '<input type="text" id="text_' + rel.data.emergency_item_guid + '" />';
|
|
} else {
|
|
buttonstr += '<div><button type="button" class="btn btn-danger waves-effect waves-themed mr-2" onclick="NextStep(\'' + rel.data.emergency_item_guid + '\',2)"> 不執行 </button>';
|
|
}
|
|
buttonstr += '</div>';
|
|
buttonstr += '<div><button type="button" class="btn btn-success waves-effect waves-themed" onclick="NextStep(\'' + rel.data.emergency_item_guid + '\',0)"> 執行 </button></div>';
|
|
|
|
|
|
$('#button_' + setting).empty();
|
|
$('#button_' + setting).append(buttonstr);
|
|
if (has == 0) {
|
|
$('#button_' + setting).find('button').attr('disabled', true);
|
|
}
|
|
|
|
$('#hbr_' + setting).empty();
|
|
$('#hbr_' + setting).append('<h2>' + rel.data.full_name + '</h2>');
|
|
$('#tag_' + setting).empty();
|
|
$('#tag_' + setting).append(rel.data.set_doing);
|
|
|
|
Historytable.ajax.reload();
|
|
}
|
|
}, 'json');
|
|
|
|
|
|
}
|
|
|
|
function NextStep(eventguid, choose) { //choose:選擇 0:下一步 1:不通報(需要原因) 2:不通報(不用原因)
|
|
var url = "/EmergencySetting/NextStep";
|
|
var send_data = {
|
|
eventguid: eventguid,
|
|
choose: choose,
|
|
reason: $('#text_' + eventguid).val()
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
$('#list_' + EmerNowsetting).find('.active').addClass('send');
|
|
//給予完成勾勾
|
|
var strnow = $('#list_' + EmerNowsetting).find('.active').find('.abc').html();
|
|
$('#list_' + EmerNowsetting).find('.active').find('.abc').html('<i class="fal fa-check text-success"></i>' + strnow);
|
|
//找下一個沒有的做動作
|
|
var a = $('#list_' + EmerNowsetting).children().not('.send').not('.active').first().attr('id');
|
|
//如果沒下一個動作則到下一格大步驟
|
|
if (a == undefined) {
|
|
strnow = $('#t' + EmerNowsetting + '_tab').find('.text-secondary').html();
|
|
$('#t' + EmerNowsetting + '_tab').find('.text-secondary').html('<i class="fal fa-check text-success"></i>' + strnow);
|
|
$('#t' + EmerNowsetting + '_tab').addClass('send');
|
|
var tablist = $('#t' + EmerNowsetting + '_tab').parent().parent().children().children().not('.send').not('.active').first().attr('id');
|
|
//console.log(tablist);
|
|
|
|
if (tablist == undefined) {
|
|
$('#button_' + EmerNowsetting).find('button').attr('disabled', true);
|
|
CloseVerify = true;
|
|
//$('#closemodal').attr('disabled', false);
|
|
} else {
|
|
$('#' + tablist).trigger('click');
|
|
}
|
|
}
|
|
else {
|
|
$('#' + a).find('.abc').trigger('click');
|
|
}
|
|
|
|
}
|
|
}, 'json');
|
|
Historytable.ajax.reload();
|
|
|
|
}
|
|
|
|
function ChangeBigSetting(setting, verify) {//-------------------------------------------------------------------------------------
|
|
//console.log(verify);
|
|
if (verify == 1) {
|
|
if (Verifybool)//需驗證且通過
|
|
{
|
|
|
|
}
|
|
else//需驗證未通過
|
|
{
|
|
EmerLastsetting = $('#bigsetting').find('.active').attr('mas');
|
|
ToVerifyType = 0;
|
|
$('.modal-title').html("指揮官驗證");
|
|
$('#small_setting').hide();
|
|
$('#emergency_verify_input').val('');
|
|
$('#emergency-verify-modal').modal();
|
|
|
|
}
|
|
}
|
|
else//不需驗證
|
|
{
|
|
|
|
}
|
|
EmerNowsetting = setting;
|
|
$('#list_' + EmerNowsetting).find('.active').children().trigger('click');
|
|
}
|
|
|
|
function PassVerify(Vbool) {
|
|
if (ToVerifyType == 0) {
|
|
if (Vbool) {
|
|
var url = "/EmergencySetting/CheckVerifybool";
|
|
var send_data = {
|
|
pass: $('#emergency_verify_input').val()
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
} else {
|
|
if (rel.data) {
|
|
Verifybool = true;
|
|
$('#small_setting').show();
|
|
$('#emergency-verify-modal').modal('hide');
|
|
} else {
|
|
toast_warning('密碼驗證失敗,請重新驗證');
|
|
}
|
|
}
|
|
})
|
|
} else {//取消驗證
|
|
if (EmerLastsetting == 0) {
|
|
|
|
} else {
|
|
$('#small_setting').show();
|
|
$('#bigsetting').find('.active').removeClass('active');
|
|
$(`#t${EmerLastsetting}_tab`).addClass('active');
|
|
|
|
$('#small_setting').find('.show').removeClass('active show')
|
|
$(`#t${EmerLastsetting}_modal`).addClass('active show');
|
|
|
|
$('#list_' + EmerLastsetting).find('.active').children().trigger('click');
|
|
$('#emergency-verify-modal').modal('hide');
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
if (ToVerifyType == 1) {
|
|
if (Vbool) {
|
|
var url = "/EmergencySetting/CheckVerifybool";
|
|
var send_data = {
|
|
pass: $('#emergency_verify_input').val()
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
} else {
|
|
if (rel.data) {
|
|
CloseVerify = true;
|
|
$('#emergency-verify-modal').modal('hide');
|
|
$('#SimulationExercisemodal').modal('hide');
|
|
} else {
|
|
toast_warning('密碼驗證失敗,請重新驗證');
|
|
}
|
|
}
|
|
})
|
|
}
|
|
else {
|
|
$('#emergency-verify-modal').modal('hide');
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function GetbuttonList() {
|
|
var url = "/EmergencyGrouping/GetGroupingList";
|
|
var send_data = {
|
|
system_parent_id: Selectadisaster
|
|
};
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
if (rel.code == "9999") {
|
|
toast_error(rel.msg);
|
|
}
|
|
return;
|
|
}
|
|
else {
|
|
//console.log(rel);
|
|
var grouping = "";
|
|
$('#button_grouping').empty();
|
|
Allgroupidlist = [];
|
|
$.each(rel.data, function (index, val) {
|
|
Allgroupidlist.push(val.id);
|
|
grouping += '<div class="btn-group mb-2 mr-2">';
|
|
grouping += '<button type="button" class="btn btn-outline-success select" onclick="SelectGrouping(' + val.id + ',this)">' + val.name + '</button>';
|
|
grouping += '</div>';
|
|
});
|
|
$('#button_grouping').append(grouping);
|
|
|
|
//SMS
|
|
$("#sms-grouping").empty();
|
|
$.each(rel.data, function (index, val) {
|
|
$('#sms-grouping').append(`
|
|
<div class="btn-group mb-2 mr-2">
|
|
<button type="button" class="btn btn-outline-success select"
|
|
onclick="SelectSMSGrouping(${val.id},this)">${val.name}</button>
|
|
</div>`);
|
|
});
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
function SelectGrouping(grouping, e) {
|
|
if ($(e).hasClass("btn-outline-success")) {
|
|
$(e).removeClass("btn-outline-success").addClass("btn-success");
|
|
SelectMemberDepart.push(grouping);
|
|
} else if ($(e).hasClass("btn-success")) {
|
|
$(e).removeClass("btn-success").addClass("btn-outline-success");
|
|
var a = SelectMemberDepart.filter(function (n, i) {
|
|
if (n === grouping) {
|
|
SelectMemberDepart.splice(i, 1);
|
|
}
|
|
});
|
|
}
|
|
EmergencyContact.ajax.reload();
|
|
}
|
|
|
|
//全選所有組別
|
|
function Allgroupingselect() {
|
|
if (Allgroupingbool) {
|
|
$('#button_grouping').find(".btn-success").removeClass("btn-success").addClass("btn-outline-success");
|
|
SelectMemberDepart = [];
|
|
Allgroupingbool = false;
|
|
}
|
|
else {
|
|
$('#button_grouping').find(".btn-outline-success").removeClass("btn-outline-success").addClass("btn-success");
|
|
SelectMemberDepart = Allgroupidlist;
|
|
Allgroupingbool = true;
|
|
}
|
|
EmergencyContact.ajax.reload();
|
|
}
|
|
|
|
//選擇要發送簡訊的組別
|
|
function SelectSMSGrouping(grouping, e) {
|
|
if ($(e).hasClass("btn-outline-success")) {
|
|
$(e).removeClass("btn-outline-success").addClass("btn-success");
|
|
SelectSMSMemberDepart.push(grouping);
|
|
} else if ($(e).hasClass("btn-success")) {
|
|
$(e).removeClass("btn-success").addClass("btn-outline-success");
|
|
var a = SelectSMSMemberDepart.filter(function (n, i) {
|
|
if (n === grouping) {
|
|
SelectSMSMemberDepart.splice(i, 1);
|
|
}
|
|
});
|
|
}
|
|
SmsMemberTable.ajax.reload();
|
|
}
|
|
|
|
//全選所有發送簡訊的組別
|
|
function AllSMSgroupingselect() {
|
|
if (AllSMSgroupingbool) {
|
|
$('#sms-grouping').find(".btn-success").removeClass("btn-success").addClass("btn-outline-success");
|
|
SelectSMSMemberDepart = [];
|
|
AllSMSgroupingbool = false;
|
|
}
|
|
else {
|
|
$('#sms-grouping').find(".btn-outline-success").removeClass("btn-outline-success").addClass("btn-success");
|
|
SelectSMSMemberDepart = Allgroupidlist;
|
|
AllSMSgroupingbool = true;
|
|
}
|
|
SmsMemberTable.ajax.reload();
|
|
}
|
|
|
|
function Closemodal() {
|
|
$('.modal-title').html("指揮官驗證");
|
|
ToVerifyType = 1;
|
|
if (CloseVerify) {
|
|
$('#SimulationExercisemodal').modal('hide');
|
|
} else {
|
|
$('#emergency_verify_input').val('');
|
|
$('#emergency-verify-modal').modal();
|
|
}
|
|
}
|
|
|
|
//開啟發送簡訊Modal
|
|
function OpenSendSMSModal() {
|
|
$('#send-sms-modal').modal();
|
|
SmsMemberTable.ajax.reload();
|
|
}
|
|
</script>
|
|
} |