身份证脱敏优化
This commit is contained in:
parent
511f621634
commit
95990a2a84
|
|
@ -26,6 +26,7 @@ import {
|
||||||
selectDictLabels,
|
selectDictLabels,
|
||||||
handleTree,
|
handleTree,
|
||||||
indexContinuation,
|
indexContinuation,
|
||||||
|
desensitizeIdNumber,
|
||||||
} from '@/utils/bonus'
|
} from '@/utils/bonus'
|
||||||
// 分页组件
|
// 分页组件
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
|
|
@ -58,7 +59,7 @@ Vue.prototype.selectDictLabels = selectDictLabels
|
||||||
Vue.prototype.download = download
|
Vue.prototype.download = download
|
||||||
Vue.prototype.handleTree = handleTree
|
Vue.prototype.handleTree = handleTree
|
||||||
Vue.prototype.indexContinuation = indexContinuation
|
Vue.prototype.indexContinuation = indexContinuation
|
||||||
|
Vue.prototype.desensitizeIdNumber = desensitizeIdNumber
|
||||||
// 全局组件挂载
|
// 全局组件挂载
|
||||||
Vue.component('DictTag', DictTag)
|
Vue.component('DictTag', DictTag)
|
||||||
Vue.component('Pagination', Pagination)
|
Vue.component('Pagination', Pagination)
|
||||||
|
|
|
||||||
|
|
@ -259,3 +259,13 @@ export function blobValidate(data) {
|
||||||
export function indexContinuation(num, size) {
|
export function indexContinuation(num, size) {
|
||||||
return (num - 1) * size + 1
|
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 = [
|
export const columnsList = [
|
||||||
{ t_props: 'name', t_label: '姓名' },
|
{ t_props: 'name', t_label: '姓名' },
|
||||||
{ t_props: 'idNumber', t_label: '身份证' },
|
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||||
{ t_props: 'phone', t_label: '联系方式' },
|
{ t_props: 'phone', t_label: '联系方式' },
|
||||||
{ t_props: 'postName', t_label: '工种' },
|
{ t_props: 'postName', t_label: '工种' },
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
:columnsList="columnsList"
|
:columnsList="columnsList"
|
||||||
:request-api="getEntryPersonListAPI"
|
:request-api="getEntryPersonListAPI"
|
||||||
>
|
>
|
||||||
|
<template slot="idNumber" slot-scope="{ data }">
|
||||||
|
{{ desensitizeIdNumber(data.idNumber) }}
|
||||||
|
</template>
|
||||||
<template slot="btn" slot-scope="{ queryParams }">
|
<template slot="btn" slot-scope="{ queryParams }">
|
||||||
<el-button
|
<el-button
|
||||||
plain
|
plain
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ export const formLabel = [
|
||||||
|
|
||||||
export const columnsList = [
|
export const columnsList = [
|
||||||
{ t_props: 'name', t_label: '姓名' },
|
{ t_props: 'name', t_label: '姓名' },
|
||||||
{ t_props: 'idNumber', t_label: '身份证' },
|
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||||
{ t_props: 'proName', t_label: '所属工程' },
|
{ t_props: 'proName', t_label: '所属工程' },
|
||||||
{ t_props: 'teamName', t_label: '所属班组' },
|
{ t_props: 'teamName', t_label: '所属班组' },
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@
|
||||||
:selectable="(row) => row.einStatus === 1"
|
:selectable="(row) => row.einStatus === 1"
|
||||||
:request-api="getExitPersonListAPI"
|
:request-api="getExitPersonListAPI"
|
||||||
>
|
>
|
||||||
|
<template slot="idNumber" slot-scope="{ data }">
|
||||||
|
{{ desensitizeIdNumber(data.idNumber) }}
|
||||||
|
</template>
|
||||||
<template slot="btn" slot-scope="{ queryParams }">
|
<template slot="btn" slot-scope="{ queryParams }">
|
||||||
<el-button
|
<el-button
|
||||||
plain
|
plain
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ export const formLabel = [
|
||||||
|
|
||||||
export const columnsList = [
|
export const columnsList = [
|
||||||
{ t_props: 'name', t_label: '姓名' },
|
{ t_props: 'name', t_label: '姓名' },
|
||||||
{ t_props: 'idNumber', t_label: '身份证' },
|
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||||
{ t_props: 'contractCode', t_label: '合同编号' },
|
{ t_props: 'contractCode', t_label: '合同编号' },
|
||||||
{ t_props: 'proName', t_label: '工程名称' },
|
{ t_props: 'proName', t_label: '工程名称' },
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@
|
||||||
导出
|
导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
<template slot="idNumber" slot-scope="{ data }">
|
||||||
|
{{ desensitizeIdNumber(data.idNumber) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- 签订状态 -->
|
<!-- 签订状态 -->
|
||||||
<template slot="isSign" slot-scope="{ data }">
|
<template slot="isSign" slot-scope="{ data }">
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export const formLabel = [
|
||||||
|
|
||||||
export const columnsList = [
|
export const columnsList = [
|
||||||
{ t_props: 'name', t_label: '姓名' },
|
{ t_props: 'name', t_label: '姓名' },
|
||||||
{ t_props: 'idNumber', t_label: '身份证' },
|
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||||
{ t_props: 'postName', t_label: '工种/岗位' },
|
{ t_props: 'postName', t_label: '工种/岗位' },
|
||||||
{ t_props: 'proName', t_label: '工程名称' },
|
{ t_props: 'proName', t_label: '工程名称' },
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@
|
||||||
模板下载
|
模板下载
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
<template slot="idNumber" slot-scope="{ data }">
|
||||||
|
{{ desensitizeIdNumber(data.idNumber) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
<template slot="file" slot-scope="{ data }">
|
<template slot="file" slot-scope="{ data }">
|
||||||
<template
|
<template
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export const formLabel = [
|
||||||
|
|
||||||
export const columnsList = [
|
export const columnsList = [
|
||||||
{ t_props: 'name', t_label: '姓名' },
|
{ t_props: 'name', t_label: '姓名' },
|
||||||
{ t_props: 'idNumber', t_label: '身份证' },
|
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||||
{ t_props: 'phone', t_label: '联系方式' },
|
{ t_props: 'phone', t_label: '联系方式' },
|
||||||
{ t_props: 'bankCardCode', t_label: '银行卡号' },
|
{ t_props: 'bankCardCode', t_label: '银行卡号' },
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
ref="wageCardWitnessTableRef"
|
ref="wageCardWitnessTableRef"
|
||||||
:request-api="getPersonWageCardListAPI"
|
:request-api="getPersonWageCardListAPI"
|
||||||
>
|
>
|
||||||
|
<template slot="idNumber" slot-scope="{ data }">
|
||||||
|
{{ desensitizeIdNumber(data.idNumber) }}
|
||||||
|
</template>
|
||||||
<template slot="btn" slot-scope="{ queryParams }">
|
<template slot="btn" slot-scope="{ queryParams }">
|
||||||
<el-button
|
<el-button
|
||||||
plain
|
plain
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ export const formLabel = [
|
||||||
|
|
||||||
export const columnsList = [
|
export const columnsList = [
|
||||||
{ t_props: 'workerName', t_label: '姓名' },
|
{ t_props: 'workerName', t_label: '姓名' },
|
||||||
{ t_label: '身份证', t_props: 'idNumber' },
|
{ t_label: '身份证', t_slot: 'idNumber' },
|
||||||
|
|
||||||
{
|
{
|
||||||
t_label: '联系方式',
|
t_label: '联系方式',
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
:columnsList="columnsList"
|
:columnsList="columnsList"
|
||||||
:request-api="getPersonCountListAPI"
|
:request-api="getPersonCountListAPI"
|
||||||
>
|
>
|
||||||
|
<template slot="idNumber" slot-scope="{ data }">
|
||||||
|
{{ desensitizeIdNumber(data.idNumber) }}
|
||||||
|
</template>
|
||||||
<template slot="btn" slot-scope="{ queryParams }">
|
<template slot="btn" slot-scope="{ queryParams }">
|
||||||
<el-button
|
<el-button
|
||||||
plain
|
plain
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue