[設備管理] 前端building-guid main-system-guid sub-system-guid 皆改為tag

This commit is contained in:
dev01 2022-10-22 09:44:25 +08:00
parent 6fbc9b41fb
commit 75fdda80fe

View File

@ -607,7 +607,7 @@
<script src="~/js/echarts.min.js"></script>
<script>
var buildingCollapses;
var selected_building_menu = {}, selected_floor_guid;
var selected_building_menu = {}, selected_floor_tag;
var chartDom, myChart, option,
floor_map_mode = "view", //平面圖當前模式
selected_temp_device, //被選擇要修改的設備
@ -747,10 +747,10 @@
"url": "/DeviceManage/DeviceTableList",
"type": "POST",
"data": function (d) {
d.Building_guid = selected_building_menu.building_guid ? selected_building_menu.building_guid : "";
d.Main_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_guid : "";
d.Sub_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_guid : "" : "";
d.Floor_guid = selected_floor_guid ? selected_floor_guid : "";
d.Buliding_tag = selected_building_menu.buliding_tag ? selected_building_menu.buliding_tag : "";
d.Main_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : "";
d.Sub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
d.Floor_tag = selected_floor_tag ? selected_floor_tag : "";
},
"dataSrc": function (rel) {
if (rel.code == "9999") {
@ -1050,10 +1050,10 @@
"url": "/DeviceManage/GetDeviceMasterTableList",
"type": "POST",
"data": function (d) {
d.Building_guid = selected_building_menu.building_guid ? selected_building_menu.building_guid : "";
d.Main_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_guid : "";
d.Sub_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_guid : "" : "";
d.Floor_guid = selected_floor_guid ? selected_floor_guid : "";
d.Buliding_tag = selected_building_menu.buliding_tag ? selected_building_menu.buliding_tag : "";
d.Main_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : "";
d.Sub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
d.Floor_tag = selected_floor_tag ? selected_floor_tag : "";
},
"dataSrc": function (rel) {
if (rel.code == "9999") {
@ -1077,11 +1077,11 @@
$("#device-master-list-btn").click(function (e) {
e.preventDefault();
var selectedBuilding_guid = selected_building_menu.building_guid ? selected_building_menu.building_guid : "";
var selectedMain_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_guid : "";
var selectedSub_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_guid : "" : "";
var selectedFloor_guid = selected_floor_guid ? selected_floor_guid : "";
if (selectedBuilding_guid == '' || selectedMain_system_guid == '' || selectedSub_system_guid == '' || selectedFloor_guid == '') {
var selectedBuliding_tag = selected_building_menu.buliding_tag ? selected_building_menu.buliding_tag : "";
var selectedMain_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : "";
var selectedSub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
var selectedFloor_tag = selected_floor_tag ? selected_floor_tag : "";
if (selectedBuliding_tag == '' || selectedMain_system_tag == '' || selectedSub_system_tag == '' || selectedFloor_tag == '') {
toast_warning("請先選擇系統類別及樓層。");
return;
}
@ -1494,10 +1494,10 @@
"url": "/DeviceManage/DeviceKindTableList",
"type": "POST",
"data": function (d) {
d.Building_guid = selected_building_menu.building_guid ? selected_building_menu.building_guid : "";
d.Main_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_guid : "";
d.Sub_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_guid : "" : "";
d.Floor_guid = selected_floor_guid ? selected_floor_guid : "";
d.Buliding_tag = selected_building_menu.buliding_tag ? selected_building_menu.buliding_tag : "";
d.Main_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : "";
d.Sub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
d.Floor_tag = selected_floor_tag ? selected_floor_tag : "";
},
"dataSrc": function (rel) {
if (rel.code == "9999") {
@ -1549,10 +1549,10 @@
device_kind_data = rel.data;
//取得單一設備基本資料
var selectedSub_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_guid : "" : "";
var selectedSub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
var url = "/DeviceManage/GetDeviceItem";
var send_data = {
sub_system_guid: selectedSub_system_guid
sub_system_tag: selectedSub_system_tag
}
$.post(url, send_data, function (rel) {
@ -1910,9 +1910,9 @@
html += `
<li class="list-group-item pr-0 d-flex justify-content-between">
<a href="javascript:;" onclick="ChangeFloorPanel(this)"
data-building-guid="${buildingCollapse.building_guid}"
data-main-system-guid="${main_system.main_system_guid}"
data-sub-system-guid="${sub_system.sub_system_guid}">
data-building-tag="${buildingCollapse.buliding_tag}"
data-main-system-tag="${main_system.main_system_tag}"
data-sub-system-tag="${sub_system.sub_system_tag}">
${sub_system.full_name}
</a>
</li>`;
@ -1944,26 +1944,26 @@
function ChangeFloorPanel(dom) {
var selected_target = {
"building_guid": $(dom).attr("data-building-guid") ? $(dom).attr("data-building-guid") : "",
"main_system_guid": $(dom).attr("data-main-system-guid") ? $(dom).attr("data-main-system-guid") : "",
"sub_system_guid": $(dom).attr("data-sub-system-guid") ? $(dom).attr("data-sub-system-guid") : "",
"buliding_tag": $(dom).attr("data-building-tag") ? $(dom).attr("data-building-tag") : "",
"main_system_tag": $(dom).attr("data-main-system-tag") ? $(dom).attr("data-main-system-tag") : "",
"sub_system_tag": $(dom).attr("data-sub-system-tag") ? $(dom).attr("data-sub-system-tag") : "",
}
buildingCollapses.forEach(function (building_item, building_index) {
if (building_item.building_guid == selected_target.building_guid) {
selected_building_menu.building_guid = building_item.building_guid;
if (building_item.buliding_tag == selected_target.buliding_tag) {
selected_building_menu.buliding_tag = building_item.buliding_tag;
selected_building_menu.main_system = {};
building_item.main_systems.forEach(function (main_system_item, main_system_index) {
if (main_system_item.main_system_guid == selected_target.main_system_guid) {
selected_building_menu.main_system.main_system_guid = main_system_item.main_system_guid
if (main_system_item.main_system_tag == selected_target.main_system_tag) {
selected_building_menu.main_system.main_system_tag = main_system_item.main_system_tag
selected_building_menu.main_system.sub_system = {};
$("#select-main-system-name").html(main_system_item.full_name);
main_system_item.sub_systems.forEach(function (sub_system_item, sub_system_index) {
if (sub_system_item.sub_system_guid == selected_target.sub_system_guid) {
selected_building_menu.main_system.sub_system.sub_system_guid = sub_system_item.sub_system_guid
if (sub_system_item.sub_system_tag == selected_target.sub_system_tag) {
selected_building_menu.main_system.sub_system.sub_system_tag = sub_system_item.sub_system_tag
selected_building_menu.main_system.sub_system.floors = sub_system_item.floors;
$("#select-sub-system-name").html(sub_system_item.full_name);
@ -1971,7 +1971,7 @@
//匯入floor panel
$(".floor-panel-wrap").empty();
sub_system_item.floors.forEach(function (floor_item, floor_index) {
$(".floor-panel-wrap").append(`<button type="button" class="btn btn-secondary waves-effect waves-themed mr-2 mb-2 btn-floor" onclick="ChangeDevicePanel(this)" data-floor-guid="${floor_item.floor_guid}">${floor_item.full_name}</button>`)
$(".floor-panel-wrap").append(`<button type="button" class="btn btn-secondary waves-effect waves-themed mr-2 mb-2 btn-floor" onclick="ChangeDevicePanel(this)" data-floor-guid="${floor_item.Floor_tag}">${floor_item.full_name}</button>`)
});
}
});
@ -1987,10 +1987,10 @@
//#region 變更平面圖與設備的控制面板
function ChangeDevicePanel(dom) {
selected_floor_guid = $(dom).attr("data-floor-guid") ? $(dom).attr("data-floor-guid") : ""
selected_floor_tag = $(dom).attr("data-floor-guid") ? $(dom).attr("data-floor-guid") : ""
var current_floor = selected_building_menu.main_system.sub_system.floors.filter(function (item) {
return item.floor_guid == selected_floor_guid
return item.Floor_tag == selected_floor_tag
})[0];
$.each($(".btn-floor"), function (index, item) {
@ -2522,11 +2522,11 @@
//#region 新增設備
function AddDevice() {
var selectedBuilding_guid = selected_building_menu.building_guid ? selected_building_menu.building_guid : "";
var selectedMain_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_guid : "";
var selectedSub_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_guid : "" : "";
var selectedFloor_guid = selected_floor_guid ? selected_floor_guid : "";
if (selectedBuilding_guid == '' || selectedMain_system_guid == '' || selectedSub_system_guid == '' || selectedFloor_guid == '') {
var selectedBuliding_tag = selected_building_menu.buliding_tag ? selected_building_menu.buliding_tag : "";
var selectedMain_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : "";
var selectedSub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
var selectedFloor_tag = selected_floor_tag ? selected_floor_tag : "";
if (selectedBuliding_tag == '' || selectedMain_system_tag == '' || selectedSub_system_tag == '' || selectedFloor_tag == '') {
toast_warning("請先選擇系統類別及樓層。");
return;
}
@ -2676,11 +2676,11 @@
//#region 設備儲存(透過新增按鈕)
function SaveDeviceAdd() {
var selectedBuilding_guid = selected_building_menu.building_guid ? selected_building_menu.building_guid : "";
var selectedMain_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_guid : "";
var selectedSub_system_guid = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_guid : "" : "";
var selectedFloor_guid = selected_floor_guid ? selected_floor_guid : "";
if (selectedBuilding_guid == '' || selectedMain_system_guid == '' || selectedSub_system_guid == '' || selectedFloor_guid == '')
var selectedBuliding_tag = selected_building_menu.buliding_tag ? selected_building_menu.buliding_tag : "";
var selectedMain_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : "";
var selectedSub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
var selectedFloor_tag = selected_floor_tag ? selected_floor_tag : "";
if (selectedBuliding_tag == '' || selectedMain_system_tag == '' || selectedSub_system_tag == '' || selectedFloor_tag == '')
{
toast_warning("請先選擇系統類別及樓層。");
return;
@ -2710,10 +2710,10 @@
var url = "/DeviceManage/SaveDeviceInfoAdd";
@*var send_data = {
Building_guid: selectedBuilding_guid,
Main_system_guid: selectedMain_system_guid,
Sub_system_guid: selectedSub_system_guid,
Floor_guid: selectedFloor_guid,
Buliding_tag: selectedBuliding_tag,
Main_system_tag: selectedMain_system_tag,
Sub_system_tag: selectedSub_system_tag,
Floor_tag: selectedFloor_tag,
SelectedDevices: selectedDevices
}
@ -2734,10 +2734,10 @@
var formData = new FormData();
formData.append("Building_guid", selectedBuilding_guid);
formData.append("Main_system_guid", selectedMain_system_guid);
formData.append("Sub_system_guid", selectedSub_system_guid);
formData.append("Floor_guid", selectedFloor_guid);
formData.append("Buliding_tag", selectedBuliding_tag);
formData.append("Main_system_tag", selectedMain_system_tag);
formData.append("Sub_system_tag", selectedSub_system_tag);
formData.append("Floor_tag", selectedFloor_tag);
formData.append("SelectedDevicesFile", blob);
$.ajax({