Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
568a9e7e53
@ -267,7 +267,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Emergency_Setting_tables = await backendRepository.GetAllAsync<EmergencySettingTable>($@"
|
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");
|
where es.big_setting = {selectsetting} and es.deleted = 0 order by es.priority");
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = Emergency_Setting_tables;
|
apiResult.Data = Emergency_Setting_tables;
|
||||||
@ -296,7 +296,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var Emergency_Setting_tables = await backendRepository.GetOneAsync<EmergencyitemWithguid>($@"
|
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}'");
|
where es.emergency_guid = '{post.emergency_guid}'");
|
||||||
|
|
||||||
if (post.make_item == 1)
|
if (post.make_item == 1)
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
$(row).attr('guid', data.emergency_guid);
|
$(row).attr('guid', data.emergency_guid);
|
||||||
},
|
},
|
||||||
"ajax": {
|
"ajax": {
|
||||||
"url": "/EmergencyContact/EmergencyContactTable",
|
"url": "/api/EmergencyContact/EmergencyContactTable",
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.selectgroupidlist = selectgroupidlist
|
d.selectgroupidlist = selectgroupidlist
|
||||||
@ -116,7 +116,7 @@
|
|||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = rel.data.data;
|
data = rel.data;
|
||||||
if (data == null || data.length == 0) {
|
if (data == null || data.length == 0) {
|
||||||
|
|
||||||
this.data = [];
|
this.data = [];
|
||||||
|
@ -767,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_tag == building.guid);
|
var temp_building_index = backfill_building_device_amount.findIndex(x => x.building_tag == building.tag);
|
||||||
if (temp_building_index < 0) {
|
if (temp_building_index < 0) {
|
||||||
var building_obj = {
|
var building_obj = {
|
||||||
building_tag: building.guid,
|
building_tag: building.tag,
|
||||||
device_amount: new_layer3.device_amount
|
device_amount: new_layer3.device_amount
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,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_tag == building.guid)
|
var temp_layer2_index = backfill_layer2_device_amount.findIndex(x => x.value == layer2.value && x.building_tag == building.tag)
|
||||||
if (temp_layer2_index < 0) {
|
if (temp_layer2_index < 0) {
|
||||||
var layer2_obj = {
|
var layer2_obj = {
|
||||||
building_tag: building.guid,
|
building_tag: building.tag,
|
||||||
value: layer2.value,
|
value: layer2.value,
|
||||||
device_amount: new_layer3.device_amount
|
device_amount: new_layer3.device_amount
|
||||||
}
|
}
|
||||||
@ -792,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_tag == building.guid)
|
var temp_layer3_index = backfill_layer3_device_amount.findIndex(x => x.layer3 == layer3.value && x.layer2 == layer2.value && x.building_tag == building.tag)
|
||||||
if (temp_layer3_index < 0) {
|
if (temp_layer3_index < 0) {
|
||||||
var layer3_obj = {
|
var layer3_obj = {
|
||||||
building_tag: building.guid,
|
building_tag: building.tag,
|
||||||
layer2: layer2.value,
|
layer2: layer2.value,
|
||||||
layer3: layer3.value,
|
layer3: layer3.value,
|
||||||
device_amount: new_layer3.device_amount
|
device_amount: new_layer3.device_amount
|
||||||
@ -900,7 +900,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 (temp_all_building.findIndex(x => x.guid == building.guid) < 0) { //表示未加入,需加入
|
if (temp_all_building.findIndex(x => x.tag == building.tag) < 0) { //表示未加入,需加入
|
||||||
temp_all_building.push(building);
|
temp_all_building.push(building);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -912,16 +912,16 @@
|
|||||||
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_tag == building.guid)[0];
|
var building_device_amount = backfill_building_device_amount.filter(x => x.building_tag == building.tag)[0];
|
||||||
|
|
||||||
@*html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.guid}',this)">
|
@*html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.tag}',this)">
|
||||||
<button type="button" class="btn btn-secondary">${building.name}</button>
|
<button type="button" class="btn btn-secondary">${building.name}</button>
|
||||||
<button type="button" class="btn btn-secondary building_device_amount" id="${building.guid}_device_amount">${building_device_amount.device_amount}</button>
|
<button type="button" class="btn btn-secondary building_device_amount" id="${building.tag}_device_amount">${building_device_amount.device_amount}</button>
|
||||||
</div>`;*@
|
</div>`;*@
|
||||||
|
|
||||||
html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.guid}',this)">
|
html += `<div class="btn-group ml-2" onclick="SelectBuilding('${building.tag}',this)">
|
||||||
<button type="button" class="btn btn-secondary">${building.name}</button>
|
<button type="button" class="btn btn-secondary">${building.name}</button>
|
||||||
<button type="button" class="btn btn-secondary building_device_amount" id="${building.guid}_device_amount">0</button>
|
<button type="button" class="btn btn-secondary building_device_amount" id="${building.tag}_device_amount">0</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -932,7 +932,7 @@
|
|||||||
else {
|
else {
|
||||||
var html = "";
|
var html = "";
|
||||||
temp_all_building.forEach(function (building, building_index) {
|
temp_all_building.forEach(function (building, building_index) {
|
||||||
html += '<button type="button" class="btn btn-secondary ml-2" onclick="SelectBuilding(\'' + building.guid + '\',this)">' + building.name + '</button>';
|
html += '<button type="button" class="btn btn-secondary ml-2" onclick="SelectBuilding(\'' + building.tag + '\',this)">' + building.name + '</button>';
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#building').append(html);
|
$('#building').append(html);
|
||||||
@ -966,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_tag) { //抓取選擇棟別的底下樓層
|
if (building.tag == 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);
|
||||||
@ -1037,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_tag) { //抓取選擇棟別的底下樓層
|
if (building.tag == 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) {
|
||||||
@ -1128,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_tag) { //抓取選擇棟別的底下樓層
|
if (building.tag == 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) {
|
||||||
|
@ -192,7 +192,7 @@
|
|||||||
$(row).attr('device', data.device_name);
|
$(row).attr('device', data.device_name);
|
||||||
},
|
},
|
||||||
"ajax": {
|
"ajax": {
|
||||||
"url": "/EmergencyRecord/EmergencyRecordTable",
|
"url": "/api/EmergencyRecord/EmergencyRecordTable",
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.selectaDisaster = SelectaDisaster,
|
d.selectaDisaster = SelectaDisaster,
|
||||||
@ -205,7 +205,7 @@
|
|||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = rel.data.data;
|
data = rel.data;
|
||||||
if (data == null || data.length == 0) {
|
if (data == null || data.length == 0) {
|
||||||
|
|
||||||
this.data = [];
|
this.data = [];
|
||||||
@ -252,7 +252,7 @@
|
|||||||
$(row).attr('guid', data.emergency_item_guid);
|
$(row).attr('guid', data.emergency_item_guid);
|
||||||
},
|
},
|
||||||
"ajax": {
|
"ajax": {
|
||||||
"url": "/EmergencyRecord/EmergencyItemTable",
|
"url": "/api/EmergencyRecord/EmergencyItemTable",
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.event_guid = SelectEvent
|
d.event_guid = SelectEvent
|
||||||
@ -262,7 +262,7 @@
|
|||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = rel.data.data;
|
data = rel.data;
|
||||||
if (data == null || data.length == 0) {
|
if (data == null || data.length == 0) {
|
||||||
|
|
||||||
this.data = [];
|
this.data = [];
|
||||||
@ -320,7 +320,7 @@
|
|||||||
|
|
||||||
//取得所有棟別
|
//取得所有棟別
|
||||||
function GetBuild() {
|
function GetBuild() {
|
||||||
var url = "/EmergencyRecord/BuildInfoList";
|
var url = "/api/EmergencyRecord/BuildInfoList";
|
||||||
var send_data = {};
|
var send_data = {};
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
|
@ -253,7 +253,17 @@
|
|||||||
kind: 1
|
kind: 1
|
||||||
};
|
};
|
||||||
var url = "/RescueDevice/ExportExcel";
|
var url = "/RescueDevice/ExportExcel";
|
||||||
window.location = "/RescueDevice/ExportExcel?post=" + JSON.stringify(send_data);
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
xhrFields: { responseType: "blob" },
|
||||||
|
headers: { "Authorization": "Bearer " + localStorage.getItem('JWT-Authorization') },
|
||||||
|
url: "/RescueDevice/ExportExcel",
|
||||||
|
data: { "post": JSON.stringify(send_data) },
|
||||||
|
success: (res, text, xhr) => {
|
||||||
|
download(xhr, res);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//window.location = "/RescueDevice/ExportExcel?post=" + JSON.stringify(send_data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -253,8 +253,20 @@
|
|||||||
kind: 0
|
kind: 0
|
||||||
};
|
};
|
||||||
var url = "/RescueDevice/ExportExcel";
|
var url = "/RescueDevice/ExportExcel";
|
||||||
window.location = "/RescueDevice/ExportExcel?post=" + JSON.stringify(send_data);
|
$.ajax({
|
||||||
|
method:"POST",
|
||||||
|
xhrFields:{responseType:"blob"},
|
||||||
|
headers:{"Authorization":"Bearer " + localStorage.getItem('JWT-Authorization')},
|
||||||
|
url: "/RescueDevice/ExportExcel",
|
||||||
|
data:{"post":JSON.stringify(send_data)},
|
||||||
|
success:(res,text,xhr) => {
|
||||||
|
download(xhr,res);
|
||||||
|
}
|
||||||
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
@ -228,6 +228,36 @@ function SaveSpinner(status) { //1:Spinner 0:還原儲存
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下載檔案
|
||||||
|
*/
|
||||||
|
function download(res, blob, filename, fetchOption, callback = null) {
|
||||||
|
// 擷取回傳 header > content-disposition (後端定義檔案名稱)
|
||||||
|
let disposition = res.getResponseHeader("Content-Disposition");
|
||||||
|
let sDowName = "";
|
||||||
|
if (disposition) {
|
||||||
|
// 解析出名稱
|
||||||
|
sDowName = disposition.split(/filename\*=(?:utf-8'')?(.*)/gi)[1];
|
||||||
|
if (sDowName.toLowerCase().startsWith("utf-8''"))
|
||||||
|
sDowName = decodeURIComponent(sDowName.replace(/utf-8''/i, ""));
|
||||||
|
else sDowName = sDowName.replace(/['"]/g, "");
|
||||||
|
sDowName = decodeURIComponent(sDowName);
|
||||||
|
}
|
||||||
|
// 隱形a標籤
|
||||||
|
const a = document.createElement("a");
|
||||||
|
let href = URL.createObjectURL(blob);
|
||||||
|
if (href) {
|
||||||
|
a.href = href;
|
||||||
|
a.download = filename || sDowName || "";
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
callback ? callback() : "";
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user