[Backend]修改區域選單管理設定視窗大小的邏輯

This commit is contained in:
張家睿 2024-08-29 10:29:03 +08:00
parent 9885a73975
commit f2c56cc45d
2 changed files with 145 additions and 42 deletions

View File

@ -167,7 +167,11 @@ namespace Backend.Controllers
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
}
if (buildMenu.left_planimetric_click == 1)
{
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);
}
dictionary.Add("@left_system_url", buildMenu.left_system_url);
}
else if (buildMenu.left_drawing == 4)
@ -184,8 +188,11 @@ namespace Backend.Controllers
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);
if (buildMenu.left_icon_click == 1 || buildMenu.left_planimetric_click == 1)
{
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.left_drawing == 1)
{
@ -293,7 +300,11 @@ namespace Backend.Controllers
buildMenu.left_system_url = string.Format("http://{0}:{1}{2}", building.Ip_address, building.Ip_port, buildMenu.left_system_url);
}
if (buildMenu.left_planimetric_click == 1)
{
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);
}
dictionary.Add("@left_system_url", buildMenu.left_system_url);
}
else if (buildMenu.left_drawing == 4)
@ -310,8 +321,11 @@ namespace Backend.Controllers
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);
if (buildMenu.left_icon_click == 1 || buildMenu.left_planimetric_click == 1)
{
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.left_drawing == 1)
{

View File

@ -869,15 +869,16 @@
changebuild_menu_drawing_modal(this);
});
//#endregion
$('#build_menu_icon_click_onoff_modal_div').on("click", "input[type=checkbox]", function () {
if ($(this).prop("checked") && $(this).val() == 1) {
//$('#build_menu_icon_click_url_modal_div').show();
$('#build_menu_icon_click_url_width_height_modal_div').show();
} else {
//$('#build_menu_icon_click_url_modal_div').hide();
$('#build_menu_icon_click_url_width_height_modal_div').hide();
}
});
// $('#build_menu_icon_click_onoff_modal_div').on("click", "input[type=checkbox]", function () {
// if ($(this).prop("checked") && $(this).val() == 1) {
// $('#build_menu_icon_click_url_modal_div').show();
// $('#build_menu_icon_click_url_width_height_modal_div').show();
// } else {
// $('#build_menu_icon_click_url_modal_div').hide();
// $('#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) {
@ -1057,43 +1058,131 @@
}, 'json');
});
//#endregion
function changebuild_menu_drawing_modal(selector = "input[name^='drawing']:checked") {
function changebuild_menu_drawing_modal(selector = "input[name^='drawing']:checked") {
$(selector).each(function (index, value) {
let drawingParent = $(value).parents("[id^=build_menu_position]")
let drawingParent = $(value).parents("[id^=build_menu_position]");
// 重置所有相關的 modal
$(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').hide();
$(drawingParent).find('[id^=build_menu_blankurl_modal_div]').hide();
//$(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').hide();
$(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').hide();
$(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').hide();
$(drawingParent).find('[id^=build_menu_systemurl_modal_div]').hide();
$(drawingParent).find('[id^=build_menu_planimetric_modal_div]').show();
if ($(value).val() == 2) {
$(drawingParent).find('[id^=planimetric_click]').attr("disabled", false);
$(drawingParent).find('[id^=build_menu_systemurl_modal_div]').show();
} else if ($(value).val() == 4) {
$(drawingParent).find('[id^="planimetric_click"]').attr("disabled", false);
$(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').show();
if ($(drawingParent).find("[id^=icon_click_url]").prop('checked')) {
//$(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').show();
$(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').show();
}
} else if ($(value).val() == 1) {
$(drawingParent).find('[id^=planimetric_click]').prop("checked", true).attr("disabled", true);
$(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').show();
} else if ($(value).val() == 5) {
$(drawingParent).find('[id^=planimetric_click]').prop("checked", false);
$(drawingParent).find('[id^=build_menu_blankurl_modal_div]').show();
} else if ($(value).val() == 3) {
$(drawingParent).find('[id^=planimetric_click]').prop("checked", false).attr("disabled", true);
} else {
$(drawingParent).find('[id^=build_menu_planimetric_modal_div]').hide();
// 根據 input 的值設定顯示/隱藏邏輯
switch ($(value).val()) {
case '2':
$(drawingParent).find('[id^=planimetric_click]').attr("disabled", false);
$(drawingParent).find('[id^=build_menu_systemurl_modal_div]').show();
function toggleModalVisibilityCase2() {
const planimetricChecked = $(drawingParent).find('#build_menu_planimetric_modal_div input[type=checkbox]').is(":checked");
if (planimetricChecked) {
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').show();
} else {
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').hide();
}
}
$(drawingParent).find('#build_menu_planimetric_modal_div').on("click", "input[type=checkbox]", function () {
toggleModalVisibilityCase2();
});
toggleModalVisibilityCase2(); // 初始化時也要檢查一次
break;
case '4':
$(drawingParent).find('[id^=planimetric_click]').attr("disabled", false);
$(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').show();
function toggleModalVisibilityCase4() {
const planimetricChecked = $(drawingParent).find('#build_menu_planimetric_modal_div input[type=checkbox]').is(":checked");
const onoffChecked = $(drawingParent).find('#build_menu_icon_click_onoff_modal_div input[type=checkbox]').is(":checked");
if (planimetricChecked || onoffChecked) {
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').show();
} else {
$(drawingParent).find('#build_menu_icon_click_url_width_height_modal_div').hide();
}
}
$(drawingParent).find('#build_menu_planimetric_modal_div').on("click", "input[type=checkbox]", function () {
toggleModalVisibilityCase4();
});
$(drawingParent).find('#build_menu_icon_click_onoff_modal_div').on("click", "input[type=checkbox]", function () {
toggleModalVisibilityCase4();
});
toggleModalVisibilityCase4(); // 初始化時也要檢查一次
break;
case '1':
$(drawingParent).find('[id^=planimetric_click]').prop("checked", true).attr("disabled", true);
$(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').show();
break;
case '5':
$(drawingParent).find('[id^=planimetric_click]').prop("checked", false);
$(drawingParent).find('[id^=build_menu_blankurl_modal_div]').show();
break;
case '3':
$(drawingParent).find('[id^=planimetric_click]').prop("checked", false).attr("disabled", true);
break;
default:
$(drawingParent).find('[id^=build_menu_planimetric_modal_div]').hide();
break;
}
})
});
}
// function changebuild_menu_drawing_modal(selector = "input[name^='drawing']:checked") {
// $(selector).each(function (index, value) {
// let drawingParent = $(value).parents("[id^=build_menu_position]")
// $(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').hide();
// $(drawingParent).find('[id^=build_menu_blankurl_modal_div]').hide();
// $(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').hide();
// $(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').hide();
// $(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').hide();
// $(drawingParent).find('[id^=build_menu_systemurl_modal_div]').hide();
// $(drawingParent).find('[id^=build_menu_planimetric_modal_div]').show();
// if ($(value).val() == 2) {
// $(drawingParent).find('[id^=planimetric_click]').attr("disabled", false);
// $(drawingParent).find('[id^=build_menu_systemurl_modal_div]').show();
// if ($(drawingParent).find("[id^=planimetric_click]").prop('checked')) {
// $(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').show();
// }
// } else if ($(value).val() == 4) {
// $(drawingParent).find('[id^="planimetric_click"]').attr("disabled", false);
// $(drawingParent).find('[id^=build_menu_icon_click_onoff_modal_div]').show();
// if ($(drawingParent).find("[id^=icon_click_url]").prop('checked')) {
// $(drawingParent).find('[id^=build_menu_icon_click_url_modal_div]').show();
// $(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').show();
// }
// } else if ($(value).val() == 1) {
// $(drawingParent).find('[id^=planimetric_click]').prop("checked", true).attr("disabled", true);
// $(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').show();
// } else if ($(value).val() == 5) {
// $(drawingParent).find('[id^=planimetric_click]').prop("checked", false);
// $(drawingParent).find('[id^=build_menu_blankurl_modal_div]').show();
// } else if ($(value).val() == 3) {
// $(drawingParent).find('[id^=planimetric_click]').prop("checked", false).attr("disabled", true);
// } else {
// $(drawingParent).find('[id^=build_menu_planimetric_modal_div]').hide();
// }
// })
// }
$('#buildMenu_table').on("click", "button.del-btn", function () {
var send_data = {