[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",
onShow: function (tooltipEle, oriEle) {
var tab = new YT.Tab({ tabName: "cardTab" })
console.log($(oriEle).data("number"))
//基本資料tab block
$("#info").append(drawInfoTabBlo(devGuid))
loadOpeRecTable();
loadOpeRecTable(devGuid);
//loadErrRecTable2($(oriEle).data("number"));
loadErrRecTable();
}
@ -185,8 +186,8 @@
})
}
function loadOpeRecTable() {
let url = baseApiUrl + "/api/Device/GetOpeDevice";
function loadOpeRecTable(devGuid) {
let url = baseApiUrl + "/api/Device/GetOpeDevice?device_guid=" + devGuid;
let tag = "#opeRecTable";
let column_defs = [
@ -227,7 +228,7 @@
// 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() {

View File

@ -23,7 +23,7 @@
function getFloData() {
let url = baseApiUrl + "/api/Device/GetDeviceList";
let sendData = {
main_system_tag: pageAct.sysMainTag,
sub_system_tag: pageAct.sysSubTag,
building_tag: pageAct.buiTag,
floor_tag: pageAct.floTag,
};
@ -33,7 +33,7 @@
} else {
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);
}
}, null, "POST").send();
@ -46,7 +46,7 @@
//});
//currentData = selected_floor_objs[0].device;
debugger
currentData = $.map(devList, function (item) {
//資料處理
@ -149,6 +149,7 @@
// animationDurationUpdate: 1500,
tooltip: {
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 != "") {
return `名稱:${params.data.device_node_full_name}<br>
Guid${params.data.device_node_guid}`
@ -275,10 +276,18 @@
floChart.setOption(option);
if (currentData != undefined && currentData != null && currentData.length > 0) {
resetData();
}
var ordPath = {
"building_tag": pageAct.buiTag,
"system_tag": pageAct.sysMainTag,
}
//myBaja.setSubscribeDevicesByBql(ordPath);
//myBaja.setSubscribeDevicesCallBack(subscribeCallBack);
console.log(floChart)
floChart.getZr().on('click', function (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() {
console.log(123)
debugger
const scatter_symbol_convertData = function (data) { //正常、關閉排除CCVT(圓點)
let res = [], temp = [];
data.forEach(function (item, index) {
if (global_emergency_alarm_device_number != undefined
&& global_emergency_alarm_device_number != null) {
@ -528,7 +574,7 @@
const scatter_icon_convertData = function (data) { //正常、關閉(icon)
let res = [], temp = [];
debugger
data.forEach(function (item, index) {
if (global_emergency_alarm_device_number != undefined
&& global_emergency_alarm_device_number != null) {
@ -539,7 +585,7 @@
//添加父節點相關資訊
item_node.device_system_category_layer3 = item.device_system_category_layer3;
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);
});
} else {
@ -567,7 +613,7 @@
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,
status: item.status,
symbol: 'image://' + str_location_url + "/upload/device_icon/" + item.device_image,
symbol: 'image://' + item.device_image_url,
value: item.value,
deviceItems: item.deviceItems,
deviceURL: item.deviceURL
@ -674,7 +720,7 @@
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,
status: item.status,
symbol: 'image://' + str_location_url + "/upload/device_icon/" + item.device_image,
symbol: 'image://' + item.device_image_url,
value: item.value,
deviceItems: item.deviceItems,
deviceURL: item.deviceURL
@ -722,7 +768,6 @@
}
if (zoom <= 8) {
floChart.setOption({
series: [{
symbolOffset: [0, 0],

View File

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

View File

@ -259,19 +259,19 @@ namespace FrontendWebApi.ApiControllers
/// </summary>
/// <param name="fd"></param>
/// <returns></returns>
[HttpPost]
[HttpGet]
[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>>();
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
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
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);
if (device.Count == 0)