This commit is contained in:
dev02 2023-05-22 10:09:07 +08:00
commit ccdc6e76c9
4 changed files with 170 additions and 62 deletions

View File

@ -582,41 +582,41 @@ namespace FrontendWebApi.ApiControllers
{ {
var device_url = string.Empty; var device_url = string.Empty;
if (((de.icon_click & 1) > 0) && !string.IsNullOrEmpty(de.icon_click_url)) if (((de.left_icon_click & 1) > 0) && !string.IsNullOrEmpty(de.left_icon_click_url))
{ {
device_url = de.icon_click_url; device_url = de.left_icon_click_url;
//點擊顯示系統圖 //點擊顯示系統圖
if (de.icon_click_url.Contains("[device_building_tag]")) if (de.left_icon_click_url.Contains("[device_building_tag]"))
{ {
device_url = device_url.Replace("[device_building_tag]", de.device_building_tag); device_url = device_url.Replace("[device_building_tag]", de.device_building_tag);
} }
if (de.icon_click_url.Contains("[device_system_tag]")) if (de.left_icon_click_url.Contains("[device_system_tag]"))
{ {
device_url = device_url.Replace("[device_system_tag]", de.device_system_tag); device_url = device_url.Replace("[device_system_tag]", de.device_system_tag);
} }
if (de.icon_click_url.Contains("[device_floor_tag]")) if (de.left_icon_click_url.Contains("[device_floor_tag]"))
{ {
device_url = device_url.Replace("[device_floor_tag]", de.device_floor_tag); device_url = device_url.Replace("[device_floor_tag]", de.device_floor_tag);
} }
if (de.icon_click_url.Contains("[device_name_tag]")) if (de.left_icon_click_url.Contains("[device_name_tag]"))
{ {
device_url = device_url.Replace("[device_name_tag]", de.device_name_tag); device_url = device_url.Replace("[device_name_tag]", de.device_name_tag);
} }
if (de.icon_click_url.Contains("[device_serial_tag]")) if (de.left_icon_click_url.Contains("[device_serial_tag]"))
{ {
device_url = device_url.Replace("[device_serial_tag]", de.device_serial_tag); device_url = device_url.Replace("[device_serial_tag]", de.device_serial_tag);
} }
if (de.icon_click_url.Contains("[tag_name]")) if (de.left_icon_click_url.Contains("[tag_name]"))
{ {
device_url = device_url.Replace("[tag_name]", de.device_number); device_url = device_url.Replace("[tag_name]", de.device_number);
} }
de.icon_click_url = null; de.left_icon_click_url = null;
de.DeviceURL = device_url; de.DeviceURL = device_url;
} }
@ -642,7 +642,7 @@ namespace FrontendWebApi.ApiControllers
// priority = de.priority, // priority = de.priority,
// status = de.status, // status = de.status,
// DeviceURL = device_url, // DeviceURL = device_url,
// icon_click = de.icon_click // left_icon_click = de.left_icon_click
//}; //};
//afloor.device.Add(device); //afloor.device.Add(device);
} }

View File

@ -825,7 +825,7 @@ namespace FrontendWebApi.ApiControllers
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
return Ok(apiResult); return Ok(apiResult);
} }
apiResult.Code = "0000";
return Ok(apiResult); return Ok(apiResult);
} }
} }

View File

@ -186,10 +186,10 @@ namespace FrontendWebApi.Models
public byte device_error_flashing { get; set; } public byte device_error_flashing { get; set; }
public byte device_error_independent { get; set; } public byte device_error_independent { get; set; }
public int priority { get; set; } public int priority { get; set; }
public byte icon_click { get; set; } public byte left_icon_click { get; set; }
public string icon_click_url { get; set; } public string left_icon_click_url { get; set; }
public int icon_click_url_width { get; set; } public int left_icon_click_url_width { get; set; }
public int icon_click_url_height { get; set; } public int left_icon_click_url_height { get; set; }
public string DeviceURL { get; set; } public string DeviceURL { get; set; }
public string point_name { get; set; } public string point_name { get; set; }
public string points { get; set; } public string points { get; set; }

