version temp2
This commit is contained in:
		| @@ -12,12 +12,25 @@ | ||||
| </template> | ||||
|  | ||||
| <script setup> | ||||
| import { defineProps } from 'vue'; | ||||
| import { defineProps, watch, computed } from 'vue'; | ||||
| import { useRiskNotifier } from '@/composables/useRiskNotifier'; | ||||
|  | ||||
| // 接收父组件传入的 props | ||||
| const props = defineProps({ | ||||
|     data: Object, | ||||
|     params: Object, | ||||
|     apiId: { | ||||
|         type: String, | ||||
|         default: '', | ||||
|     }, | ||||
|     index: { | ||||
|         type: Number, | ||||
|         default: 0, | ||||
|     }, | ||||
|     notifyRiskStatus: { | ||||
|         type: Function, | ||||
|         default: () => { }, | ||||
|     }, | ||||
| }); | ||||
|  | ||||
| // 脱敏函数:姓名脱敏(保留首位) | ||||
| @@ -31,6 +44,20 @@ const maskIdCard = (idCard) => { | ||||
|     if (!idCard) return ''; | ||||
|     return idCard.replace(/^(.{6})(?:\d+)(.{4})$/, "$1****$2"); | ||||
| }; | ||||
|  | ||||
| // 计算风险评分(0-100分,分数越高越安全) | ||||
| const riskScore = computed(() => { | ||||
|     // 名下车辆不算风险,始终返回100分(最安全) | ||||
|     return 100; | ||||
| }); | ||||
|  | ||||
| // 使用 composable 通知父组件风险评分 | ||||
| useRiskNotifier(props, riskScore); | ||||
|  | ||||
| // 暴露给父组件 | ||||
| defineExpose({ | ||||
|     riskScore | ||||
| }); | ||||
| </script> | ||||
|  | ||||
| <style scoped> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user