diff --git a/Backend/App_Data/bajaJsList.ods b/Backend/App_Data/bajaJsList.ods index 8f63b6d..445e2df 100644 Binary files a/Backend/App_Data/bajaJsList.ods and b/Backend/App_Data/bajaJsList.ods differ diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js index 08a3261..086d858 100644 --- a/Frontend/js/n4js/alarmbaja.js +++ b/Frontend/js/n4js/alarmbaja.js @@ -26,13 +26,17 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i _sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_'); _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8]; - _ss += ', "' + _index + '": {"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; + + if (_index == 0) + _ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; + else + _ss += ',{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; _index++; }, after: function () { - _result += '{' + '"count": ' + _index; + _result += '{' + '"count": ' + _index + ', "data":['; _result += _ss; - _result += '}'; + _result += ']}'; if (typeof callback === 'function') { callback(_result); } @@ -64,9 +68,8 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { _index++; }, after: function () { - _result += '{' + '"count": ' + _index +', data:['; - - _result += _ss+']'; + _result += '{' + '"count": ' + _index + ', "data":['; + _result += _ss + ']'; _result += '}'; if (typeof callback === 'function') { callback(_result); @@ -92,13 +95,16 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) { .then(function (table) { return table.cursor({ each: function (record) { - _ss += ', "' + _index + '": {"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; + if (_index == 0) + _ss += '{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; + else + _ss += ',{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; _index++; }, after: function () { - _result += '{' + '"count": ' + _index; + _result += '{' + '"count": ' + _index + ', "data":['; _result += _ss; - _result += '}'; + _result += ']}'; if (typeof callback === 'function') { callback(_result); } diff --git a/Frontend/js/n4js/historybaja.js b/Frontend/js/n4js/historybaja.js index 0464754..3c5bb22 100644 --- a/Frontend/js/n4js/historybaja.js +++ b/Frontend/js/n4js/historybaja.js @@ -18,13 +18,16 @@ function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millise .then(function (table) { return table.cursor({ each: function (record) { - _ss += ', "' + _index + '": {"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}'; + if (_index == 0) + _ss += '{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}'; + else + _ss += ',{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}'; _index++; }, after: function () { - _result += '{' + '"count": ' + _index; + _result += '{' + '"count": ' + _index + ', "data":['; _result += _ss; - _result += '}'; + _result += ']}'; if (typeof callback === 'function') { callback(_result); } diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index c6a3e65..ad78366 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -61,13 +61,16 @@ namespace FrontendWebApi.ApiControllers { var dbsub = await frontendRepository.GetAllAsync( @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority, - dk.device_normal_color, dk.device_close_color, dk.device_error_color + dk.device_normal_color, dk.device_close_color, dk.device_error_color, + di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram, + di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link from role_auth a join auth_page b on a.AuthCode = b.AuthCode join userinfo c on c.role_guid = a.role_guid join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag + left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0 where c.account = @account order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag }); var mains = dbsub.GroupBy(a => a.main_system_tag).ToList(); diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index 3f3269c..519ea79 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -62,6 +62,14 @@ namespace FrontendWebApi.Models public string device_normal_color { get; set; } public string device_close_color { get; set; } public string device_error_color { get; set; } + public string device_item_name { get; set; } + public string device_item_points { get; set; } + public string device_item_unit { get; set; } + public byte device_item_is_show { get; set; } + public byte device_item_is_show_riserDiagram { get; set; } + public byte device_item_is_controll { get; set; } + public byte device_item_is_bool { get; set; } + public byte device_item_is_link { get; set; } } public class BuildingFloorRawData