This commit is contained in:
dev02 2023-09-07 16:39:39 +08:00
commit b4118602c3
15 changed files with 283 additions and 30 deletions

View File

@ -385,7 +385,8 @@ namespace Backend.Controllers
left join variable sv on bm.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type and sv.deleted = 0 left join variable sv on bm.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type and sv.deleted = 0
left join floor lf on lf.floor_guid = bm.left_planimetric_floor_guid left join floor lf on lf.floor_guid = bm.left_planimetric_floor_guid
left join floor rf on rf.floor_guid = bm.right_planimetric_floor_guid left join floor rf on rf.floor_guid = bm.right_planimetric_floor_guid
where bm.building_tag = @building_tag and bm.main_system_tag in @MainList ORDER BY mv.system_priority ASC, sv.system_priority ASC, sv.created_at DESC ", where bm.building_tag = @building_tag and bm.main_system_tag in @MainList
ORDER BY bm.priority, mv.system_priority ASC, sv.system_priority ASC, sv.created_at DESC ",
new { building_tag = post.building_tag, MainList = post.MainList, main_system_type = main_system_type, sub_system_type = sub_system_type }); new { building_tag = post.building_tag, MainList = post.MainList, main_system_type = main_system_type, sub_system_type = sub_system_type });
apiResult.Code = "0000"; apiResult.Code = "0000";
@ -661,5 +662,53 @@ namespace Backend.Controllers
} }
return apiResult; return apiResult;
} }
/// <summary>
/// 修改棟別區域排列順序
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<List<string>>> ChangeBuildMenuPriority(PostBuildMenuPriority post)
{
ApiResult<List<string>> apiResult = new ApiResult<List<string>>();
try
{
List<Dictionary<string, object>> building_priorities = new List<Dictionary<string, object>>();
if (post.BuildMenuPriorities != null)
{
foreach (var building_priority in post.BuildMenuPriorities)
{
Dictionary<string, object> building_priority_dic = new Dictionary<string, object>();
building_priority_dic = new Dictionary<string, object>()
{
{ "building_tag", building_priority.Building_tag},
{ "main_system_tag", building_priority.Main_System_tag},
{ "sub_system_tag", building_priority.Sub_System_tag},
{ "@priority", building_priority.Priority},
{ "@updated_by", myUserInfo.Userinfo_guid},
{ "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
};
building_priorities.Add(building_priority_dic);
}
var sql = $@"UPDATE building_menu SET priority = @priority, updated_by = @updated_by, updated_at=@updated_at
WHERE building_tag = @building_tag and main_system_tag = @main_system_tag and sub_system_tag = @sub_system_tag";
await backendRepository.ExecuteSql(sql, building_priorities);
}
apiResult.Code = "0000";
apiResult.Msg = "修改成功";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
} }
} }

View File

@ -54,9 +54,9 @@ namespace Backend.Controllers
sv.system_key AS sFull_name, sv.system_key AS sFull_name,
sv.system_priority AS sPriority sv.system_priority AS sPriority
FROM building_menu bm FROM building_menu bm
LEFT JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0 JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0
LEFT JOIN variable mv ON bm.main_system_tag = mv.system_value AND mv.deleted = 0 and mv.system_type = '{main_system_type}' JOIN variable mv ON bm.main_system_tag = mv.system_value AND mv.deleted = 0 and mv.system_type = '{main_system_type}'
LEFT JOIN variable sv ON bm.sub_system_tag = sv.system_value AND sv.deleted = 0 and sv.system_type = '{sub_system_type}'"; JOIN variable sv ON bm.sub_system_tag = sv.system_value AND sv.deleted = 0 and sv.system_type = '{sub_system_type}'";
if (!string.IsNullOrEmpty(filter)) if (!string.IsNullOrEmpty(filter))
{ {
@ -67,7 +67,7 @@ namespace Backend.Controllers
)"; )";
} }
sql += $@" ORDER BY b.priority, mv.system_priority, sv.system_priority, sv.created_at DESC"; sql += $@" ORDER BY b.priority, mv.system_priority, bm.priority, sv.system_priority, sv.created_at DESC";
var buildingMenuRawDatas = await backendRepository.GetAllAsync<BuildingMenuRawData>(sql, new { Filter = filter }); var buildingMenuRawDatas = await backendRepository.GetAllAsync<BuildingMenuRawData>(sql, new { Filter = filter });

View File

