diff --git a/Backend/Controllers/BuildMenuController.cs b/Backend/Controllers/BuildMenuController.cs
index d29e611..e97b30c 100644
--- a/Backend/Controllers/BuildMenuController.cs
+++ b/Backend/Controllers/BuildMenuController.cs
@@ -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 floor lf on lf.floor_guid = bm.left_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 });
apiResult.Code = "0000";
@@ -661,5 +662,53 @@ namespace Backend.Controllers
}
return apiResult;
}
+
+ ///
+ /// 修改棟別區域排列順序
+ ///
+ ///
+ [HttpPost]
+ public async Task>> ChangeBuildMenuPriority(PostBuildMenuPriority post)
+ {
+ ApiResult> apiResult = new ApiResult>();
+ try
+ {
+ List> building_priorities = new List>();
+ if (post.BuildMenuPriorities != null)
+ {
+ foreach (var building_priority in post.BuildMenuPriorities)
+ {
+ Dictionary building_priority_dic = new Dictionary();
+ building_priority_dic = new Dictionary()
+ {
+ { "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;
+ }
}
}
diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs
index 0875c61..40e97d2 100644
--- a/Backend/Controllers/DeviceManageController.cs
+++ b/Backend/Controllers/DeviceManageController.cs
@@ -54,9 +54,9 @@ namespace Backend.Controllers
sv.system_key AS sFull_name,
sv.system_priority AS sPriority
FROM building_menu bm
- LEFT 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}'
- LEFT JOIN variable sv ON bm.sub_system_tag = sv.system_value AND sv.deleted = 0 and sv.system_type = '{sub_system_type}'";
+ JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0
+ JOIN variable mv ON bm.main_system_tag = mv.system_value AND mv.deleted = 0 and mv.system_type = '{main_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))
{
@@ -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(sql, new { Filter = filter });
diff --git a/Backend/Models/BuildMenu.cs b/Backend/Models/BuildMenu.cs
index ed61c61..5e8d20d 100644
--- a/Backend/Models/BuildMenu.cs
+++ b/Backend/Models/BuildMenu.cs
@@ -28,7 +28,23 @@ namespace Backend.Models
public string right_riser_diagram_url { get; set; }
public byte right_planimetric_click { get; set; }
public string right_planimetric_floor_guid { get; set; }
+ public string priority { get; set; }
}
+
+ public class PostBuildMenuPriority
+ {
+ public List 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 string sub_system_guid_name { get; set; }
diff --git a/Backend/Views/BuildInfo/Index.cshtml b/Backend/Views/BuildInfo/Index.cshtml
index 29306d2..a0ac509 100644
--- a/Backend/Views/BuildInfo/Index.cshtml
+++ b/Backend/Views/BuildInfo/Index.cshtml
@@ -57,6 +57,7 @@
"columns": [
{
"data": "building_tag",
+ "sortable":false,
"render": function (data, type, row, meta) {
return meta.row + 1;
}
@@ -64,28 +65,36 @@
{
"data": "priority",
"className": "reorder",
+ "sortable":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,
+ "sortable":false,
"defaultContent": ' '
}
],
+ "order": [],
//"order": [[2, "desc"]],
'createdRow': function (row, data, dataIndex) {
$(row).attr('data-guid', data.building_tag);
@@ -126,12 +135,30 @@
buildInfoTable.on("row-reorder", function (e, diff, edit) {
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++) {
var rowData = buildInfoTable.row(diff[i].node).data();
var obj = {
building_tag: rowData.building_tag,
- priority: diff[i].newData
+ priority: diff[i].newPosition + 1
}
exchangeList.push(obj);
diff --git a/Backend/Views/BuildMenu/Index.cshtml b/Backend/Views/BuildMenu/Index.cshtml
index 07d0521..ba3bde6 100644
--- a/Backend/Views/BuildMenu/Index.cshtml
+++ b/Backend/Views/BuildMenu/Index.cshtml
@@ -49,6 +49,7 @@
序 |
+ |
系統大類 |
系統小類 |
左邊預設頁面 |
@@ -449,27 +450,42 @@
GetBuild();
GetMainList();
buildMenuTable = $("#buildMenu_table").DataTable({
+ "rowReorder": {
+ "dataSrc": "priority"
+ },
"columns": [
{
"data": "building_tag",
+ "sortable":false,
"render": function (data, type, row, meta) {
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,
+ "sortable":false,
"render": function (data, type, row, meta) {
var str = [];
if (2 & parseInt(data) > 0) {
@@ -485,13 +501,16 @@
// "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,
+ "sortable":false,
"render": function (data, type, row, meta) {
var str = [];
if (2 & parseInt(data) > 0) {
@@ -508,11 +527,13 @@
//},
{
"data": null,
+ "sortable": false,
"render": function (data, type, row, meta){
return ' ';
}
}
],
+ "order":[],
'createdRow': function (row, data, dataIndex) {
$(row).attr('bg-guid', data.building_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({
"columns": [
{
diff --git a/Backend/appsettings.Development.json b/Backend/appsettings.Development.json
index 060577f..0d3c1f3 100644
--- a/Backend/appsettings.Development.json
+++ b/Backend/appsettings.Development.json
@@ -18,10 +18,11 @@
"Port": "js2LutKe+rdjzdxMPQUrvQ==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
- "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
+ //"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
+ "Database": "+5RAiFLJVU+LRyDxF1K/pcLZaoZa4k/thZqF6xKoCag=", //dome_online_0821
//"Database": "2U+9jYGy0dCbMzLaguBXow==", //tpe_dome_mall
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs
index 56b30a8..135a379 100644
--- a/FrontendWebApi/ApiControllers/BuildController.cs
+++ b/FrontendWebApi/ApiControllers/BuildController.cs
@@ -180,7 +180,6 @@ namespace FrontendWebApi.ApiControllers
v2.system_key subfull_name,
v2.system_priority subpriority
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 v2 on me.sub_system_tag = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
inner join (
@@ -196,8 +195,9 @@ namespace FrontendWebApi.ApiControllers
left join auth_page ap on ra.AuthCode = ap.AuthCode
where ap.AuthType = 1
) 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
- 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(@"
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(@$"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
- 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 Floors = new List();
var floorsql = await backendRepository.GetAllAsync($@"
diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs
index 284be73..3f1f677 100644
--- a/FrontendWebApi/ApiControllers/DeviceManageController.cs
+++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs
@@ -61,7 +61,7 @@ namespace FrontendWebApi.ApiControllers
try
{
var dbsub = await frontendRepository.GetAllAsync(
- @$"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_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
@@ -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_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
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
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();
apiResult.Data = new History_MainSubBuildFloor();
apiResult.Data.history_Main_Systems = new List();
@@ -158,7 +158,8 @@ namespace FrontendWebApi.ApiControllers
var buiMenu = await frontendRepository.GetOneAsync(
@$"SELECT b.urn_3D,bm.* FROM building_menu bm
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 });
apiResult.Data = buiMenu;
@@ -856,7 +857,8 @@ namespace FrontendWebApi.ApiControllers
var buiMenu = await frontendRepository.GetOneAsync(
@$"SELECT b.urn_3D,bm.* FROM building_menu bm
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 });
apiResult.Data = buiMenu;
diff --git a/FrontendWebApi/Controllers/HomeController.cs b/FrontendWebApi/Controllers/HomeController.cs
index 78e9710..35e4019 100644
--- a/FrontendWebApi/Controllers/HomeController.cs
+++ b/FrontendWebApi/Controllers/HomeController.cs
@@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
+using Repository.BaseRepository.Interface;
+using Repository.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,12 +12,15 @@ namespace FrontendWebApi.Controllers
public class HomeController : MyBaseController
{
private readonly ILogger _logger;
+
public HomeController(ILogger logger)
{
_logger = logger;
+
}
+
public IActionResult Index()
{
return View();
diff --git a/FrontendWebApi/Controllers/LoginController.cs b/FrontendWebApi/Controllers/LoginController.cs
index 464ada6..6e8caea 100644
--- a/FrontendWebApi/Controllers/LoginController.cs
+++ b/FrontendWebApi/Controllers/LoginController.cs
@@ -10,6 +10,7 @@ using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using Repository.BackendRepository.Interface;
using Repository.FrontendRepository.Interface;
+using Repository.Helper;
using System;
using System.Collections.Generic;
using System.IO;
@@ -25,6 +26,7 @@ namespace FrontendWebApi.Controllers
private readonly IBackendRepository backendRepository;
private readonly IFrontendRepository frontendRepository;
private readonly IJwtHelpers jwt;
+ private readonly IDatabaseHelper _base;
//string jwt_str = "login";
protected MyUserInfo myUserInfo = null;
protected JwtGet myUser;
@@ -36,13 +38,20 @@ namespace FrontendWebApi.Controllers
ILogger logger,
IBackendRepository backendRepository,
IFrontendRepository frontendRepository,
- IJwtHelpers jwt
+ IJwtHelpers jwt,
+ IDatabaseHelper bases
)
{
this.logger = logger;
this.jwt = jwt;
this.backendRepository = backendRepository;
this.frontendRepository = frontendRepository;
+ _base = bases;
+ }
+ public IActionResult GetDB()
+ {
+ Response.WriteAsync($"{_base.GetMySqlConnectionString()}");
+ return View();
}
public IActionResult Index(string jwt)
diff --git a/FrontendWebApi/Controllers/MyBaseController.cs b/FrontendWebApi/Controllers/MyBaseController.cs
index 70408ab..b86f965 100644
--- a/FrontendWebApi/Controllers/MyBaseController.cs
+++ b/FrontendWebApi/Controllers/MyBaseController.cs
@@ -83,6 +83,8 @@ namespace FrontendWebApi.Controllers
myUserInfo.ShowView = showview.Result;
ViewBag.myUserInfo = myUserInfo;
ViewBag.role = showview.Result;
+ ViewBag.WarningValuePxPath = GetWarningValuePxPath().Result;
+
//var showviewt = new List()
// {
@@ -162,5 +164,16 @@ namespace FrontendWebApi.Controllers
//}
base.OnActionExecuting(filterContext);
}
+
+ public async Task GetWarningValuePxPath() {
+ var pxPath = await frontendRepository.GetOneAsync($@"
+ SELECT system_value FROM `variable` where system_type = 'pxPath' and system_key = 'warningValue' and deleted = '0'");
+ var frontendPath = await frontendRepository.GetOneAsync($@"
+ SELECT system_value FROM `variable` where system_type = 'obixConfig' and system_key = 'ApiBase' and deleted = '0'");
+ pxPath = frontendPath + pxPath;
+
+ return pxPath;
+ }
+
}
}
diff --git a/FrontendWebApi/Views/Shared/_Layout.cshtml b/FrontendWebApi/Views/Shared/_Layout.cshtml
index 7e85354..ea4b6d5 100644
--- a/FrontendWebApi/Views/Shared/_Layout.cshtml
+++ b/FrontendWebApi/Views/Shared/_Layout.cshtml
@@ -137,7 +137,19 @@
}
+
+
}
+ @if (ViewBag.role.Contains("RescueDeviceAED"))
+ {
+
+
+
+ 警戒值設定
+
+
+ }
+
@@ -828,6 +840,29 @@
+
+
+
@@ -861,5 +896,13 @@
@*各頁面的JavaScript*@
@RenderSection("Scripts", required: false)
+
+