function editRow(orgin_data,index,channel_power_infro) { const current_upper = document.getElementById('current_upper'); const voltage_upper = document.getElementById('voltage_upper'); const voltage_lower = document.getElementById('voltage_lower'); const p_upper = document.getElementById('p_upper'); const c_upper = document.getElementById('c_upper'); const updateRow = document.getElementById('updateRow') const closeModal = document.getElementById('closeModal') threshold = channel_power_infro c_u_val = threshold.thr.c_upper.val v_u_val = threshold.thr.v_upper.val v_l_val = threshold.thr.v_lower.val p_u_val = threshold.thr.p_upper.val w_u_val = threshold.thr.w_upper.val current_upper.value = c_u_val; voltage_upper.value = v_u_val; voltage_lower.value = v_l_val; if(voltage_upper.value < voltage_lower.value){ alert("电压上限值不能小于电压下限值") voltage_lower.value = 0 } p_upper.value = p_u_val; c_upper.value = w_u_val; document.getElementById('editModal').style.display = 'block'; updateRow.addEventListener('click',function(){ const current_uppers = document.getElementById('current_upper').value; const voltage_uppers = document.getElementById('voltage_upper').value; const voltage_lowers = document.getElementById('voltage_lower').value; const p_uppers = document.getElementById('p_upper').value; const c_uppers = document.getElementById('c_upper').value; const alarm_opration = document.getElementById('mySelect').value if(alarm_opration == 'option1') { voltage_u = parseInt(voltage_uppers, 10) voltage_ls = parseInt(voltage_lowers, 10) if(voltage_u >= voltage_ls) { threshold.thr.c_upper.val = Number(current_uppers); threshold.thr.v_upper.val= Number(voltage_uppers); threshold.thr.v_lower.val = Number(voltage_lowers); threshold.thr.p_upper.val = Number(p_uppers); threshold.thr.w_upper.val = Number(c_uppers); if(current_uppers != 0) { threshold.thr.c_upper.en = 1 } if(voltage_uppers != 0) { threshold.thr.v_upper.en = 1 } if(voltage_lowers != 0) { threshold.thr.v_lower.en = 1 } if(p_uppers != 0) { threshold.thr.p_upper.en = 1 } if(c_uppers != 0) { threshold.thr.w_upper.en = 1 } threshold_update(threshold) setInterval(quite(),3000) }else { alert("电压上限值不能小于下限值") voltage_upper.value = 0 voltage_lower.value = 0 } } }); closeModal.addEventListener('click',function(){ document.getElementById('editModal').style.display = 'none'; currentRowIndex = null; }); } function quite() { document.getElementById('editModal').style.display = 'none'; currentRowIndex = null; }