DmitrMakeev commited on
Commit
3859e93
·
verified ·
1 Parent(s): ebb5cb9

Update nutri_call.html

Browse files
Files changed (1) hide show
  1. nutri_call.html +23 -11
nutri_call.html CHANGED
@@ -1450,15 +1450,26 @@ function calculateMicroElements() {
1450
 
1451
  function calculateMicroElements2() {
1452
  // 1. Получаем объем раствора (в литрах)
1453
- const solutionVolume = parseFloat(document.getElementById('liters-input').value);
 
 
 
 
 
1454
  if (!solutionVolume || solutionVolume <= 0) {
1455
  alert("Введите корректный объем раствора!");
1456
  return;
1457
  }
1458
 
1459
  // 2. Получаем массы удобрений (в граммах)
1460
- const feChelateMass = parseFloat(document.getElementById('fert_fe_chelate_mass').value) || 0;
1461
- const complexPowderMass = parseFloat(document.getElementById('fert_complex_mass').value) || 0;
 
 
 
 
 
 
1462
 
1463
  // 3. Содержание микроэлементов в удобрениях (%)
1464
  const feChelateContent = {
@@ -1491,17 +1502,18 @@ function calculateMicroElements2() {
1491
  }
1492
 
1493
  // 6. Выводим результаты в соответствующие поля матрицы
1494
- document.getElementById('ppm_fe').value = ppm.Fe?.toFixed(3) || 0;
1495
- document.getElementById('ppm_zn').value = ppm.Zn?.toFixed(3) || 0;
1496
- document.getElementById('ppm_cu').value = ppm.Cu?.toFixed(3) || 0;
1497
- document.getElementById('ppm_mn').value = ppm.Mn?.toFixed(3) || 0;
1498
- document.getElementById('ppm_b').value = ppm.B?.toFixed(3) || 0;
1499
- document.getElementById('ppm_mo').value = ppm.Mo?.toFixed(3) || 0;
 
 
 
1500
 
1501
  console.log("=== РАСЧЕТ PPM ===", ppm);
1502
  }
1503
-
1504
-
1505
 
1506
  </script>
1507
 
 
1450
 
1451
  function calculateMicroElements2() {
1452
  // 1. Получаем объем раствора (в литрах)
1453
+ const litersInput = document.getElementById('liters-input');
1454
+ if (!litersInput) {
1455
+ console.error("Элемент с id='liters-input' не найден!");
1456
+ return;
1457
+ }
1458
+ const solutionVolume = parseFloat(litersInput.value);
1459
  if (!solutionVolume || solutionVolume <= 0) {
1460
  alert("Введите корректный объем раствора!");
1461
  return;
1462
  }
1463
 
1464
  // 2. Получаем массы удобрений (в граммах)
1465
+ const feChelateInput = document.getElementById('fert_fe_chelate_mass');
1466
+ const complexPowderInput = document.getElementById('fert_fe_complex_mass');
1467
+ if (!feChelateInput || !complexPowderInput) {
1468
+ console.error("Один из элементов для ввода масс удобрений не найден!");
1469
+ return;
1470
+ }
1471
+ const feChelateMass = parseFloat(feChelateInput.value) || 0;
1472
+ const complexPowderMass = parseFloat(complexPowderInput.value) || 0;
1473
 
1474
  // 3. Содержание микроэлементов в удобрениях (%)
1475
  const feChelateContent = {
 
1502
  }
1503
 
1504
  // 6. Выводим результаты в соответствующие поля матрицы
1505
+ const outputFields = ['ppm_fe', 'ppm_zn', 'ppm_cu', 'ppm_mn', 'ppm_b', 'ppm_mo'];
1506
+ outputFields.forEach((field, index) => {
1507
+ const element = document.getElementById(field);
1508
+ if (element) {
1509
+ element.value = ppm[Object.keys(ppm)[index]]?.toFixed(3) || 0;
1510
+ } else {
1511
+ console.error(`Элемент с id='${field}' не найден!`);
1512
+ }
1513
+ });
1514
 
1515
  console.log("=== РАСЧЕТ PPM ===", ppm);
1516
  }
 
 
1517
 
1518
  </script>
1519