feat:人脸质量
This commit is contained in:
1 parent
18aa169b69
commit
f16c1e6eb7
1 file changed
+130
@@ -32,6 +32,16 @@
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="state.queryForm.phone" placeholder="请输入手机号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 180px" label="人脸质量" prop="qualityCategory">
|
||||
<el-select v-model="state.queryForm.qualityCategory" placeholder="全部" clearable>
|
||||
<el-option
|
||||
v-for="option in FACE_QUALITY_FILTER_OPTIONS"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</SearchPanel>
|
||||
</el-row>
|
||||
<el-row>
|
||||
@@ -83,6 +93,27 @@
|
||||
<preview-image :src="row.faceImg" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="人脸质量" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip :content="getFaceQualityTooltip(row)" placement="top" :show-after="250">
|
||||
<span
|
||||
tabindex="0"
|
||||
role="status"
|
||||
:aria-label="getFaceQualityTooltip(row)"
|
||||
class="inline-flex cursor-help rounded-sm focus:outline-none focus:ring-2 focus:ring-primary-light-5"
|
||||
>
|
||||
<el-tag
|
||||
:type="getFaceQualityTagType(row)"
|
||||
size="small"
|
||||
effect="plain"
|
||||
class="min-w-[112px] justify-center whitespace-nowrap tabular-nums"
|
||||
>
|
||||
{{ getFaceQualityLabel(row) }}
|
||||
</el-tag>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审核状态" prop="processStatus" show-overflow-tooltip min-width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="check_status" :value="row.processStatus" />
|
||||
@@ -141,6 +172,104 @@ const processDrawerRef = ref()
|
||||
const batchDealRef = ref()
|
||||
const loading = ref()
|
||||
|
||||
/** PC 当前阶段用于判定低质量人脸的固定阈值,与终端默认在库阈值保持一致。 */
|
||||
const LIBRARY_FACE_QUALITY_THRESHOLD = 0.6
|
||||
|
||||
/** 人脸质量查询分类,与后端分页接口的 qualityCategory 协议值保持一致。 */
|
||||
const FACE_QUALITY_FILTER_OPTIONS = [
|
||||
{ label: "合格", value: "qualified" },
|
||||
{ label: "低质量", value: "low" },
|
||||
{ label: "检测失败", value: "failed" },
|
||||
{ label: "未检测", value: "pending" },
|
||||
] as const
|
||||
|
||||
/** Element Plus 小号状态标签允许使用的语义类型。 */
|
||||
type FaceQualityTagType = "success" | "warning" | "danger" | "info"
|
||||
|
||||
/** 审批列表中与服务端人脸质量字段有关的最小行结构。 */
|
||||
interface UserFaceQualityRow {
|
||||
/** 虹软综合质量分,数据库 decimal 可能由不同网关序列化为数字或文本。 */
|
||||
qualityScore?: number | string | null
|
||||
/** 服务端质量状态;历史未检测记录为空。 */
|
||||
qualityStatus?: string | null
|
||||
/** 终端完成质量检测的时间。 */
|
||||
qualityCheckedAt?: string | null
|
||||
/** 虹软 SDK 或终端插件错误码。 */
|
||||
qualityErrorCode?: number | string | null
|
||||
/** 最后一次成功写入质量结果的终端设备主键。 */
|
||||
qualityDeviceId?: number | string | null
|
||||
}
|
||||
|
||||
/** 人脸质量单元格的紧凑展示模型。 */
|
||||
interface FaceQualityDisplay {
|
||||
/** 标签内可直接理解的状态与分数文案。 */
|
||||
label: string
|
||||
/** 与状态对应的 Element Plus 语义颜色。 */
|
||||
tagType: FaceQualityTagType
|
||||
/** 包含阈值、时间、来源和排查动作的完整辅助说明。 */
|
||||
tooltip: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 将服务端人脸质量字段归一化为不依赖颜色的表格状态。
|
||||
*
|
||||
* @param row 审批列表人脸记录
|
||||
* @returns 标签文案、语义颜色和完整诊断说明
|
||||
*/
|
||||
const resolveFaceQuality = (row: UserFaceQualityRow): FaceQualityDisplay => {
|
||||
const checkedAt = row.qualityCheckedAt || "未知"
|
||||
const deviceId = row.qualityDeviceId ?? "未知"
|
||||
if (row.qualityStatus === "detected") {
|
||||
const score = Number(row.qualityScore)
|
||||
if (row.qualityScore == null || row.qualityScore === "" || !Number.isFinite(score) || score < 0 || score > 1) {
|
||||
return {
|
||||
label: "数据异常",
|
||||
tagType: "danger",
|
||||
tooltip: `服务端质量状态为已检测,但质量分无效。检测时间:${checkedAt};来源设备:${deviceId}`,
|
||||
}
|
||||
}
|
||||
const scoreText = score.toFixed(2)
|
||||
if (score < LIBRARY_FACE_QUALITY_THRESHOLD) {
|
||||
return {
|
||||
label: `低质量 ${scoreText}`,
|
||||
tagType: "warning",
|
||||
tooltip: `质量分 ${scoreText},低于当前阈值 ${LIBRARY_FACE_QUALITY_THRESHOLD.toFixed(
|
||||
2,
|
||||
)}。请排查照片清晰度、光照、人脸角度及人脸区域大小。检测时间:${checkedAt};来源设备:${deviceId}`,
|
||||
}
|
||||
}
|
||||
return {
|
||||
label: `合格 ${scoreText}`,
|
||||
tagType: "success",
|
||||
tooltip: `质量分 ${scoreText},达到当前阈值 ${LIBRARY_FACE_QUALITY_THRESHOLD.toFixed(
|
||||
2,
|
||||
)}。检测时间:${checkedAt};来源设备:${deviceId}`,
|
||||
}
|
||||
}
|
||||
if (row.qualityStatus === "failed") {
|
||||
const errorCode = row.qualityErrorCode == null ? "未知" : row.qualityErrorCode
|
||||
return {
|
||||
label: "检测失败",
|
||||
tagType: "danger",
|
||||
tooltip: `质量检测失败,错误码:${errorCode}。请确认终端虹软质量授权和本地图片有效性。检测时间:${checkedAt};来源设备:${deviceId}`,
|
||||
}
|
||||
}
|
||||
return {
|
||||
label: "未检测",
|
||||
tagType: "info",
|
||||
tooltip: "尚未收到终端质量检测结果,可在终端人脸管理中执行存量检测。",
|
||||
}
|
||||
}
|
||||
|
||||
/** 返回人脸质量标签文案。 */
|
||||
const getFaceQualityLabel = (row: UserFaceQualityRow) => resolveFaceQuality(row).label
|
||||
|
||||
/** 返回人脸质量标签语义类型。 */
|
||||
const getFaceQualityTagType = (row: UserFaceQualityRow) => resolveFaceQuality(row).tagType
|
||||
|
||||
/** 返回人脸质量 Tooltip 与无障碍说明。 */
|
||||
const getFaceQualityTooltip = (row: UserFaceQualityRow) => resolveFaceQuality(row).tooltip
|
||||
|
||||
// 多选rows
|
||||
const selectObjs = ref([]) as any
|
||||
const selectIds = ref([]) as any
|
||||
@@ -153,6 +282,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
deptId: "",
|
||||
username: "",
|
||||
phone: "",
|
||||
qualityCategory: "",
|
||||
isDeepDept: false,
|
||||
processStatus: "2",
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user