[Frontend] baja輸出格式更改
This commit is contained in:
parent
bcb07e0054
commit
7bb23e0679
@ -30,13 +30,17 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
|
|||||||
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
|
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
|
||||||
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
||||||
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
|
_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++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index;
|
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||||
_result += _ss;
|
_result += _ss;
|
||||||
_result += '}';
|
_result += ']}';
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(_result);
|
callback(_result);
|
||||||
}
|
}
|
||||||
@ -84,7 +88,6 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
|||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index + ', "data":[';
|
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||||
|
|
||||||
_result += _ss + ']';
|
_result += _ss + ']';
|
||||||
_result += '}';
|
_result += '}';
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
@ -111,13 +114,16 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) {
|
|||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
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++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index;
|
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||||
_result += _ss;
|
_result += _ss;
|
||||||
_result += '}';
|
_result += ']}';
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(_result);
|
callback(_result);
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,16 @@ function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millise
|
|||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
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++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index;
|
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||||
_result += _ss;
|
_result += _ss;
|
||||||
_result += '}';
|
_result += ']}';
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(_result);
|
callback(_result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user