Threshold_Adjust.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. function editRow(orgin_data,threshold,index,channel_power_infro) {
  2. const current_upper = document.getElementById('current_upper');
  3. const voltage_upper = document.getElementById('voltage_upper');
  4. const voltage_lower = document.getElementById('voltage_lower');
  5. const p_upper = document.getElementById('p_upper');
  6. const c_upper = document.getElementById('c_upper');
  7. const updateRow = document.getElementById('updateRow')
  8. const closeModal = document.getElementById('closeModal')
  9. current_upper.value = threshold.c_upper.act_para[index];
  10. voltage_upper.value = threshold.v_upper.act_para[index];
  11. voltage_lower.value = threshold.v_lower.act_para[index];
  12. if(voltage_upper.value < voltage_lower.value){
  13. alert("电压上限值不能小于电压下限值")
  14. voltage_lower.value = 0
  15. }
  16. p_upper.value = threshold.p_upper.act_para[index];
  17. c_upper.value = threshold.w_upper.act_para[index];
  18. document.getElementById('editModal').style.display = 'block';
  19. updateRow.addEventListener('click',function(){
  20. const current_uppers = document.getElementById('current_upper').value;
  21. const voltage_uppers = document.getElementById('voltage_upper').value;
  22. const voltage_lowers = document.getElementById('voltage_lower').value;
  23. const p_uppers = document.getElementById('p_upper').value;
  24. const c_uppers = document.getElementById('c_upper').value;
  25. if(voltage_uppers >= voltage_lowers)
  26. {
  27. threshold.c_upper.act_para[index] = Number(current_uppers);
  28. threshold.v_upper.act_para[index] = Number(voltage_uppers);
  29. threshold.v_lower.act_para[index] = Number(voltage_lowers);
  30. threshold.p_upper.act_para[index] = Number(p_uppers);
  31. threshold.w_upper.act_para[index] = Number(c_uppers);
  32. channel_power_infro.thr = threshold
  33. orgin_data.powerc = channel_power_infro
  34. threshold_update(orgin_data)
  35. }else
  36. {
  37. alert("电压上限值不能小于下限值")
  38. voltage_upper.value = 0
  39. voltage_lower.value = 0
  40. }
  41. });
  42. closeModal.addEventListener('click',function(){
  43. document.getElementById('editModal').style.display = 'none';
  44. currentRowIndex = null;
  45. });
  46. }