feat(server): 扫描报告存储(scan_reports)+诊断阈值配置(diagnosis_config)+admin 编辑
- scan_reports 表+dao+3个报告接口(POST/latest/:id,requireUser) - GET /treatment/diagnosis-config 下发实时阈值(免发版调参) - admin SettingsView 加 diagnosis_config JSON 编辑器 - 注意: schema.sql 变更需手动 TencentDB 迁移
这个提交包含在:
@@ -125,6 +125,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section-card">
|
||||
<view class="section-title">智能诊断阈值(diagnosis_config)</view>
|
||||
<view class="config-desc">下发给小程序的实时诊断阈值,改此处即可调参无需发版。levels 为归一化吸收阈值;problem_wavelength 将问题类型映射到波长码 IR=1,R=2,UV=3,Y=4。保存前会校验 JSON 格式。</view>
|
||||
<textarea class="config-editor" v-model="diagnosisConfigText" placeholder='{"calibrated": false, ...}' />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="save-bar">
|
||||
@@ -155,7 +161,8 @@ export default {
|
||||
maintenance_mode: false
|
||||
},
|
||||
timezoneOptions: ['Asia/Shanghai', 'Asia/Tokyo', 'America/New_York', 'Europe/London'],
|
||||
passwordForm: { old_password: '', new_password: '', confirm_password: '' }
|
||||
passwordForm: { old_password: '', new_password: '', confirm_password: '' },
|
||||
diagnosisConfigText: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -166,15 +173,25 @@ export default {
|
||||
try {
|
||||
const data = await get('/api/v1/admin/settings')
|
||||
if (data) {
|
||||
Object.assign(this.settings, data)
|
||||
const { diagnosis_config, ...rest } = data
|
||||
Object.assign(this.settings, rest)
|
||||
this.diagnosisConfigText = JSON.stringify(diagnosis_config || {}, null, 2)
|
||||
}
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
async onSave() {
|
||||
let diagnosisConfig
|
||||
try {
|
||||
await post('/api/v1/admin/settings', this.settings)
|
||||
diagnosisConfig = JSON.parse(this.diagnosisConfigText || '{}')
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '诊断阈值 JSON 格式错误', icon: 'none' })
|
||||
return
|
||||
}
|
||||
try {
|
||||
const payload = { ...this.settings, diagnosis_config: diagnosisConfig }
|
||||
await post('/api/v1/admin/settings', payload)
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '保存失败', icon: 'none' })
|
||||
@@ -303,6 +320,26 @@ export default {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.config-desc {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.config-editor {
|
||||
width: 100%;
|
||||
min-height: 200px;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
font-size: 13px;
|
||||
font-family: 'Menlo', 'Consolas', monospace;
|
||||
color: #333;
|
||||
box-sizing: border-box;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.toggle-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
在新工单中引用
屏蔽一个用户