Threshold_Adjust.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. function editRow(orgin_data,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. threshold = channel_power_infro
  10. c_u_val = threshold.thr.c_upper.val
  11. v_u_val = threshold.thr.v_upper.val
  12. v_l_val = threshold.thr.v_lower.val
  13. p_u_val = threshold.thr.p_upper.val
  14. w_u_val = threshold.thr.w_upper.val
  15. current_upper.value = c_u_val;
  16. voltage_upper.value = v_u_val;
  17. voltage_lower.value = v_l_val;
  18. if(voltage_upper.value < voltage_lower.value){
  19. alert("电压上限值不能小于电压下限值")
  20. voltage_lower.value = 0
  21. }
  22. p_upper.value = p_u_val;
  23. c_upper.value = w_u_val;
  24. document.getElementById('editModal').style.display = 'block';
  25. updateRow.addEventListener('click',function(){
  26. const current_uppers = document.getElementById('current_upper').value;
  27. const voltage_uppers = document.getElementById('voltage_upper').value;
  28. const voltage_lowers = document.getElementById('voltage_lower').value;
  29. const p_uppers = document.getElementById('p_upper').value;
  30. const c_uppers = document.getElementById('c_upper').value;
  31. const alarm_opration = document.getElementById('mySelect').value
  32. if(alarm_opration == 'option1')
  33. {
  34. voltage_u = parseInt(voltage_uppers, 10)
  35. voltage_ls = parseInt(voltage_lowers, 10)
  36. if(voltage_u >= voltage_ls)
  37. {
  38. threshold.thr.c_upper.val = Number(current_uppers);
  39. threshold.thr.v_upper.val= Number(voltage_uppers);
  40. threshold.thr.v_lower.val = Number(voltage_lowers);
  41. threshold.thr.p_upper.val = Number(p_uppers);
  42. threshold.thr.w_upper.val = Number(c_uppers);
  43. if(current_uppers != 0)
  44. {
  45. threshold.thr.c_upper.en = 1
  46. }
  47. if(voltage_uppers != 0)
  48. {
  49. threshold.thr.v_upper.en = 1
  50. }
  51. if(voltage_lowers != 0)
  52. {
  53. threshold.thr.v_lower.en = 1
  54. }
  55. if(p_uppers != 0)
  56. {
  57. threshold.thr.p_upper.en = 1
  58. }
  59. if(c_uppers != 0)
  60. {
  61. threshold.thr.w_upper.en = 1
  62. }
  63. threshold_update(threshold)
  64. setInterval(quite(),3000)
  65. }else
  66. {
  67. alert("电压上限值不能小于下限值")
  68. voltage_upper.value = 0
  69. voltage_lower.value = 0
  70. }
  71. }
  72. });
  73. closeModal.addEventListener('click',function(){
  74. document.getElementById('editModal').style.display = 'none';
  75. currentRowIndex = null;
  76. });
  77. }
  78. function quite()
  79. {
  80. document.getElementById('editModal').style.display = 'none';
  81. currentRowIndex = null;
  82. }