function getToCurrentPeriod(formula,startTime, parameter){
var res = [];
var obj = {
"entId":parameter.entId,
"templateVarValType":parameter.templateVarValType,
"unitId":parameter.unitId+"",
"aliasFormula": "A1",
"sheetIndex": parameter.sheetIndex,
"rowIndex": parameter.rowIndex,
"colIndex": parameter.colIndex,
"detList": [{
"aliasName": "A1",
"collectionFormula":formula.substring(1),
"startTime": startTime,
"endTime": parameter.endTime
}]
};
res.push(obj);
// 必须转为json格式
return JSON.stringify(res);
}
var para = {
"entId": 87685456,
"templateVarValType": "采集值",
"unitId": "396731776942485518",
"sheetIndex": 0,
"rowIndex": 1,
"colIndex": 1,
"startTime": "2022-08-01 23:30:00",
"endTime": "2022-08-02 07:30:00",
"cycle": "班",
"year": 2022,
"yearNum": 2,
"quarter": 3,
"month": 8,
"day": 2,
"factoryCalendarDTO": {
calendarDOList: [
{
"year": 2022,
"month": 8,
"startTime": "2022-08-01 00:00:00",
"endTime": "2022-08-31 00:00:00"
}
],
shiftDOList: [
{
"startDay": 0,
"endTDay": 1,
"startTime": "23:00:00",
"endTime": "07:00:00"
},
{
"startDay": 1,
"endTDay": 1,
"startTime": "07:00:00",
"endTime": "15:00:00"
},
{
"startDay": 1,
"endTDay": 1,
"startTime": "15:00:00",
"endTime": "23:00:00"
},
]
}
};
console.log(getToCurrentPeriod("#JLDL009+JLDL007", "2021-01-01 00:00:00",para));
console