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 v_u_val = threshold.thr.v_upper v_l_val = threshold.thr.v_lower p_u_val = threshold.thr.p_upper w_u_val = threshold.thr.w_upper current_upper.value = c_u_val / 10.0; voltage_upper.value = v_u_val / 10.0; voltage_lower.value = v_l_val / 10.0; if (voltage_upper.value < voltage_lower.value) { alert("电压上限值不能小于电压下限值") voltage_lower.value = 0 } p_upper.value = p_u_val / 1000.0; c_upper.value = w_u_val / 1000.0; document.getElementById('editModal').style.display = 'block'; updateRow.addEventListener('click', function() { const current_uppers = document.getElementById('current_upper').value * 10; const voltage_uppers = document.getElementById('voltage_upper').value * 10; const voltage_lowers = document.getElementById('voltage_lower').value * 10; const p_uppers = document.getElementById('p_upper').value * 1000; const c_uppers = document.getElementById('c_upper').value * 1000; 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.en = 0; threshold.thr.c_upper = Number(current_uppers); threshold.thr.v_upper = Number(voltage_uppers); threshold.thr.v_lower = Number(voltage_lowers); threshold.thr.p_upper = Number(p_uppers); threshold.thr.w_upper = 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; }