var fnDataCamcel = require('../../Plugins/fn-common-data-camcel.js');
module.exports = function (callback, result, params, args) {
let argParams = JSON.parse(result);
let paramsT = JSON.parse(params);
if (paramsT._dataFromType === "api") {
//api
callback(null, argParams);
} else if (paramsT._dataFromType === "configFile") {
//静态数据
callback(null, argParams);
} else if (argParams.Success === true) {
if (argParams.Children) {
fnDataCamcel.mergeBsObject(argParams.Data, argParams.Children);
delete argParams.Children;
}
//扩展代码处理 start
if (argParams.data.length > 0) {
const dataT = argParams.data;
//
argParams.data = [
{
"name": "严重告警",
"value": dataT[0].levelYz||0
},
{
"name": "重要告警",
"value": dataT[0].levelZy || 0
},
{
"name": "次要告警",
"value": dataT[0].levelCy || 0
},
{
"name": "一般告警",
"value": dataT[0].levelYb || 0
}
];
} else {
argParams.data = [
{
"name": "严重告警",
"value": 0
},
{
"name": "重要告警",
"value": 0
},
{
"name": "次要告警",
"value": 0
},
{
"name": "一般告警",
"value": 0
}
];
}
//扩展代码处理 end
//数据库
if (paramsT["_nodejs"] !== "common-data-under") {
fnDataCamcel.toLowerCamcelByObject(argParams, paramsT["_null"] !== "true");
}
delete argParams.schema;
delete argParams.dimension;
if (argParams.children) {
fnDataCamcel.mergeBsObject(argParams.data, argParams.children);
delete argParams.children;
}
callback(null, argParams);
} else {
callback(null, argParams);
}
};
//if (paramsT["_nodejs"] !== "common-data-under") {
// fnDataCamcel.toLowerCamcelByObject(lastData, paramsT["_null"] !== "true");
//}
//if (argParams.success === true) {
// //
// //argParams.data.power_free = {
// //}
文档更新时间: 2021-07-04 08:00 作者:admin