View File

@ -282,20 +282,23 @@
</table> </table>
</div> </div>
<div class="col-6"> <div class="col-6">
<textarea class="form-control mt-3 mb-2" rows="5"></textarea> <textarea class="form-control mt-3 mb-2" rows="5" id="sms_messagebox"></textarea>
<span>發訊人:</span> <span>發訊人:</span>
</div> </div>
</div> </div>
<div class="row justify-content-between"> <div class="row justify-content-between">
<div class="col-auto"> <div class="col-auto">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="PassVerify(false)">取消</button>
</div> </div>
<div class="col-auto row"> <div class="col-auto row">
<div class="col-auto"> <div class="col-auto">
<input class="form-control" type="text" placeholder="請輸入指揮官密碼" /> <input class="form-control" type="password" id="sendSms_verify_input" placeholder="請輸入指揮官密碼" />
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button type="button" class="btn btn-primary" onclick="SaveSubSetting()">儲存</button>
<button type="button" class="btn btn-primary" onclick="PassVerify(true)">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" id="smsSaveBtnLoading" style="display:none"></span>
儲存</button>
</div> </div>
</div> </div>
</div> </div>
@ -337,7 +340,7 @@
var SelectedFilter = var SelectedFilter =
{ {
disasters: [], disasters: [],
building_guid: '', building_tag: '',
floor_guids: [], floor_guids: [],
layer2: [], layer2: [],
layer3: [] layer3: []
@ -393,7 +396,7 @@
$("#building").find(".building_device_amount").html(0); $("#building").find(".building_device_amount").html(0);
rel.data.buildingAlarmDeviceAmount.forEach(function (item) { rel.data.buildingAlarmDeviceAmount.forEach(function (item) {
$(`#${item.building_guid}_device_amount`).html(item.device_amount); $(`#${item.building_tag}_device_amount`).html(item.device_amount);
}); });
ResetDeviceTable(); ResetDeviceTable();
} }
@ -562,13 +565,13 @@
"data": "device_number", "data": "device_number",
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
@*var html = ` @*var html = `
<a href="javascript:void(0)" onclick="ChangeFloormap('${row.building_guid}', '${row.floorguid}', '${data}', '${row.layer3}')"> <a href="javascript:void(0)" onclick="ChangeFloormap('${row.building_tag}', '${row.floorguid}', '${data}', '${row.layer3}')">
${data} ${data}
</a> </a>
`;*@ `;*@
var html = ` var html = `
<a href="http://${row.ip_address}/file/BajascriptTest/_FloorMap.html?building_guid=${row.building_guid}&floor_guid=${row.floorguid}&layer3=${row.layer3}&device_number=${data}&show_cctv=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank"> <a href="http://${row.ip_address}/file/BajascriptTest/_FloorMap.html?building_tag=${row.building_tag}&floor_guid=${row.floorguid}&layer3=${row.layer3}&device_number=${data}&show_cctv=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank">
${data} ${data}
</a> </a>
`; `;
@ -620,7 +623,7 @@
"type": "POST", "type": "POST",
"data": function (d) { "data": function (d) {
d.select_disasters = SelectedFilter.disasters; d.select_disasters = SelectedFilter.disasters;
d.selectbuilding = SelectedFilter.building_guid; d.selectbuilding = SelectedFilter.building_tag;
d.select_Floors = SelectedFilter.floor_guids; d.select_Floors = SelectedFilter.floor_guids;
d.select_Layer3 = SelectedFilter.layer3; d.select_Layer3 = SelectedFilter.layer3;
}, },
@ -656,7 +659,7 @@
device_number: temp_device.device_number, device_number: temp_device.device_number,
device_name: temp_device.device_name, device_name: temp_device.device_name,
building_name: temp_device.building_name, building_name: temp_device.building_name,
building_guid: temp_device.building_guid, building_tag: temp_device.building_tag,
ip_address: temp_device.ip_address, ip_address: temp_device.ip_address,
disaster: temp_device.disaster, disaster: temp_device.disaster,
disaster_name: temp_device.disaster_name, disaster_name: temp_device.disaster_name,
@ -669,10 +672,10 @@
alarm_timestamp: alarm_device.alarm_timestamp, alarm_timestamp: alarm_device.alarm_timestamp,
} }
var temp_building_index = backfill_building_alarm_device_amount.findIndex(x => x.building_guid == temp_device.building_guid); var temp_building_index = backfill_building_alarm_device_amount.findIndex(x => x.building_tag == temp_device.building_tag);
if (temp_building_index < 0) { if (temp_building_index < 0) {
var building_obj = { var building_obj = {
building_guid: temp_device.building_guid, building_tag: temp_device.building_tag,
device_amount: 1 device_amount: 1
} }
@ -681,10 +684,10 @@
backfill_building_alarm_device_amount[temp_building_index].device_amount += 1; backfill_building_alarm_device_amount[temp_building_index].device_amount += 1;
} }
var temp_layer2_index = backfill_layer2_alarm_device_amount.findIndex(x => x.value == temp_device.layer2 && x.building_guid == temp_device.building_guid) var temp_layer2_index = backfill_layer2_alarm_device_amount.findIndex(x => x.value == temp_device.layer2 && x.building_tag == temp_device.building_tag)
if (temp_layer2_index < 0) { if (temp_layer2_index < 0) {
var layer2_obj = { var layer2_obj = {
building_guid: temp_device.building_guid, building_tag: temp_device.building_tag,
value: temp_device.layer2, value: temp_device.layer2,
device_amount: 1 device_amount: 1
} }
@ -694,10 +697,10 @@
backfill_layer2_alarm_device_amount[temp_layer2_index].device_amount += 1; backfill_layer2_alarm_device_amount[temp_layer2_index].device_amount += 1;
} }
var temp_layer3_index = backfill_layer3_alarm_device_amount.findIndex(x => x.layer3 == temp_device.layer3 && x.layer2 == temp_device.layer2 && x.building_guid == temp_device.building_guid) var temp_layer3_index = backfill_layer3_alarm_device_amount.findIndex(x => x.layer3 == temp_device.layer3 && x.layer2 == temp_device.layer2 && x.building_tag == temp_device.building_tag)
if (temp_layer3_index < 0) { if (temp_layer3_index < 0) {
var layer3_obj = { var layer3_obj = {
building_guid: temp_device.building_guid, building_tag: temp_device.building_tag,
layer2: temp_device.layer2, layer2: temp_device.layer2,
layer3: temp_device.layer3, layer3: temp_device.layer3,
device_amount: 1 device_amount: 1
@ -764,10 +767,10 @@
device_amount: layer3.device_amount device_amount: layer3.device_amount
} }
var temp_building_index = backfill_building_device_amount.findIndex(x => x.building_guid == building.guid); var temp_building_index = backfill_building_device_amount.findIndex(x => x.building_tag == building.guid);
if (temp_building_index < 0) { if (temp_building_index < 0) {
var building_obj = { var building_obj = {
building_guid: building.guid, building_tag: building.guid,
device_amount: new_layer3.device_amount device_amount: new_layer3.device_amount
} }
@ -776,10 +779,10 @@
backfill_building_device_amount[temp_building_index].device_amount += new_layer3.device_amount; backfill_building_device_amount[temp_building_index].device_amount += new_layer3.device_amount;
} }
var temp_layer2_index = backfill_layer2_device_amount.findIndex(x => x.value == layer2.value && x.building_guid == building.guid) var temp_layer2_index = backfill_layer2_device_amount.findIndex(x => x.value == layer2.value && x.building_tag == building.guid)
if (temp_layer2_index < 0) { if (temp_layer2_index < 0) {
var layer2_obj = { var layer2_obj = {
building_guid: building.guid, building_tag: building.guid,
value: layer2.value, value: layer2.value,
device_amount: new_layer3.device_amount device_amount: new_layer3.device_amount
} }
@ -789,10 +792,10 @@
backfill_layer2_device_amount[temp_layer2_index].device_amount += new_layer3.device_amount; backfill_layer2_device_amount[temp_layer2_index].device_amount += new_layer3.device_amount;
} }
var temp_layer3_index = backfill_layer3_device_amount.findIndex(x => x.layer3 == layer3.value && x.layer2 == layer2.value && x.building_guid == building.guid) var temp_layer3_index = backfill_layer3_device_amount.findIndex(x => x.layer3 == layer3.value && x.layer2 == layer2.value && x.building_tag == building.guid)
if (temp_layer3_index < 0) { if (temp_layer3_index < 0) {
var layer3_obj = { var layer3_obj = {
building_guid: building.guid, building_tag: building.guid,
layer2: layer2.value, layer2: layer2.value,
layer3: layer3.value, layer3: layer3.value,
device_amount: new_layer3.device_amount device_amount: new_layer3.device_amount
@ -909,7 +912,7 @@
var html = ""; var html = "";
temp_all_building.forEach(function (building, building_index) { temp_all_building.forEach(function (building, building_index) {
var building_device_amount = backfill_building_device_amount.filter(x => x.building_guid == building.guid)[0]; var building_device_amount = backfill_building_device_amount.filter(x => x.building_tag == building.guid)[0];
@*html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.guid}',this)"> @*html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.guid}',this)">
<button type="button" class="btn btn-secondary">${building.name}</button> <button type="button" class="btn btn-secondary">${building.name}</button>
@ -941,10 +944,10 @@
//#endregion //#endregion
//#region 選擇棟別 //#region 選擇棟別
function SelectBuilding(building_guid, e) { function SelectBuilding(building_tag, e) {
$('#building').find('button').removeClass('btn-success').addClass('btn-secondary') $('#building').find('button').removeClass('btn-success').addClass('btn-secondary')
SelectedFilter.building_guid = building_guid; SelectedFilter.building_tag = building_tag;
if (show_mode == 'alarm') { if (show_mode == 'alarm') {
$(e).find('button').addClass('btn-success'); $(e).find('button').addClass('btn-success');
} else { } else {
@ -963,7 +966,7 @@
all_device_group.forEach(function (disaster, disaster_index) { all_device_group.forEach(function (disaster, disaster_index) {
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取已選擇的防災類型的棟別內容 if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取已選擇的防災類型的棟別內容
disaster.groupBuildings.forEach(function (building, building_index) { disaster.groupBuildings.forEach(function (building, building_index) {
if (building.guid == SelectedFilter.building_guid) { //抓取選擇棟別的底下樓層 if (building.guid == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
building.groupFloors.forEach(function (floor, floor_index) { building.groupFloors.forEach(function (floor, floor_index) {
if (temp_all_floor.findIndex(x => x.guid == floor.guid) < 0) { //表示未加入,需加入 if (temp_all_floor.findIndex(x => x.guid == floor.guid) < 0) { //表示未加入,需加入
temp_all_floor.push(floor); temp_all_floor.push(floor);
@ -1034,7 +1037,7 @@
all_device_group.forEach(function (disaster, disaster_index) { all_device_group.forEach(function (disaster, disaster_index) {
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別 if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別
disaster.groupBuildings.forEach(function (building, building_index) { disaster.groupBuildings.forEach(function (building, building_index) {
if (building.guid == SelectedFilter.building_guid) { //抓取選擇棟別的底下樓層 if (building.guid == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
building.groupFloors.forEach(function (floor, floor_index) { building.groupFloors.forEach(function (floor, floor_index) {
if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類 if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類
floor.groupLayer2s.forEach(function (layer2, layer2_index) { floor.groupLayer2s.forEach(function (layer2, layer2_index) {
@ -1056,18 +1059,18 @@
var html = ""; var html = "";
temp_all_layer2.forEach(function (layer2, layer2_index) { temp_all_layer2.forEach(function (layer2, layer2_index) {
var layer2_device_amount = backfill_layer2_device_amount.filter(x => x.value == layer2.value && x.building_guid == SelectedFilter.building_guid)[0]; var layer2_device_amount = backfill_layer2_device_amount.filter(x => x.value == layer2.value && x.building_tag == SelectedFilter.building_tag)[0];
@*html += ` @*html += `
<div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)"> <div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)">
<button type="button" class="btn btn-outline-success">${layer2.name}</button> <button type="button" class="btn btn-outline-success">${layer2.name}</button>
<button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_guid}_${layer2_device_amount.value}_device_amount">${layer2_device_amount.device_amount}</button> <button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_tag}_${layer2_device_amount.value}_device_amount">${layer2_device_amount.device_amount}</button>
</div>`;*@ </div>`;*@
html += ` html += `
<div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)"> <div class="btn-group ml-2 mb-2" onclick="SelectLayer2('${layer2.value}',this)">
<button type="button" class="btn btn-outline-success">${layer2.name}</button> <button type="button" class="btn btn-outline-success">${layer2.name}</button>
<button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_guid}_${layer2_device_amount.value}_device_amount">0</button> <button type="button" class="btn btn-outline-success device_amount" id="${layer2_device_amount.building_tag}_${layer2_device_amount.value}_device_amount">0</button>
</div>`; </div>`;
}); });
@ -1125,7 +1128,7 @@
all_device_group.forEach(function (disaster, disaster_index) { all_device_group.forEach(function (disaster, disaster_index) {
if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別 if (SelectedFilter.disasters.findIndex(x => x == disaster.value) > -1) { //抓取選擇防災類型的底下棟別
disaster.groupBuildings.forEach(function (building, building_index) { disaster.groupBuildings.forEach(function (building, building_index) {
if (building.guid == SelectedFilter.building_guid) { //抓取選擇棟別的底下樓層 if (building.guid == SelectedFilter.building_tag) { //抓取選擇棟別的底下樓層
building.groupFloors.forEach(function (floor, floor_index) { building.groupFloors.forEach(function (floor, floor_index) {
if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類 if (SelectedFilter.floor_guids.findIndex(x => x == floor.guid) > -1) { //抓取選擇樓層的底下大類
floor.groupLayer2s.forEach(function (layer2, layer2_index) { floor.groupLayer2s.forEach(function (layer2, layer2_index) {
@ -1161,18 +1164,18 @@
var html = ""; var html = "";
temp_all_layer3.forEach(function (layer3, layer3_index) { temp_all_layer3.forEach(function (layer3, layer3_index) {
var layer3_device_amount = backfill_layer3_device_amount.filter(x => x.layer3 == layer3.value && x.building_guid == SelectedFilter.building_guid)[0]; var layer3_device_amount = backfill_layer3_device_amount.filter(x => x.layer3 == layer3.value && x.building_tag == SelectedFilter.building_tag)[0];
@*html += ` @*html += `
<div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)"> <div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)">
<button type="button" class="btn btn-outline-success">${layer3.name}</button> <button type="button" class="btn btn-outline-success">${layer3.name}</button>
<button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_guid}_${layer3_device_amount.layer3}_device_amount">${layer3_device_amount.device_amount}</button> <button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_tag}_${layer3_device_amount.layer3}_device_amount">${layer3_device_amount.device_amount}</button>
</div>`;*@ </div>`;*@
html += ` html += `
<div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)"> <div class="btn-group ml-2 mb-2" onclick="SelectLayer3('${layer3.value}',this)">
<button type="button" class="btn btn-outline-success">${layer3.name}</button> <button type="button" class="btn btn-outline-success">${layer3.name}</button>
<button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_guid}_${layer3_device_amount.layer3}_device_amount">0</button> <button type="button" class="btn btn-outline-success device_amount" id="${layer3_device_amount.building_tag}_${layer3_device_amount.layer3}_device_amount">0</button>
</div>`; </div>`;
}); });
@ -1226,20 +1229,20 @@
function ResetDeviceTable() { function ResetDeviceTable() {
if ((SelectedFilter.disasters == null || SelectedFilter.disasters.length <= 0) if ((SelectedFilter.disasters == null || SelectedFilter.disasters.length <= 0)
|| (SelectedFilter.building_guid == null || SelectedFilter.building_guid == "") || (SelectedFilter.building_tag == null || SelectedFilter.building_tag == "")
|| (SelectedFilter.floor_guids == null || SelectedFilter.floor_guids.length <= 0) || (SelectedFilter.floor_guids == null || SelectedFilter.floor_guids.length <= 0)
|| (SelectedFilter.layer3 == null || SelectedFilter.layer3.length <= 0) || (SelectedFilter.layer3 == null || SelectedFilter.layer3.length <= 0)
) { ) {
return; return;
} }
if (changeBuilding != "" && changeBuilding != SelectedFilter.building_guid) { if (changeBuilding != "" && changeBuilding != SelectedFilter.building_tag) {
alarmDeviceTable.clear().draw(); alarmDeviceTable.clear().draw();
} }
else { else {
alarmDeviceTable.ajax.reload(null, false); alarmDeviceTable.ajax.reload(null, false);
} }
changeBuilding = SelectedFilter.building_guid; changeBuilding = SelectedFilter.building_tag;
} }
//#endregion //#endregion
@ -1250,39 +1253,39 @@
if (show_mode == 'alarm') { if (show_mode == 'alarm') {
backfill_building_alarm_device_amount.forEach(function (building, index) { backfill_building_alarm_device_amount.forEach(function (building, index) {
$(`#${building.building_guid}_device_amount`).html(building.device_amount); $(`#${building.building_tag}_device_amount`).html(building.device_amount);
}); });
backfill_layer2_alarm_device_amount.forEach(function (layer2, index) { backfill_layer2_alarm_device_amount.forEach(function (layer2, index) {
$(`#${layer2.building_guid}_${layer2.value}_device_amount`).html(layer2.device_amount); $(`#${layer2.building_tag}_${layer2.value}_device_amount`).html(layer2.device_amount);
}); });
backfill_layer3_alarm_device_amount.forEach(function (layer3, index) { backfill_layer3_alarm_device_amount.forEach(function (layer3, index) {
$(`#${layer3.building_guid}_${layer3.layer3}_device_amount`).html(layer3.device_amount); $(`#${layer3.building_tag}_${layer3.layer3}_device_amount`).html(layer3.device_amount);
}); });
} else { } else {
backfill_building_device_amount.forEach(function (building, index) { backfill_building_device_amount.forEach(function (building, index) {
$(`#${building.building_guid}_device_amount`).html(building.device_amount); $(`#${building.building_tag}_device_amount`).html(building.device_amount);
}); });
backfill_layer2_device_amount.forEach(function (layer2, index) { backfill_layer2_device_amount.forEach(function (layer2, index) {
$(`#${layer2.building_guid}_${layer2.value}_device_amount`).html(layer2.device_amount); $(`#${layer2.building_tag}_${layer2.value}_device_amount`).html(layer2.device_amount);
}); });
backfill_layer3_device_amount.forEach(function (layer3, index) { backfill_layer3_device_amount.forEach(function (layer3, index) {
$(`#${layer3.building_guid}_${layer3.layer3}_device_amount`).html(layer3.device_amount); $(`#${layer3.building_tag}_${layer3.layer3}_device_amount`).html(layer3.device_amount);
}); });
} }
} }
//#endregion //#endregion
//#region 變更右方地圖(改為跳新分頁) //#region 變更右方地圖(改為跳新分頁)
function ChangeFloormap(building_guid, floor_guid, device_number, layer3) { function ChangeFloormap(building_tag, floor_guid, device_number, layer3) {
@* @*
$("#iframe-floormap").empty(); $("#iframe-floormap").empty();
$("#iframe-floormap").append( $("#iframe-floormap").append(
`<iframe src="http://60.251.164.125:8080/file/BajascriptTest/_FloorMap.html?building_guid=${building_guid}&floor_guid=${floor_guid}&layer3=${layer3}&device_number=${device_number}&show_cctv=1" width="100%" height="100%;" scrolling="no"></iframe>` `<iframe src="http://60.251.164.125:8080/file/BajascriptTest/_FloorMap.html?building_tag=${building_tag}&floor_guid=${floor_guid}&layer3=${layer3}&device_number=${device_number}&show_cctv=1" width="100%" height="100%;" scrolling="no"></iframe>`
) )
*@ *@
} }
@ -1312,7 +1315,7 @@
// de_number = $(e).parent().parent().attr('de-number'); // de_number = $(e).parent().parent().attr('de-number');
var url = "/api/EmergencyDevice/SaveAndOpenSimulationExercise"; var url = "/api/EmergencyDevice/SaveAndOpenSimulationExercise";
var send_data = { var send_data = {
build: SelectedFilter.building_guid, build: SelectedFilter.building_tag,
disaster: disaster, disaster: disaster,
type: type, type: type,
device: guid device: guid
@ -1418,6 +1421,7 @@
//#region 模擬演練 / SOP modal 開啟發送簡訊Modal //#region 模擬演練 / SOP modal 開啟發送簡訊Modal
function OpenSendSMSModal() { function OpenSendSMSModal() {
ToVerifyType = 2;
$('#send-sms-modal').modal(); $('#send-sms-modal').modal();
SmsMemberTable.ajax.reload(); SmsMemberTable.ajax.reload();
} }
@ -1731,7 +1735,7 @@
{ {
EmerLastsetting = $('#bigsetting').find('.active').attr('mas'); EmerLastsetting = $('#bigsetting').find('.active').attr('mas');
ToVerifyType = 0; ToVerifyType = 0;
$('.modal-title').html("指揮官驗證"); //$('.modal-title').html("指揮官驗證");
$('#small_setting').hide(); $('#small_setting').hide();
$('#emergency_verify_input').val(''); $('#emergency_verify_input').val('');
$('#emergency-verify-modal').modal(); $('#emergency-verify-modal').modal();
@ -1747,6 +1751,7 @@
} }
function PassVerify(Vbool) { function PassVerify(Vbool) {
console.log(SmsMemberTable.data().toArray())
if (ToVerifyType == 0) { if (ToVerifyType == 0) {
if (Vbool) { if (Vbool) {
var url = "api/EmergencyDevice/CheckVerifybool"; var url = "api/EmergencyDevice/CheckVerifybool";
@ -1815,6 +1820,109 @@
$('#emergency-verify-modal').modal('hide'); $('#emergency-verify-modal').modal('hide');
} }
} }
if(ToVerifyType == 2) {
if (Vbool) {
if(!$("#sms_messagebox").val()){
toast_warning('請輸入簡訊內容');
return;
}
controlSmsSaveBtnLoading(true);
var url = "api/EmergencyDevice/CheckVerifybool";
var send_data = {
pass: $('#sendSms_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;
sendSmsMessage();
} else {
toast_warning('密碼驗證失敗,請重新驗證');
}
}
controlSmsSaveBtnLoading(false);
})
} 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');
}
}
}
}
function controlSmsSaveBtnLoading(isShow = true) {
if(isShow){
$("#smsSaveBtnLoading").parent("button").prop("disabled",true);
$("#smsSaveBtnLoading").fadeIn(200);
} else {
$("#smsSaveBtnLoading").fadeOut(200);
$("#smsSaveBtnLoading").parent("button").prop("disabled",false);
}
}
function sendSmsMessage() {
if(Verifybool){
const members = SmsMemberTable.data().toArray();
const url = "api/HiNetMsg";
controlSmsSaveBtnLoading(true);
members.forEach(m => {
const send_data = {
Number:m.phone,
Msg:$("#sms_messagebox").val(),
};
$.ajax({
method:"POST",
url:url,
data:JSON.stringify(send_data),
contentType:"application/json;charset=utf-8",
success:(rel) => {
if (rel.code != "0000") {
if (rel.code == "9999") {
toast_error(rel.msg);
}
return;
} else {
if (rel.data) {
toast_ok("簡訊發送成功");
$("#send-sms-modal").modal("hide");
} else {
toast_warning('簡訊發送失敗,請重新操作');
}
}
},
complete:() => {
controlSmsSaveBtnLoading(false);
}
})
//$.post(url, JSON.stringify(send_data),{contentType:"applicaiton/json;charset=utf-8"}, function (rel) {
//})
})
} else {
toast_warning('密碼驗證失敗,請重新驗證');
}
} }
function Closemodal() { function Closemodal() {