feat: 加入了一系列调试和分析工具,包括 SCPI REPL、示波器数据查看器、声速检测器等,方便开发和实验调试。

fix: 修复实验页面中实验状态未正确更新的问题,确保实验状态在前端和后端之间保持一致。
docs: 添加了SCPI文档和总程序设计架构
这个提交包含在:
2026-06-25 18:29:31 +08:00
父节点 61b20ca200
当前提交 c742cc7070
共有 24 个文件被更改,包括 9263 次插入 和 5 次删除

查看文件

@ -164,6 +164,12 @@ const handleContinue = () => {
}
}
const handleReset = async () => {
if (!confirm('确定要重置实验数据吗?所有已填数据将被清除。')) return
await experimentStore.resetAndRestart()
allValidated.value = false
}
const handleExport = async () => {
if (!canExport.value || exporting.value) return
exporting.value = true
@ -245,6 +251,12 @@ watch(
>
{{ continueButtonText }}
</button>
<button
class="reset-button"
@click="handleReset"
>
重置
</button>
<button
v-if="canExport"
class="export-button"
@ -466,6 +478,20 @@ watch(
.continue-button:hover:not(:disabled) { background: #218838; }
.reset-button {
padding: 0.6rem 1.25rem;
border-radius: 4px;
border: 1px solid #dc3545;
background-color: #fff;
color: #dc3545;
font-weight: 600;
font-size: 0.9rem;
cursor: pointer;
transition: all 0.2s ease;
}
.reset-button:hover { background-color: #fff5f5; }
.export-button {
padding: 0.6rem 1.25rem;
border-radius: 4px;

查看文件

@ -321,6 +321,31 @@ export const useExperimentStore = defineStore('experiment', () => {
allAreas.forEach((areaId) => calculateArea(areaId))
}
const resetAndRestart = async () => {
if (!config.value) return
const savedConfig = config.value
const savedValidationUrl = validationUrl.value
if (savedValidationUrl) {
try {
const response = await fetch(savedValidationUrl.replace(/\/$/, '') + '/reset', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
})
if (response.ok) {
const result = await response.json()
pendingField.value = result.pending_field || null
controlStatus.value = result.control_status || null
}
} catch (e) {
console.error('重置后端失败:', e)
}
}
setConfig(savedConfig, savedValidationUrl || undefined)
}
const resetExperiment = () => {
config.value = null
data.value = {}
@ -377,6 +402,7 @@ export const useExperimentStore = defineStore('experiment', () => {
setFieldValue,
validateField,
updateAreaCalculations,
resetAndRestart,
resetExperiment,
loadConfigFromUrl,
findInputCell,