diff --git a/app.py b/app.py index e3c6a9a..fa3c747 100644 --- a/app.py +++ b/app.py @@ -173,5 +173,11 @@ def test_port(): except Exception as e: return jsonify({'success': False, 'message': f'测试失败: {str(e)}'}) +@app.route('/clear_signal_data', methods=['POST']) +def clear_signal_data(): + global signal_data + signal_data = [] + return '', 204 + if __name__ == '__main__': app.run(debug=True, host='0.0.0.0', port=5888) diff --git a/static/images/celex_logo.png b/static/images/celex_logo.png new file mode 100644 index 0000000..841bd32 Binary files /dev/null and b/static/images/celex_logo.png differ diff --git a/static/main.js b/static/main.js index 69108f2..58c3e7c 100644 --- a/static/main.js +++ b/static/main.js @@ -85,33 +85,38 @@ function resetCheckList() { function updateTestResult() { const rows = document.querySelectorAll('#resultTable tbody tr'); - rows.forEach(row => { - const checkbox = row.querySelector('.form-check-input'); - const label = row.querySelector('.form-check-label'); - const pendingSpan = label.querySelector('.pending'); - const passSpan = label.querySelector('.pass'); - const failSpan = label.querySelector('.fail'); - - if (allTestsPassed) { - checkbox.disabled = false; - checkbox.checked = true; - pendingSpan.style.display = 'none'; - passSpan.style.display = 'inline'; - failSpan.style.display = 'none'; - row.classList.remove('pending-row'); - row.classList.add('pass-row'); - row.classList.remove('fail-row'); - } else { - checkbox.disabled = true; - checkbox.checked = false; - pendingSpan.style.display = 'inline'; - passSpan.style.display = 'none'; - failSpan.style.display = 'none'; - row.classList.add('pending-row'); - row.classList.remove('pass-row'); - row.classList.remove('fail-row'); - } - }); + const lastRow = rows[rows.length - 1]; + + // 只更新最后一行的状态 + updateRowTestResult(lastRow); +} + +function updateRowTestResult(row) { + const checkbox = row.querySelector('.form-check-input'); + const label = row.querySelector('.form-check-label'); + const pendingSpan = label.querySelector('.pending'); + const passSpan = label.querySelector('.pass'); + const failSpan = label.querySelector('.fail'); + + if (allTestsPassed) { + checkbox.disabled = false; + checkbox.checked = true; + pendingSpan.style.display = 'none'; + passSpan.style.display = 'inline'; + failSpan.style.display = 'none'; + row.classList.remove('pending-row'); + row.classList.add('pass-row'); + row.classList.remove('fail-row'); + } else { + checkbox.disabled = true; + checkbox.checked = false; + pendingSpan.style.display = 'inline'; + passSpan.style.display = 'none'; + failSpan.style.display = 'none'; + row.classList.add('pending-row'); + row.classList.remove('pass-row'); + row.classList.remove('fail-row'); + } } function addNewRow(button) { @@ -124,10 +129,11 @@ function addNewRow(button) { return; } - serialNumberInput.disabled = true; - button.style.display = 'none'; + // 固定当前行状态 + finalizeRowStatus(currentRow); - const newRow = table.insertRow(table.rows.length); + // 创建新行 + const newRow = table.insertRow(); const rowIndex = table.rows.length - 1; const cell1 = newRow.insertCell(0); @@ -137,39 +143,85 @@ function addNewRow(button) { cell1.innerHTML = ''; cell2.innerHTML = `
公共灯
警铃灯
-上行灯
@@ -105,6 +104,10 @@下行灯
警铃灯
+急停灯
@@ -143,10 +146,6 @@ 公共 -