@ -28,7 +28,23 @@ namespace Backend.Models
public string right_riser_diagram_url { get; set; } public string right_riser_diagram_url { get; set; }
public byte right_planimetric_click { get; set; } public byte right_planimetric_click { get; set; }
public string right_planimetric_floor_guid { get; set; } public string right_planimetric_floor_guid { get; set; }
public string priority { get; set; }
} }
public class PostBuildMenuPriority
{
public List<BuildMenuPriority> BuildMenuPriorities { get; set; }
}
public class BuildMenuPriority
{
public string Building_guid { get; set; } //區域GUID
public string Building_tag { get; set; } //區域TAG
public string Main_System_tag { get; set; } //大類TAG
public string Sub_System_tag { get; set; } //小類TAG
public int Priority { get; set; }
}
public class BuildMenuAddSub: BuildMenu public class BuildMenuAddSub: BuildMenu
{ {
public string sub_system_guid_name { get; set; } public string sub_system_guid_name { get; set; }

View File

@ -57,6 +57,7 @@
"columns": [ "columns": [
{ {
"data": "building_tag", "data": "building_tag",
"sortable":false,
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
return meta.row + 1; return meta.row + 1;
} }
@ -64,28 +65,36 @@
{ {
"data": "priority", "data": "priority",
"className": "reorder", "className": "reorder",
"sortable":false,
"visible": false "visible": false
}, },
{ {
"data": "full_name" "data": "full_name",
"sortable":false,
}, },
{ {
"data": "ip_address" "data": "ip_address",
"sortable":false,
}, },
{ {
"data": "ip_port" "data": "ip_port",
"sortable":false,
}, },
{ {
"data": "floorNum" "data": "floorNum",
"sortable":false,
}, },
{ {
"data": "created_at" "data": "created_at",
"sortable":false,
}, },
{ {
"data": null, "data": null,
"sortable":false,
"defaultContent": '<button class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>' "defaultContent": '<button class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>'
} }
], ],
"order": [],
//"order": [[2, "desc"]], //"order": [[2, "desc"]],
'createdRow': function (row, data, dataIndex) { 'createdRow': function (row, data, dataIndex) {
$(row).attr('data-guid', data.building_tag); $(row).attr('data-guid', data.building_tag);
@ -126,12 +135,30 @@
buildInfoTable.on("row-reorder", function (e, diff, edit) { buildInfoTable.on("row-reorder", function (e, diff, edit) {
var exchangeList = []; var exchangeList = [];
let allData = buildInfoTable.rows().data().toArray();
allData.forEach((ad,i) => ad._idx = i);
let defData = allData.filter(d =>
!diff.some(f => {
let rowData = buildInfoTable.row(f.node).data();
return d.building_tag == rowData.building_tag
}) && d.priority == "0"
);
for(var rowData of defData){
let obj = {
building_tag: rowData.building_tag,
priority: rowData._idx + 1
}
exchangeList.push(obj);
}
for (var i = 0, len = diff.length; i < len; i++) { for (var i = 0, len = diff.length; i < len; i++) {
var rowData = buildInfoTable.row(diff[i].node).data(); var rowData = buildInfoTable.row(diff[i].node).data();
var obj = { var obj = {
building_tag: rowData.building_tag, building_tag: rowData.building_tag,
priority: diff[i].newData priority: diff[i].newPosition + 1
} }
exchangeList.push(obj); exchangeList.push(obj);

View File

@ -49,6 +49,7 @@
<thead class="thead-themed"> <thead class="thead-themed">
<tr> <tr>
<th>序</th> <th>序</th>
<th></th>
<th>系統大類</th> <th>系統大類</th>
<th>系統小類</th> <th>系統小類</th>
<th>左邊預設頁面</th> <th>左邊預設頁面</th>
@ -449,27 +450,42 @@
GetBuild(); GetBuild();
GetMainList(); GetMainList();
buildMenuTable = $("#buildMenu_table").DataTable({ buildMenuTable = $("#buildMenu_table").DataTable({
"rowReorder": {
"dataSrc": "priority"
},
"columns": [ "columns": [
{ {
"data": "building_tag", "data": "building_tag",
"sortable":false,
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
return meta.row + 1; return meta.row + 1;
} }
}, },
{ {
"data": "main_system_guid_name" "data": "priority",
"className": "reorder",
"sortable":false,
"visible": false
}, },
{ {
"data": "sub_system_guid_name" "data": "main_system_guid_name",
"sortable":false,
}, },
{ {
"data": "left_drawing_name" "data": "sub_system_guid_name",
"sortable":false,
}, },
{ {
"data": "left_planimetric_click_name" "data": "left_drawing_name",
"sortable":false,
},
{
"data": "left_planimetric_click_name",
"sortable":false,
}, },
{ {
"data": null, "data": null,
"sortable":false,
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
var str = []; var str = [];
if (2 & parseInt(data) > 0) { if (2 & parseInt(data) > 0) {
@ -485,13 +501,16 @@
// "data": "left_icon_click_url" // "data": "left_icon_click_url"
//}, //},
{ {
"data": "right_drawing_name" "data": "right_drawing_name",
"sortable":false,
}, },
{ {
"data": "right_planimetric_click_name" "data": "right_planimetric_click_name",
"sortable":false,
}, },
{ {
"data": null, "data": null,
"sortable":false,
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
var str = []; var str = [];
if (2 & parseInt(data) > 0) { if (2 & parseInt(data) > 0) {
@ -508,11 +527,13 @@
//}, //},
{ {
"data": null, "data": null,
"sortable": false,
"render": function (data, type, row, meta){ "render": function (data, type, row, meta){
return '<button bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn" bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" >刪除</button>'; return '<button bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn" bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" >刪除</button>';
} }
} }
], ],
"order":[],
'createdRow': function (row, data, dataIndex) { 'createdRow': function (row, data, dataIndex) {
$(row).attr('bg-guid', data.building_tag); $(row).attr('bg-guid', data.building_tag);
$(row).attr('ms-guid', data.main_system_tag); $(row).attr('ms-guid', data.main_system_tag);
@ -558,6 +579,71 @@
} }
} }
}); });
buildMenuTable.on("row-reorder", function(e,node,pos){
console.log(buildMenuTable.context[0])
})
buildMenuTable.on("row-reorder", function (e, diff, edit) {
if (SelectMainList.length > 1) {
toast_warning("只能在單選系統大類時排序系統小類!");
return false;
}
let allData = buildMenuTable.rows().data().toArray();
allData.forEach((ad,i) => ad._idx = i);
let defData = allData.filter(d =>
!diff.some(f => {
let rowData = buildMenuTable.row(f.node).data();
return d.building_tag == rowData.building_tag && d.main_system_tag == rowData.main_system_tag && d.sub_system_tag == rowData.sub_system_tag
}) && d.priority == "0"
);
var exchangeList = [];
for(var rowData of defData){
let obj = {
building_tag: rowData.building_tag,
main_system_tag: rowData.main_system_tag,
sub_system_tag: rowData.sub_system_tag,
priority: rowData._idx + 1
}
exchangeList.push(obj);
}
for (var i = 0, len = diff.length; i < len; i++) {
var rowData = buildMenuTable.row(diff[i].node).data();
var obj = {
building_tag: rowData.building_tag,
main_system_tag: rowData.main_system_tag,
sub_system_tag: rowData.sub_system_tag,
priority: diff[i].newPosition + 1
}
exchangeList.push(obj);
}
var url = "/BuildMenu/ChangeBuildMenuPriority";
var send_data = {
BuildMenuPriorities: exchangeList
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
if (rel.code == "9999") {
toast_error(rel.msg);
}
else {
toast_warning(rel.msg);
}
return;
}
else {
toast_ok(rel.msg);
buildMenuTable.ajax.reload(null, false);
}
}, "json");
});
buildMenuFloorTable = $("#buildMenu_floor_table").DataTable({ buildMenuFloorTable = $("#buildMenu_floor_table").DataTable({
"columns": [ "columns": [
{ {

View File

@ -18,10 +18,11 @@
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome //"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office //"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut //"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
"Database": "+5RAiFLJVU+LRyDxF1K/pcLZaoZa4k/thZqF6xKoCag=", //dome_online_0821
//"Database": "2U+9jYGy0dCbMzLaguBXow==", //tpe_dome_mall //"Database": "2U+9jYGy0dCbMzLaguBXow==", //tpe_dome_mall
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="

View File

@ -180,7 +180,6 @@ namespace FrontendWebApi.ApiControllers
v2.system_key subfull_name, v2.system_key subfull_name,
v2.system_priority subpriority v2.system_priority subpriority
from building_menu me from building_menu me
join building b on b.building_tag = me.building_tag and b.deleted = 0
left join variable v1 on me.main_system_tag = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' left join variable v1 on me.main_system_tag = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
left join variable v2 on me.sub_system_tag = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' left join variable v2 on me.sub_system_tag = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
inner join ( inner join (
@ -196,8 +195,9 @@ namespace FrontendWebApi.ApiControllers
left join auth_page ap on ra.AuthCode = ap.AuthCode left join auth_page ap on ra.AuthCode = ap.AuthCode
where ap.AuthType = 1 where ap.AuthType = 1
) shower on shower.building_tag = me.building_tag and shower.ShowView = v2.id ) shower on shower.building_tag = me.building_tag and shower.ShowView = v2.id
join building b on b.building_tag = me.building_tag and b.deleted = 0 and shower.building_tag = b.building_tag
where me.is_link = 1 where me.is_link = 1
order by b.priority, v1.system_priority, v2.system_priority, v2.created_at DESC", new { Account = account }); order by b.priority, v1.system_priority, me.priority, v2.system_priority, v2.created_at DESC", new { Account = account });
var floorsql = await backendRepository.GetAllAsync<Floorsql>(@" var floorsql = await backendRepository.GetAllAsync<Floorsql>(@"
select * from (select * from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0) a select * from (select * from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0) a
@ -325,7 +325,7 @@ namespace FrontendWebApi.ApiControllers
{ {
var sub_system = await backendRepository.GetOneAsync<BuildMenuSql>(@$"select v.system_key subfull_name,me.* from building_menu me var sub_system = await backendRepository.GetOneAsync<BuildMenuSql>(@$"select v.system_key subfull_name,me.* from building_menu me
left join variable v on v.system_value = me.sub_system_tag and v.system_type = 'device_system_category_layer3' and v.deleted = 0 left join variable v on v.system_value = me.sub_system_tag and v.system_type = 'device_system_category_layer3' and v.deleted = 0
where me.building_tag = '{get.building_tag}' and me.main_system_tag = '{get.main_system_tag}' and me.sub_system_tag = '{get.sub_system_tag}' order by v.system_priority"); where me.building_tag = '{get.building_tag}' and me.main_system_tag = '{get.main_system_tag}' and me.sub_system_tag = '{get.sub_system_tag}' order by me.priority");
List<Floor> Floors = new List<Floor>(); List<Floor> Floors = new List<Floor>();
var floorsql = await backendRepository.GetAllAsync<Floorsql>($@" var floorsql = await backendRepository.GetAllAsync<Floorsql>($@"

View File

@ -61,7 +61,7 @@ namespace FrontendWebApi.ApiControllers
try try
{ {
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>( var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
@$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority, @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority, bm.priority,
dk.device_normal_color, dk.device_close_color, dk.device_error_color,dk.device_normal_flashing, dk.device_close_flashing, dk.device_error_flashing, dk.device_normal_color, dk.device_close_color, dk.device_error_color,dk.device_normal_flashing, dk.device_close_flashing, dk.device_error_flashing,
dk.device_normal_text, dk.device_close_text, dk.device_error_text,dk.device_normal_point_name, dk.device_close_point_name, dk.device_error_point_name, dk.device_normal_text, dk.device_close_text, dk.device_error_text,dk.device_normal_point_name, dk.device_close_point_name, dk.device_error_point_name,
dk.device_normal_point_value, dk.device_close_point_value, dk.device_error_point_value dk.device_normal_point_value, dk.device_close_point_value, dk.device_error_point_value
@ -76,10 +76,10 @@ namespace FrontendWebApi.ApiControllers
left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
-- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0 -- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
join ( join (
select distinct main_system_tag, sub_system_tag from building_menu where building_tag = @building_tag and is_link = 1 select distinct main_system_tag, sub_system_tag, priority from building_menu where building_tag = @building_tag and is_link = 1
) as bm on v2.system_value = bm.sub_system_tag and v1.system_value = bm.main_system_tag ) as bm on v2.system_value = bm.sub_system_tag and v1.system_value = bm.main_system_tag
where c.account = @account where c.account = @account
order by v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag }); order by v2.system_priority, bm.priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });
var mains = dbsub.GroupBy(a => a.main_system_tag).ToList(); var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
apiResult.Data = new History_MainSubBuildFloor(); apiResult.Data = new History_MainSubBuildFloor();
apiResult.Data.history_Main_Systems = new List<History_Main_system>(); apiResult.Data.history_Main_Systems = new List<History_Main_system>();
@ -158,7 +158,8 @@ namespace FrontendWebApi.ApiControllers
var buiMenu = await frontendRepository.GetOneAsync<BuildBuildingMenu>( var buiMenu = await frontendRepository.GetOneAsync<BuildBuildingMenu>(
@$"SELECT b.urn_3D,bm.* FROM building_menu bm @$"SELECT b.urn_3D,bm.* FROM building_menu bm
JOIN building b on b.building_tag = bm.building_tag JOIN building b on b.building_tag = bm.building_tag
WHERE bm.building_tag = @building_tag AND bm.main_system_tag = @main_system_tag AND bm.sub_system_tag = @sub_system_tag", WHERE bm.building_tag = @building_tag AND bm.main_system_tag = @main_system_tag AND bm.sub_system_tag = @sub_system_tag
ORDER BY bm.priority",
new { @sub_system_tag = fd.sub_system_tag, @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag }); new { @sub_system_tag = fd.sub_system_tag, @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag });
apiResult.Data = buiMenu; apiResult.Data = buiMenu;
@ -856,7 +857,8 @@ namespace FrontendWebApi.ApiControllers
var buiMenu = await frontendRepository.GetOneAsync<BuildBuildingMenu>( var buiMenu = await frontendRepository.GetOneAsync<BuildBuildingMenu>(
@$"SELECT b.urn_3D,bm.* FROM building_menu bm @$"SELECT b.urn_3D,bm.* FROM building_menu bm
JOIN building b on b.building_tag = bm.building_tag JOIN building b on b.building_tag = bm.building_tag
WHERE bm.building_tag = @building_tag AND bm.main_system_tag = @main_system_tag AND bm.sub_system_tag = @sub_system_tag", WHERE bm.building_tag = @building_tag AND bm.main_system_tag = @main_system_tag AND bm.sub_system_tag = @sub_system_tag
ORDER BY bm.priority",
new { @sub_system_tag = fd.sub_system_tag, @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag }); new { @sub_system_tag = fd.sub_system_tag, @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag });
apiResult.Data = buiMenu; apiResult.Data = buiMenu;

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Repository.BaseRepository.Interface;
using Repository.Helper;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -10,12 +12,15 @@ namespace FrontendWebApi.Controllers
public class HomeController : MyBaseController<HomeController> public class HomeController : MyBaseController<HomeController>
{ {
private readonly ILogger<HomeController> _logger; private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger) public HomeController(ILogger<HomeController> logger)
{ {
_logger = logger; _logger = logger;
} }
public IActionResult Index() public IActionResult Index()
{ {
return View(); return View();

View File

@ -10,6 +10,7 @@ using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using Repository.BackendRepository.Interface; using Repository.BackendRepository.Interface;
using Repository.FrontendRepository.Interface; using Repository.FrontendRepository.Interface;
using Repository.Helper;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -25,6 +26,7 @@ namespace FrontendWebApi.Controllers
private readonly IBackendRepository backendRepository; private readonly IBackendRepository backendRepository;
private readonly IFrontendRepository frontendRepository; private readonly IFrontendRepository frontendRepository;
private readonly IJwtHelpers jwt; private readonly IJwtHelpers jwt;
private readonly IDatabaseHelper _base;
//string jwt_str = "login"; //string jwt_str = "login";
protected MyUserInfo myUserInfo = null; protected MyUserInfo myUserInfo = null;
protected JwtGet myUser; protected JwtGet myUser;
@ -36,13 +38,20 @@ namespace FrontendWebApi.Controllers
ILogger<LoginController> logger, ILogger<LoginController> logger,
IBackendRepository backendRepository, IBackendRepository backendRepository,
IFrontendRepository frontendRepository, IFrontendRepository frontendRepository,
IJwtHelpers jwt IJwtHelpers jwt,
IDatabaseHelper bases
) )
{ {
this.logger = logger; this.logger = logger;
this.jwt = jwt; this.jwt = jwt;
this.backendRepository = backendRepository; this.backendRepository = backendRepository;
this.frontendRepository = frontendRepository; this.frontendRepository = frontendRepository;
_base = bases;
}
public IActionResult GetDB()
{
Response.WriteAsync($"{_base.GetMySqlConnectionString()}");
return View();
} }
public IActionResult Index(string jwt) public IActionResult Index(string jwt)

View File

@ -83,6 +83,8 @@ namespace FrontendWebApi.Controllers
myUserInfo.ShowView = showview.Result; myUserInfo.ShowView = showview.Result;
ViewBag.myUserInfo = myUserInfo; ViewBag.myUserInfo = myUserInfo;
ViewBag.role = showview.Result; ViewBag.role = showview.Result;
ViewBag.WarningValuePxPath = GetWarningValuePxPath().Result;
//var showviewt = new List<string>() //var showviewt = new List<string>()
// { // {
@ -162,5 +164,16 @@ namespace FrontendWebApi.Controllers
//} //}
base.OnActionExecuting(filterContext); base.OnActionExecuting(filterContext);
} }
public async Task<string> GetWarningValuePxPath() {
var pxPath = await frontendRepository.GetOneAsync<string>($@"
SELECT system_value FROM `variable` where system_type = 'pxPath' and system_key = 'warningValue' and deleted = '0'");
var frontendPath = await frontendRepository.GetOneAsync<string>($@"
SELECT system_value FROM `variable` where system_type = 'obixConfig' and system_key = 'ApiBase' and deleted = '0'");
pxPath = frontendPath + pxPath;
return pxPath;
}
} }
} }

View File

@ -137,7 +137,19 @@
} }
</ul> </ul>
</li> </li>
} }
@if (ViewBag.role.Contains("RescueDeviceAED"))
{
<li class="">
<a href="#" title="警戒值設定" data-filter-tags="category" id="warningValueBtn">
<i class="fal fa-ballot-check"></i>
<span class="nav-link-text" data-i18n="nav.category">警戒值設定</span>
</a>
</li>
}
</ul> </ul>
<div class="filter-message js-filter-message bg-success-600"></div> <div class="filter-message js-filter-message bg-success-600"></div>
</nav> </nav>
@ -828,6 +840,29 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 警戒值設定 -->
<div class="modal" tabindex="-1" id="warning-value-modal" role="dialog" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered" style="width:40%">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">警戒值設定</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<iframe src="@ViewBag.WarningValuePxPath" style="width:100%;height:100%;"></iframe>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.變更密碼 --> <!-- /.變更密碼 -->
<!--Base JS--> <!--Base JS-->
<script src="~/js/vendors.bundle.js" asp-append-version="true"></script> <script src="~/js/vendors.bundle.js" asp-append-version="true"></script>
@ -861,5 +896,13 @@
@*各頁面的JavaScript*@ @*各頁面的JavaScript*@
@RenderSection("Scripts", required: false) @RenderSection("Scripts", required: false)
<script>
function showWarningValueModal(e){
$("#warning-value-modal").modal("show");
}
$("body").on("click","#warningValueBtn",showWarningValueModal);
</script>
</body> </body>
</html> </html>

View File

@ -18,7 +18,8 @@
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome //"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
"Database": "+5RAiFLJVU+LRyDxF1K/pcLZaoZa4k/thZqF6xKoCag=", //dome_online_0821
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office //"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT //"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT

View File

@ -24,10 +24,11 @@
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", // //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT //"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome //"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office //"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
"Database": "+5RAiFLJVU+LRyDxF1K/pcLZaoZa4k/thZqF6xKoCag=", //dome_online_0821
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
}, },

View File

@ -65,7 +65,7 @@ namespace Repository.Helper
//var databaseStr = ed.AESEncrypt("bims_mitsubishi"); // bims_wsp: IgYBsgG2VLKKxFb64j7LOA== ; bims_mitsubishi //var databaseStr = ed.AESEncrypt("bims_mitsubishi"); // bims_wsp: IgYBsgG2VLKKxFb64j7LOA== ; bims_mitsubishi
//var rootStr = ed.AESEncrypt("bims"); // bims //var rootStr = ed.AESEncrypt("bims"); // bims
//var passwordStr = ed.AESEncrypt("mjmdev_BIMS2022"); // mjmdev_BIMS2022 //var passwordStr = ed.AESEncrypt("mjmdev_BIMS2022"); // mjmdev_BIMS2022
var connStr = $"server={serverStr};port={portStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;Allow User Variables=True;"; var connStr = $"server={serverStr};port={portStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;Allow User Variables=True;SslMode=None;";
//var conn = new MySqlConnection(connStr); //var conn = new MySqlConnection(connStr);
return connStr; return connStr;