modify landing page
This commit is contained in:
commit
dd232b1c02
2599 files changed
+226992
No files matched your search
@@ -0,0 +1,169 @@
|
||||
<div class="container page">
|
||||
<h1 class="page-title">ขนาดสระน้ำ</h1>
|
||||
<p class="page-lead">
|
||||
คิดปริมาตรบ่อจากรูปทรงเรขาคณิต (ปริมาตรขุด + ระดับน้ำใช้การ) และบวกน้ำฝนที่ไหลลงสระ
|
||||
— ยังไม่คิดน้ำท่า/น้ำนอง ซึ่งต้องใช้ข้อมูลอุทกวิทยารายพื้นที่
|
||||
</p>
|
||||
|
||||
<form id="pd-form" class="calc" novalidate>
|
||||
<div class="field">
|
||||
<label for="pd-shape">รูปทรงผนังบ่อ</label>
|
||||
<select id="pd-shape">
|
||||
<option value="trapezoid">ผนังลาด (ขุดบ่อทั่วไป)</option>
|
||||
<option value="box">ผนังตั้งฉาก (บ่อคอนกรีต/บ่อ lined)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field" id="pd-slope-field">
|
||||
<label for="pd-slope">ความชันผนัง (แนวนอน ต่อ 1 แนวตั้ง)</label>
|
||||
<input id="pd-slope" type="number" inputmode="decimal" step="0.1" min="0" value="1.5">
|
||||
<span class="hint">ดินทั่วไป 1:1.5 · ดินร่วนมาก 1:2 · ผนังตั้งฉากใส่ 0</span>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="pd-length">ความยาวปากบ่อ (ม.)</label>
|
||||
<input id="pd-length" type="number" inputmode="decimal" step="0.5" min="1" value="40">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="pd-width">ความกว้างปากบ่อ (ม.)</label>
|
||||
<input id="pd-width" type="number" inputmode="decimal" step="0.5" min="1" value="30">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="pd-depth">ความลึกบ่อ (ม.)</label>
|
||||
<input id="pd-depth" type="number" inputmode="decimal" step="0.25" min="0.5" value="4">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="pd-usable">ระดับน้ำใช้การ (% ของความลึก)</label>
|
||||
<input id="pd-usable" type="number" inputmode="decimal" step="5" min="10" max="100" value="80">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="pd-catchment">พื้นที่รับน้ำฝน (ไร่)</label>
|
||||
<input id="pd-catchment" type="number" inputmode="decimal" step="0.5" min="0" value="10">
|
||||
<span class="hint">พื้นที่แปลง/ลานที่น้ำฝนไหลลงสระ — ไม่ใส่ก็ได้ (ใส่ 0)</span>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="pd-rain">น้ำฝนที่ตก (มม.)</label>
|
||||
<input id="pd-rain" type="number" inputmode="decimal" step="1" min="0" value="60">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="pd-runoff">สัดส่วนน้ำฝนที่ไหลลงสระ</label>
|
||||
<input id="pd-runoff" type="number" inputmode="decimal" step="0.05" min="0" max="1" value="0.8">
|
||||
<span class="hint">ดินเปิด/แปลงเกษตร ~0.3–0.6 · หลังคา/ลานคอนกรีต ~0.85–0.95</span>
|
||||
</div>
|
||||
<div class="calc-actions field--wide">
|
||||
<button type="submit">คำนวณ</button>
|
||||
<button type="button" class="ghost" id="pd-reset">ค่าเริ่มต้น</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<section class="result" id="pd-result" hidden aria-live="polite">
|
||||
<div>
|
||||
<span class="result-value" id="pd-value">—</span>
|
||||
<span class="result-unit">ลบ.ม. (น้ำใช้การ + น้ำฝน)</span>
|
||||
</div>
|
||||
<div class="result-grid">
|
||||
<div class="result-item">ปริมาตรขุด <b id="pd-exc">—</b>ลบ.ม.</div>
|
||||
<div class="result-item">น้ำใช้การ <b id="pd-usable-vol">—</b>ลบ.ม.</div>
|
||||
<div class="result-item">น้ำฝนลงสระ <b id="pd-rain-vol">—</b>ลบ.ม.</div>
|
||||
<div class="result-item">ขนาดก้นบ่อ <b id="pd-bottom">—</b>ม.</div>
|
||||
</div>
|
||||
<ul class="warn-list" id="pd-warnings" hidden></ul>
|
||||
<table class="steps" id="pd-steps">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ขั้นตอน</th>
|
||||
<th>ค่า</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<p class="note">
|
||||
ปริมาตรน้ำใช้การ = ปริมาตรระหว่างก้นบ่อถึงระดับน้ำใช้การ (สูตร frustum: V = h/3 × (Aล่าง + Aบน + √(Aล่าง×Aบน)))
|
||||
· สูตรอยู่ใน <code>core/pond.js</code> · ยังไม่คิดการระเหย/รั่วซึมรายเดือน และน้ำท่า–น้ำนอง
|
||||
(เอกสารวิธีคำนวณอยู่ใน <code>Document/คำนวณขนาดสระน้ำ/</code>)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { calculatePondVolume } from './core/pond.js';
|
||||
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const form = $('pd-form');
|
||||
const result = $('pd-result');
|
||||
const slopeField = $('pd-slope-field');
|
||||
|
||||
function syncShape() {
|
||||
const isBox = $('pd-shape').value === 'box';
|
||||
slopeField.style.display = isBox ? 'none' : '';
|
||||
}
|
||||
|
||||
function render(outcome) {
|
||||
result.hidden = false;
|
||||
$('pd-value').textContent = outcome.value.toFixed(2);
|
||||
$('pd-exc').textContent = outcome.details.excavated_volume_m3.toFixed(2) + ' ';
|
||||
$('pd-usable-vol').textContent = outcome.details.usable_volume_m3.toFixed(2) + ' ';
|
||||
$('pd-rain-vol').textContent = outcome.details.rain_harvest_m3.toFixed(2) + ' ';
|
||||
$('pd-bottom').textContent =
|
||||
outcome.details.bottom_length_m.toFixed(2) + ' × ' + outcome.details.bottom_width_m.toFixed(2) + ' ';
|
||||
|
||||
const list = $('pd-warnings');
|
||||
list.innerHTML = outcome.warnings.map((text) => `<li>${text}</li>`).join('');
|
||||
list.hidden = outcome.warnings.length === 0;
|
||||
|
||||
$('pd-steps').querySelector('tbody').innerHTML = outcome.steps
|
||||
.map((step) => `<tr><td>${step.label}</td><td>${step.value} ${step.unit}</td></tr>`)
|
||||
.join('');
|
||||
}
|
||||
|
||||
function showError(message) {
|
||||
result.hidden = false;
|
||||
$('pd-value').textContent = '—';
|
||||
const list = $('pd-warnings');
|
||||
list.innerHTML = `<li>${message}</li>`;
|
||||
list.hidden = false;
|
||||
}
|
||||
|
||||
function run() {
|
||||
try {
|
||||
const outcome = calculatePondVolume({
|
||||
shape: $('pd-shape').value,
|
||||
top_length_m: $('pd-length').value,
|
||||
top_width_m: $('pd-width').value,
|
||||
depth_m: $('pd-depth').value,
|
||||
side_slope_horizontal_per_vertical: $('pd-slope').value,
|
||||
usable_depth_percent: $('pd-usable').value,
|
||||
catchment_rai: $('pd-catchment').value,
|
||||
rainfall_mm: $('pd-rain').value,
|
||||
runoff_coefficient: $('pd-runoff').value
|
||||
});
|
||||
render(outcome);
|
||||
} catch (error) {
|
||||
showError(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
form.addEventListener('submit', (event) => {
|
||||
event.preventDefault();
|
||||
run();
|
||||
});
|
||||
$('pd-shape').addEventListener('change', () => {
|
||||
syncShape();
|
||||
run();
|
||||
});
|
||||
$('pd-reset').addEventListener('click', () => {
|
||||
$('pd-shape').value = 'trapezoid';
|
||||
$('pd-slope').value = '1.5';
|
||||
$('pd-length').value = '40';
|
||||
$('pd-width').value = '30';
|
||||
$('pd-depth').value = '4';
|
||||
$('pd-usable').value = '80';
|
||||
$('pd-catchment').value = '10';
|
||||
$('pd-rain').value = '60';
|
||||
$('pd-runoff').value = '0.8';
|
||||
syncShape();
|
||||
run();
|
||||
});
|
||||
|
||||
syncShape();
|
||||
run();
|
||||
</script>
|
||||
Reference in new issue
Block a user