身份证脱敏优化
This commit is contained in:
parent
511f621634
commit
95990a2a84
|
|
@ -26,6 +26,7 @@ import {
|
|||
selectDictLabels,
|
||||
handleTree,
|
||||
indexContinuation,
|
||||
desensitizeIdNumber,
|
||||
} from '@/utils/bonus'
|
||||
// 分页组件
|
||||
import Pagination from '@/components/Pagination'
|
||||
|
|
@ -58,7 +59,7 @@ Vue.prototype.selectDictLabels = selectDictLabels
|
|||
Vue.prototype.download = download
|
||||
Vue.prototype.handleTree = handleTree
|
||||
Vue.prototype.indexContinuation = indexContinuation
|
||||
|
||||
Vue.prototype.desensitizeIdNumber = desensitizeIdNumber
|
||||
// 全局组件挂载
|
||||
Vue.component('DictTag', DictTag)
|
||||
Vue.component('Pagination', Pagination)
|
||||
|
|
|
|||
|
|
@ -259,3 +259,13 @@ export function blobValidate(data) {
|
|||
export function indexContinuation(num, size) {
|
||||
return (num - 1) * size + 1
|
||||
}
|
||||
|
||||
// 对身份证号码进行脱敏
|
||||
export function desensitizeIdNumber(idNumber) {
|
||||
// 校验身份证格式(18位,前17位为数字,最后一位可为数字或Xx)
|
||||
if (!/^\d{17}[\dXx]$/.test(idNumber)) {
|
||||
return idNumber // 非有效格式返回原字符串
|
||||
}
|
||||
// 保留前6位和最后4位(最后一位可为Xx),中间8位用*替换
|
||||
return idNumber.replace(/^(\d{6})\d{8}([\dXx]{4})$/, '$1********$2')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export const formLabel = [
|
|||
|
||||
export const columnsList = [
|
||||
{ t_props: 'name', t_label: '姓名' },
|
||||
{ t_props: 'idNumber', t_label: '身份证' },
|
||||
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||
{ t_props: 'phone', t_label: '联系方式' },
|
||||
{ t_props: 'postName', t_label: '工种' },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
:columnsList="columnsList"
|
||||
:request-api="getEntryPersonListAPI"
|
||||
>
|
||||
<template slot="idNumber" slot-scope="{ data }">
|
||||
{{ desensitizeIdNumber(data.idNumber) }}
|
||||
</template>
|
||||
<template slot="btn" slot-scope="{ queryParams }">
|
||||
<el-button
|
||||
plain
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export const formLabel = [
|
|||
|
||||
export const columnsList = [
|
||||
{ t_props: 'name', t_label: '姓名' },
|
||||
{ t_props: 'idNumber', t_label: '身份证' },
|
||||
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||
{ t_props: 'proName', t_label: '所属工程' },
|
||||
{ t_props: 'teamName', t_label: '所属班组' },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@
|
|||
:selectable="(row) => row.einStatus === 1"
|
||||
:request-api="getExitPersonListAPI"
|
||||
>
|
||||
<template slot="idNumber" slot-scope="{ data }">
|
||||
{{ desensitizeIdNumber(data.idNumber) }}
|
||||
</template>
|
||||
<template slot="btn" slot-scope="{ queryParams }">
|
||||
<el-button
|
||||
plain
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export const formLabel = [
|
|||
|
||||
export const columnsList = [
|
||||
{ t_props: 'name', t_label: '姓名' },
|
||||
{ t_props: 'idNumber', t_label: '身份证' },
|
||||
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||
{ t_props: 'contractCode', t_label: '合同编号' },
|
||||
{ t_props: 'proName', t_label: '工程名称' },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
导出
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot="idNumber" slot-scope="{ data }">
|
||||
{{ desensitizeIdNumber(data.idNumber) }}
|
||||
</template>
|
||||
|
||||
<!-- 签订状态 -->
|
||||
<template slot="isSign" slot-scope="{ data }">
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export const formLabel = [
|
|||
|
||||
export const columnsList = [
|
||||
{ t_props: 'name', t_label: '姓名' },
|
||||
{ t_props: 'idNumber', t_label: '身份证' },
|
||||
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||
{ t_props: 'postName', t_label: '工种/岗位' },
|
||||
{ t_props: 'proName', t_label: '工程名称' },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@
|
|||
模板下载
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot="idNumber" slot-scope="{ data }">
|
||||
{{ desensitizeIdNumber(data.idNumber) }}
|
||||
</template>
|
||||
|
||||
<template slot="file" slot-scope="{ data }">
|
||||
<template
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export const formLabel = [
|
|||
|
||||
export const columnsList = [
|
||||
{ t_props: 'name', t_label: '姓名' },
|
||||
{ t_props: 'idNumber', t_label: '身份证' },
|
||||
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||
{ t_props: 'phone', t_label: '联系方式' },
|
||||
{ t_props: 'bankCardCode', t_label: '银行卡号' },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
ref="wageCardWitnessTableRef"
|
||||
:request-api="getPersonWageCardListAPI"
|
||||
>
|
||||
<template slot="idNumber" slot-scope="{ data }">
|
||||
{{ desensitizeIdNumber(data.idNumber) }}
|
||||
</template>
|
||||
<template slot="btn" slot-scope="{ queryParams }">
|
||||
<el-button
|
||||
plain
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export const formLabel = [
|
|||
|
||||
export const columnsList = [
|
||||
{ t_props: 'workerName', t_label: '姓名' },
|
||||
{ t_label: '身份证', t_props: 'idNumber' },
|
||||
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||
|
||||
{
|
||||
t_label: '联系方式',
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
:columnsList="columnsList"
|
||||
:request-api="getPersonCountListAPI"
|
||||
>
|
||||
<template slot="idNumber" slot-scope="{ data }">
|
||||
{{ desensitizeIdNumber(data.idNumber) }}
|
||||
</template>
|
||||
<template slot="btn" slot-scope="{ queryParams }">
|
||||
<el-button
|
||||
plain
|
||||
|
|
|
|||
Loading…
Reference in New Issue