|
@@ -235,6 +235,86 @@
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
|
|
|
+ <a-form-item label="坐摔检测开关" name="fallSwitch">
|
|
|
+ <a-switch v-model:checked="baseFormState.fallSwitch" />
|
|
|
+ </a-form-item>
|
|
|
+
|
|
|
+ <a-form-item v-if="baseFormState.fallSwitch" label="坐摔最低高度" name="fallHeightThreshold">
|
|
|
+ <a-input
|
|
|
+ v-model:value.trim="baseFormState.fallHeightThreshold"
|
|
|
+ placeholder="请输入坐摔最低高度"
|
|
|
+ :style="inputStyle"
|
|
|
+ >
|
|
|
+ <template #suffix>
|
|
|
+ <a-tooltip>
|
|
|
+ <template #title>
|
|
|
+ <div>参考范围:0.1 - 2.5 m</div>
|
|
|
+ </template>
|
|
|
+ <info-circle-outlined style="color: rgba(0, 0, 0, 0.45)" />
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ v-if="baseFormState.fallSwitch"
|
|
|
+ label="坐摔门限值"
|
|
|
+ name="fallConfidenceThreshold"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-model:value.trim="baseFormState.fallConfidenceThreshold"
|
|
|
+ placeholder="请输入坐摔门限值"
|
|
|
+ :style="inputStyle"
|
|
|
+ :disabled="!baseFormState.fallSwitch"
|
|
|
+ >
|
|
|
+ <template #suffix>
|
|
|
+ <a-tooltip>
|
|
|
+ <template #title>
|
|
|
+ <div>参考范围:1 - 100</div>
|
|
|
+ </template>
|
|
|
+ <info-circle-outlined style="color: rgba(0, 0, 0, 0.45)" />
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item v-if="baseFormState.fallSwitch" label="坐摔判断阈值" name="fallTriggerCount">
|
|
|
+ <a-input
|
|
|
+ v-model:value.trim="baseFormState.fallTriggerCount"
|
|
|
+ placeholder="请输入坐摔判断阈值"
|
|
|
+ :style="inputStyle"
|
|
|
+ :disabled="!baseFormState.fallSwitch"
|
|
|
+ >
|
|
|
+ <template #suffix>
|
|
|
+ <a-tooltip>
|
|
|
+ <template #title>
|
|
|
+ <div>参考范围:1 -100</div>
|
|
|
+ </template>
|
|
|
+ <info-circle-outlined style="color: rgba(0, 0, 0, 0.45)" />
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ v-if="baseFormState.fallSwitch"
|
|
|
+ label="坐摔状态阈值"
|
|
|
+ name="fallStatusChangeCount"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-model:value.trim="baseFormState.fallStatusChangeCount"
|
|
|
+ placeholder="请输入坐摔状态阈值"
|
|
|
+ :style="inputStyle"
|
|
|
+ :disabled="!baseFormState.fallSwitch"
|
|
|
+ >
|
|
|
+ <template #suffix>
|
|
|
+ <a-tooltip>
|
|
|
+ <template #title>
|
|
|
+ <div>参考范围:1 - 100</div>
|
|
|
+ </template>
|
|
|
+ <info-circle-outlined style="color: rgba(0, 0, 0, 0.45)" />
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </a-form-item>
|
|
|
+
|
|
|
<div class="footer" :style="{ marginLeft: '100px' }">
|
|
|
<a-space>
|
|
|
<a-button
|
|
@@ -298,6 +378,11 @@ interface BaseFormState {
|
|
|
fallingConfirm: ID // 跌倒确认
|
|
|
guardAge?: ID // 监护对象年龄
|
|
|
guardType?: ID // 监护对象类型
|
|
|
+ fallSwitch?: boolean // 坐摔检测开关
|
|
|
+ fallHeightThreshold?: ID // 坐摔最低高度阈值(米)
|
|
|
+ fallConfidenceThreshold?: ID // 坐摔门限阈值
|
|
|
+ fallTriggerCount?: ID // 坐摔判断触发次数
|
|
|
+ fallStatusChangeCount?: ID // 坐摔状态变更触发次数
|
|
|
}
|
|
|
|
|
|
const spinning = ref(false)
|
|
@@ -317,6 +402,11 @@ const baseFormState = reactive<BaseFormState>({
|
|
|
fallingConfirm: 53,
|
|
|
guardAge: null,
|
|
|
guardType: null,
|
|
|
+ fallSwitch: false,
|
|
|
+ fallHeightThreshold: null,
|
|
|
+ fallConfidenceThreshold: null,
|
|
|
+ fallTriggerCount: null,
|
|
|
+ fallStatusChangeCount: null,
|
|
|
})
|
|
|
|
|
|
// 范围输入框尺寸
|
|
@@ -359,6 +449,28 @@ const saveBaseConfig = async () => {
|
|
|
: null,
|
|
|
age: baseFormState?.guardAge ? Number(baseFormState?.guardAge) : null,
|
|
|
guardianshipType: baseFormState?.guardType ? String(baseFormState?.guardType) : null,
|
|
|
+ fallSettingEnabled:
|
|
|
+ baseFormState?.fallSwitch && baseFormState?.fallSwitch === true ? 1 : 0,
|
|
|
+ lowZMax: baseFormState?.fallSwitch
|
|
|
+ ? Number(baseFormState?.fallHeightThreshold) > 0
|
|
|
+ ? Number(baseFormState?.fallHeightThreshold)
|
|
|
+ : null
|
|
|
+ : null,
|
|
|
+ humanPredThreshold: baseFormState?.fallSwitch
|
|
|
+ ? Number(baseFormState?.fallConfidenceThreshold) > 0
|
|
|
+ ? Number(baseFormState?.fallConfidenceThreshold)
|
|
|
+ : null
|
|
|
+ : null,
|
|
|
+ minEventsForDetection: baseFormState?.fallSwitch
|
|
|
+ ? Number(baseFormState?.fallTriggerCount) > 0
|
|
|
+ ? Number(baseFormState?.fallTriggerCount)
|
|
|
+ : null
|
|
|
+ : null,
|
|
|
+ minHumanEventsForDetection: baseFormState?.fallSwitch
|
|
|
+ ? Number(baseFormState?.fallStatusChangeCount) > 0
|
|
|
+ ? Number(baseFormState?.fallStatusChangeCount)
|
|
|
+ : null
|
|
|
+ : null,
|
|
|
})
|
|
|
saveBaseLoading.value = false
|
|
|
message.success('保存成功')
|
|
@@ -405,6 +517,19 @@ const saveBaseConfig = async () => {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
+const numberValidator = (_rule: Rule, value: string) => {
|
|
|
+ console.log('numberValidator', _rule, value)
|
|
|
+ if (!value) return Promise.resolve()
|
|
|
+
|
|
|
+ const validPattern = /^\d+(\.\d{1,2})?$/
|
|
|
+
|
|
|
+ if (!validPattern.test(value)) {
|
|
|
+ return Promise.reject(new Error('只能输入数字,保留两位小数'))
|
|
|
+ }
|
|
|
+
|
|
|
+ return Promise.resolve()
|
|
|
+}
|
|
|
+
|
|
|
// 统一校验规则
|
|
|
const rules: Record<string, Rule[]> = {
|
|
|
installWay: [
|
|
@@ -432,6 +557,30 @@ const rules: Record<string, Rule[]> = {
|
|
|
trigger: ['change', 'blur'],
|
|
|
},
|
|
|
],
|
|
|
+ fallHeightThreshold: [
|
|
|
+ {
|
|
|
+ validator: numberValidator,
|
|
|
+ trigger: ['change', 'blur'],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fallConfidenceThreshold: [
|
|
|
+ {
|
|
|
+ validator: numberValidator,
|
|
|
+ trigger: ['change', 'blur'],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fallTriggerCount: [
|
|
|
+ {
|
|
|
+ validator: numberValidator,
|
|
|
+ trigger: ['change', 'blur'],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fallStatusChangeCount: [
|
|
|
+ {
|
|
|
+ validator: numberValidator,
|
|
|
+ trigger: ['change', 'blur'],
|
|
|
+ },
|
|
|
+ ],
|
|
|
// xRangeStart: [
|
|
|
// {
|
|
|
// required: true,
|
|
@@ -534,6 +683,11 @@ const fetchDeviceBaseInfo = async () => {
|
|
|
baseFormState.fallingConfirm = res.data.fallingConfirm
|
|
|
baseFormState.guardAge = res.data.age
|
|
|
baseFormState.guardType = res.data.guardianshipType
|
|
|
+ baseFormState.fallSwitch = Boolean(res.data.fallSettingEnabled) ?? false
|
|
|
+ baseFormState.fallHeightThreshold = res.data.lowZMax ?? null
|
|
|
+ baseFormState.fallConfidenceThreshold = res.data.humanPredThreshold ?? null
|
|
|
+ baseFormState.fallTriggerCount = res.data.minEventsForDetection ?? null
|
|
|
+ baseFormState.fallStatusChangeCount = res.data.minHumanEventsForDetection ?? null
|
|
|
} catch (error) {
|
|
|
console.error('❌获取设备详情失败', error)
|
|
|
}
|