| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- channle_datas = []
- let currentNumber = 1;
- let resultArray = [];
- const cyclesPerNumber = 3;
- let button_status = [];
- const data = [];
- const datas = []
- const finall_data = []
- const processing_data = {}
- // function data_process()
- // {
- // //chaannle_length = pageData.length
- // // for(let i = 1;i<chaannle_length;i++)
- // // {
- // // channle_datas.push(pageData[i])
- // // }
- // //const totalIterations = channle_datas.length;
- // const text_length = data_arr.length
- // // for (let i = 0; i < totalIterations; i++) {
- // // resultArray.push(currentNumber);
- // // if ((i + 1) % cyclesPerNumber === 0) {
- // // // 如果是,则递增数字
- // // currentNumber++;
- // // }
- // // }
- // channle_datas = data_arr
- // for(let j = 0;j < text_length;j++)
- // {
- // j_type = channle_datas[j].info.type
- // if(j_type = 1)
- // {
- // j_c_type = '直流'
- // }
- // if(j_type = 3)
- // {
- // j_c_type = '三相'
- // }
- // if(j_type = 5)
- // {
- // j_c_type = '单相'
- // }
- // j_open_time = channle_datas[j].info.start_delay
- // j_close_time = channle_datas[j].info.stop_delay
- // j_device_name = 'SmartPDU'
- // j_channle_name = `CH${j+1}`
- // for(let i = 0;i<3;i++)
- // {
- // j_status = channle_datas[j].power[i].status
- // j_channle = channle_datas[j].power[i]
- // j_infor = channle_datas[j].info
- // if(j_status = 0)
- // {
- // j_c_status = '关闭'
- // datas.push(j_device_name),
- // datas.push(j_channle_name),
- // datas.push(j),
- // datas.push(j_c_type),
- // datas.push(j_c_status),
- // datas.push(j_open_time),
- // datas.push(j_close_time),
- // datas.push(j_channle.voltage),
- // datas.push(j_channle.current),
- // datas.push(j_channle.power),
- // datas.push(j_channle.freq),
- // datas.push(j_channle.consump)
- // datas.push(j_channle.factor)
- // num = datas
- // }
- // if(j_status = 1)
- // {
- // j_c_status = '关闭'
- // datas.push(j_device_name),
- // datas.push(j_channle_name),
- // datas.push(j),
- // datas.push(j_c_type),
- // datas.push(j_c_status),
- // datas.push(j_open_time),
- // datas.push(j_close_time),
- // datas.push(j_channle.voltage),
- // datas.push(j_channle.current),
- // datas.push(j_channle.power),
- // datas.push(j_channle.freq),
- // datas.push(j_channle.consump)
- // datas.push(j_channle.factor)
- // num = datas
- // }
- // for(let n = 0;n<num.length;n++)
- // {
- // processing_data[chanle_data_process[n]] = num[n];
- // }
- // finall_data.push(processing_data)
- // }
- // }
- // j_processed_data = finall_data
- // }
- const result = [];
- function alarm_process(alarmd_data)
- {
- const alarmProperties = alarmd_data.alarm;
- const baseProperties = {
- "ch": alarmd_data.ch,
- "time": alarmd_data.time
- };
- let idCounter = 1;
-
- for (const key in alarmProperties) {
- if (alarmProperties.hasOwnProperty(key) && alarmProperties[key] == 1) {
- const newObj = { ...baseProperties, [key]: alarmProperties[key], "id": idCounter++ };
- result.push(newObj);
- }
- }
-
- return result;
- }
|