[後台] 修改區域選單管理

This commit is contained in:
dev02 2022-10-22 13:24:29 +08:00
parent 3aa61ea59c
commit 1db6262602
6 changed files with 305 additions and 119 deletions

View File

@ -149,44 +149,81 @@ namespace Backend.Controllers
{"@building_tag", buildMenu.building_tag},
{"@main_system_tag",buildMenu.main_system_tag },
{"@sub_system_tag", buildMenu.sub_system_tag},
{"@drawing",buildMenu.drawing },
{"@left_drawing",buildMenu.left_drawing },
{"@right_drawing",buildMenu.right_drawing },
{"@created_by",myUserInfo.Userinfo_guid },
{"@planimetric_click",buildMenu.planimetric_click}
{"@left_planimetric_click",buildMenu.left_planimetric_click},
{"@right_planimetric_click",buildMenu.right_planimetric_click}
};
if (buildMenu.drawing == 2)
if (buildMenu.left_drawing == 2)
{
if (buildMenu.system_url != null && buildMenu.system_url.CompareTo("http://") < 0 && buildMenu.system_url.CompareTo("https://") < 0)
if (buildMenu.left_system_url != null && buildMenu.left_system_url.CompareTo("http://") < 0 && buildMenu.left_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.system_url);
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
}
dictionary.Add("@system_url", buildMenu.system_url);
dictionary.Add("@left_system_url", buildMenu.left_system_url);
}
else if (buildMenu.drawing == 4)
else if (buildMenu.left_drawing == 4)
{
if (buildMenu.system_url != null && buildMenu.system_url.CompareTo("http://") < 0 && buildMenu.system_url.CompareTo("https://") < 0)
if (buildMenu.left_system_url != null && buildMenu.left_system_url.CompareTo("http://") < 0 && buildMenu.left_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.system_url);
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
}
dictionary.Add("@riser_diagram_url", buildMenu.riser_diagram_url);
dictionary.Add("@icon_click", buildMenu.icon_click);
dictionary.Add("@icon_click_url", buildMenu.icon_click_url);
dictionary.Add("@icon_click_url_width", buildMenu.icon_click_url_width);
dictionary.Add("@icon_click_url_height", buildMenu.icon_click_url_height);
dictionary.Add("@left_riser_diagram_url", buildMenu.left_riser_diagram_url);
dictionary.Add("@left_icon_click", buildMenu.left_icon_click);
dictionary.Add("@left_icon_click_url", buildMenu.left_icon_click_url);
dictionary.Add("@left_icon_click_url_width", buildMenu.left_icon_click_url_width);
dictionary.Add("@left_icon_click_url_height", buildMenu.left_icon_click_url_height);
}
else if (buildMenu.drawing == 1)
else if (buildMenu.left_drawing == 1)
{
dictionary.Add("@planimetric_floor_guid", buildMenu.planimetric_floor_guid);
dictionary.Add("@planimetric_floor_guid", buildMenu.left_planimetric_floor_guid);
}
if (buildMenu.right_drawing == 2)
{
if (buildMenu.right_system_url != null && buildMenu.right_system_url.CompareTo("http://") < 0 && buildMenu.right_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.right_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.right_system_url);
}
dictionary.Add("@right_system_url", buildMenu.right_system_url);
}
else if (buildMenu.right_drawing == 4)
{
if (buildMenu.right_system_url != null && buildMenu.right_system_url.CompareTo("http://") < 0 && buildMenu.right_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.right_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.right_system_url);
}
dictionary.Add("@right_riser_diagram_url", buildMenu.right_riser_diagram_url);
dictionary.Add("@right_icon_click", buildMenu.right_icon_click);
dictionary.Add("@right_icon_click_url", buildMenu.right_icon_click_url);
dictionary.Add("@right_icon_click_url_width", buildMenu.right_icon_click_url_width);
dictionary.Add("@right_icon_click_url_height", buildMenu.right_icon_click_url_height);
}
else if (buildMenu.right_drawing == 1)
{
dictionary.Add("@right_planimetric_floor_guid", buildMenu.right_planimetric_floor_guid);
}
await backendRepository.AddOneByCustomTable(dictionary, "building_menu");
@ -233,44 +270,82 @@ namespace Backend.Controllers
{
var dictionary = new Dictionary<string, object>()
{
{"@drawing",buildMenu.drawing },
{"@left_drawing",buildMenu.left_drawing },
{"@right_drawing",buildMenu.right_drawing },
{"@updated_by",myUserInfo.Userinfo_guid },
{"@updated_at",DateTime.Now },
{"@planimetric_click",buildMenu.planimetric_click}
{"@left_planimetric_click",buildMenu.left_planimetric_click},
{"@right_planimetric_click",buildMenu.right_planimetric_click}
};
if (buildMenu.drawing == 2)
if (buildMenu.left_drawing == 2)
{
if (buildMenu.system_url != null && buildMenu.system_url.CompareTo("http://") < 0 && buildMenu.system_url.CompareTo("https://") < 0)
if (buildMenu.left_system_url != null && buildMenu.left_system_url.CompareTo("http://") < 0 && buildMenu.left_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.system_url);
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
}
dictionary.Add("@system_url", buildMenu.system_url);
dictionary.Add("@left_system_url", buildMenu.left_system_url);
}
else if (buildMenu.drawing == 4)
else if (buildMenu.left_drawing == 4)
{
if (buildMenu.system_url != null && buildMenu.system_url.CompareTo("http://") < 0 && buildMenu.system_url.CompareTo("https://") < 0)
if (buildMenu.left_system_url != null && buildMenu.left_system_url.CompareTo("http://") < 0 && buildMenu.left_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.system_url);
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
}
dictionary.Add("@riser_diagram_url", buildMenu.riser_diagram_url);
dictionary.Add("@icon_click", buildMenu.icon_click);
dictionary.Add("@icon_click_url", buildMenu.icon_click_url);
dictionary.Add("@icon_click_url_width", buildMenu.icon_click_url_width);
dictionary.Add("@icon_click_url_height", buildMenu.icon_click_url_height);
dictionary.Add("@left_riser_diagram_url", buildMenu.left_riser_diagram_url);
dictionary.Add("@left_icon_click", buildMenu.left_icon_click);
dictionary.Add("@left_icon_click_url", buildMenu.left_icon_click_url);
dictionary.Add("@left_icon_click_url_width", buildMenu.left_icon_click_url_width);
dictionary.Add("@left_icon_click_url_height", buildMenu.left_icon_click_url_height);
}
else if (buildMenu.drawing == 1)
else if (buildMenu.left_drawing == 1)
{
dictionary.Add("@planimetric_floor_guid", buildMenu.planimetric_floor_guid);
dictionary.Add("@left_planimetric_floor_guid", buildMenu.left_planimetric_floor_guid);
}
if (buildMenu.right_drawing == 2)
{
if (buildMenu.right_system_url != null && buildMenu.right_system_url.CompareTo("http://") < 0 && buildMenu.right_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.right_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.right_system_url);
}
dictionary.Add("@right_system_url", buildMenu.right_system_url);
}
else if (buildMenu.right_drawing == 4)
{
if (buildMenu.right_system_url != null && buildMenu.right_system_url.CompareTo("http://") < 0 && buildMenu.right_system_url.CompareTo("https://") < 0)
{
//未包含http || https 抓該棟ip + port
var building_where = @"deleted = 0 AND building_tag = @Building_tag";
var building = await backendRepository.GetOneAsync<BuildInfo>("building", building_where, new { Building_tag = buildMenu.building_tag });
buildMenu.right_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.right_system_url);
}
dictionary.Add("@right_riser_diagram_url", buildMenu.right_riser_diagram_url);
dictionary.Add("@right_icon_click", buildMenu.right_icon_click);
dictionary.Add("@right_icon_click_url", buildMenu.right_icon_click_url);
dictionary.Add("@right_icon_click_url_width", buildMenu.right_icon_click_url_width);
dictionary.Add("@right_icon_click_url_height", buildMenu.right_icon_click_url_height);
}
else if (buildMenu.right_drawing == 1)
{
dictionary.Add("@right_planimetric_floor_guid", buildMenu.right_planimetric_floor_guid);
}
await backendRepository.UpdateOneByCustomTable(dictionary, "building_menu", $"building_tag = '{buildMenu.building_tag}' and main_system_tag = '{buildMenu.main_system_tag}' and sub_system_tag = '{buildMenu.sub_system_tag}'");
@ -297,15 +372,19 @@ namespace Backend.Controllers
try
{
buildMenuTables = await backendRepository.GetAllAsync<BuildMenuTable>($@"select bm.*,
case drawing when 1 then '' when 2 then '' when 4 then '' end drawing_name,
case icon_click when 1 then '開' when 0 then '關' end icon_click_name,
case planimetric_click when 1 then '開' when 0 then '關' end planimetric_click_name,
mv.system_key main_system_guid_name, sv.system_key sub_system_guid_name,ff.full_name floor_guid_name
from building_menu bm
left join variable mv on bm.main_system_tag = mv.system_value and mv.system_type = @main_system_type and mv.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 ff on ff.floor_guid = bm.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 ",
case left_drawing when 1 then '' when 2 then '' when 4 then '' end left_drawing_name,
case left_icon_click when 1 then '開' when 0 then '關' end left_icon_click_name,
case left_planimetric_click when 1 then '開' when 0 then '關' end left_planimetric_click_name,
case right_drawing when 1 then '' when 2 then '' when 4 then '' end right_drawing_name,
case right_icon_click when 1 then '開' when 0 then '關' end right_icon_click_name,
case right_planimetric_click when 1 then '開' when 0 then '關' end right_planimetric_click_name,
mv.system_key main_system_guid_name, sv.system_key sub_system_guid_name,lf.full_name left_floor_guid_name, rf.full_name right_floor_guid_name
from building_menu bm
left join variable mv on bm.main_system_tag = mv.system_value and mv.system_type = @main_system_type and mv.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 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 ",
new { building_tag = post.building_tag, MainList = post.MainList, main_system_type = main_system_type, sub_system_type = sub_system_type });
apiResult.Code = "0000";
@ -331,7 +410,7 @@ namespace Backend.Controllers
try
{
var BuildMenu = await backendRepository.GetOneAsync<BuildMenuAddSub>(
$@"select *, sv.system_key sub_system_guid_name
$@"select bm.*, sv.system_key sub_system_guid_name
from building_menu bm
left join variable sv on bm.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type
where bm.building_tag = @building_tag and bm.main_system_tag = @main_system_tag and bm.sub_system_tag = @sub_system_tag"
@ -356,7 +435,7 @@ namespace Backend.Controllers
try
{
await backendRepository.PurgeOneByGuidWithCustomDBNameAndTable("building_menu", $"building_tag = '{post.building_tag}' and main_system_tag = '{post.main_system_tag}' and sub_system_tag = '{post.sub_system_tag}'");
var subV = await backendRepository.GetOneAsync<VariableInfo>(@$"select * from variable where system_value = @sub_system_tag and system_type = sub_system_type and deleted = 0", new { sub_system_tag = post.sub_system_tag, sub_system_type = sub_system_type });
var subV = await backendRepository.GetOneAsync<VariableInfo>(@$"select * from variable where system_value = @sub_system_tag and system_type = @sub_system_type and deleted = 0", new { sub_system_tag = post.sub_system_tag, sub_system_type = sub_system_type });
var authcode = await backendRepository.GetOneAsync<string>(@$"select AuthCode from auth_page where building_tag = @building_tag and ShowView = @sub_id", new {post.building_tag, subV.id});
if (authcode != null)
{
@ -395,7 +474,7 @@ namespace Backend.Controllers
from sub_system_floor ssf
where ssf.building_tag = @building_tag and ssf.main_system_tag = @main_system_tag and ssf.sub_system_tag = @sub_system_tag and deleted = 0 and status = 0
) sf
left join floor f on sf.floor_tag = f.full_name
left join floor f on sf.floor_tag = f.full_name and sf.building_tag = f.building_tag
left join variable mv on sf.main_system_tag = mv.system_value and mv.system_type = @main_system_type and mv.deleted = 0
left join variable sv on sf.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type and sv.deleted = 0
ORDER BY mv.system_priority, sv.system_priority, f.priority", param);

View File

@ -316,8 +316,19 @@ namespace Backend.Controllers
var systemSub = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
sWhere = @$"deleted = 0 AND system_type = @sub_system_type AND system_value = @system_value";
param = new { sub_system_type = sub_system_type, system_value = post.system_value };
var subV = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
if (systemSub == null)
{
if (subV != null)
{
apiResult.Code = "0001";
apiResult.Msg = "不可新增相同的系統小類代號。";
return apiResult;
}
//新增
//產生一組GUID
//獲取最新的大類
@ -344,6 +355,13 @@ namespace Backend.Controllers
}
else
{
if (subV != null)
{
apiResult.Code = "0001";
apiResult.Msg = "不可修改成相同的系統小類代號。";
return apiResult;
}
Dictionary<string, object> systemSubDic = new Dictionary<string, object>()
{
@ -449,7 +467,7 @@ namespace Backend.Controllers
di.full_name
FROM device_item di
INNER JOIN variable sv on di.device_name_tag = sv.system_value
WHERE v.deleted = 0 AND sv.id = @id AND di.deleted = 0";
WHERE sv.deleted = 0 AND sv.id = @id AND di.deleted = 0";
var deviceItems = await backendRepository.GetAllAsync<string>(sdeviceItem, new { id = id });
if (deviceItems.Count > 0)
@ -515,7 +533,6 @@ namespace Backend.Controllers
{ "@is_show_riserDiagram", device_Item.is_show_riserDiagram},
{ "@is_controll", device_Item.is_controll},
{ "@is_bool", device_Item.is_bool},
{ "@is_link", device_Item.is_link},
{ "@created_by", myUserInfo.Userinfo_guid},
};
await backendRepository.AddOneByCustomTable(Device_itemDic, "device_item");
@ -534,7 +551,6 @@ namespace Backend.Controllers
{ "@is_show_riserDiagram", device_Item.is_show_riserDiagram},
{ "@is_controll", device_Item.is_controll},
{ "@is_bool", device_Item.is_bool},
{ "@is_link", device_Item.is_link},
{ "@updated_by", myUserInfo.Userinfo_guid},
{ "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
};

View File

@ -10,15 +10,24 @@ namespace Backend.Models
public string building_tag { get; set; }
public string main_system_tag { get; set; }
public string sub_system_tag { get; set; }
public byte drawing { get; set; }
public byte icon_click { get; set; }
public string icon_click_url { get; set; }
public int icon_click_url_width { get; set; }
public int icon_click_url_height { get; set; }
public string system_url { get; set; }
public string riser_diagram_url { get; set; }
public byte planimetric_click { get; set; }
public string planimetric_floor_guid { get; set; }
public byte left_drawing { get; set; }
public byte left_icon_click { get; set; }
public string left_icon_click_url { get; set; }
public int left_icon_click_url_width { get; set; }
public int left_icon_click_url_height { get; set; }
public string left_system_url { get; set; }
public string left_riser_diagram_url { get; set; }
public byte left_planimetric_click { get; set; }
public string left_planimetric_floor_guid { get; set; }
public byte right_drawing { get; set; }
public byte right_icon_click { get; set; }
public string right_icon_click_url { get; set; }
public int right_icon_click_url_width { get; set; }
public int right_icon_click_url_height { get; set; }
public string right_system_url { get; set; }
public string right_riser_diagram_url { get; set; }
public byte right_planimetric_click { get; set; }
public string right_planimetric_floor_guid { get; set; }
}
public class BuildMenuAddSub: BuildMenu
{
@ -26,9 +35,7 @@ namespace Backend.Models
}
public class SubListIn
{
public string main { get; set; }
public string main_system_tag { get; set; }
public string build { get; set; }
public string building_tag { get; set; }
}
public class BuildMenuTablePost
@ -40,14 +47,16 @@ namespace Backend.Models
{
public string main_system_guid_name { get; set; }
public string sub_system_guid_name { get; set; }
public string drawing_name { get; set; }
public string icon_click_name { get; set; }
public string planimetric_click_name { get; set; }
public string left_drawing_name { get; set; }
public string right_drawing_name { get; set; }
public string left_icon_click_name { get; set; }
public string left_planimetric_click_name { get; set; }
public string right_icon_click_name { get; set; }
public string right_planimetric_click_name { get; set; }
public string floor_guid_name { get; set; }
}
public class MenuIn : SubListIn
{
public string sub { get; set; }
public string sub_system_tag { get; set; }
}
public class BuildMenuFloor : Actor

View File

@ -51,10 +51,14 @@
<th>序</th>
<th>系統大類</th>
<th>系統小類</th>
<th>預設頁面</th>
<th>是否顯示<br>平面圖</th>
<th>昇位圖<br>詳細資料設定</th>
<th>昇位圖<br>詳細資料URL</th>
<th>左邊預設頁面</th>
<th>左邊是否顯示<br>平面圖</th>
<th>左邊昇位圖<br>詳細資料設定</th>
<th>左邊昇位圖<br>詳細資料URL</th>
<th>右邊預設頁面</th>
<th>右邊是否顯示<br>平面圖</th>
<th>右邊昇位圖<br>詳細資料設定</th>
<th>右邊昇位圖<br>詳細資料URL</th>
@*<th>昇位圖URL</th>*@
<th>功能</th>
</tr>
@ -218,12 +222,12 @@
</div>
<div class="form-group col-12" id="build_menu_icon_click_url_modal_div" name="drawing_extend">
<label class="form-label" for="build_menu_icon_click_url_modal">詳細資料 URL</label><br>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_building_tag')">+/[device_building_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_system_tag')">+/[device_system_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_floor_tag')">+/[device_floor_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_name_tag')">+/[device_name_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_serial_tag')">+/[device_serial_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('tag_name')">+/[tag_name]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_building_tag', 'l')">+/[device_building_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_system_tag', 'l')">+/[device_system_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_floor_tag', 'l')">+/[device_floor_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_name_tag', 'l')">+/[device_name_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('device_serial_tag', 'l')">+/[device_serial_tag]</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed mb-2" onclick="AddTagIntoClickUrl('tag_name', 'l')">+/[tag_name]</button>
<input type="text" id="build_menu_icon_click_url_modal" class="form-control">
</div>
<div class="form-group col-12" id="build_menu_icon_click_url_width_height_modal_div">
@ -455,13 +459,13 @@
"data": "sub_system_guid_name"
},
{
"data": "drawing_name"
"data": "left_drawing_name"
},
{
"data": "planimetric_click_name"
"data": "left_planimetric_click_name"
},
{
"data": "icon_click",
"data": null,
"render": function (data, type, row, meta) {
var str = [];
if (2 & parseInt(data) > 0) {
@ -474,7 +478,29 @@
}
},
{
"data": "icon_click_url"
"data": "left_icon_click_url"
},
{
"data": "right_drawing_name"
},
{
"data": "right_planimetric_click_name"
},
{
"data": null,
"render": function (data, type, row, meta) {
var str = [];
if (2 & parseInt(data) > 0) {
str.push("點擊開關")
}
if (1 & parseInt(data) > 0) {
str.push("顯示詳細資料")
}
return str.join(";");
}
},
{
"data": "right_icon_click_url"
},
{
"data": null,
@ -507,11 +533,17 @@
} else {
$.each(this.data, function (k, rel) {
rel.sub_system_guid_name = "<font color='#7c91df'>" + rel.sub_system_guid_name + "</font>"
if (rel.drawing == 2) {
rel.drawing_name = rel.drawing_name + "<br>" + '<a href = "' + rel.system_url + '" target="_blank" >點擊連結</a >'
if (rel.left_drawing == 2) {
rel.left_drawing_name = rel.left_drawing_name + "<br>" + '<a href = "' + rel.system_url + '" target="_blank" >點擊連結</a >'
}
if (rel.drawing == 1) {
rel.drawing_name = rel.drawing_name + "<br>" + '[' + rel.floor_guid_name + ']'
if (rel.left_drawing == 1) {
rel.left_drawing_name = rel.left_drawing_name + "<br>" + '[' + rel.floor_guid_name + ']'
}
if (rel.right_drawing == 2) {
rel.right_drawing_name = rel.right_drawing_name + "<br>" + '<a href = "' + rel.system_url + '" target="_blank" >點擊連結</a >'
}
if (rel.right_drawing == 1) {
rel.right_drawing_name = rel.right_drawing_name + "<br>" + '[' + rel.floor_guid_name + ']'
}
})
}
@ -754,6 +786,17 @@
$('#build_menu_icon_click_url_width_height_modal_div').hide();
}
});
$('#build_menu_icon_click_onoff_modal_div_r').on("click", "input[type=checkbox]", function () {
if ($(this).prop("checked") && $(this).val() == 1) {
$('#build_menu_icon_click_url_modal_div_r').show();
$('#build_menu_icon_click_url_width_height_modal_div_r').show();
} else {
$('#build_menu_icon_click_url_modal_div_r').hide();
$('#build_menu_icon_click_url_width_height_modal_div_r').hide();
}
});
//#region 更改大類更換小類
$('#build_menu_main_modal').on("change", function () {
GetSubList($('#build_menu_main_modal').val());
@ -782,10 +825,16 @@
return;
}
var icon_click = 0;
var left_icon_click = 0;
var right_icon_click = 0;
$.each($("input[name='icon_click[]']"), function (index, item) {
if (item.checked) {
icon_click += parseInt(item.value);
left_icon_click += parseInt(item.value);
}
});
$.each($("input[name='icon_click[]_r']"), function (index, item) {
if (item.checked) {
right_icon_click += parseInt(item.value);
}
});
@ -794,15 +843,24 @@
building_tag: $('#build_menu_building_modal').val(),
main_system_tag: $('#build_menu_main_modal').val(),
sub_system_tag: $('#build_menu_sub_modal').val(),
drawing: $('input[name="drawing"]:checked').val(),
system_url: $('#build_menu_systemurl_modal').val(),
icon_click: icon_click,
icon_click_url: $('#build_menu_icon_click_url_modal').val(),
icon_click_url_width: $('#build_menu_icon_click_url_width_modal').val(),
icon_click_url_height: $('#build_menu_icon_click_url_height_modal').val(),
planimetric_click: $('input[name="planimetric_click"]:checked').val(),
riser_diagram_url: $('#build_menu_riser_diagram_url_modal').val(),
planimetric_floor_guid: $('#build_menu_planimetric_floor_modal').val()
left_drawing: $('input[name="drawing"]:checked').val(),
left_system_url: $('#build_menu_systemurl_modal').val(),
left_icon_click: left_icon_click,
left_icon_click_url: $('#build_menu_icon_click_url_modal').val(),
left_icon_click_url_width: $('#build_menu_icon_click_url_width_modal').val(),
left_icon_click_url_height: $('#build_menu_icon_click_url_height_modal').val(),
left_planimetric_click: $('input[name="planimetric_click"]:checked').val(),
left_riser_diagram_url: $('#build_menu_riser_diagram_url_modal').val(),
left_planimetric_floor_guid: $('#build_menu_planimetric_floor_modal').val(),
right_drawing: $('input[name="drawing_r"]:checked').val(),
right_system_url: $('#build_menu_systemurl_modal_r').val(),
right_icon_click: right_icon_click,
right_icon_click_url: $('#build_menu_icon_click_url_modal_r').val(),
right_icon_click_url_width: $('#build_menu_icon_click_url_width_modal_r').val(),
right_icon_click_url_height: $('#build_menu_icon_click_url_height_modal_r').val(),
right_planimetric_click: $('input[name="planimetric_click_r"]:checked').val(),
right_riser_diagram_url: $('#build_menu_riser_diagram_url_modal_r').val(),
right_planimetric_floor_guid: $('#build_menu_planimetric_floor_modal_r').val()
};
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
@ -838,35 +896,65 @@
$('#build_menu_sub_modal').attr('disabled', true);
$('#build_menu_sub_modal').append($("<option />").val(rel.data.sub_system_tag).text(rel.data.sub_system_guid_name));
$('#build_menu_sub_modal').val(rel.data.sub_system_tag);
$("input[name*='drawing'][value='" + rel.data.drawing + "']").prop("checked", true);
if (rel.data.planimetric_click == 1) {
//left
$("input[name='drawing'][value='" + rel.data.left_drawing + "']").prop("checked", true);
if (rel.data.left_planimetric_click == 1) {
$('input[name="planimetric_click"]').prop("checked", true)
} else {
$('input[name="planimetric_click"]').prop("checked", false)
}
$('#build_menu_systemurl_modal').val(rel.data.system_url);
$('#build_menu_systemurl_modal').val(rel.data.left_system_url);
$.each($("input[name='icon_click[]']"), function (index, item) {
if (parseInt(item.value) & rel.data.icon_click > 0) {
if (parseInt(item.value) & rel.data.left_icon_click > 0) {
$(item).prop("checked", true);
} else {
$(item).prop("checked", false);
}
});
@*$("input[name*='icon_click_onoff'][value='" + rel.data.icon_click + "']").prop("checked", true);*@
$('#build_menu_icon_click_url_modal').val(rel.data.icon_click_url);
if (rel.data.icon_click_url_width != undefined && rel.data.icon_click_url_width != null && rel.data.icon_click_url_width > 0) {
$('#build_menu_icon_click_url_width_modal').val(rel.data.icon_click_url_width);
@*$("input[name*='icon_click_onoff'][value='" + rel.data.icon_click + "']").prop("checked", true);*@
$('#build_menu_icon_click_url_modal').val(rel.data.left_icon_click_url);
if (rel.data.left_icon_click_url_width != undefined && rel.data.left_icon_click_url_width != null && rel.data.left_icon_click_url_width > 0) {
$('#build_menu_icon_click_url_width_modal').val(rel.data.left_icon_click_url_width);
} else {
$('#build_menu_icon_click_url_width_modal').val("");
}
if (rel.data.icon_click_url_height != undefined && rel.data.icon_click_url_height != null && rel.data.icon_click_url_height > 0) {
$('#build_menu_icon_click_url_height_modal').val(rel.data.icon_click_url_height);
if (rel.data.left_icon_click_url_height != undefined && rel.data.left_icon_click_url_height != null && rel.data.left_icon_click_url_height > 0) {
$('#build_menu_icon_click_url_height_modal').val(rel.data.left_icon_click_url_height);
} else {
$('#build_menu_icon_click_url_height_modal').val("");
}
//right
$("input[name*='drawing_r'][value='" + rel.data.right_drawing + "']").prop("checked", true);
if (rel.data.right_planimetric_click == 1) {
$('input[name="planimetric_click_r"]').prop("checked", true)
} else {
$('input[name="planimetric_click_r"]').prop("checked", false)
}
$('#build_menu_systemurl_modal_r').val(rel.data.right_system_url);
$.each($("input[name='icon_click[]_r']"), function (index, item) {
if (parseInt(item.value) & rel.data.left_icon_click > 0) {
$(item).prop("checked", true);
} else {
$(item).prop("checked", false);
}
});
$('#build_menu_icon_click_url_modal_r').val(rel.data.right_icon_click_url);
if (rel.data.right_icon_click_url_width != undefined && rel.data.right_icon_click_url_width != null && rel.data.right_icon_click_url_width > 0) {
$('#build_menu_icon_click_url_width_modal_r').val(rel.data.right_icon_click_url_width);
} else {
$('#build_menu_icon_click_url_width_modal_r').val("");
}
if (rel.data.right_icon_click_url_height != undefined && rel.data.right_icon_click_url_height != null && rel.data.right_icon_click_url_height > 0) {
$('#build_menu_icon_click_url_height_modal_r').val(rel.data.right_icon_click_url_height);
} else {
$('#build_menu_icon_click_url_height_modal_r').val("");
}
changebuild_menu_drawing_modal();
GetFloorInSubSystem(rel.data.planimetric_floor_guid);
GetFloorInSubSystem(rel.data.left_planimetric_floor_guid);
GetFloorInSubSystem(rel.data.right_planimetric_floor_guid);
$('.modal-title').html("選單基本資料 - 修改");
$('#build-menu-modal').modal();
@ -1077,26 +1165,28 @@
}
buildMenuTable.ajax.reload();
}
function AddTagIntoClickUrl(tag) {
var a = $('#build_menu_icon_click_url_modal').val();
function AddTagIntoClickUrl(tag, way) {
var elem = way == "l" ? $('#build_menu_icon_click_url_modal') : $('#build_menu_icon_click_url_modal_r');
var a = elem.val();
switch (tag) {
case 'device_building_tag':
$('#build_menu_icon_click_url_modal').val(a + '/[device_building_tag]');
elem.val(a + '/[device_building_tag]');
break;
case 'device_system_tag':
$('#build_menu_icon_click_url_modal').val(a + '/[device_system_tag]');
elem.val(a + '/[device_system_tag]');
break;
case 'device_floor_tag':
$('#build_menu_icon_click_url_modal').val(a + '/[device_floor_tag]');
elem.val(a + '/[device_floor_tag]');
break;
case 'device_name_tag':
$('#build_menu_icon_click_url_modal').val(a + '/[device_name_tag]');
elem.val(a + '/[device_name_tag]');
break;
case 'device_serial_tag':
$('#build_menu_icon_click_url_modal').val(a + '/[device_serial_tag]');
elem.val(a + '/[device_serial_tag]');
break;
case 'tag_name':
$('#build_menu_icon_click_url_modal').val(a + '/[tag_name]');
elem.val(a + '/[tag_name]');
break;
}

View File

@ -723,7 +723,6 @@
$("input[name='is_show_riserDiagram'][value='" + rel.data.is_show_riserDiagram + "']").prop("checked", true);
$("input[name='is_controll'][value='" + rel.data.is_controll + "']").prop("checked", true);
$("input[name='is_bool'][value='" + rel.data.is_bool + "']").prop("checked", true);
$("input[name='is_link'][value='" + rel.data.is_link+ "']").prop("checked", true);
$("#device-sub-modal").modal();
}

View File

@ -153,13 +153,6 @@
<label class="custom-control-label" for="is_bool">是否為布林值</label>
</div>
</div>
<div class="form-group col-12">
<div class="col-12 mb-2 custom-control custom-checkbox align-content-center">
<input type="checkbox" class="custom-control-input" name="is_link" id="is_link" value="1" />
<label class="custom-control-label" for="is_link">是否與N4同步</label>
</div>
</div>
</div>
</form>
</div>