[FrontedWebApi] 設備運維資料 改為 GET | [Frontend] 平面圖串接程序調整 | 系統監控下拉選單 改為系統小類選項

This commit is contained in:
dev01 2022-11-17 18:26:30 +08:00
parent a74cb2ba9c
commit a3161a2214
4 changed files with 72 additions and 20 deletions

View File

@ -175,9 +175,10 @@
group: "device", group: "device",
onShow: function (tooltipEle, oriEle) { onShow: function (tooltipEle, oriEle) {
var tab = new YT.Tab({ tabName: "cardTab" }) var tab = new YT.Tab({ tabName: "cardTab" })
console.log($(oriEle).data("number"))
//基本資料tab block //基本資料tab block
$("#info").append(drawInfoTabBlo(devGuid)) $("#info").append(drawInfoTabBlo(devGuid))
loadOpeRecTable(); loadOpeRecTable(devGuid);
//loadErrRecTable2($(oriEle).data("number")); //loadErrRecTable2($(oriEle).data("number"));
loadErrRecTable(); loadErrRecTable();
} }
@ -185,8 +186,8 @@
}) })
} }
function loadOpeRecTable() { function loadOpeRecTable(devGuid) {
let url = baseApiUrl + "/api/Device/GetOpeDevice"; let url = baseApiUrl + "/api/Device/GetOpeDevice?device_guid=" + devGuid;
let tag = "#opeRecTable"; let tag = "#opeRecTable";
let column_defs = [ let column_defs = [
@ -227,7 +228,7 @@
// api.columns.adjust(); // api.columns.adjust();
//} //}
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs,null, null, null, null, null, null, "tpi"); let opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs,null, null, null, null, null, null, "tpi");
} }
function loadErrRecTable() { function loadErrRecTable() {

View File

@ -23,7 +23,7 @@
function getFloData() { function getFloData() {
let url = baseApiUrl + "/api/Device/GetDeviceList"; let url = baseApiUrl + "/api/Device/GetDeviceList";
let sendData = { let sendData = {
main_system_tag: pageAct.sysMainTag, sub_system_tag: pageAct.sysSubTag,
building_tag: pageAct.buiTag, building_tag: pageAct.buiTag,
floor_tag: pageAct.floTag, floor_tag: pageAct.floTag,
}; };
@ -33,7 +33,7 @@
} else { } else {
chartHandler(`${baseImgUrl}/upload/floor_map/${res.data[0].floor_map_name}`); chartHandler(`${baseImgUrl}/upload/floor_map/${res.data[0].floor_map_name}`);
allDeviceRowData = res.data[0].device_list; /*allDeviceRowData = res.data[0].device_list;*/
getDevice(res.data[0].device_list); getDevice(res.data[0].device_list);
} }
}, null, "POST").send(); }, null, "POST").send();
@ -46,7 +46,7 @@
//}); //});
//currentData = selected_floor_objs[0].device; //currentData = selected_floor_objs[0].device;
debugger
currentData = $.map(devList, function (item) { currentData = $.map(devList, function (item) {
//資料處理 //資料處理
@ -149,6 +149,7 @@
// animationDurationUpdate: 1500, // animationDurationUpdate: 1500,
tooltip: { tooltip: {
formatter: function (params) { formatter: function (params) {
console.log("23",params)
if (params.data.device_node_guid != undefined && params.data.device_node_guid != null && params.data.device_node_guid != "") { if (params.data.device_node_guid != undefined && params.data.device_node_guid != null && params.data.device_node_guid != "") {
return `名稱:${params.data.device_node_full_name}<br> return `名稱:${params.data.device_node_full_name}<br>
Guid${params.data.device_node_guid}` Guid${params.data.device_node_guid}`
@ -275,10 +276,18 @@
floChart.setOption(option); floChart.setOption(option);
if (currentData != undefined && currentData != null && currentData.length > 0) { if (currentData != undefined && currentData != null && currentData.length > 0) {
resetData(); resetData();
} }
var ordPath = {
"building_tag": pageAct.buiTag,
"system_tag": pageAct.sysMainTag,
}
//myBaja.setSubscribeDevicesByBql(ordPath);
//myBaja.setSubscribeDevicesCallBack(subscribeCallBack);
console.log(floChart) console.log(floChart)
floChart.getZr().on('click', function (params) { floChart.getZr().on('click', function (params) {
console.log("click", params); console.log("click", params);
@ -345,7 +354,7 @@
}); });
} }
resetData();
}); });
}) })
@ -358,12 +367,49 @@
} }
//訂閱設備的回傳值,並塞到全域變數
function subscribeCallBack(change_device, is_need_reset = false) {
if (change_device != undefined && change_device != null) {
var target_device = allDeviceRowData.filter(x => x.device_number == change_device.device_number)[0];
if (target_device == undefined || target_device == null) {
//新增
obj = {
device_number: change_device.device_number,
points: [{
name: change_device.point_name,
value: change_device.value
}]
};
allDeviceRowData.push(obj);
}
else {
selected_device_point = target_device.points.find(x => x.name == change_device.point_name);
if (selected_device_point != null) {
selected_device_point.value = change_device.value;
}
else {
obj = {
name: change_device.point_name,
value: change_device.value
}
target_device.points.push(obj);
}
}
if (is_need_reset) {
resetData();
}
}
}
// 重設平面圖設備資料 // 重設平面圖設備資料
function resetData() { function resetData() {
console.log(123) debugger
const scatter_symbol_convertData = function (data) { //正常、關閉排除CCVT(圓點) const scatter_symbol_convertData = function (data) { //正常、關閉排除CCVT(圓點)
let res = [], temp = []; let res = [], temp = [];
data.forEach(function (item, index) { data.forEach(function (item, index) {
if (global_emergency_alarm_device_number != undefined if (global_emergency_alarm_device_number != undefined
&& global_emergency_alarm_device_number != null) { && global_emergency_alarm_device_number != null) {
@ -528,7 +574,7 @@
const scatter_icon_convertData = function (data) { //正常、關閉(icon) const scatter_icon_convertData = function (data) { //正常、關閉(icon)
let res = [], temp = []; let res = [], temp = [];
debugger
data.forEach(function (item, index) { data.forEach(function (item, index) {
if (global_emergency_alarm_device_number != undefined if (global_emergency_alarm_device_number != undefined
&& global_emergency_alarm_device_number != null) { && global_emergency_alarm_device_number != null) {
@ -539,7 +585,7 @@
//添加父節點相關資訊 //添加父節點相關資訊
item_node.device_system_category_layer3 = item.device_system_category_layer3; item_node.device_system_category_layer3 = item.device_system_category_layer3;
item_node.device_normal_color = item.device_normal_color; item_node.device_normal_color = item.device_normal_color;
item_node.device_image = item.device_image; item_node.device_image_url = item.device_image_url;
temp.push(item_node); temp.push(item_node);
}); });
} else { } else {
@ -567,7 +613,7 @@
device_node_full_name: item.device_node_full_name ? item.device_node_full_name : null, device_node_full_name: item.device_node_full_name ? item.device_node_full_name : null,
device_system_category_layer3: item.device_system_category_layer3 ? item.device_system_category_layer3 : null, device_system_category_layer3: item.device_system_category_layer3 ? item.device_system_category_layer3 : null,
status: item.status, status: item.status,
symbol: 'image://' + str_location_url + "/upload/device_icon/" + item.device_image, symbol: 'image://' + item.device_image_url,
value: item.value, value: item.value,
deviceItems: item.deviceItems, deviceItems: item.deviceItems,
deviceURL: item.deviceURL deviceURL: item.deviceURL
@ -674,7 +720,7 @@
device_node_full_name: item.device_node_full_name ? item.device_node_full_name : null, device_node_full_name: item.device_node_full_name ? item.device_node_full_name : null,
device_system_category_layer3: item.device_system_category_layer3 ? item.device_system_category_layer3 : null, device_system_category_layer3: item.device_system_category_layer3 ? item.device_system_category_layer3 : null,
status: item.status, status: item.status,
symbol: 'image://' + str_location_url + "/upload/device_icon/" + item.device_image, symbol: 'image://' + item.device_image_url,
value: item.value, value: item.value,
deviceItems: item.deviceItems, deviceItems: item.deviceItems,
deviceURL: item.deviceURL deviceURL: item.deviceURL
@ -722,7 +768,6 @@
} }
if (zoom <= 8) { if (zoom <= 8) {
floChart.setOption({ floChart.setOption({
series: [{ series: [{
symbolOffset: [0, 0], symbolOffset: [0, 0],

View File

@ -157,11 +157,17 @@ function fnInitJqDataTablesAjax(apiUrl, tag, sendData = null, columns, columns_d
} }
} }
let table = null; let table = null;
let token = localStorage.getItem("JWT-Authorization");
try { try {
let oTable = { let oTable = {
"ajax": { "ajax": {
method: "GET", method: "GET",
url: apiUrl, url: apiUrl,
/* beforeSend: beforeSend,*/
headers: {
"Authorization": "Bearer " + token,
},
cache: true, cache: true,
async:false, async:false,
dataSrc: sendData, dataSrc: sendData,

View File

@ -259,19 +259,19 @@ namespace FrontendWebApi.ApiControllers
/// </summary> /// </summary>
/// <param name="fd"></param> /// <param name="fd"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpGet]
[Route("api/Device/GetOpeDevice")] [Route("api/Device/GetOpeDevice")]
public async Task<ActionResult<ApiResult<List<DeviceOpeRecord>>>> GetOpeDevice([FromBody] FindDevice fd) public async Task<ActionResult<ApiResult<List<DeviceOpeRecord>>>> GetOpeDevice([FromQuery] string device_guid)
{ {
ApiResult<List<DeviceOpeRecord>> apiResult = new ApiResult<List<DeviceOpeRecord>>(); ApiResult<List<DeviceOpeRecord>> apiResult = new ApiResult<List<DeviceOpeRecord>>();
try try
{ {
string sql = $@"select orr.work_type, orr.fix_do, ui.full_name as work_person_name, finish_time, created_at string sql = $@"select orr.work_type, orr.fix_do, ui.full_name as work_person_name, orr.finish_time, orr.created_at
from device d from device d
join operation_record orr on d.device_number = orr.fix_do_code and orr.deleted = 0 join operation_record orr on d.device_number = orr.fix_do_code and orr.deleted = 0
left join userinfo ui on orr.work_person_id = ui.userinfo_guid left join userinfo ui on orr.work_person_id = ui.userinfo_guid
where d.deleted = 0 and d.device_guid = @device_guid"; where d.deleted = 0 and d.device_guid = @device_guid";
object param = new { @device_guid = fd.device_guid }; object param = new { @device_guid = device_guid };
var device = await backendRepository.GetAllAsync<DeviceOpeRecord>(sql, param); var device = await backendRepository.GetAllAsync<DeviceOpeRecord>(sql, param);
if (device.Count == 0) if (device.Count == 0)