Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
b0e9ba73f0
@ -777,6 +777,11 @@ namespace Backend.Controllers
|
||||
{
|
||||
device_guid_record = device_guid.ToString();
|
||||
node_priority = 1;
|
||||
Dictionary<string, object> deviceForLight = new Dictionary<string, object>();
|
||||
deviceForLight.Add("@device_coordinate_3d", idfc.device_coordinate_3d);
|
||||
deviceForLight.Add("@forge_dbid", idfc.forge_dbid);
|
||||
deviceForLight.Add("@updated_at", DateTime.Now);
|
||||
await backendRepository.UpdateOneByCustomTable(deviceForLight, "device", $@" device_guid = '{device_guid}'");
|
||||
}
|
||||
|
||||
//燈具
|
||||
@ -798,12 +803,96 @@ namespace Backend.Controllers
|
||||
Dictionary<string, object> device = new Dictionary<string, object>();
|
||||
device.Add("@device_coordinate_3d", idfc.device_coordinate_3d);
|
||||
device.Add("@forge_dbid", idfc.forge_dbid);
|
||||
device.Add("@updated_at", DateTime.Now);
|
||||
await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "編輯成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
apiResult.Code = "0001";
|
||||
apiResult.Msg = "無資料輸入";
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新forge_room room_id(dbid), room_name
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> ImportForgeRoom([FromBody] List<ImportForgeRoom> post)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
//var device_guid_record = "";
|
||||
try
|
||||
{
|
||||
if (post != null)
|
||||
{
|
||||
if (post.Count > 0)
|
||||
{
|
||||
//清空device_node資料表
|
||||
await backendRepository.TruncateTable("forge_room");
|
||||
|
||||
foreach (var idfc in post)
|
||||
{
|
||||
// var room_name_arr = idfc.room_name.Split('_');
|
||||
string full_name = idfc.room_name;
|
||||
char first = full_name[0];
|
||||
if (first != 'B' && first != 'R' && first != 'U')
|
||||
{
|
||||
full_name = 'U' + full_name;
|
||||
}
|
||||
|
||||
//var param = new { floor_name = floor_name };
|
||||
|
||||
//房間 新增Data至forge_room資料表
|
||||
Dictionary<string, object> room = new Dictionary<string, object>();
|
||||
room.Add("@room_id", idfc.room_id);
|
||||
room.Add("@deleted", 0);
|
||||
room.Add("@room_name", full_name);
|
||||
room.Add("@created_at", DateTime.Now);
|
||||
|
||||
await backendRepository.AddOneByCustomTableReturnId(room, "forge_room", false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//更新forge_room資料表 building_tag, floor_guid欄位
|
||||
string sql = @"
|
||||
update forge_room a
|
||||
join (
|
||||
select building_tag, floor_guid,
|
||||
case when right(floor_name, 1) = 'F' then floor_name
|
||||
else CONCAT(floor_name, 'F') end floor_name , priority
|
||||
from (
|
||||
SELECT
|
||||
a.building_tag,
|
||||
a.floor_guid, a.full_name,
|
||||
case when left(a.full_name, 1) = 'B' then a.full_name
|
||||
when left(a.full_name, 1) = 'R' then a.full_name
|
||||
when left(a.full_name, 1) = 'U' then a.full_name
|
||||
else CONCAT('U', a.full_name) end as floor_name,
|
||||
a.priority
|
||||
FROM floor AS a
|
||||
INNER JOIN building AS b ON a.building_tag = b.building_tag
|
||||
WHERE a.deleted = 0 AND b.deleted = 0
|
||||
)y
|
||||
)x on SUBSTRING_INDEX(a.room_name, '_', 1) = x.floor_name
|
||||
set a.building_tag = x.building_tag,
|
||||
a.floor_guid = x.floor_guid";
|
||||
await backendRepository.ExecuteSql(sql);
|
||||
}
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "編輯成功";
|
||||
|
@ -270,4 +270,23 @@ namespace Backend.Models
|
||||
public string device_coordinate_3d { get; set; }
|
||||
public int forge_dbid { get; set; }
|
||||
}
|
||||
|
||||
public class ImportForgeRoom
|
||||
{
|
||||
public string building_tag { get; set; }
|
||||
public string floor_guid { get; set; }
|
||||
public int room_id { get; set; }
|
||||
public int deleted { get; set; }
|
||||
public string room_name { get; set; }
|
||||
public string created_at { get; set; }
|
||||
}
|
||||
|
||||
public class Import_floor_data
|
||||
{
|
||||
public string building_tag { get; set; }
|
||||
public string floor_guid { get; set; }
|
||||
public string floor_name { get; set; }
|
||||
public int priority { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,11 +54,9 @@
|
||||
<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>
|
||||
@ -215,12 +213,12 @@
|
||||
<div class="col">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="icon_click[]" id="icon_click_url" value="1">
|
||||
<label class="custom-control-label" for="icon_click_url">顯示詳細資料</label>
|
||||
<label class="custom-control-label" for="icon_click_url">顯示詳細資料 - (抓取設備八段路徑呈現詳細資料)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-12" id="build_menu_icon_click_url_modal_div" name="drawing_extend">
|
||||
@*<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', '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>
|
||||
@ -229,7 +227,7 @@
|
||||
<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>*@
|
||||
<div class="form-group col-12" id="build_menu_icon_click_url_width_height_modal_div">
|
||||
<label class="form-label">詳細資料 顯示視窗設定</label><br>
|
||||
<div class="row">
|
||||
@ -340,12 +338,12 @@
|
||||
<div class="col">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="icon_click[]_r" id="icon_click_url_r" value="1">
|
||||
<label class="custom-control-label" for="icon_click_url_r">顯示詳細資料</label>
|
||||
<label class="custom-control-label" for="icon_click_url_r">顯示詳細資料 - (抓取設備八段路徑呈現詳細資料)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-12" id="build_menu_icon_click_url_modal_div_r" name="drawing_extend_r">
|
||||
@*<div class="form-group col-12" id="build_menu_icon_click_url_modal_div_r" name="drawing_extend_r">
|
||||
<label class="form-label" for="build_menu_icon_click_url_modal_r">詳細資料 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>
|
||||
@ -354,7 +352,7 @@
|
||||
<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>
|
||||
<input type="text" id="build_menu_icon_click_url_modal_r" class="form-control">
|
||||
</div>
|
||||
</div>*@
|
||||
<div class="form-group col-12" id="build_menu_icon_click_url_width_height_modal_div_r">
|
||||
<label class="form-label">詳細資料 顯示視窗設定</label><br>
|
||||
<div class="row">
|
||||
@ -478,14 +476,14 @@
|
||||
str.push("點擊開關")
|
||||
}
|
||||
if (1 & parseInt(data) > 0) {
|
||||
str.push("顯示詳細資料")
|
||||
str.push("顯示詳細資料 - (抓取設備八段路徑呈現詳細資料)")
|
||||
}
|
||||
return str.join(";");
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "left_icon_click_url"
|
||||
},
|
||||
//{
|
||||
// "data": "left_icon_click_url"
|
||||
//},
|
||||
{
|
||||
"data": "right_drawing_name"
|
||||
},
|
||||
@ -500,14 +498,14 @@
|
||||
str.push("點擊開關")
|
||||
}
|
||||
if (1 & parseInt(data) > 0) {
|
||||
str.push("顯示詳細資料")
|
||||
str.push("顯示詳細資料 - (抓取設備八段路徑呈現詳細資料)")
|
||||
}
|
||||
return str.join(";");
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "right_icon_click_url"
|
||||
},
|
||||
//{
|
||||
// "data": "right_icon_click_url"
|
||||
//},
|
||||
{
|
||||
"data": null,
|
||||
"render": function (data, type, row, meta){
|
||||
@ -542,13 +540,13 @@
|
||||
$.each(this.data, function (k, rel) {
|
||||
rel.sub_system_guid_name = "<font color='#7c91df'>" + rel.sub_system_guid_name + "</font>"
|
||||
if (rel.left_drawing == 2) {
|
||||
rel.left_drawing_name = rel.left_drawing_name + "<br>" + '<a href = "' + rel.system_url + '" target="_blank" >點擊連結</a >'
|
||||
rel.left_drawing_name = rel.left_drawing_name + "<br>" + '<a href = "' + rel.left_system_url + '" target="_blank" >點擊連結</a >'
|
||||
}
|
||||
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 >'
|
||||
rel.right_drawing_name = rel.right_drawing_name + "<br>" + '<a href = "' + rel.right_system_url + '" target="_blank" >點擊連結</a >'
|
||||
}
|
||||
if (rel.right_drawing == 1) {
|
||||
rel.right_drawing_name = rel.right_drawing_name + "<br>" + '[' + rel.floor_guid_name + ']'
|
||||
@ -787,20 +785,20 @@
|
||||
//#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_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_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) {
|
||||
$('#build_menu_icon_click_url_modal_div_r').show();
|
||||
//$('#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_modal_div_r').hide();
|
||||
$('#build_menu_icon_click_url_width_height_modal_div_r').hide();
|
||||
}
|
||||
});
|
||||
@ -977,7 +975,7 @@
|
||||
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_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();
|
||||
@ -989,7 +987,7 @@
|
||||
$(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_modal_div]').show();
|
||||
$(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').show();
|
||||
}
|
||||
} else if ($(value).val() == 1) {
|
||||
|
@ -40,7 +40,7 @@
|
||||
<button type="button" class="btn btn-dark" onclick="cancelTransparentModel()">取消透明物件</button>
|
||||
<button type="button" class="btn btn-danger" onclick="proFile()">剖面</button>
|
||||
<button type="button" class="btn btn-dark" onclick="getLevels()">取得levels</button>
|
||||
<button type="button" class="btn btn-success" onclick="importDevCor()">匯入設備座標及dbid</button>
|
||||
<button type="button" class="btn btn-success" onclick="importDevCor()">匯入設備座標及房間等dbid</button>
|
||||
<!--<input id="lightBar" type="range" min="0" max="100" step="5" onchange="changeLightPower()">亮度-->
|
||||
<!-- <input type="range">Main Axis</input> -->
|
||||
</div>
|
||||
@ -240,8 +240,13 @@
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8yMDIyXzEyXzMxLm53ZA');
|
||||
|
||||
//雙模式
|
||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8yMDIyXzEyXzMxLm53ZA==');
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8yMDIyXzEyXzMxLm53ZA==');
|
||||
|
||||
//01.06 樓層刪除燈具
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQyVFOSU5QiU5OSVFNiVBOCVBMSVFNSVCQyU4RitNRVAlRTYlOEIlODYlRTclQjMlQkIlRTclQjUlQjFfJUU1JTg4JUFBJUU3JTg3JTg4JUU1JTg1JUI3XzIwMjNfMDFfMDYubndk');
|
||||
|
||||
|
||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQyVFOSU5QiU5OSVFNiVBOCVBMSVFNSVCQyU4RitNRVAlRTYlOEIlODYlRTclQjMlQkIlRTclQjUlQjFfJUU1JTg4JUFBJUU3JTg3JTg4JUU1JTg1JUI3XzIwMjNfMDFfMDYubndk');
|
||||
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP
|
||||
@ -381,6 +386,7 @@
|
||||
|
||||
function importDevCor() {
|
||||
ImportDevForCor();
|
||||
ImportForgeRoom();
|
||||
}
|
||||
|
||||
function ImportDevForCor() {//callback = null
|
||||
@ -412,9 +418,38 @@
|
||||
fail: function (xhr, status, error) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function ImportForgeRoom() {
|
||||
var url = "/DeviceImport/ImportForgeRoom";
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: url,
|
||||
data: JSON.stringify(roomDataList),
|
||||
cache: false,
|
||||
async: false,
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
dataType: 'json',
|
||||
success: function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
if (rel.code == "9999") {
|
||||
console.log(rel.msg);
|
||||
}
|
||||
else {
|
||||
console.log(rel.msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
console.log(rel.msg);
|
||||
return;
|
||||
}
|
||||
},
|
||||
fail: function (xhr, status, error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -13,7 +13,8 @@ var levels;//剖面用
|
||||
var baseApiUrl = "http://localhost:3604";
|
||||
var instanceTree;
|
||||
//var objSendData = { Data: null };
|
||||
var tagIdDevList = [];
|
||||
var tagIdDevList = [];//模型設備List: device_number、device_coordinate_3d、forge_dbid
|
||||
var roomDataList = [];//模型房間List: room_id、room_name
|
||||
|
||||
function launchViewer(urn) {
|
||||
var av = Autodesk.Viewing;
|
||||
@ -274,39 +275,36 @@ function onDocumentLoadSuccess(doc) {
|
||||
e.properties.forEach(function (item) {
|
||||
if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】
|
||||
if (item.displayValue != "") {
|
||||
//if ((item.displayValue).indexOf('TPE_B1_ME_M10') > -1) {
|
||||
console.log("--------------------------------------------------");
|
||||
console.log("Tag_name dbid: " + e.dbId);
|
||||
console.log("value: " + item.displayValue);
|
||||
|
||||
//myDataList.forEach((myData, index) => {
|
||||
// devices.push({ id: index, position: JSON.parse(myData.device_coordinate_3d), sensorTypes: ["temperature", "humidity"] });
|
||||
//});
|
||||
//}
|
||||
|
||||
////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10
|
||||
//console.log("--------------------------------------------------");
|
||||
//console.log("Tag_name dbid: " + e.dbId);
|
||||
//console.log("value: " + item.displayValue);
|
||||
////}
|
||||
var str = item.displayValue.split('_');
|
||||
if (str.length == 2) { //兩段為房間 ex: U7F_01
|
||||
roomDataList.push({ room_id: e.dbId, room_name: item.displayValue });
|
||||
}
|
||||
else if (str.length == 8) { //八段為設備 ex: TPE_B1_ME_M10_U7F_NA_FCU_N1
|
||||
//取得座標
|
||||
let bounds = new THREE.Box3();
|
||||
|
||||
instanceTree.enumNodeFragments(e.dbId, (fragId) => {
|
||||
let box = new THREE.Box3();
|
||||
fragList.getWorldBounds(fragId, box);
|
||||
bounds.union(box);
|
||||
}, true);
|
||||
var position = bounds.center();
|
||||
//if ((item.displayValue).indexOf('TPE_B1_ME_M10') > -1) {
|
||||
console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
|
||||
////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {
|
||||
//console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
|
||||
//console.log("--------------------------------------------------");
|
||||
////}
|
||||
tagIdDevList.push({ device_number: item.displayValue, device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', forge_dbid: e.dbId });
|
||||
console.log("--------------------------------------------------");
|
||||
//}
|
||||
}
|
||||
//getFragmentWorldMatrixByNodeId(e.dbId, viewer);
|
||||
//let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//---------------------- end ---------------------------------------------------
|
||||
@ -792,8 +790,6 @@ function setElevatorSpeed(speed) { //0.01 ~ 1
|
||||
}
|
||||
|
||||
function movElevator() {
|
||||
|
||||
|
||||
let tree = viewer.model.getData().instanceTree;//三組:(749,750,751),(755,756,757),(761,762,763)
|
||||
let nodeId = 12112;//12104; //749; //10952;
|
||||
let nodeId2 = 12111;//12105; //750;
|
||||
@ -908,64 +904,6 @@ function hideColor(nodeId) {//顏色改成透明
|
||||
viewer.setThemingColor(nodeId, color);
|
||||
}
|
||||
|
||||
//function movElevator() {
|
||||
|
||||
|
||||
// let tree = viewer.model.getData().instanceTree;
|
||||
// let nodeId = 750;// 10952;
|
||||
// let fragProxyZ = 0;
|
||||
// var movStatus = 0; // 0=no 1=up 2=down
|
||||
|
||||
|
||||
// if (fragProxy.position.z > targetFloorZ) {
|
||||
// movStatus = 2
|
||||
// }
|
||||
// else if (fragProxy.position.z < targetFloorZ) {
|
||||
// movStatus = 1
|
||||
// }
|
||||
|
||||
// if (movStatus == 0) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// tree.enumNodeFragments(nodeId, function (frag) {
|
||||
// fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
// fragProxy.getAnimTransform();
|
||||
// //let fragPosition = new THREE.Vector3(0, 0, 15);// 一樓0 二樓15 三樓 26
|
||||
// if (movStatus == 2) {
|
||||
// fragProxy.position.z -= elevatorSpeed;
|
||||
// }
|
||||
// else if (movStatus == 1) {
|
||||
// fragProxy.position.z += elevatorSpeed;
|
||||
// }
|
||||
|
||||
// fragProxyZ = fragProxy.position.z;
|
||||
// fragProxy.updateAnimTransform()
|
||||
|
||||
// });
|
||||
// viewer.impl.sceneUpdated(true);
|
||||
|
||||
// if (movStatus == 2) {
|
||||
// if (fragProxyZ >= targetFloorZ) {
|
||||
// requestAnimationFrame(movElevator);
|
||||
// }
|
||||
// }
|
||||
// else if (movStatus == 1) {
|
||||
// if (fragProxyZ <= targetFloorZ) {
|
||||
// requestAnimationFrame(movElevator);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// //let fragPosition = new THREE.Vector3(position);// 一樓0 二樓15 三樓 26
|
||||
|
||||
// //fragProxy.position = fragPosition;
|
||||
|
||||
// //fragProxy.updateAnimTransform();
|
||||
|
||||
// //viewer.impl.sceneUpdated(true);
|
||||
//}
|
||||
|
||||
function getAllDbIds(viewer) {
|
||||
var instanceTree = viewer.model.getData().instanceTree;
|
||||
|
||||
@ -1025,10 +963,6 @@ function onButtonClicked() {
|
||||
this.viewer.setCutPlanes([upperCutPlaneParam, lowerCutPlaneParam]);
|
||||
}
|
||||
|
||||
function displayCuttedPlane() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Autodesk.Viewing.Document.load() failuire callback.
|
||||
*/
|
||||
@ -1082,27 +1016,7 @@ async function loadHeatmaps(model) {
|
||||
position: { x: 6.98, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (-4.93, -3.85, 16.86)
|
||||
sensorTypes: ["temperature", "humidity"]
|
||||
}
|
||||
|
||||
//{
|
||||
// id: "Oficina 5",
|
||||
// //name: "Oficina-",
|
||||
// position: { x: 3.35, y: -4.81, z: 12.88 }, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
|
||||
// sensorTypes: ["temperature", "humidity"]
|
||||
//},
|
||||
//{
|
||||
// id: "Oficina 4",
|
||||
// //name: "Oficina-",
|
||||
// position: { x: 37.03, y: -4.81, z: 12.88 }, // x: 0, y: 25.03, z: -2.52 (37.03, -4.81, 12.88)
|
||||
// sensorTypes: ["temperature", "humidity"]
|
||||
//},
|
||||
//{
|
||||
// id: "Oficina 3",
|
||||
// //name: "Oficina-",
|
||||
// position: { x: 2.83, y: -22.60, z: 12.88 }, // x: 0, y: 25.03, z: -2.52 (2.83, -22.60, 12.88)
|
||||
// sensorTypes: ["temperature", "humidity"]
|
||||
//}
|
||||
];
|
||||
//冷氣N5: (6.98, -19.00, 16.86), N4: (35.85, -2.24, 16.86), N3: (6.98, -2.24, 16.86)
|
||||
|
||||
// Initialize sensor values
|
||||
let sensorVals = [];
|
||||
@ -1228,11 +1142,6 @@ async function loadHeatmap() {
|
||||
|
||||
function hideObject() {
|
||||
//viewer.hide(4);
|
||||
//viewer.hide(58);
|
||||
//viewer.hide(613);
|
||||
//viewer.hide(640);
|
||||
//viewer.hide(560);
|
||||
|
||||
for (var i = 0; i < allDbIdsStr.length; i++) {
|
||||
viewer.hide(parseInt(allDbIdsStr[i]));
|
||||
}
|
||||
@ -1240,11 +1149,6 @@ function hideObject() {
|
||||
|
||||
function openObject() {
|
||||
//viewer.show(4);
|
||||
//viewer.show(58);
|
||||
//viewer.show(613);
|
||||
//viewer.show(640);
|
||||
//viewer.show(560);
|
||||
|
||||
for (var i = 0; i < allDbIdsStr.length; i++) {
|
||||
viewer.show(parseInt(allDbIdsStr[i]));
|
||||
}
|
||||
@ -1252,67 +1156,11 @@ function openObject() {
|
||||
|
||||
async function setObjectTransparent() {
|
||||
//setTransparency(4, 0);
|
||||
//setTransparency(58, 0);
|
||||
//setTransparency(613, 0);
|
||||
//setTransparency(640, 0);
|
||||
//setTransparency(560, 0);
|
||||
//setTransparency(parseInt(515), 0);
|
||||
|
||||
//for (var i = 0; i < allDbIdsStr.length; i++) {
|
||||
// setTransparency(parseInt(allDbIdsStr[i]), 0);
|
||||
//}
|
||||
|
||||
//setTransparency(parseInt(515), 0);
|
||||
//setTransparency(parseInt(516), 0);
|
||||
//setTransparency(parseInt(517), 0);
|
||||
//setTransparency(parseInt(518), 0);
|
||||
//setTransparency(parseInt(519), 0);
|
||||
//setTransparency(parseInt(399), 0);
|
||||
//setTransparency(parseInt(101), 0);
|
||||
//setTransparency(parseInt(100), 0);
|
||||
//setTransparency(parseInt(58), 0);
|
||||
|
||||
//setTransparency(parseInt(587), 0);
|
||||
//setTransparency(parseInt(586), 0);
|
||||
//setTransparency(parseInt(585), 0);
|
||||
//setTransparency(parseInt(584), 0);
|
||||
//setTransparency(parseInt(583), 0);
|
||||
//setTransparency(parseInt(562), 0);
|
||||
//setTransparency(parseInt(361), 0);
|
||||
|
||||
//test();
|
||||
//hideColor(587);
|
||||
//hideColor(586);
|
||||
//hideColor(585);
|
||||
//hideColor(584);
|
||||
//hideColor(583);
|
||||
//hideColor(562);
|
||||
//hideColor(361);
|
||||
|
||||
setTransparentBuilding();
|
||||
|
||||
}
|
||||
|
||||
async function cancelObjectTransparent() {
|
||||
//setTransparency(4, 1);
|
||||
//setTransparency(58, 1);
|
||||
//setTransparency(613, 1);
|
||||
//setTransparency(640, 1);
|
||||
//setTransparency(560, 1);
|
||||
//for (var i = 0; i < allDbIdsStr.length; i++) {
|
||||
// setTransparency(parseInt(allDbIdsStr[i]), 1);
|
||||
//}
|
||||
|
||||
//setTransparency(515, 0.2);
|
||||
//setTransparency(516, 0.2);
|
||||
//setTransparency(517, 0.2);
|
||||
//setTransparency(518, 0.2);
|
||||
//setTransparency(519, 0.2);
|
||||
//setTransparency(399, 0.2);
|
||||
//setTransparency(101, 0.2);
|
||||
//setTransparency(100, 0.2);
|
||||
//setTransparency(58, 0.2);
|
||||
|
||||
recoverTransparentBuilding();
|
||||
|
||||
}
|
||||
@ -1348,7 +1196,6 @@ async function test() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------ 剖面 ----------------------
|
||||
async function getRemoteLevels() {
|
||||
const aecData = await Autodesk.Viewing.Document.getAecModelData(this.viewer.model.getDocumentNode());
|
||||
@ -1364,26 +1211,6 @@ async function getLevelsData() {
|
||||
this.levels = data;
|
||||
}
|
||||
|
||||
//function getCutPlaneParam(idx, n) {
|
||||
// if (idx < 0 || !n) return;
|
||||
|
||||
// const level = this.levels[idx];
|
||||
// if (!level) return;
|
||||
|
||||
// //const precision = Autodesk.Viewing.Private.calculatePrecision( level.elevation );
|
||||
// const model = this.viewer.model;
|
||||
// const globalOffset = model.getData().globalOffset;
|
||||
// const units = model.getUnitString();
|
||||
// const elevRaw = Autodesk.Viewing.Private.convertUnits('ft', units, 1, level.elevation);
|
||||
|
||||
// let d = elevRaw - globalOffset.z - 0.5;
|
||||
// if (n == 1)
|
||||
// d = -1 * d;
|
||||
|
||||
// return new THREE.Vector4(0, 0, n, d);
|
||||
//}
|
||||
|
||||
|
||||
function profile() {
|
||||
const upperIdx = 6;
|
||||
const upperCutPlaneParam = this.getCutPlaneParam(upperIdx, 1);
|
||||
@ -1393,71 +1220,3 @@ function profile() {
|
||||
}
|
||||
//----------------- end -----------------------------------------------
|
||||
|
||||
// 設備的dbid和3D座標 存進 資料庫
|
||||
//function ImportDevForCor() {//callback = null
|
||||
// var url = "/DeviceImport/ImportDevForCor";
|
||||
// //let sendData = {
|
||||
// // "device_number": pageAct.AreaTag,
|
||||
// // "device_coordinate_3d": "",
|
||||
// // "device_dbid": "",
|
||||
// //};
|
||||
// objSendData.Data = tagIdDevList;
|
||||
// //ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
// // if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
// // } else {
|
||||
|
||||
// // }
|
||||
// //}, null, "POST").send();
|
||||
|
||||
// //$.post(url, objSendData, 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);
|
||||
// // //ReloadRawDataCheckTable();
|
||||
// // }
|
||||
|
||||
// //}, 'json');
|
||||
|
||||
// //headers={'content-type': 'application/json'}
|
||||
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: url,
|
||||
// data: objSendData,
|
||||
// cache: false,
|
||||
// contentType: 'application/json',
|
||||
// processData: false,
|
||||
// success: function (rel) {
|
||||
// //$("#save-building-btn").html('確定').attr("disabled", false);
|
||||
// if (rel.code != "0000") {
|
||||
// if (rel.code == "9999") {
|
||||
// toast_error(rel.msg);
|
||||
// }
|
||||
// else {
|
||||
// toast_warning(rel.msg);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// else {
|
||||
// toast_ok(rel.msg);
|
||||
// //buildInfoTable.ajax.reload(null, false);
|
||||
// //$('#build-modal').modal('hide');
|
||||
// return;
|
||||
// }
|
||||
// },
|
||||
// fail: function (xhr, status, error) {
|
||||
// //$("#save-building-btn").html('確定').attr("disabled", false);
|
||||
// //toast_error(rel.msg);
|
||||
// }
|
||||
// });
|
||||
|
||||
//}
|
12
Frontend/Web.config
Normal file
12
Frontend/Web.config
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<!--<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\Backend.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />-->
|
||||
</system.webServer>
|
||||
</location>
|
||||
</configuration>
|
||||
<!--ProjectGuid: C0B93B4D-F0AF-4C80-ABF9-5C984425749C-->
|
@ -161,27 +161,16 @@
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<div class="row">
|
||||
<div class="row h-100">
|
||||
<div class="col-lg-6">
|
||||
<div id="panel-3" class="panel" data-panel-sortable data-panel-collapsed data-panel-close>
|
||||
<div id="panel-3" class="panel" style="height: calc(100% - 1.5rem);">
|
||||
<div class="panel-hdr">
|
||||
<h2>
|
||||
異常狀態
|
||||
</h2>
|
||||
</div>
|
||||
<div class="panel-container show">
|
||||
<div class="panel-content poisition-relative p-0">
|
||||
<!--<div class="pb-5 pt-3">
|
||||
<div class="d-flex mr-4">
|
||||
<div class="mr-2">
|
||||
<span class="peity-donut" data-peity="{ "fill": ["#967bbd", "#ccbfdf"], "innerRadius": 14, "radius": 20 }">7/10</span>
|
||||
</div>
|
||||
<div>
|
||||
<label class="fs-sm mb-0 mt-2 mt-md-0">New Sessions</label>
|
||||
<h4 class="font-weight-bold mb-0">70.60%</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="panel-container h-100 show">
|
||||
<div class="panel-content poisition-relative p-0 row p-0 h-100">
|
||||
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
||||
<canvas class="chart" id="errRecChart"></canvas>
|
||||
</div>
|
||||
@ -193,34 +182,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div id="panel-3" class="panel" data-panel-sortable data-panel-collapsed data-panel-close>
|
||||
<div id="panel-3" class="panel" style="height: calc(100% - 1.5rem);">
|
||||
<div class="panel-hdr">
|
||||
<h2>
|
||||
工單進度
|
||||
</h2>
|
||||
</div>
|
||||
<div class="panel-container show">
|
||||
<div class="panel-content poisition-relative p-0">
|
||||
<!--<div class="pb-5 pt-3">
|
||||
<div class="d-flex mr-0">
|
||||
<div class="mr-2">
|
||||
<span class="peity-donut" data-peity="{ "fill": ["#2196F3", "#9acffa"], "innerRadius": 14, "radius": 20 }">3/10</span>
|
||||
</div>
|
||||
<div>
|
||||
<label class="fs-sm mb-0 mt-2 mt-md-0">Page Views</label>
|
||||
<h4 class="font-weight-bold mb-0">14,134</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="panel-container h-100 show">
|
||||
<div class="panel-content poisition-relative row p-0 h-100 p-0">
|
||||
|
||||
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
||||
<span class="text-center position-absolute t-white" style="top:25%;left:27%;">已完成<br>6</span>
|
||||
<img src="img/u40.png" class="" style="width:75%;margin-left:0px;left:-22px;">
|
||||
<span class="text-center position-absolute t-white" style="top:51%;left:58%;">未完成<br>8</span>
|
||||
<canvas class="chart" id="worOrdErrChart"></canvas>
|
||||
</div>
|
||||
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
||||
<span class="text-center position-absolute t-white" style="top:43%;left:26%;">未派工<br>5</span>
|
||||
<img src="img/u43.png" class="mt-2 mb-1" style="width:51%;">
|
||||
<span class="text-center position-absolute t-white" style="top:42%;left:58%;">派工中<br>9</span>
|
||||
<canvas class="chart" id="worOrdFinChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -244,6 +219,8 @@
|
||||
var timeOuters = [];
|
||||
var eveDayElecChart = null;
|
||||
var eveWeekElecChart = null;
|
||||
var worOrdErrChart = null;
|
||||
var worOrdFinChart = null;
|
||||
var errRecChart = null;
|
||||
var errChkChart = null;
|
||||
var loadedCnt = 0;
|
||||
@ -262,6 +239,11 @@
|
||||
{ mainSys: "FE", subSys: "F2", iconClass: "fal fa-smog" },
|
||||
{ mainSys: "WP", subSys: "W1", iconClass: "fal fa-stopwatch" },
|
||||
{ mainSys: "S", subSys: "R", iconClass: "fal fa-user-shield" },
|
||||
{ mainSys: "LT", subSys: "L2", iconClass: "fal fa-sun"},
|
||||
{ mainSys: "ME", subSys: "M1", iconClass: "fal fa-icicles"},
|
||||
{ mainSys: "ME", subSys: "M8", iconClass: "fal fa-bong"},
|
||||
{ mainSys: "W3", subSys: "W1", iconClass: "fal fa-tint"},
|
||||
|
||||
];
|
||||
|
||||
var tempSysSubText = [
|
||||
@ -270,12 +252,16 @@
|
||||
{ text: "緊急發電機", mainSys: "EE", subSys: "E3", },
|
||||
{ text: "電錶系統", mainSys: "EE", subSys: "E4", },
|
||||
{ text: "二線式照明系統", mainSys: "LT", subSys: "L1", },
|
||||
{ text: "景觀照明系統", mainSys: "LT", subSys: "L2", },
|
||||
{ text: "儲冰系統", mainSys: "ME", subSys: "M1", },
|
||||
{ text: "小型送風機", mainSys: "ME", subSys: "M10", },
|
||||
{ text: "排油煙設備", mainSys: "ME", subSys: "M8", },
|
||||
{ text: "環境感測設備", mainSys: "ME", subSys: "M12", },
|
||||
{ text: "電梯設備", mainSys: "ELEV", subSys: "EL", },
|
||||
{ text: "消防設備", mainSys: "FE", subSys: "F1", },
|
||||
{ text: "排煙系統", mainSys: "FE", subSys: "F2", },
|
||||
{ text: "電子水錶", mainSys: "WP", subSys: "W1", },
|
||||
{ text: "熱水系統", mainSys: "W3", subSys: "W1", },
|
||||
{ text: "門禁安全系統", mainSys: "S", subSys: "R", }
|
||||
];
|
||||
|
||||
@ -291,7 +277,7 @@
|
||||
let strHtml = ``;
|
||||
|
||||
$.each(tempSysSubText, (idx, obj) => {
|
||||
if (isExiNames.indexOf(obj.text) == -1 && $("#sysSubBtnList .dev-group").length < 12) {
|
||||
if (isExiNames.indexOf(obj.text) == -1 && $("#sysSubBtnList .dev-group").length < 16) {
|
||||
let iconObj = sysIconList.filter(x => x.mainSys == obj.mainSys && x.subSys == obj.subSys)[0];
|
||||
strHtml = `<div class="btn-group btn-group-lg col-lg-3 mb-4 dev-group">
|
||||
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><i class="${iconObj.iconClass || "fal fa-hdd"} fa-2x py-2"></i></button>
|
||||
@ -408,14 +394,14 @@
|
||||
// 本週與上週用電量 (每天)
|
||||
getElectricMeterDayDataByBaja(devNum + "_KWH", n4Sup, prevTwoWeek, tomorrow, (data) => {
|
||||
let curDay = (new Date()).getDay() == 0 ? 7 : (new Date()).getDay();
|
||||
let curWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr));
|
||||
let prevWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - 7 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr) && strToDate(new Date(), null, 0 - 7) >= strToDate(x.timestamp.$cEncStr));
|
||||
|
||||
let curWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 1 - 7) <= strToDate(x.timestamp.$cEncStr));
|
||||
let prevWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 1 - 14) <= strToDate(x.timestamp.$cEncStr) && strToDate(new Date(), null, 1 - 7) >= strToDate(x.timestamp.$cEncStr));
|
||||
debugger
|
||||
chartEveWeeksElec(curWeekData, prevWeekData)
|
||||
chkBajaLoaded();
|
||||
})
|
||||
|
||||
// 異常數量與賦歸數量
|
||||
// 異常數量與復歸數量
|
||||
getAlarmCountByBaja((aData) => {
|
||||
chartDataCnt.alarmCnt = aData.count;
|
||||
chkBajaLoaded();
|
||||
@ -424,7 +410,7 @@
|
||||
chartDataCnt.recCnt = rData.count;
|
||||
chkBajaLoaded();
|
||||
})
|
||||
// 異常數量與賦歸數量
|
||||
// 異常數量與復歸數量
|
||||
getCheckedAckedCountByBaja((data) => {
|
||||
chartDataCnt.chkedErrCnt = data.count;
|
||||
chkBajaLoaded();
|
||||
@ -440,8 +426,10 @@
|
||||
loadedCnt++;
|
||||
|
||||
if (loadedCnt == 9) {
|
||||
chartErrRec(["異常數量", "賦歸數量"], [chartDataCnt.alarmCnt, chartDataCnt.recCnt]);
|
||||
chartErrRec(["異常數量", "復歸數量"], [chartDataCnt.alarmCnt, chartDataCnt.recCnt]);
|
||||
chartErrChk(["已確認異常", "未確認異常"], [chartDataCnt.chkedErrCnt, chartDataCnt.unChkedErrCnt]);
|
||||
chartWorOrdErr();
|
||||
chartWorOrdFin();
|
||||
|
||||
endPageLoading();
|
||||
}
|
||||
@ -628,7 +616,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 圖表 - 異常與賦歸圖表 (圓餅圖)
|
||||
// 圖表 - 異常與復歸圖表 (圓餅圖)
|
||||
function chartErrRec(labels, datas) {
|
||||
|
||||
let errRecChartCanvas = ctx = $('#errRecChart').get(0).getContext('2d');
|
||||
@ -720,6 +708,101 @@
|
||||
|
||||
}
|
||||
|
||||
// 圖表 - 異常未派工與異常已派工 (圓環圖)
|
||||
function chartWorOrdErr(labels, datas) {
|
||||
labels = ["異常未派工", "異常已派工"]
|
||||
datas = [5, 9]
|
||||
let worOrdErrChartCanvas = ctx = $('#worOrdErrChart').get(0).getContext('2d');
|
||||
|
||||
let worOrdErrChartData = {
|
||||
labels: labels,
|
||||
datasets: [
|
||||
{
|
||||
label: '數量',
|
||||
unit: '個',
|
||||
fill: true,
|
||||
backgroundColor: [color.danger._500, color.info._300],
|
||||
//data: worOrdErrArr.map(x => parseInt((Math.random() * (1500 - 300) + 300))),
|
||||
data: datas,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let worOrdErrChartOptions = {
|
||||
//maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
legend: {
|
||||
display: true,
|
||||
},
|
||||
tooltips: {
|
||||
enabled: true,
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (worOrdErrChart == null) {
|
||||
worOrdErrChart = new Chart(worOrdErrChartCanvas, {
|
||||
type: "doughnut",
|
||||
data: worOrdErrChartData,
|
||||
options: worOrdErrChartOptions
|
||||
})
|
||||
} else {
|
||||
worOrdErrChart.data.datasets.forEach((dataset) => {
|
||||
dataset.data = datas;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 圖表 - 工單已完成與工單未完成 (圓環圖)
|
||||
function chartWorOrdFin(labels, datas) {
|
||||
labels = ["工單已完成","工單未完成"]
|
||||
datas = [5,9]
|
||||
let worOrdFinChartCanvas = ctx = $('#worOrdFinChart').get(0).getContext('2d');
|
||||
|
||||
let worOrdFinChartData = {
|
||||
labels: labels,
|
||||
datasets: [
|
||||
{
|
||||
label: '數量',
|
||||
unit: '個',
|
||||
fill: true,
|
||||
backgroundColor: [color.danger._500, color.info._300],
|
||||
//data: worOrdFinArr.map(x => parseInt((Math.random() * (1500 - 300) + 300))),
|
||||
data: datas,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let worOrdFinChartOptions = {
|
||||
//maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
legend: {
|
||||
display: true,
|
||||
},
|
||||
tooltips: {
|
||||
enabled: true,
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (worOrdFinChart == null) {
|
||||
worOrdFinChart = new Chart(worOrdFinChartCanvas, {
|
||||
type: "doughnut",
|
||||
data: worOrdFinChartData,
|
||||
options: worOrdFinChartOptions
|
||||
})
|
||||
} else {
|
||||
worOrdFinChart.data.datasets.forEach((dataset) => {
|
||||
dataset.data = datas;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 從 baja 訂閱 左下角各系統小類異常狀態
|
||||
function getAlarmSub(data) {
|
||||
$.each(data.data, (idx, alaObj) => {
|
||||
|
@ -38,14 +38,17 @@
|
||||
var allDevList = []; //全設備清單
|
||||
var subDeviceData = [];
|
||||
var heatMap = null;
|
||||
var buildMenuData = {};
|
||||
|
||||
$(function () {
|
||||
getBuildMenu((arr, data) => {
|
||||
buildMenuData = data;
|
||||
if (arr.indexOf(4) != -1) {
|
||||
getFloDevList();
|
||||
getFloDevList(arr[0] == 4 ? "left" :"right");
|
||||
setLightColor();
|
||||
}
|
||||
if (arr.indexOf(3) != -1) {
|
||||
getLightPoint();
|
||||
getHotspotPoint(() => {
|
||||
show3DModel(data.urn_3D);
|
||||
});
|
||||
@ -72,7 +75,10 @@
|
||||
</div>`;
|
||||
break;
|
||||
case 3:
|
||||
strHtml = `<div name="forgeViewer" style="height:85vh;"></div>`;
|
||||
strHtml = `<div class="d-flex mb-4" style="gap:15px">
|
||||
${setTopHeatBar()}
|
||||
</div>
|
||||
<div name="forgeViewer" style="height:85vh;"></div>`;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -90,6 +96,7 @@
|
||||
}
|
||||
myBaja.setSubscribeDevicesByBql(ordPath);
|
||||
myBaja.setSubscribeDevicesCallBack(function (data) {
|
||||
console.log(data)
|
||||
let matchDevice = allDevList.filter(x => x.device_number == data.device_number_full)[0];
|
||||
if (!matchDevice) {
|
||||
return false;
|
||||
@ -130,15 +137,32 @@
|
||||
|
||||
setLightColor();
|
||||
setForgeHotSpotColor(matchDevice);
|
||||
lightDevForgeSpotLig(matchDevice)
|
||||
// 從設備訂閱更新每個設備卡片即時點位
|
||||
setDevItemPoiValBySub(data);
|
||||
});
|
||||
|
||||
myBaja.setSubscribeDeviceEndCallBack(function (data) {
|
||||
|
||||
endPageLoading();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function lightDevForgeSpotLig(devObj) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 從設備訂閱更新每個設備卡片即時點位
|
||||
function setDevItemPoiValBySub(data) {
|
||||
|
||||
let pointSpan = $(`.card.device-wrap[data-number=${data.device_number_full}] span[name=devItemPoiVal]`);
|
||||
if (pointSpan && pointSpan.data("point") == data.point_name) {
|
||||
console.log(data)
|
||||
pointSpan.text(data.value);
|
||||
}
|
||||
}
|
||||
|
||||
function setLightColor() {
|
||||
$("[data-light-type]").each((index, ele) => {
|
||||
let type = $(ele).data("light-type");
|
||||
@ -192,6 +216,12 @@
|
||||
return strHtml;
|
||||
}
|
||||
|
||||
// 設置 Forge 3D 溫度條
|
||||
function setTopHeatBar() {
|
||||
let strHtml = `<canvas name="forgeHeatBar" width="200" height="30" style="z-index:9999"></canvas>`;
|
||||
return strHtml;
|
||||
}
|
||||
|
||||
// forge 3D 異常點位變紅色
|
||||
function setForgeHotSpotColor(device) {
|
||||
let subData = subDeviceData.filter(x => x.device_number == device.device_number)[0]
|
||||
@ -200,8 +230,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 取得昇位圖點位 (deviceItem)
|
||||
function getRiserPoiObj() {
|
||||
let tarDevItem = pageAct.devItems?.filter(x => x.is_show_riserDiagram == 1);
|
||||
if (tarDevItem && tarDevItem[0]) {
|
||||
return tarDevItem[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 取得設備列表 並繪製卡片
|
||||
function getFloDevList() {
|
||||
function getFloDevList(position = "left") {
|
||||
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
||||
let sendData = {
|
||||
sub_system_tag: pageAct.sysSubTag,
|
||||
@ -220,8 +259,8 @@
|
||||
strHtml += `<div class="col p-0 d-grid grid-gap-5 grid-temp-col-c" style="--c-grid-temp-col:repeat(auto-fill,minmax(250px,1fr))">`
|
||||
$.each(floObj.device_list, (index2, devObj) => {
|
||||
allDevList.push(devObj);
|
||||
|
||||
strHtml += `<div class="card m-1 border device-wrap">
|
||||
let devItem = getRiserPoiObj();
|
||||
strHtml += `<div class="card m-1 border device-wrap" data-number="${devObj.device_number}" data-position="${position}">
|
||||
<div class="card-body p-2">
|
||||
<div class="d-flex mb-2">
|
||||
<div class="mr-5 cur-poi">
|
||||
@ -233,7 +272,7 @@
|
||||
</div>
|
||||
<div class="d-flex mb-0 mt-2 align-items-center">
|
||||
<span id="${devObj.device_number}_status" class="circle-light"></span>
|
||||
<span class="d-none">即時功率:</span>
|
||||
<span class="${devItem ? "" : "d-none"} ml-2">${devItem?.full_name}:<span name="devItemPoiVal" data-point="${devItem?.points}"></span>${devItem?.unit}</span>
|
||||
<a href="javascript:;" name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" class=" ml-2 mb-0 ">詳細資料</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -295,19 +334,27 @@
|
||||
// Card 即時狀態
|
||||
function drawStateTabBlo(devNum) {
|
||||
let devPath = devNum.replaceAll("_", "/");
|
||||
let strHtml = `<div style="height:100%">
|
||||
<iframe src="/ord?station:%7Cslot:/${devPath}|view:?fullScreen=true" style="width:100%;height:100%;min-height:30vh"></iframe>
|
||||
let position = $(`.card.device-wrap[data-number=${devNum}]`).data("position");
|
||||
let width = buildMenuData[position + "_icon_click_url_width"] ? buildMenuData[position + "_icon_click_url_width"] + "px" : "100%";
|
||||
let height = buildMenuData[position + "_icon_click_url_height"] ? buildMenuData[position + "_icon_click_url_height"] + "px" : "100%";
|
||||
let strHtml = `<div style="height:100%;width:100%">
|
||||
<iframe src="/ord?station:%7Cslot:/${devPath}|view:?fullScreen=true" style="width:${width};height:${height};min-height:100px;"></iframe>
|
||||
</div>`
|
||||
return strHtml;
|
||||
}
|
||||
|
||||
function iframeResize(obj) {
|
||||
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
|
||||
}
|
||||
|
||||
function show3DModel(urn) {
|
||||
$(loadEle).Loading("start");
|
||||
getLightData(allDevList);
|
||||
launchViewerForHotspot(urn, (viewer, nodeIds) => {
|
||||
showHeat("[name=forgeHeatBar]");
|
||||
let devDbIds = allDevList.map(x => x.forge_dbid);
|
||||
/*hideAllObjects(devDbIds);*/
|
||||
|
||||
setTransparentBuilding(0, devDbIds);
|
||||
$(loadEle).Loading("close");
|
||||
|
||||
@ -416,11 +463,49 @@
|
||||
|
||||
}
|
||||
|
||||
async function getLightPoint(callback = null) {
|
||||
let url = baseApiUrl + "/api/GetDevNodeForCor";
|
||||
let sendData = {
|
||||
"device_area_tag": pageAct.AreaTag,
|
||||
"device_building_tag": pageAct.buiTag,
|
||||
"device_system_tag": pageAct.sysMainTag,
|
||||
"device_name_tag": pageAct.sysSubTag,
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
|
||||
let myDataList = [];
|
||||
$.each(res.data, (idx, data) => {
|
||||
let item = {};
|
||||
item.position = {};
|
||||
if (data.device_node_coordinate_3d != null && isJSON(data.device_node_coordinate_3d)) {
|
||||
item.position = JSON.parse(data.device_node_coordinate_3d);
|
||||
}
|
||||
$.extend(item, data);
|
||||
myDataList.push(item);
|
||||
})
|
||||
|
||||
console.log("2", myDataList)
|
||||
setLightPoint(myDataList);
|
||||
callback ? callback() : "";
|
||||
}
|
||||
}, null, "POST").send();
|
||||
|
||||
}
|
||||
|
||||
function setHotspotPoint(myDataList = []) {
|
||||
console.log(myDataList)
|
||||
getHopspotPoint(myDataList);
|
||||
}
|
||||
|
||||
async function setLightPoint(myDataList = []) {
|
||||
console.log(myDataList)
|
||||
getLightData(myDataList);
|
||||
}
|
||||
|
||||
var parentEle = "";
|
||||
onEvent("autodesk:click:sprite", "[name=forgeViewer]", function (e, obj) {
|
||||
forgeUnFocusAll();
|
||||
|
@ -1,8 +1,4 @@
|
||||
<style>
|
||||
[id^=yt_tooltip] {
|
||||
width: 650px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row bg-dark align-items-center">
|
||||
<label id="sysSubText" class=" mx-5 mb-0 fs-1-05"></label>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
label[id$='-error'].error { color: var(--yt-red-2); }
|
||||
|
||||
[id^=yt_tooltip] { min-width: 650px !important; }
|
||||
/*[id^=yt_tooltip] { min-width: 650px !important; }*/
|
||||
|
||||
.circle-light { display: inline-block; width: 25px; height: 25px; border-radius: 50px; }
|
||||
|
||||
@ -89,8 +89,25 @@ input:-webkit-autofill { background-color: rgba(0, 0, 0, 0.15) !important; }
|
||||
.yt-navbar-content ul li a:active, .yt-navbar-content ul li a.active { background-color: var(--theme-fusion-500); }
|
||||
|
||||
.card-header.p-3.ui-draggable-handle:hover { cursor: move; }
|
||||
@media screen and (max-width: 576px) {
|
||||
.yt-left-navbar { width: 100%; max-width: 100%; margin-top: 0; }
|
||||
|
||||
.device-wrap .card-body #info, .device-wrap .card-body #errRec, .device-wrap .card-body #opeRec { min-width: 500px; }
|
||||
.scrolledTable { overflow-y: auto; clear: both; max-height:100%;}
|
||||
|
||||
/*a[data-tabname="topFunBtn"] { color: #fff }
|
||||
|
||||
a[data-tabname="topFunBtn"].active { color: #886ab5 }
|
||||
a[data-tabname="topFunBtn"]:hover { color: var(--theme-primary-50); }
|
||||
|
||||
.userblock {
|
||||
color:#fff;
|
||||
}
|
||||
.userblock:hover { color: var(--theme-primary-50); }
|
||||
.dropdown.show .userblock { color: var(--theme-primary-50) !important; }*/
|
||||
.page-header a {color:#fff !important;}
|
||||
.page-header a:hover { color: var(--theme-primary-50) !important; }
|
||||
.page-header a.active { color: var(--theme-primary-500) !important; }
|
||||
.dropdown.show a { color: var(--theme-primary-50) !important; }
|
||||
@media screen and (max-width: 576px) { .yt-left-navbar { width: 100%; max-width: 100%; margin-top: 0; }
|
||||
}
|
||||
|
||||
@keyframes lds-ring {
|
||||
|
@ -51,6 +51,7 @@
|
||||
<canvas id="iot-heatmap-legend" width="300" height="50"></canvas>
|
||||
</div>
|
||||
<button type="button" class="btn btn-info" onclick="showHeat()">顯示熱圖圖示</button>
|
||||
<button type="button" class="btn btn-default" onclick="showList()">顯示設備清單</button>
|
||||
<!--<input id="lightBar" type="range" min="0" max="100" step="5" onchange="changeLightPower()">亮度-->
|
||||
<!-- <input type="range">Main Axis</input> -->
|
||||
</div>
|
||||
@ -244,7 +245,7 @@
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk');
|
||||
|
||||
//12.30 整棟樓 ARC + MEP
|
||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q');
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q');
|
||||
|
||||
//12.30 整棟樓 ARC + MEP 半透明
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
|
||||
@ -254,8 +255,11 @@
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxJUU1JTg1JUE4JUU2JUEzJTlGXzIwMjJfMTJfMTMubndj');//全棟 ARC
|
||||
|
||||
//01.06 加上room_id(樓層有燈具)
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8yMDIzXzAxXzA2Lm53ZA');
|
||||
|
||||
|
||||
//01.06 樓層刪除燈具
|
||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQyVFOSU5QiU5OSVFNiVBOCVBMSVFNSVCQyU4RitNRVAlRTYlOEIlODYlRTclQjMlQkIlRTclQjUlQjFfJUU1JTg4JUFBJUU3JTg3JTg4JUU1JTg1JUI3XzIwMjNfMDFfMDYubndk');
|
||||
|
||||
});
|
||||
//function move1Floor() {
|
||||
@ -412,6 +416,10 @@
|
||||
createHeatmapRect(labels, colorStops);
|
||||
}
|
||||
|
||||
function showList() {
|
||||
consoleList();
|
||||
}
|
||||
|
||||
function createHeatmapRect(labels, colorStops) {
|
||||
if (!this.canvas) {
|
||||
return;
|
||||
|
@ -180,7 +180,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<a class="dropdown-toggle" href="javascript:;" role="button" id="buiActDrop"
|
||||
<a class="dropdown-toggle fs-1" href="javascript:;" role="button" id="buiActDrop"
|
||||
data-target="buiList" data-toggle="dropdown" aria-haspopup="true">
|
||||
|
||||
</a>
|
||||
@ -199,8 +199,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
<!--<img src="img/demo/avatars/avatar-admin.png" class="profile-image rounded-circle"
|
||||
alt="Dr. Codex Lantern">-->
|
||||
<!--you can also add username next to the avatar with the codes below:-->
|
||||
<span id="usrName" class="ml-1 mr-2 text-truncate text-truncate-header hidden-xs-down"></span>
|
||||
<i class="ni ni-chevron-down hidden-xs-down"></i>
|
||||
<div class="row m-0 justify-content-center userblock">
|
||||
<i class="fas fa-user-circle fs-1-5 w-100 text-center"></i>
|
||||
<span id="usrName" class="text-truncate text-truncate-header hidden-xs-down"></span>
|
||||
</div>
|
||||
|
||||
</a>
|
||||
<div id="logoutList" class="dropdown-menu dropdown-menu-right dropdown-lg">
|
||||
|
||||
@ -726,9 +729,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
if (location.href.indexOf("ord") != -1) {
|
||||
location.href = "/file/index.html"
|
||||
}
|
||||
var lastPage = sessionStorage.getItem("lastPage");
|
||||
// 執行初步 Loading
|
||||
var loadEle = pageLoading();
|
||||
var errRecTable = null, opeRecTable = null;
|
||||
var tolSubList = [];
|
||||
|
||||
/**
|
||||
* 頁面 Loading 建立
|
||||
@ -770,7 +775,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
"lib/statistics/flot/flot.bundle",
|
||||
"lib/statistics/peity/peity.bundle",
|
||||
"lib/jquery-validation/dist/jquery.validate",
|
||||
"lib/jquery-validation/dist/additional-methods.min",
|
||||
/*"lib/jquery-validation/dist/additional-methods.min",*/ /* 會影響 messages_zh_TW 文字呈現 */
|
||||
"lib/jquery-validation/dist/localization/messages_zh_TW",
|
||||
"lib/jquery-ui/jquery-ui.min",
|
||||
"lib/chart.js/Chart.min",
|
||||
@ -825,7 +830,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
* 登入驗證完成 Callback
|
||||
* */
|
||||
function isValidLogin() {
|
||||
$("#app").load("_dashboard.html", loadCallback);
|
||||
|
||||
getUserInfo();
|
||||
iniFroList();
|
||||
@ -834,6 +838,24 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
getSysMonBtnList();
|
||||
checkDevState();
|
||||
|
||||
if (lastPage) {
|
||||
let lastPageAct = {};
|
||||
if (isJSON(sessionStorage.getItem("pageAct"))) {
|
||||
lastPageAct = JSON.parse(sessionStorage.getItem("pageAct"));
|
||||
}
|
||||
if (lastPageAct.sysSubTag && lastPage == "systemMonitor") {
|
||||
$(`#subSysBtn${lastPageAct.sysSubTag}`).click();
|
||||
$("#sysMonTopBtn").YTTab("set");
|
||||
} else {
|
||||
$(`[data-tabname=topFunBtn][data-page=${lastPage}]`).YTTab("setAndClick");
|
||||
}
|
||||
|
||||
/*$(`[name=topFunBtn][data-page=${lastPage}]`).click();*/
|
||||
} else {
|
||||
$("#app").load("_dashboard.html", loadCallback);
|
||||
}
|
||||
|
||||
|
||||
function getBuiList() {
|
||||
let url = baseApiUrl + "/api/Device/GetBuild";
|
||||
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||
@ -893,10 +915,17 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
onEvent("click", "[name=topFunBtn]", function () {
|
||||
_ytTabInited = [];
|
||||
let page = $(this).data("page");
|
||||
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
if (page != "systemMonitor") {
|
||||
$("#sysMonBtnList .dropdown-item").removeClass("active");
|
||||
pageAct.sysMainTag = null;
|
||||
pageAct.sysSubTag = null;
|
||||
} else {
|
||||
setSysTagForPageAct(this);
|
||||
$("#sysMonTopBtn").YTTab("set");
|
||||
$(`#subSysBtn${pageAct.sysSubTag}`).YTTab("set");
|
||||
}
|
||||
$.each(tolSubList, (idx, sub) => {
|
||||
sub.unsubscribeAll();
|
||||
@ -914,6 +943,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
}
|
||||
|
||||
getUserInfo();
|
||||
|
||||
sessionStorage.setItem("lastPage", page);
|
||||
sessionStorage.setItem("pageAct", JSON.stringify(pageAct));
|
||||
$("#app").load(`_${page}.html`, loadCallback);
|
||||
|
||||
})
|
||||
@ -924,10 +956,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
})
|
||||
|
||||
onEvent("click", "#sysMonBtnList a", function (e) {
|
||||
pageAct.sysMainTag = $(this).data("subSysObj").main_system_tag;
|
||||
pageAct.sysSubTag = $(this).data("subSysObj").sub_system_tag;
|
||||
pageAct.sysSubName = $(this).data("subSysObj").full_name;
|
||||
pageAct.sysSubObj = $(this).data("subSysObj");
|
||||
//pageAct.sysMainTag = $(this).data("subSysObj").main_system_tag;
|
||||
//pageAct.sysSubTag = $(this).data("subSysObj").sub_system_tag;
|
||||
//pageAct.sysSubName = $(this).data("subSysObj").full_name;
|
||||
//pageAct.sysSubObj = $(this).data("subSysObj");
|
||||
//getDevItem();
|
||||
})
|
||||
|
||||
onEvent("active:change", "#buiList", function (e, actEle) {
|
||||
@ -945,6 +978,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
}
|
||||
})
|
||||
|
||||
onEvent("yt:tab:prechange", "[data-tabname=topFunBtn]", function (e, arg) {
|
||||
if ($(this)[0].id == "sysMonTopBtn" || !$(this).data("page")) {
|
||||
arg.cancel = true;
|
||||
}
|
||||
})
|
||||
|
||||
onEvent("click", "#testsysbtn", function () {
|
||||
|
||||
})
|
||||
@ -1080,7 +1119,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-2 tab-content">
|
||||
<div id="state" class="show active" data-tabname="cardTab" data-tabrole="child" style="height:100%">
|
||||
<div id="state" class="show active" data-tabname="cardTab" data-tabrole="child" style="height:100%;width:100%">
|
||||
${drawStateTabBlo(devNum)}
|
||||
</div>
|
||||
<div id="info" data-tabname="cardTab" data-tabrole="child">
|
||||
@ -1106,18 +1145,27 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
}
|
||||
$(tooltipEle).draggable({
|
||||
cursor: "move",
|
||||
handle: ".card-header" // 只能通过卡片的标题栏拖拽
|
||||
handle: ".card-header", // 只能通过卡片的标题栏拖拽
|
||||
containment: "document",
|
||||
scroll: true
|
||||
});
|
||||
$(tooltipEle).resizable({
|
||||
resize: function (event,ui) {
|
||||
let iframe = $(ui.element).find("iframe");
|
||||
if (iframe.length != 0) {
|
||||
//let cardBodyHei = $(ui.element).find(".card-body").css("height");
|
||||
//if (cardBodyHei) {
|
||||
// $(iframe).css("height", cardBodyHei);
|
||||
//}
|
||||
if (ui.size.width != ui.originalSize.width) {
|
||||
iframe.css("width", "100%");
|
||||
} else if (ui.size.height != ui.originalSize.height) {
|
||||
iframe.css("height", "100%");
|
||||
}
|
||||
}
|
||||
let cardBodyHeight = $(ui.element).find(".card-body").css("height");
|
||||
$(ui.element).find(".scrolledTable").css("height", cardBodyHeight)
|
||||
|
||||
errRecTable.draw(false)
|
||||
},
|
||||
minWidth: 200,
|
||||
minHeight:150,
|
||||
});
|
||||
typeof subDeviceSetTable != "undefined" ? subDeviceSetTable($(oriEle).data("number")) : ""
|
||||
},
|
||||
@ -1172,7 +1220,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
|
||||
];
|
||||
|
||||
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, null, null, null, null, null, null, "tpi");
|
||||
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, null, null, null, null, null, null, "<'scrolledTable'tpi>");
|
||||
}
|
||||
|
||||
function loadLightSchTable(devGuid) {
|
||||
@ -1294,7 +1342,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
|
||||
let json_object = JSON.parse(result);
|
||||
datas = json_object['data'];
|
||||
errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs, null, null, null, null, "tpi");
|
||||
errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs, null, null, null, null, "<'scrolledTable'tpi>");
|
||||
|
||||
}
|
||||
|
||||
@ -1350,6 +1398,30 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
$(loadEle).Loading("close");
|
||||
}
|
||||
|
||||
function setSysTagForPageAct(obj) {
|
||||
pageAct.sysMainTag = $(obj).data("subSysObj").main_system_tag;
|
||||
pageAct.sysSubTag = $(obj).data("subSysObj").sub_system_tag;
|
||||
pageAct.sysSubName = $(obj).data("subSysObj").full_name;
|
||||
pageAct.sysSubObj = $(obj).data("subSysObj");
|
||||
getDevItem();
|
||||
}
|
||||
|
||||
function getDevItem() {
|
||||
let url = baseApiUrl + "/api/Device/GetDeviceItem";
|
||||
|
||||
objSendData.Data = {
|
||||
main_system_tag: pageAct.sysMainTag,
|
||||
sub_system_tag: pageAct.sysSubTag,
|
||||
}
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
pageAct.devItems = res.data;
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function alarmIconBlink(data) {
|
||||
if (data?.data.length != 0) {
|
||||
$(".page-header [name=topFunBtn][data-page=alert] i").addClass("blink");
|
||||
@ -1411,7 +1483,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
|
||||
} else {
|
||||
let strHtml = `<div class="btn-group mx-4">
|
||||
<a href="javascript:;" name="topFunBtn" data-page="dashboard" class="text-center">
|
||||
<a href="javascript:;" name="topFunBtn" data-page="dashboard" data-tabname="topFunBtn" class="text-center">
|
||||
<i class="fal fa-home fa-2x"></i><br>首頁
|
||||
</a>
|
||||
<!--<div class="dropdown-menu">
|
||||
@ -1424,7 +1496,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
$.each(res.data, function (i, v) {
|
||||
if (v.authCode == 'PF1') {
|
||||
strHtml += `<div class="btn-group mx-4" >
|
||||
<a href="javascript:;" id="sysMonTopBtn" class="text-center" data-toggle="navbar" data-target="#sysMonNavbar" aria-haspopup="true" aria-expanded="false">
|
||||
<a href="javascript:;" id="sysMonTopBtn" class="text-center" data-toggle="navbar" data-target="#sysMonNavbar" data-tabname="topFunBtn" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fal fa-tv fa-2x"></i><br>${v.subName}
|
||||
</a>
|
||||
|
||||
@ -1433,9 +1505,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
hasMonitor = true;
|
||||
}
|
||||
else {
|
||||
let icon = v.authCode == 'PF2' ? 'fa-chart-pie' : v.authCode == 'PF3' ? 'fa-chart-area' : v.authCode == 'PF4' ? 'fa-bell' : v.authCode == 'PF5' ? 'fa-server' : v.authCode == 'PF6' ? 'fa-image' : v.authCode == 'PF7' ? 'fa-user' : '';
|
||||
let icon = v.authCode == 'PF2' ? 'fa-chart-pie' : v.authCode == 'PF3' ? 'fa-chart-area' : v.authCode == 'PF4' ? 'fa-chart-line' : v.authCode == 'PF5' ? 'fa-bell' : v.authCode == 'PF6' ? 'fa-server' : v.authCode == 'PF7' ? 'fa-image' : v.authCode == 'PF8' ? 'fa-user' : '';
|
||||
strHtml += `<div class="btn-group mx-4">
|
||||
<a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
|
||||
<a href="javascript:;" name="topFunBtn" data-tabname="topFunBtn" class="dropdown-toggle no-arrow text-center"
|
||||
data-page="${v.showView}">
|
||||
<i class="fal ${icon} fa-2x"></i><br>${v.subName}
|
||||
</a>
|
||||
@ -1464,7 +1536,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
|
||||
} else {
|
||||
$("#sysMonBtnList").html("")
|
||||
debugger
|
||||
|
||||
$.each(res.data.history_Main_Systems, (index, mainSysObj) => {
|
||||
$.each(mainSysObj.history_Sub_systems, (index2, subSysObj) => {
|
||||
let page = "systemMonitor";
|
||||
|
@ -330,15 +330,6 @@ class elevator3D {
|
||||
}
|
||||
|
||||
function onDocumentLoadSuccess(doc, eleOption) {
|
||||
//取得燈光清單
|
||||
if (lightDataList != undefined && lightDataList != null && lightDataList.length > 0) {
|
||||
lightDataList.forEach((myData, index) => {
|
||||
//if (myData.priority == 5) {
|
||||
const position = JSON.parse(myData.device_node_coordinate_3d);
|
||||
lightList.push({ dbid: myData.forge_dbid, spotLight: newLight(position) });
|
||||
//}
|
||||
});
|
||||
}
|
||||
|
||||
var viewables = doc.getRoot().getDefaultGeometry();
|
||||
viewer.loadDocumentNode(doc, viewables).then(i => {
|
||||
@ -727,15 +718,26 @@ function hideColor(nodeId) {//顏色改成透明
|
||||
|
||||
}
|
||||
|
||||
//------------------ 紀錄熱點座標 ---------------
|
||||
function getHopspotPoint(data) {
|
||||
//var av = Autodesk.Viewing;
|
||||
myDataList = data;
|
||||
//viewer.addEventListener(av.GEOMETRY_LOADED_EVENT, addHotPoint, {
|
||||
// once: true,
|
||||
//});
|
||||
//紀錄燈具座標
|
||||
async function getLightData(data) {
|
||||
lightDataList = data;
|
||||
}
|
||||
|
||||
async function testNewLight(dataList) {
|
||||
dataList.forEach((myData, index) => {
|
||||
const position = JSON.parse(myData.device_node_coordinate_3d);
|
||||
lightList.push({ dbid: myData.forge_dbid, device_guid: myData.device_guid, lightObject: new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10) });
|
||||
|
||||
lightList[index].lightObject.position.set(position.x, position.y, position.z);
|
||||
lightList[index].lightObject.castShadow = true;
|
||||
lightList[index].lightObject.visible = true;
|
||||
lightList[index].lightObject.target.position.set(position.x, position.y, position.z - 20);
|
||||
viewer.scene.add(lightList[index].lightObject.target);
|
||||
viewer.scene.add(lightList[index].lightObject);
|
||||
viewer.impl.sceneUpdated(true);
|
||||
|
||||
});
|
||||
}
|
||||
//-------------------- end ----------------------
|
||||
|
||||
//------------------- 加入熱點 -----------------
|
||||
async function addHotPoint(data) {
|
||||
@ -753,13 +755,10 @@ async function addHotPoint(data) {
|
||||
|
||||
const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
|
||||
|
||||
//取得燈光清單
|
||||
//if (lightDataList != undefined && lightDataList != null && lightDataList.length > 0) {
|
||||
// lightDataList.forEach((myData, index) => {
|
||||
// const position = JSON.parse(myData.device_node_coordinate_3d);
|
||||
// lightList.push({ dbid: myData.forge_dbid, spotLight: newLight(position) });
|
||||
// });
|
||||
//}
|
||||
if (lightDataList != undefined && lightDataList != null && lightDataList.length > 0) {
|
||||
testNewLight(lightDataList);
|
||||
}
|
||||
|
||||
|
||||
//熱點 點擊事件註冊
|
||||
viewer.addEventListener(DataVizCore.MOUSE_CLICK, onSpriteClicked);// SPRITE_SELECTED
|
||||
@ -790,12 +789,17 @@ async function addHotPoint(data) {
|
||||
if (event != undefined && event != null) {
|
||||
if (event.dbId >= dbIdStart) {//event.dbId > 0 && event.dbId < 19
|
||||
console.log(`Sprite clicked: ${event.dbId}`);
|
||||
openHotspotModal();
|
||||
|
||||
for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
|
||||
changeColorForHotspot(i);
|
||||
changeScaleForHotspot(i, false);
|
||||
}
|
||||
let myData = myDataList.filter(x => x._dbId == event.dbId)[0];
|
||||
if (lightList != undefined && lightList != null && lightList.length > 0) {
|
||||
//setLightOpenOrClose(false, myData.device_guid);//關燈測試
|
||||
//setLightValues(myData.device_guid, 20, 0x00ff00);//更改燈光顏色和強度的測試
|
||||
moveViewToDevice(myData.forge_dbid);//移動視角至該設備
|
||||
}
|
||||
$(selector).trigger("autodesk:click:sprite", { event, myData });
|
||||
} else {
|
||||
$(selector).trigger("autodesk:clickOut:sprite", { event });
|
||||
@ -817,7 +821,6 @@ async function addHotPoint(data) {
|
||||
// if (dbIds.length > 0) {
|
||||
// // 處理已選取元件的邏輯
|
||||
// $(selector).trigger("autodesk:click:sprite", event);
|
||||
// //openHotspotModal();
|
||||
// console.log(`------ name: ${viewer.model.getInstanceTree().getNodeName(dbIds)} , dbId: ${dbIds}`);//, id: ${event.clickInfo.object.id}, position.x: ${event.clickInfo.point.x}, y: ${event.clickInfo.point.y}, z: ${event.clickInfo.point.z}
|
||||
// } else {
|
||||
// // 處理沒有選取元件的邏輯
|
||||
@ -864,22 +867,7 @@ async function changeScaleForHotspot(dbId, type = true) {
|
||||
|
||||
//------------------- end --------------
|
||||
|
||||
//----------------- 開關熱點小視窗 ----------------------
|
||||
function openHotspotModal() {
|
||||
//var modal = document.getElementById("hotspotModal");
|
||||
//modal.style.display = "block";
|
||||
//$("#pills-register-tab").removeClass("active");
|
||||
//$("#pills-alarm-tab").removeClass("active");
|
||||
//$("#pills-operation-tab").removeClass("active");
|
||||
//$("#pills-login-tab").tab("show");
|
||||
}
|
||||
|
||||
function closeHotspotModal() {
|
||||
//var modal = document.getElementById("hotspotModal");
|
||||
//modal.style.display = "none";
|
||||
|
||||
}
|
||||
//------------------ end --------------------------------
|
||||
|
||||
//------------------ 熱圖 -------------------------------
|
||||
async function loadHeatmaps(model) {
|
||||
@ -1106,6 +1094,7 @@ async function newLight(lightPosition) {
|
||||
//聚光燈
|
||||
var spotLight = new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10);
|
||||
spotLight.position.set(lightPosition.x, lightPosition.y, lightPosition.z);
|
||||
console.log(lightPosition.x, lightPosition.y, lightPosition.z)
|
||||
spotLight.castShadow = false;
|
||||
spotLight.visible = true;
|
||||
spotLight.target.position.set(lightPosition.x, lightPosition.y, lightPosition.z-20);
|
||||
@ -1117,25 +1106,24 @@ async function newLight(lightPosition) {
|
||||
}
|
||||
|
||||
//調整燈光 強度、顏色
|
||||
async function setLightValues(dbid, intensity, color) {
|
||||
async function setLightValues(deviceGuid, intensity, color) {
|
||||
for (var i = 0; i < lightList.length; i++) {
|
||||
if (lightList[i].dbid == dbid) {
|
||||
lightList[i].spotLight.intensity = intensity;
|
||||
if (lightList[i].device_guid == deviceGuid) {
|
||||
lightList[i].lightObject.intensity = intensity;
|
||||
|
||||
var tempcolor = new THREE.Color().setHex(color);
|
||||
lightList[i].spotLight.color = tempcolor;
|
||||
lightList[i].lightObject.color = tempcolor;
|
||||
}
|
||||
}
|
||||
viewer.impl.sceneUpdated(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//燈光開關
|
||||
function setLightOpenOrClose(value, light) {
|
||||
if (value) {
|
||||
light.visible = true;
|
||||
async function setLightOpenOrClose(value, deviceGuid) {
|
||||
for (var i = 0; i < lightList.length; i++) {
|
||||
if (lightList[i].device_guid == deviceGuid) {
|
||||
lightList[i].lightObject.visible = value;
|
||||
}
|
||||
else {
|
||||
light.visible = false;
|
||||
}
|
||||
viewer.impl.sceneUpdated(true);
|
||||
}
|
||||
@ -1166,17 +1154,48 @@ function showAllObjects() {
|
||||
}
|
||||
}
|
||||
|
||||
function showHeat(selector) {
|
||||
const labels = [
|
||||
`${(10).toFixed(2)}${"°C"}`,
|
||||
`${(40 / 2).toFixed(2)}${"°C"}`,
|
||||
`${(30).toFixed(2)}${"°C"}`
|
||||
];
|
||||
const colorStops = ['blue', 'green', 'yellow', 'red'];
|
||||
createHeatmapRect(labels, colorStops, selector);
|
||||
}
|
||||
|
||||
function createHeatmapRect(labels, colorStops, selector) {
|
||||
if (!$(selector)[0]) {
|
||||
return;
|
||||
}
|
||||
const context = $(selector)[0].getContext('2d');
|
||||
let i, len;
|
||||
context.clearRect(0, 0, 300, 50);
|
||||
context.fillStyle = 'back';//white
|
||||
for (i = 0, len = labels.length; i < len; i++) {
|
||||
let x = 10 + 280 * i / (len - 1);
|
||||
if (i === len - 1) {
|
||||
x -= context.measureText(labels[i]).width;
|
||||
}
|
||||
else if (i > 0) {
|
||||
x -= 0.5 * context.measureText(labels[i]).width;
|
||||
}
|
||||
context.fillText(labels[i], x, 10);
|
||||
}
|
||||
const gradient = context.createLinearGradient(0, 0, 300, 0);
|
||||
for (i = 0, len = colorStops.length; i < len; i++) {
|
||||
gradient.addColorStop(i / (len - 1), colorStops[i]);
|
||||
}
|
||||
context.fillStyle = gradient;
|
||||
context.fillRect(10, 20, 280, 20);
|
||||
}
|
||||
|
||||
//======================== 外部呼叫function ===========================
|
||||
//紀錄熱點座標
|
||||
function getHopspotPoint(data) {
|
||||
myDataList = data;
|
||||
}
|
||||
|
||||
//紀錄燈具座標
|
||||
async function getLightData(data) {
|
||||
lightDataList = data;
|
||||
}
|
||||
|
||||
//呼叫載入熱圖
|
||||
async function toLoadHeatmap(roomArr) {
|
||||
const model = viewer.model;
|
||||
@ -1189,3 +1208,14 @@ function setShadowShow(type = false) {
|
||||
|
||||
}
|
||||
//============================= end ===================================
|
||||
|
||||
function moveViewToDevice(letter) {
|
||||
if (letter != "") {
|
||||
viewer.clearSelection();
|
||||
viewer.select(letter);
|
||||
viewer.fitToView([letter]);
|
||||
}
|
||||
else {
|
||||
viewer.clearSelection();
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ var elevatorSpeed;
|
||||
var allDbIdsStr;
|
||||
let bulbLight;//點燈
|
||||
var spotLight;//聚光燈
|
||||
let testLight;
|
||||
var myDataList;//設備清單
|
||||
var viewableData;
|
||||
var dataVizExtn;
|
||||
@ -12,6 +13,8 @@ var spriteColorRed;
|
||||
var levels;//剖面用
|
||||
var light;
|
||||
let pointLightHelper;
|
||||
var tagIdDevList = [];//模型設備List: device_number、device_coordinate_3d、forge_dbid
|
||||
var roomDataList = [];//模型房間List: room_id、room_name
|
||||
|
||||
function launchViewer(urn) {
|
||||
var av = Autodesk.Viewing;
|
||||
@ -140,11 +143,9 @@ function onDocumentLoadSuccess(doc) {
|
||||
|
||||
viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () {
|
||||
var instanceTree = viewer.model.getData().instanceTree;
|
||||
|
||||
var domElem = document.getElementById('all_id');
|
||||
allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
|
||||
domElem.innerText = allDbIdsStr;
|
||||
|
||||
//parseInt(allDbIdsStr[i]
|
||||
//for (var i = 0; i < allDbIdsStr.length; i++) {
|
||||
// //setTransparency(parseInt(allDbIdsStr[i]), 0.2);
|
||||
@ -161,105 +162,152 @@ function onDocumentLoadSuccess(doc) {
|
||||
// })
|
||||
//}
|
||||
|
||||
// ------------------ 取得tag_id底下的nodeId --------------------------------------
|
||||
var curDbId = 0;
|
||||
var tagId = 0;
|
||||
var _parentId = 0;
|
||||
var _childId = 0;
|
||||
var itemName = '';
|
||||
var childIdArr = new Array();
|
||||
let evelMap = new Map();
|
||||
//// ------------------ 取得tag_id底下的nodeId --------------------------------------
|
||||
//var curDbId = 0;
|
||||
////var tagId = 0;
|
||||
////var _parentId = 0;
|
||||
////var _childId = 0;
|
||||
////var itemName = '';
|
||||
////var childIdArr = new Array();
|
||||
////let evelMap = new Map();
|
||||
|
||||
let tree = viewer.model.getData().instanceTree;
|
||||
const model = viewer.model;
|
||||
const fragList = model.getFragmentList();
|
||||
//let tree = viewer.model.getData().instanceTree;
|
||||
//const model = viewer.model;
|
||||
//const fragList = model.getFragmentList();
|
||||
|
||||
|
||||
//loadHeatmaps(model);
|
||||
// //loadHeatmaps(model);
|
||||
|
||||
|
||||
|
||||
////allDbIdsStr.forEach((dbId) => {
|
||||
//// curDbId = parseInt(dbId);
|
||||
//// viewer.getProperties(curDbId, function (e) {
|
||||
//// e.properties.forEach(function (item) {
|
||||
//// if (item.displayName == "tag_id" && e.name == "【電梯】") {
|
||||
|
||||
//// //getFragmentWorldMatrixByNodeId(e.dbId, viewer);
|
||||
//// //let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
|
||||
//// tree.enumNodeFragments(e.dbId, function (frag) {
|
||||
|
||||
//// let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
//// let matrix = new THREE.Matrix4();
|
||||
//// console.log("proxy: " + fragProxy.position);
|
||||
|
||||
//// fragProxy.getWorldMatrix(matrix);
|
||||
|
||||
//// });
|
||||
|
||||
|
||||
|
||||
//// tagId = e.dbId;
|
||||
//// viewer.getProperties(tagId, function (e2) {
|
||||
//// e2.properties.forEach(function (item2) {
|
||||
//// if (item2.displayName == "child") {
|
||||
//// _parentId = item2.displayValue;
|
||||
|
||||
//// viewer.getProperties(_parentId, function (e3) {
|
||||
//// let itemMap = new Map();
|
||||
//// e3.properties.forEach(function (item3) {
|
||||
//// if (item3.displayName == "child") {
|
||||
//// _childId = item3.displayValue;
|
||||
//// childIdArr.push(_childId);
|
||||
|
||||
//// var n = 0;
|
||||
//// viewer.getProperties(childIdArr[n], function (e5) {
|
||||
//// e5.properties.forEach(function (item5) {
|
||||
//// if (item5.displayName == "Name") {
|
||||
//// itemName = item5.displayValue;
|
||||
//// itemMap.set(childIdArr[0], itemName)
|
||||
//// console.log("childIdArr[0] ", childIdArr[0])
|
||||
//// console.log("item name: ", itemName);
|
||||
//// n += 3;
|
||||
//// }
|
||||
//// });
|
||||
//// })
|
||||
|
||||
//// n = 1;
|
||||
//// viewer.getProperties(childIdArr[n], function (e6) {
|
||||
//// e6.properties.forEach(function (item6) {
|
||||
//// if (item6.displayName == "Name") {
|
||||
//// itemName = item6.displayValue;
|
||||
//// itemMap.set(childIdArr[1], itemName)
|
||||
//// console.log("childIdArr[1] ", childIdArr[1])
|
||||
//// console.log("item name: ", itemName);
|
||||
//// n += 3;
|
||||
//// }
|
||||
//// });
|
||||
//// })
|
||||
|
||||
//// n = 2;
|
||||
//// viewer.getProperties(childIdArr[n], function (e7) {
|
||||
//// e7.properties.forEach(function (item7) {
|
||||
//// if (item7.displayName == "Name") {
|
||||
//// itemName = item7.displayValue;
|
||||
//// itemMap.set(childIdArr[2], itemName)
|
||||
//// console.log("childIdArr[2] ", childIdArr[2])
|
||||
//// console.log("item name: ", itemName);
|
||||
//// n += 3;
|
||||
//// }
|
||||
//// });
|
||||
//// })
|
||||
|
||||
//// }
|
||||
//// });
|
||||
//// evelMap.set(item.displayValue, itemMap)
|
||||
//// })
|
||||
|
||||
//// }
|
||||
//// });
|
||||
//// })
|
||||
//// }
|
||||
//// });
|
||||
|
||||
//// })
|
||||
|
||||
////})
|
||||
|
||||
//allDbIdsStr.forEach((dbId) => {
|
||||
// curDbId = parseInt(dbId);
|
||||
// viewer.getProperties(curDbId, function (e) {
|
||||
// e.properties.forEach(function (item) {
|
||||
// if (item.displayName == "tag_id" && e.name == "【電梯】") {
|
||||
// if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】
|
||||
// if (item.displayValue != "") {
|
||||
// if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10
|
||||
// console.log("--------------------------------------------------");
|
||||
// console.log("Tag_name dbid: " + e.dbId);
|
||||
// console.log("value: " + item.displayValue);
|
||||
// }
|
||||
// //var v = getFragmentWorldMatrixByNodeId(e.dbId, viewer);
|
||||
// //console.log("v: " + v);
|
||||
|
||||
|
||||
// //tree.enumNodeFragments(e.dbId, function (frag) {
|
||||
// // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
// // fragProxy.getAnimTransform();
|
||||
// // console.log("postion: " + fragProxy.position + ", fragP: " + fragProxy.fragPosition);
|
||||
// //});
|
||||
|
||||
|
||||
|
||||
// let bounds = new THREE.Box3();
|
||||
|
||||
// instanceTree.enumNodeFragments(e.dbId, (fragId) => {
|
||||
// let box = new THREE.Box3();
|
||||
// fragList.getWorldBounds(fragId, box);
|
||||
// bounds.union(box);
|
||||
// }, true);
|
||||
// var position = bounds.center();
|
||||
// if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {
|
||||
// console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
|
||||
// console.log("--------------------------------------------------");
|
||||
// }
|
||||
// }
|
||||
// //getFragmentWorldMatrixByNodeId(e.dbId, viewer);
|
||||
// //let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
|
||||
// tree.enumNodeFragments(e.dbId, function (frag) {
|
||||
|
||||
// let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
// let matrix = new THREE.Matrix4();
|
||||
// console.log("proxy: " + fragProxy.position);
|
||||
|
||||
// fragProxy.getWorldMatrix(matrix);
|
||||
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// tagId = e.dbId;
|
||||
// viewer.getProperties(tagId, function (e2) {
|
||||
// e2.properties.forEach(function (item2) {
|
||||
// if (item2.displayName == "child") {
|
||||
// _parentId = item2.displayValue;
|
||||
|
||||
// viewer.getProperties(_parentId, function (e3) {
|
||||
// let itemMap = new Map();
|
||||
// e3.properties.forEach(function (item3) {
|
||||
// if (item3.displayName == "child") {
|
||||
// _childId = item3.displayValue;
|
||||
// childIdArr.push(_childId);
|
||||
|
||||
// var n = 0;
|
||||
// viewer.getProperties(childIdArr[n], function (e5) {
|
||||
// e5.properties.forEach(function (item5) {
|
||||
// if (item5.displayName == "Name") {
|
||||
// itemName = item5.displayValue;
|
||||
// itemMap.set(childIdArr[0], itemName)
|
||||
// console.log("childIdArr[0] ", childIdArr[0])
|
||||
// console.log("item name: ", itemName);
|
||||
// n += 3;
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
// n = 1;
|
||||
// viewer.getProperties(childIdArr[n], function (e6) {
|
||||
// e6.properties.forEach(function (item6) {
|
||||
// if (item6.displayName == "Name") {
|
||||
// itemName = item6.displayValue;
|
||||
// itemMap.set(childIdArr[1], itemName)
|
||||
// console.log("childIdArr[1] ", childIdArr[1])
|
||||
// console.log("item name: ", itemName);
|
||||
// n += 3;
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
// n = 2;
|
||||
// viewer.getProperties(childIdArr[n], function (e7) {
|
||||
// e7.properties.forEach(function (item7) {
|
||||
// if (item7.displayName == "Name") {
|
||||
// itemName = item7.displayValue;
|
||||
// itemMap.set(childIdArr[2], itemName)
|
||||
// console.log("childIdArr[2] ", childIdArr[2])
|
||||
// console.log("item name: ", itemName);
|
||||
// n += 3;
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
// }
|
||||
// });
|
||||
// evelMap.set(item.displayValue, itemMap)
|
||||
// })
|
||||
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
// }
|
||||
// });
|
||||
|
||||
@ -267,44 +315,55 @@ function onDocumentLoadSuccess(doc) {
|
||||
|
||||
//})
|
||||
|
||||
////---------------------- end ---------------------------------------------------
|
||||
|
||||
// ------------------ 2023.01.06 取得tag_id、底下的nodeId --------------------------------------
|
||||
var curDbId = 0;
|
||||
|
||||
let tree = viewer.model.getData().instanceTree;
|
||||
const model = viewer.model;
|
||||
const fragList = model.getFragmentList();
|
||||
|
||||
|
||||
allDbIdsStr.forEach((dbId) => {
|
||||
curDbId = parseInt(dbId);
|
||||
viewer.getProperties(curDbId, function (e) {
|
||||
e.properties.forEach(function (item) {
|
||||
if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】
|
||||
if (item.displayValue != "") {
|
||||
if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10
|
||||
console.log("--------------------------------------------------");
|
||||
console.log("Tag_name dbid: " + e.dbId);
|
||||
console.log("value: " + item.displayValue);
|
||||
////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10
|
||||
//console.log("--------------------------------------------------");
|
||||
//console.log("Tag_name dbid: " + e.dbId);
|
||||
//console.log("value: " + item.displayValue);
|
||||
////}
|
||||
var str = item.displayValue.split('_');
|
||||
if (str.length == 2) { //兩段為房間 ex: U7F_01
|
||||
roomDataList.push({ room_id: e.dbId, room_name: item.displayValue });
|
||||
}
|
||||
//var v = getFragmentWorldMatrixByNodeId(e.dbId, viewer);
|
||||
//console.log("v: " + v);
|
||||
|
||||
|
||||
//tree.enumNodeFragments(e.dbId, function (frag) {
|
||||
// fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
// fragProxy.getAnimTransform();
|
||||
// console.log("postion: " + fragProxy.position + ", fragP: " + fragProxy.fragPosition);
|
||||
//});
|
||||
|
||||
|
||||
|
||||
else if (str.length == 8) { //八段為設備 ex: TPE_B1_ME_M10_U7F_NA_FCU_N1
|
||||
//取得座標
|
||||
let bounds = new THREE.Box3();
|
||||
|
||||
instanceTree.enumNodeFragments(e.dbId, (fragId) => {
|
||||
let box = new THREE.Box3();
|
||||
fragList.getWorldBounds(fragId, box);
|
||||
bounds.union(box);
|
||||
}, true);
|
||||
var position = bounds.center();
|
||||
if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {
|
||||
console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
|
||||
console.log("--------------------------------------------------");
|
||||
////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {
|
||||
//console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
|
||||
//console.log("--------------------------------------------------");
|
||||
////}
|
||||
tagIdDevList.push({ device_number: item.displayValue, device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', forge_dbid: e.dbId });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//getFragmentWorldMatrixByNodeId(e.dbId, viewer);
|
||||
//let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
|
||||
|
||||
}
|
||||
@ -313,7 +372,6 @@ function onDocumentLoadSuccess(doc) {
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//---------------------- end ---------------------------------------------------
|
||||
|
||||
|
||||
@ -361,114 +419,49 @@ function onDocumentLoadSuccess(doc) {
|
||||
//})
|
||||
|
||||
|
||||
//let tree = viewer.model.getData().instanceTree;
|
||||
let nodeId = 12112;//12104; //749; //10952;
|
||||
let nodeId2 = 12111;//12105; //750;
|
||||
let nodeId3 = 12110;//12104; //751;
|
||||
|
||||
tree.enumNodeFragments(nodeId, function (frag) {
|
||||
fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
fragProxy.getAnimTransform();
|
||||
let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||
// //let tree = viewer.model.getData().instanceTree;
|
||||
//let nodeId = 12112;//12104; //749; //10952;
|
||||
//let nodeId2 = 12111;//12105; //750;
|
||||
//let nodeId3 = 12110;//12104; //751;
|
||||
|
||||
fragProxy.position = fragPosition
|
||||
//tree.enumNodeFragments(nodeId, function (frag) {
|
||||
// fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
// fragProxy.getAnimTransform();
|
||||
// let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||
// fragProxy.position = fragPosition
|
||||
// fragProxy.updateAnimTransform()
|
||||
//});
|
||||
//viewer.impl.sceneUpdated(true);
|
||||
|
||||
fragProxy.updateAnimTransform()
|
||||
////------------ add -------------
|
||||
//tree.enumNodeFragments(nodeId2, function (frag) {
|
||||
// fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
// fragProxy.getAnimTransform();
|
||||
// let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||
|
||||
// fragProxy.position = fragPosition
|
||||
|
||||
// fragProxy.updateAnimTransform()
|
||||
|
||||
//});
|
||||
//viewer.impl.sceneUpdated(true);
|
||||
|
||||
//tree.enumNodeFragments(nodeId3, function (frag) {
|
||||
// fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
// fragProxy.getAnimTransform();
|
||||
// let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||
|
||||
// fragProxy.position = fragPosition
|
||||
|
||||
// fragProxy.updateAnimTransform()
|
||||
|
||||
//});
|
||||
//viewer.impl.sceneUpdated(true);
|
||||
|
||||
});
|
||||
viewer.impl.sceneUpdated(true);
|
||||
|
||||
//------------ add -------------
|
||||
tree.enumNodeFragments(nodeId2, function (frag) {
|
||||
fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
fragProxy.getAnimTransform();
|
||||
let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||
|
||||
fragProxy.position = fragPosition
|
||||
|
||||
fragProxy.updateAnimTransform()
|
||||
|
||||
});
|
||||
viewer.impl.sceneUpdated(true);
|
||||
|
||||
tree.enumNodeFragments(nodeId3, function (frag) {
|
||||
fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
fragProxy.getAnimTransform();
|
||||
let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||
|
||||
fragProxy.position = fragPosition
|
||||
|
||||
fragProxy.updateAnimTransform()
|
||||
|
||||
});
|
||||
viewer.impl.sceneUpdated(true);
|
||||
|
||||
});
|
||||
|
||||
//add toolbar fail
|
||||
//function ToolbarExtension(viewer, options) {
|
||||
// Autodesk.Viewing.Extension.call(this, viewer, options);
|
||||
//}
|
||||
|
||||
//ToolbarExtension.prototype = Object.create(Autodesk.Viewing.Extension.prototype);
|
||||
//ToolbarExtension.prototype.constructor = ToolbarExtension;
|
||||
|
||||
//ToolbarExtension.prototype.load = function () {
|
||||
// this.viewer.setLightPreset(6);
|
||||
// this.viewer.setEnvMapBackground(true);
|
||||
// this.viewer.fitToView();
|
||||
// return true;
|
||||
//};
|
||||
|
||||
//ToolbarExtension.prototype.unload = function () {
|
||||
|
||||
//};
|
||||
//Autodesk.Viewing.theExtensionManager.registerExtension('ToolbarExtension', ToolbarExtension);
|
||||
|
||||
//ToolbarExtension.prototype.onToolbarCreated = function (toolbar) {
|
||||
// //alert('TODO: customize Viewer toolbar');
|
||||
|
||||
// var viewer = this.viewer;
|
||||
// var button1 = new Autodesk.Viewing.UI.Button('show-env-bg-button');
|
||||
// button1.onClick = function (e) {
|
||||
// viewer.setEnvMapBackground(true);
|
||||
// };
|
||||
// button1.addClass('show-env-bg-button');
|
||||
// button1.setToolTip('Show Environment');
|
||||
|
||||
// //SubToolbar
|
||||
// this.subToolbar = new Autodesk.Viewing.UI.ControlGroup('my-custom-toolbar');
|
||||
// this.subToolbar.addControl(button1);
|
||||
// toolbar.addControl(this.subToolbar);
|
||||
|
||||
//};
|
||||
|
||||
|
||||
//加入點燈光
|
||||
//bulbLight = new THREE.PointLight(0xffffff, 1, 1, 2);//0xff0000
|
||||
//bulbLight.position.set(-17.33, 51.03, -2.52);//17.880840301513672
|
||||
//bulbLight.castShadow = true;
|
||||
//bulbLight.intensity = 50;
|
||||
//bulbLight.distance = 1;
|
||||
//bulbLight.emissiveIntensity = bulbLight.intensity / Math.pow(0.02, 2.0);
|
||||
//viewer.scene.add(bulbLight);
|
||||
|
||||
//聚光燈
|
||||
//spotLight = new THREE.SpotLight(0xffff00, 80, 10);//0xffffff
|
||||
//spotLight.position.set(-7.58, 18.20, -0.25); //set(-17.33, 51.03, -2.52);
|
||||
//spotLight.castShadow = true;
|
||||
//spotLight.visible = true;
|
||||
//var geom = new THREE.BoxGeometry(); //create 幾何對象 -17.33, 51.03, -4.52
|
||||
//var material = new THREE.MeshLambertMaterial({ color: 0xffff00 });//0xff0000
|
||||
//var cube = new THREE.Mesh(geom, material);
|
||||
//cube.position.set(-7.58, 18.20, -1); //set(-17.33, 51.03, -10);//-4.52
|
||||
//viewer.scene.add(cube);
|
||||
//spotLight.target = cube;
|
||||
//viewer.scene.add(spotLight);
|
||||
|
||||
//light = newLight();
|
||||
newLight();
|
||||
|
||||
//newLight();
|
||||
//testLight = new THREE.SpotLight();
|
||||
}
|
||||
|
||||
//------------------- 加入熱點 -----------------
|
||||
@ -482,7 +475,8 @@ async function addHotPoint(data) {
|
||||
const spriteIcon = "https://d2zqnmauvnpnnm.cloudfront.net/assets-1/images/circle.svg"; //"/img/forge/hotspot.svg";
|
||||
|
||||
const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
|
||||
var a = newLight();
|
||||
//var a = newLight();
|
||||
newLight();
|
||||
//function onSpriteClicked(event) {
|
||||
// console.log(`Sprite clicked: ${event.dbId}`);
|
||||
//}
|
||||
@ -521,7 +515,7 @@ async function addHotPoint(data) {
|
||||
event.hasStopped = true;
|
||||
if (event != undefined && event != null) {
|
||||
if (event.dbId >= 10 && event.dbId <= 13) {//event.dbId > 0 && event.dbId < 19
|
||||
setLightValues(20, 0x00ff00)
|
||||
setLightValues(20, 0x00ff00);
|
||||
console.log(`Sprite clicked: ${event.dbId}`);
|
||||
openHotspotModal();
|
||||
}
|
||||
@ -1387,26 +1381,26 @@ async function newLight() {
|
||||
//angle - 光從其上界為 Math.PI / 2 的方向散射的最大角度。
|
||||
//半影 - 由於半影而衰減的聚光燈錐體的百分比。取值介於 0 和 1 之間。默認值為零。
|
||||
//decay - 光沿光的距離變暗的量。
|
||||
//spotLight = new THREE.SpotLight(0xff0000, 200, 20, 0.6, 0.5, 10);//0xffffff 80, 10 //15, 20 , Math.PI / 12
|
||||
//spotLight.position.set(43.72, -15.65, -44.96); //set(-17.33, 51.03, -2.52); // -7.58, 18.20, -0.25 -44.96
|
||||
//spotLight.castShadow = false;
|
||||
//spotLight.visible = true;
|
||||
spotLight = new THREE.SpotLight(0xff0000, 200, 20, 0.6, 0.5, 10);//0xffffff 80, 10 //15, 20 , Math.PI / 12
|
||||
spotLight.position.set(43.72, -15.65, -44.96); //set(-17.33, 51.03, -2.52); // -7.58, 18.20, -0.25 -44.96
|
||||
spotLight.castShadow = false;
|
||||
spotLight.visible = true;
|
||||
|
||||
//spotLight.target.position.set(43.72, -15.65, -60);// -15.65 -48
|
||||
//viewer.scene.add(spotLight.target);
|
||||
spotLight.target.position.set(43.72, -15.65, -60);// -15.65 -48
|
||||
viewer.scene.add(spotLight.target);
|
||||
|
||||
//viewer.scene.add(spotLight);
|
||||
viewer.scene.add(spotLight);
|
||||
|
||||
//viewer.impl.sceneUpdated(true);
|
||||
viewer.impl.sceneUpdated(true);
|
||||
|
||||
//return spotLight;
|
||||
|
||||
//加入點燈光
|
||||
bulbLight = new THREE.PointLight(0xff0000, 50, 20, 2);//0xff0000
|
||||
bulbLight.position.set(43.72, -15.65, -44.96);//17.880840301513672
|
||||
bulbLight.castShadow = true;
|
||||
bulbLight.visible = true;
|
||||
viewer.scene.add(bulbLight);
|
||||
//bulbLight = new THREE.PointLight(0xffffff, 50, 20, 2);//0xff0000
|
||||
//bulbLight.position.set(43.72, -15.65, -44.96);//17.880840301513672
|
||||
//bulbLight.castShadow = true;
|
||||
//bulbLight.visible = true;
|
||||
//viewer.scene.add(bulbLight);
|
||||
|
||||
//pointLightHelper = new THREE.PointLightHelper(pointLight);
|
||||
//viewer.scene.add(pointLightHelper);
|
||||
@ -1439,13 +1433,15 @@ function setLightValues(intensity, color) {// distance, angle, penumbra, decay,
|
||||
function setLightOpenOrClose(value) {//, light
|
||||
if (value) {
|
||||
//light.visible = true;
|
||||
//spotLight.visible = true;
|
||||
bulbLight.visible = true;
|
||||
spotLight.visible = true;
|
||||
//bulbLight.visible = true;
|
||||
//testLight.visible = true;
|
||||
}
|
||||
else {
|
||||
//light.visible = false;
|
||||
//spotLight.visible = false;
|
||||
bulbLight.visible = false;
|
||||
spotLight.visible = false;
|
||||
//bulbLight.visible = false;
|
||||
//testLight.visible = false;
|
||||
}
|
||||
viewer.impl.sceneUpdated(true);
|
||||
}
|
||||
@ -1457,3 +1453,7 @@ function setLightTransparency(value) {
|
||||
}
|
||||
//------------- end -----------------------------------
|
||||
|
||||
function consoleList() {
|
||||
console.log(tagIdDevList);
|
||||
console.log(roomDataList);
|
||||
}
|
@ -21,84 +21,33 @@ var endPageLoading; // 開始 loading
|
||||
window.tolSubList = [];
|
||||
|
||||
var user_name = "";
|
||||
function subscriptionDevices() {
|
||||
// 用BQL的方式去訂閱
|
||||
this.setSubscribeDevicesByBql = function (tempOrdPath) {
|
||||
ordPath = tempOrdPath;
|
||||
BajaSubscribeDevicesByBql();
|
||||
|
||||
class subscriptionDevices {
|
||||
constructor() {
|
||||
this.ordPath = {};
|
||||
this.changeCallback = null;
|
||||
this.changeEndCallback = null;
|
||||
}
|
||||
|
||||
setSubscribeDevicesByBql = function (tempOrdPath) {
|
||||
this.ordPath = tempOrdPath;
|
||||
this.BajaSubscribeDevicesByBql();
|
||||
};
|
||||
// BQL去訂閱回傳的Function
|
||||
this.setSubscribeDevicesCallBack = function (callBackFunc) {
|
||||
|
||||
setSubscribeDevicesCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_device_callback_func = callBackFunc;
|
||||
this.changeCallback = callBackFunc;
|
||||
}
|
||||
}
|
||||
// BQL訂閱結束回傳的Function
|
||||
this.setSubscribeDeviceEndCallBack = function (callBackFunc) {
|
||||
setSubscribeDeviceEndCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_end_device_callback_func = callBackFunc;
|
||||
this.changeEndCallback = callBackFunc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function subscriptionAlarms() {
|
||||
// 用BQL的方式去訂閱
|
||||
this.setSubscribeAlarmsByBql = function (tempOrdPath) {
|
||||
BajaSubscribeAlarmsByBql(tempOrdPath);
|
||||
};
|
||||
// BQL去訂閱回傳的Function
|
||||
this.setSubscribeAlarmsCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_alarm_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
// BQL訂閱結束回傳的Function
|
||||
this.setSubscribeAlarmEndCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_end_alarm_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function subscriptionElectricmeter() {
|
||||
// 用BQL的方式去訂閱
|
||||
this.setSubscribeElectricmeterByBql = function (tempOrdPath) {
|
||||
BajaSubscribeElectricmeterByBql(tempOrdPath);
|
||||
};
|
||||
// BQL去訂閱回傳的Function
|
||||
this.setSubscribeElectricmeterCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_electricmeter_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
// BQL訂閱結束回傳的Function
|
||||
this.setSubscribeElectricmeterEndCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_end_electricmeter_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MyBaja() {
|
||||
// 取得使用者帳號
|
||||
this.setMyUserAccount = function (callBackFunc = null) {
|
||||
require(['baja!'], function (baja) {
|
||||
console.log("baja", baja)
|
||||
user_name = baja.getUserName();
|
||||
callBackFunc ? callBackFunc(user_name) : "";
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用者透過BQL指定路徑去訂閱設備點位
|
||||
*/
|
||||
function BajaSubscribeDevicesByBql() {
|
||||
|
||||
|
||||
BajaSubscribeDevicesByBql = function () {
|
||||
let _this = this;
|
||||
require(['baja!'], function (baja) {
|
||||
console.log("進入Function 準備執行BQL訂閱");
|
||||
startPageLoading ? startPageLoading() : ""
|
||||
@ -135,8 +84,8 @@ function BajaSubscribeDevicesByBql() {
|
||||
"value": key
|
||||
}
|
||||
|
||||
if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
|
||||
baja_subscribe_device_callback_func(modify_target_device, true); //第2參數用在平面圖,刷新畫面
|
||||
if (_this.changeCallback != undefined && _this.changeCallback != null) {
|
||||
_this.changeCallback(modify_target_device, true); //第2參數用在平面圖,刷新畫面
|
||||
}
|
||||
}
|
||||
}, function (err) {
|
||||
@ -147,8 +96,8 @@ function BajaSubscribeDevicesByBql() {
|
||||
// var building_tag = "H";
|
||||
// var system_tag = "M10";
|
||||
// baja.Ord.make(`ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/${building_tag}/${system_tag}|bql:select name, displayname, slotPath, out.value, out from control:ControlPoint`)
|
||||
console.log(`local:|foxs:|station:|slot:/${ordPath.area_tag}/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`);
|
||||
baja.Ord.make(`local:|foxs:|station:|slot:/${ordPath.area_tag}/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`)
|
||||
console.log(`local:|foxs:|station:|slot:/TPE/${_this.ordPath.building_tag}/${_this.ordPath.system_tag}/${_this.ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`);
|
||||
baja.Ord.make(`local:|foxs:|station:|slot:/TPE/${_this.ordPath.building_tag}/${_this.ordPath.system_tag}/${_this.ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`)
|
||||
.get(
|
||||
function (table) {
|
||||
var tableStart, tableFinish;
|
||||
@ -165,7 +114,7 @@ function BajaSubscribeDevicesByBql() {
|
||||
totalTargetDevice = [];
|
||||
tableStart = new Date(Date.now());
|
||||
$("#table-start-timestamp").html(tableStart.toISOString());
|
||||
render_start = new Date(Date.now());
|
||||
|
||||
|
||||
},
|
||||
each: function (item, index) {
|
||||
@ -209,8 +158,8 @@ function BajaSubscribeDevicesByBql() {
|
||||
}
|
||||
totalTargetDevice.push(modify_target_device);
|
||||
//取得component當下就更新設備點位
|
||||
if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
|
||||
baja_subscribe_device_callback_func(modify_target_device);
|
||||
if (_this.changeCallback != undefined && _this.changeCallback != null) {
|
||||
_this.changeCallback(modify_target_device);
|
||||
}
|
||||
|
||||
|
||||
@ -269,8 +218,8 @@ function BajaSubscribeDevicesByBql() {
|
||||
// $("#table-finish-timestamp").html(tableFinish.toISOString());
|
||||
// $("#table-time").html((tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
||||
//取得component當下就更新設備點位
|
||||
if (baja_subscribe_end_device_callback_func != undefined && baja_subscribe_end_device_callback_func != null) {
|
||||
baja_subscribe_end_device_callback_func(totalTargetDevice);
|
||||
if (_this.changeEndCallback != undefined && _this.changeEndCallback != null) {
|
||||
_this.changeEndCallback(totalTargetDevice);
|
||||
}
|
||||
endPageLoading ? endPageLoading() : ""
|
||||
console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
||||
@ -281,6 +230,268 @@ function BajaSubscribeDevicesByBql() {
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//function subscriptionDevices() {
|
||||
// // 用BQL的方式去訂閱
|
||||
// this.setSubscribeDevicesByBql = function (tempOrdPath) {
|
||||
// ordPath = tempOrdPath;
|
||||
// BajaSubscribeDevicesByBql();
|
||||
// };
|
||||
// // BQL去訂閱回傳的Function
|
||||
// this.setSubscribeDevicesCallBack = function (callBackFunc) {
|
||||
// if (callBackFunc != undefined && callBackFunc != null) {
|
||||
// baja_subscribe_device_callback_func = callBackFunc;
|
||||
// }
|
||||
// }
|
||||
// // BQL訂閱結束回傳的Function
|
||||
// this.setSubscribeDeviceEndCallBack = function (callBackFunc) {
|
||||
// if (callBackFunc != undefined && callBackFunc != null) {
|
||||
// baja_subscribe_end_device_callback_func = callBackFunc;
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
function subscriptionAlarms() {
|
||||
// 用BQL的方式去訂閱
|
||||
this.setSubscribeAlarmsByBql = function (tempOrdPath) {
|
||||
BajaSubscribeAlarmsByBql(tempOrdPath);
|
||||
};
|
||||
// BQL去訂閱回傳的Function
|
||||
this.setSubscribeAlarmsCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_alarm_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
// BQL訂閱結束回傳的Function
|
||||
this.setSubscribeAlarmEndCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_end_alarm_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function subscriptionElectricmeter() {
|
||||
// 用BQL的方式去訂閱
|
||||
this.setSubscribeElectricmeterByBql = function (tempOrdPath) {
|
||||
BajaSubscribeElectricmeterByBql(tempOrdPath);
|
||||
};
|
||||
// BQL去訂閱回傳的Function
|
||||
this.setSubscribeElectricmeterCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_electricmeter_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
// BQL訂閱結束回傳的Function
|
||||
this.setSubscribeElectricmeterEndCallBack = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_subscribe_end_electricmeter_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MyBaja() {
|
||||
// 取得使用者帳號
|
||||
this.setMyUserAccount = function (callBackFunc = null) {
|
||||
require(['baja!'], function (baja) {
|
||||
console.log("baja", baja)
|
||||
user_name = baja.getUserName();
|
||||
callBackFunc ? callBackFunc(user_name) : "";
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用者透過BQL指定路徑去訂閱設備點位
|
||||
*/
|
||||
//function BajaSubscribeDevicesByBql() {
|
||||
|
||||
|
||||
// require(['baja!'], function (baja) {
|
||||
// console.log("進入Function 準備執行BQL訂閱");
|
||||
// startPageLoading ? startPageLoading() : ""
|
||||
// var init_start = new Date(Date.now());
|
||||
// var sub = new baja.Subscriber();
|
||||
|
||||
// sub.attach('changed', function (prop) {
|
||||
// if (prop.getName() === 'out') {
|
||||
// var out_value = this.getOutDisplay();
|
||||
// var target_device_number = this.$parent.getDisplayName().split('_').slice(0, 5).join('_');
|
||||
// var point_name = this.getDisplayName();
|
||||
|
||||
// //依據Facets判斷回傳的內容值為何
|
||||
// var facets_split = this.getFacets1().$cEncStr.split('|');
|
||||
// var facets_arr = [];
|
||||
// facets_split.forEach(function (item, index) {
|
||||
// facets_arr.push(item.split('=s:'));
|
||||
// });
|
||||
|
||||
// var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
|
||||
|
||||
// var point_out_split = this.getOutDisplay().split(' ');
|
||||
|
||||
// let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
|
||||
|
||||
// if (key == undefined) {
|
||||
// key = point_out_split[0];
|
||||
// }
|
||||
|
||||
// var modify_target_device = {
|
||||
// "device_number": target_device_number ? target_device_number : null,
|
||||
// "device_number_full": this.$parent.getSlotPath().$names.join("_"),
|
||||
// "point_name": point_name ? point_name : null,
|
||||
// "value": key
|
||||
// }
|
||||
|
||||
// if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
|
||||
// baja_subscribe_device_callback_func(modify_target_device, true); //第2參數用在平面圖,刷新畫面
|
||||
// }
|
||||
// }
|
||||
// }, function (err) {
|
||||
// console.log(err)
|
||||
// });
|
||||
|
||||
// //使用bql語法
|
||||
// // var building_tag = "H";
|
||||
// // var system_tag = "M10";
|
||||
// // baja.Ord.make(`ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/${building_tag}/${system_tag}|bql:select name, displayname, slotPath, out.value, out from control:ControlPoint`)
|
||||
// console.log(`local:|foxs:|station:|slot:/TPE/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`);
|
||||
// baja.Ord.make(`local:|foxs:|station:|slot:/TPE/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`)
|
||||
// .get(
|
||||
// function (table) {
|
||||
// var tableStart, tableFinish;
|
||||
// var subStart, subFinish;
|
||||
// var component_index = 0;
|
||||
// var total_component_index = 0;
|
||||
// var totalTargetDevice = [];
|
||||
// var readBqlFinish = new Date(Date.now());
|
||||
// // $("#readPath-finish-timestamp").html(readBqlFinish.toISOString());
|
||||
// // $("#readPath-finish-time").html((readBqlFinish.getTime() - init_start.getTime()) / 1000 + "sec");
|
||||
// console.log("讀取路徑完成-花費時間", (readBqlFinish.getTime() - init_start.getTime()) / 1000 + "sec");
|
||||
// table.cursor({
|
||||
// before: function () {
|
||||
// totalTargetDevice = [];
|
||||
// tableStart = new Date(Date.now());
|
||||
// $("#table-start-timestamp").html(tableStart.toISOString());
|
||||
// render_start = new Date(Date.now());
|
||||
|
||||
// },
|
||||
// each: function (item, index) {
|
||||
// if (index < 1) {
|
||||
// subStart = new Date(Date.now());
|
||||
// $("#sub-start").html(subStart.toISOString());
|
||||
// }
|
||||
// $("#sub-number").html(index + 1);
|
||||
// total_component_index = index;
|
||||
|
||||
|
||||
|
||||
// var target_device_number_split = this.getDisplay("slotPath").split('/');
|
||||
// var target_device_number = target_device_number_split[8];
|
||||
// //console.log(target_device_number);
|
||||
// var point_name = this.getDisplay("name");
|
||||
// var facets = this.getDisplay("facets");
|
||||
|
||||
// //依據Facets判斷回傳的內容值為何
|
||||
// var facets_split = facets.split(',');
|
||||
// var facets_arr = [];
|
||||
// facets_split.forEach(function (item, index) {
|
||||
// facets_arr.push(item.split('='));
|
||||
// });
|
||||
|
||||
// facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
|
||||
|
||||
// var point_out_split = this.getDisplay("out").split(' ');
|
||||
|
||||
// let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
|
||||
|
||||
// if (key == undefined) {
|
||||
// key = point_out_split[0];
|
||||
// }
|
||||
|
||||
// var modify_target_device = {
|
||||
// "device_number": target_device_number ? target_device_number : null,
|
||||
// "device_number_full": this.getDisplay("slotPath").split("slot:")[1].split('/').slice(1, -1).join("_"),
|
||||
// "point_name": point_name ? point_name : null,
|
||||
// "value": key
|
||||
// }
|
||||
// totalTargetDevice.push(modify_target_device);
|
||||
// //取得component當下就更新設備點位
|
||||
// if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
|
||||
// baja_subscribe_device_callback_func(modify_target_device);
|
||||
// }
|
||||
|
||||
|
||||
// baja.Ord.make("local:|foxs:|station:|" + this.getDisplay("slotPath"))
|
||||
// .get()
|
||||
// .then(function (component) {
|
||||
// component_index++;
|
||||
// var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_');
|
||||
// var point_name = component.getDisplayName();
|
||||
|
||||
// // //依據Facets判斷回傳的內容值為何
|
||||
// // var facets_split = component.getFacets1().$cEncStr.split('|');
|
||||
// // var facets_arr = [];
|
||||
// // facets_split.forEach(function (item, index) {
|
||||
// // facets_arr.push(item.split('=s:'));
|
||||
// // });
|
||||
|
||||
// // var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
|
||||
|
||||
// // var point_out_split = component.getOutDisplay().split(' ');
|
||||
|
||||
// // let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
|
||||
|
||||
// // if (key == undefined) {
|
||||
// // key = point_out_split[0];
|
||||
// // }
|
||||
|
||||
// // var modify_target_device = {
|
||||
// // "device_number": target_device_number ? target_device_number : null,
|
||||
// // "point_name": point_name ? point_name : null,
|
||||
// // "value": key
|
||||
// // }
|
||||
|
||||
// // //取得component當下就更新設備點位
|
||||
// // if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
|
||||
// // if (component_index == total_component_index) {
|
||||
// // baja_subscribe_device_callback_func(modify_target_device, true);
|
||||
// // }
|
||||
// // else {
|
||||
// // baja_subscribe_device_callback_func(modify_target_device);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// sub.subscribe({
|
||||
// comps: component,
|
||||
// });
|
||||
// tolSubList.push(sub);
|
||||
// subFinish = new Date(Date.now());
|
||||
// $("#sub-end").html(subFinish.toISOString());
|
||||
// $("#sub-time").html((subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
|
||||
// // console.log("訂閱完成時間", (subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
|
||||
// });
|
||||
// },
|
||||
// after: function () {
|
||||
// tableFinish = new Date(Date.now());
|
||||
// // $("#table-finish-timestamp").html(tableFinish.toISOString());
|
||||
// // $("#table-time").html((tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
||||
// //取得component當下就更新設備點位
|
||||
// if (baja_subscribe_end_device_callback_func != undefined && baja_subscribe_end_device_callback_func != null) {
|
||||
// baja_subscribe_end_device_callback_func(totalTargetDevice);
|
||||
// }
|
||||
// endPageLoading ? endPageLoading() : ""
|
||||
// console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
||||
// },
|
||||
// limit: -1,
|
||||
// offset: 0
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
//}
|
||||
|
||||
/**
|
||||
* 使用者透過BQL指定路徑去訂閱Alarm
|
||||
@ -296,7 +507,7 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) {
|
||||
var sourceState = (this.$map.$map.in10.$val.$map.$map.value.$display) == 'true' ? "Offnormal" : "Normal";
|
||||
|
||||
var modify_target_device = {
|
||||
"system": ordPathForAlarm.area_tag + "_" + ordPathForAlarm.building_tag + "_" + ordPathForAlarm.system_tag + "_" + ordPathForAlarm.name_tag,
|
||||
"system": "TPE_" + ordPathForAlarm.building_tag + "_" + ordPathForAlarm.system_tag + "_" + ordPathForAlarm.name_tag,
|
||||
"sourceState": sourceState ? sourceState : null
|
||||
}
|
||||
|
||||
@ -307,8 +518,8 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) {
|
||||
});
|
||||
|
||||
//使用bql語法
|
||||
console.log(`local:|foxs:|alarm:|bql:select top 1 timestamp, sourceState, normalTime where alarmData.sourceName like '%${ordPathForAlarm.area_tag}_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`);
|
||||
baja.Ord.make(`local:|foxs:|alarm:|bql:select top 1 timestamp, sourceState, alarmData, alarmData.sourceName, normalTime where alarmData.sourceName like '%${ordPathForAlarm.area_tag}_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`)
|
||||
console.log(`local:|foxs:|alarm:|bql:select top 1 timestamp, sourceState, normalTime where alarmData.sourceName like '%TPE_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`);
|
||||
baja.Ord.make(`local:|foxs:|alarm:|bql:select top 1 timestamp, sourceState, alarmData, alarmData.sourceName, normalTime where alarmData.sourceName like '%TPE_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`)
|
||||
.get(
|
||||
function (table) {
|
||||
var tableStart, tableFinish;
|
||||
@ -338,7 +549,7 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) {
|
||||
var normalTime = this.getDisplay("normalTime");
|
||||
|
||||
var modify_target_device = {
|
||||
"system": ordPathForAlarm.area_tag + "_" + ordPathForAlarm.building_tag + "_" + ordPathForAlarm.system_tag + "_" + ordPathForAlarm.name_tag,
|
||||
"system": "TPE_" + ordPathForAlarm.building_tag + "_" + ordPathForAlarm.system_tag + "_" + ordPathForAlarm.name_tag,
|
||||
"sourceState": sourceState ? sourceState : null
|
||||
}
|
||||
totalTargetDevice.push(modify_target_device);
|
||||
|
@ -368,16 +368,29 @@ function dayToChiDay(num) {
|
||||
}
|
||||
|
||||
// 取得現在或前後時間,輸出單位依據 type
|
||||
function getTimeByType(type = null, cal = 0) {
|
||||
function getTimeByType(type = null, cal = 0, unit = "d") {
|
||||
let now = new Date();
|
||||
return strToDate(now, type, cal);
|
||||
return strToDate(now, type, cal, unit);
|
||||
}
|
||||
|
||||
// 取得某當下時間或前後時間,輸出單位依據 type
|
||||
function strToDate(text, type = null, cal = 0) {
|
||||
let calDay = function (_d, _cal) {
|
||||
return new Date(_d.getTime() + (cal * 24 * 60 * 60 * 1000));
|
||||
function strToDate(text, type = null, cal = 0, unit = "d") {
|
||||
let dec = 24 * 60 * 60 * 1000;
|
||||
|
||||
if (unit == "d") {
|
||||
dec = 24 * 60 * 60 * 1000;
|
||||
} else if (unit == "h") {
|
||||
dec = 60 * 60 * 1000;
|
||||
} else if (unit == "m") {
|
||||
dec = 60 * 1000;
|
||||
} else if (unit == "s") {
|
||||
dec = 1000;
|
||||
}
|
||||
|
||||
let calDay = function (_d, _cal) {
|
||||
return new Date(_d.getTime() + (cal * dec));
|
||||
}
|
||||
|
||||
let tarDate = new Date(text);
|
||||
let result = 0;
|
||||
if (type == "year") {
|
||||
@ -394,6 +407,23 @@ function strToDate(text, type = null, cal = 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function dateRanCutPart(start, end, cutNum) {
|
||||
let sTime = (new Date(start)).getTime();
|
||||
let eTime = (new Date(end)).getTime();
|
||||
let cutTimeArr = [];
|
||||
if (sTime < eTime) return [];
|
||||
|
||||
|
||||
let partNum = (sTime - eTime) / cutNum;
|
||||
for (let i = eTime; i <= sTime; i = i + partNum) {
|
||||
cutTimeArr.push(i)
|
||||
}
|
||||
|
||||
cutTimeArr.forEach(x => new Date(x));
|
||||
|
||||
return cutTimeArr;
|
||||
}
|
||||
|
||||
function isJSON(str) {
|
||||
try {
|
||||
JSON.parse(str);
|
||||
|
@ -307,7 +307,14 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
|
||||
if (dateTime) {
|
||||
let regex = /^\/Date\((\d+)\)\/$/gm;
|
||||
|
||||
let t = Date.parse(dateTime); //若從資料庫回傳 /Date(xxxxxxxxxxxxxx)/ DateTime格式
|
||||
let t = null; //若從資料庫回傳 /Date(xxxxxxxxxxxxxx)/ DateTime格式
|
||||
|
||||
if (typeof dateTime == "number" && dateTime > 1000000) {
|
||||
dateTime = new Date(dateTime);
|
||||
}
|
||||
|
||||
t = Date.parse(dateTime);
|
||||
|
||||
if (regex.test(dateTime)) {
|
||||
t = parseInt(dateTime.replace(regex, '$1'));
|
||||
}
|
||||
@ -354,9 +361,30 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
|
||||
hour = d.getHours();
|
||||
minute = d.getMinutes();
|
||||
}
|
||||
|
||||
date = [year, String(month).padStart(2, '0'), String(day).padStart(2, '0')].filter(n => n).join("/");
|
||||
time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')].filter(n => n).join(":");
|
||||
|
||||
time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')];
|
||||
|
||||
if (dateType != "date" && dateType != "time" && dateType != "datetime") {
|
||||
let showArr = [];
|
||||
if (year) showArr.push(year);
|
||||
if (month) showArr.push(month.toString().padStart(2, '0'));
|
||||
if (day) showArr.push(day.toString().padStart(2, '0'));
|
||||
if (showArr.length != 0) {
|
||||
result += showArr.join("/");
|
||||
showArr = [];
|
||||
}
|
||||
if (hour) showArr.push(hour.toString().padStart(2, '0'));
|
||||
if (minute) showArr.push(minute.toString().padStart(2, '0'));
|
||||
if (second) showArr.push(second.toString().padStart(2, '0'));
|
||||
if (millisecond) showArr.push(millisecond.toString().padStart(3, '0'));
|
||||
if (showArr.length != 0) {
|
||||
result += " " + showArr.join(":");
|
||||
}
|
||||
} else {
|
||||
result = date.toString() + " " + time.toString();
|
||||
}
|
||||
|
||||
if (dateType == "date") {
|
||||
result = date.toString();
|
||||
|
@ -103,7 +103,7 @@ class YourTeamNavbar {
|
||||
$("[data-toggle=navbar]").each((idx, ele) => {
|
||||
let target = $(ele).data("target");
|
||||
if ($(this.element)[0] == $(target)[0]) {
|
||||
$(ele).off("click").on("click", () => {
|
||||
$(ele).on("click", () => {
|
||||
this.toggle();
|
||||
})
|
||||
}
|
||||
|
@ -33,7 +33,10 @@ function initTabsByEle() {
|
||||
class YourTeamTab {
|
||||
constructor(option = {}) {
|
||||
this.tabName = option.tabName ?? null;
|
||||
this.activeEle = null;
|
||||
this.eventArg = { cancel: false };
|
||||
this.init()
|
||||
|
||||
}
|
||||
|
||||
init = function () {
|
||||
@ -44,23 +47,49 @@ class YourTeamTab {
|
||||
this.event();
|
||||
$(`[data-tabname=${this.tabName}][data-tabrole=child]`).css("display", "none");
|
||||
if ($(`[data-tabname=${this.tabName}][data-target].active`).length == 0) {
|
||||
let parTabEle = $(`[data-tabname=${this.tabName}][data-target]`).first();
|
||||
if (parTabEle.data("toggle") == "tab" || !parTabEle.data("toggle")) {
|
||||
$(`[data-tabname=${this.tabName}][data-target]`).first().trigger("click");
|
||||
}
|
||||
} else {
|
||||
$(`[data-tabname=${this.tabName}][data-target].active`).first().trigger("click");
|
||||
}
|
||||
|
||||
_ytTabInited.push(this.tabName);
|
||||
this.setThisObj();
|
||||
}
|
||||
|
||||
setThisObj = function () {
|
||||
$(`[data-tabname=${this.tabName}]`).each((idx, ele) => {
|
||||
$(ele)[0]._ytTab = this;
|
||||
})
|
||||
}
|
||||
|
||||
setActItem = function (element) {
|
||||
|
||||
this.activeEle = element;
|
||||
}
|
||||
|
||||
updActClass = function () {
|
||||
$(`[data-tabname=${this.tabName}]:not([data-tabrole=child])`).removeClass("active");
|
||||
$(this.activeEle).addClass("active");
|
||||
}
|
||||
|
||||
event = function () {
|
||||
let clsObj = this;
|
||||
|
||||
// Tab Item 按鈕 click
|
||||
$(`[data-tabname=${this.tabName}]`).off("click").on("click", function (e) {
|
||||
$(`[data-tabname=${this.tabName}]`).on("click", function (e) {
|
||||
let target = $(this).data("target");
|
||||
let obj = this;
|
||||
$(`[data-tabname=${clsObj.tabName}]:not([data-tabrole=child])`).removeClass("active");
|
||||
$(obj).addClass("active");
|
||||
clsObj.eventArg.cancel = false;
|
||||
$(obj).trigger("yt:tab:prechange", clsObj.eventArg)
|
||||
|
||||
if (clsObj.eventArg.cancel) {
|
||||
return;
|
||||
}
|
||||
clsObj.activeEle = obj;
|
||||
clsObj.updActClass();
|
||||
// 觸發 yt:tab:change事件
|
||||
$(obj).trigger("yt:tab:change");
|
||||
if (target) {
|
||||
@ -80,4 +109,30 @@ class YourTeamTab {
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.YTTab = function (method,...arg) {
|
||||
let tabObj = $(this)[0]._ytTab;
|
||||
|
||||
if (!tabObj) {
|
||||
let tabName = $(this).data("tabname");
|
||||
if (tabName && _ytTabInited.indexOf(tabName) == -1) {
|
||||
let ytTab = new YT.Tab({ tabName: tabName })
|
||||
_ytTabInited.push(tabName);
|
||||
tabObj = ytTab;
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
if (method == "set") {
|
||||
tabObj.setActItem(this);
|
||||
tabObj.updActClass();
|
||||
} else if (method == "setAndClick") {
|
||||
tabObj.setActItem(this);
|
||||
$(this).click();
|
||||
}
|
||||
|
||||
return tabObj;
|
||||
|
||||
}
|
||||
|
||||
YT.Tab = YT.Tab || YourTeamTab;
|
@ -872,5 +872,43 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得 Device Item 系統小類下的點位資訊
|
||||
/// </summary>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/Device/GetDeviceItem")]
|
||||
public async Task<ActionResult<ApiResult<List<DeviceItemViewModel>>>> GetDeviceItem([FromBody] FindDeviceItem fdi)
|
||||
{
|
||||
ApiResult<List<DeviceItemViewModel>> apiResult = new ApiResult<List<DeviceItemViewModel>>();
|
||||
|
||||
if (string.IsNullOrEmpty(fdi.main_system_tag) || string.IsNullOrEmpty(fdi.sub_system_tag))
|
||||
{
|
||||
apiResult.Code = "0002";
|
||||
apiResult.Msg = "需傳入大小類tag";
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var sqlString = $@" SELECT * FROM device_item
|
||||
WHERE deleted = '0' AND device_system_tag = @main_system_tag AND device_name_tag = @sub_system_tag AND points = IFNULL(@points,points)";
|
||||
var param = new { @main_system_tag = fdi.main_system_tag, @sub_system_tag = fdi.sub_system_tag, @points = fdi.points };
|
||||
var fr = await backendRepository.GetAllAsync<DeviceItemViewModel>(sqlString, param);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = fr;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
return Ok(apiResult);
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,18 @@
|
||||
using FrontendWebApi.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using NPOI.SS.Formula.PTG;
|
||||
using Repository.BackendRepository.Interface;
|
||||
using Repository.FrontendRepository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FrontendWebApi.ApiControllers
|
||||
@ -47,5 +51,72 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/Energe/GetAutDemVal")]
|
||||
public async Task<ActionResult<ApiResult<List<Variable>>>> GetAutDemVal()
|
||||
{
|
||||
ApiResult<List<Variable>> apiResult = new ApiResult<List<Variable>>();
|
||||
try
|
||||
{
|
||||
var sqlString = $@"SELECT system_value,system_key FROM variable
|
||||
where system_type = 'automated_demand_response' and deleted = '0'";
|
||||
var ess = await backendRepository.GetAllAsync<Variable>(sqlString);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = ess;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
return Ok(apiResult);
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/Energe/EdiAutDemVal")]
|
||||
public async Task<ActionResult<ApiResult<List<int?>>>> EdiAutDemVal([FromBody] List<Variable> variables)
|
||||
{
|
||||
ApiResult<List<int?>> apiResult = new ApiResult<List<int?>>();
|
||||
|
||||
try
|
||||
{
|
||||
var sqlString = $@"SELECT system_value,system_key FROM variable
|
||||
where system_type = 'automated_demand_response' and deleted = '0'";
|
||||
var vs = await backendRepository.GetAllAsync<Variable>(sqlString);
|
||||
|
||||
var autDemKeys = vs.Select(x => x.System_key);
|
||||
foreach (var v in variables) {
|
||||
if (autDemKeys.Where(x => x == v.System_key).Count() != 0) {
|
||||
Dictionary<string, object> sqlParam = new Dictionary<string, object>() {
|
||||
{ "@system_key", v.System_key},
|
||||
{ "@system_value", v.system_value},
|
||||
{ "@updated_by", myUser.userinfo_guid},
|
||||
{ "@updated_at", DateTime.Now},
|
||||
};
|
||||
|
||||
await backendRepository.UpdateOneByCustomTable(sqlParam, "variable", $" system_type = 'automated_demand_response' AND system_key = @system_key");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = null;
|
||||
apiResult.Msg = "編輯成功";
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "系統內部錯誤,請聯絡管理者。" + exception.Message;
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
return Ok(apiResult);
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,4 +141,27 @@ namespace FrontendWebApi.Models
|
||||
public string device_node_coordinate_3d { get; set; }
|
||||
public int? forge_dbid { get; set; }
|
||||
}
|
||||
|
||||
public class DeviceItemViewModel
|
||||
{
|
||||
public int id { get; set; }
|
||||
public short deleted { get; set; }
|
||||
public string full_name { get; set; }
|
||||
public string points { get; set; }
|
||||
public string unit { get; set; }
|
||||
public short is_show { get; set; }
|
||||
public short? is_show_riserDiagram { get; set; }
|
||||
public short is_controll { get; set; }
|
||||
public short is_bool { get; set; }
|
||||
public short is_link { get; set; }
|
||||
public short is_show_history { get; set; }
|
||||
public string device_system_tag { get; set; }
|
||||
public string device_name_tag { get; set; }
|
||||
}
|
||||
|
||||
public class FindDeviceItem : FindDevice
|
||||
{
|
||||
public string points { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,6 @@
|
||||
public string system_remark { get; set; }
|
||||
public string priority { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ namespace FrontendWebApi.Models
|
||||
|
||||
public class Variable : Actor
|
||||
{
|
||||
public int id { get; set; }
|
||||
public int? id { get; set; }
|
||||
public string System_type { get; set; }
|
||||
public string System_key { get; set; }
|
||||
public string system_value { get; set; }
|
||||
public int system_parent_id { get; set; }
|
||||
public int? system_parent_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,10 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"LoginExpireMinute": 3600, //登入到期時間,單位(分)
|
||||
"LoginExpireMinute": 3600, //<EFBFBD>n<EFBFBD>J<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɶ<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
||||
"JwtSettings": {
|
||||
"Issuer": "Admin", //發送者
|
||||
"SignKey": "TaipeiDome123456", //簽章//最少16字元
|
||||
"Issuer": "Admin", //<EFBFBD>o<EFBFBD>e<EFBFBD><EFBFBD>
|
||||
"SignKey": "TaipeiDome123456", //ñ<EFBFBD><EFBFBD>//<EFBFBD>̤<EFBFBD>16<EFBFBD>r<EFBFBD><EFBFBD>
|
||||
"JwtLifeSeconds": 3600
|
||||
},
|
||||
"DBConfig": {
|
||||
|
Loading…
Reference in New Issue
Block a user