function total_Infor(j,total_data){ len = total_data.length //显示总信息 for(let i = 0;i<=len-1;i++) { num = i + 1 voltage = total_data[i].voltage.toFixed(2) current = total_data[i].current.toFixed(2) power = total_data[i].power power = power / 1000 power = power.toFixed(3) consump = total_data[i].consump if(consump <= 0) { consump = 0 } consump = consump / 1000 consump = consump.toFixed(3) freq = total_data[i].freq.toFixed(2) Voltage = document.getElementById("L"+num+"_voltage") Current = document.getElementById("L"+num+"_current") Power = document.getElementById("L"+num+"_power") Consump = document.getElementById("L"+num+"_power_consumption") Freq = document.getElementById("L"+num+"_freq") Voltage.textContent = voltage Current.textContent = current Power.textContent = power Consump.textContent = consump Freq.textContent = freq } } function Channel_Info(j_data,channel_power_infro) { channel_length = channel_power_infro.length channel_display(j_data,channel_power_infro,channel_infro) } function threshold_mannage(orgin_data,channel_power_infro,threshold) { // 获取要插入新行的DOM元素 const dataList = document.getElementById('threshold_mannage'); // 清空现有的列表项 dataList.innerHTML = ''; channel_length = threshold.c_upper.act_para.length current_upper = threshold.c_upper.act_para voltage_upper = threshold.v_upper.act_para voltage_lower = threshold.v_lower.act_para power_upper = threshold.p_upper.act_para consump_upper = threshold.w_upper.act_para //遍历数据数组 for(let i = 0;i<=channel_length-1;i++) { j = i + 1 // 创建一个新的列表项元素 const listItem = document.createElement('tr'); dataList.appendChild(listItem); //自动生成电源类型列 const power_type_td = document.createElement('td'); power_type_td.textContent = "通道" dataList.appendChild(power_type_td); //自动生成名称列 const Chananl_name_td = document.createElement('td'); Chananl_name_td.textContent = "CH"+j dataList.appendChild(Chananl_name_td); //自动生成编号列 const Chananl_num_td = document.createElement('td'); Chananl_num_td.textContent = j dataList.appendChild(Chananl_num_td); //自动生成电流上限列 const current_max_td = document.createElement('td'); current_max_td.textContent = current_upper[i] dataList.appendChild(current_max_td); // 自动生成电压上限列 const voltage_max_td = document.createElement('td'); voltage_max_td.textContent = voltage_upper[i]; dataList.appendChild(voltage_max_td); // 自动生成电压下限列 const voltage_min_td = document.createElement('td'); voltage_min_td.textContent = voltage_lower[i]; dataList.appendChild(voltage_min_td); // 自动生成功率上限列 const power_max_td = document.createElement('td'); power_max_td.textContent = power_upper[i]; dataList.appendChild(power_max_td); // 自动生成耗电量上限列 const consump_td = document.createElement('td'); consump_td.textContent = consump_upper[i]; dataList.appendChild(consump_td); // 自动生成配置按钮列 const operation_td = document.createElement('button'); operation_td.textContent = '配置'; operation_td.id = "edite"+{i} operation_td.addEventListener('click', function() { editRow(orgin_data,threshold,i,channel_power_infro) }); dataList.appendChild(operation_td); } } function now_time() { const now = new Date(); // 获取年、月、日、小时、分钟和秒 const year = now.getFullYear(); const month = now.getMonth() + 1; const day = now.getDate(); const hours = now.getHours(); const minutes = now.getMinutes(); const seconds = now.getSeconds(); formattedTime = `${year}-${month < 10 ? '0' : ''}${month}-${day < 10 ? '0' : ''}${day} ${hours < 10 ? '0' : ''}${hours}:${minutes < 10 ? '0' : ''}${minutes}:${seconds < 10 ? '0' : ''}${seconds}`; return formattedTime }