This commit is contained in:
姚宇浩 2024-10-18 15:45:29 +08:00
commit db72c7c983
2 changed files with 13 additions and 8 deletions

View File

@ -184,7 +184,7 @@ const props = defineProps({
}, },
}, },
}); });
const emit = defineEmits(["close", "handle",'showList']); const emit = defineEmits(["close", "handle", "showList"]);
const handleRowClick = (row, column, event) => { const handleRowClick = (row, column, event) => {
emit("showList", row); emit("showList", row);
@ -267,20 +267,25 @@ watch(
data.title = props.tableData.title; data.title = props.tableData.title;
data.columns = props.tableData.columns; data.columns = props.tableData.columns;
data.tableData.length = 0; data.tableData.length = 0;
function maskName(name) { function maskName(name) {
if (name.length === 2) { if (name.length === 2) {
// * // *
return name[0] + "*"; return name[0] + "*";
} else if (name.length > 2) { } else if (name.length > 2 && name.length <= 8) {
// //
return name[0] + "*".repeat(name.length - 2) + name[name.length - 1]; return name[0] + "*".repeat(name.length - 2) + name[name.length - 1];
} else if (name.length > 8) {
//
return maskYwfzr(name);
} }
return name; return name;
} }
function maskYwfzr(ywfzr) { function maskYwfzr(ywfzr) {
// 使 // 使
return ywfzr.replace( return ywfzr.replace(
/([^,]+)/g,(match, name) => `${maskName(name.trim())}` /([^,]+)/g,
(match, name) => `${maskName(name.trim())}`
); );
} }
if (props.tableData.data.wxs.length > 0) { if (props.tableData.data.wxs.length > 0) {
@ -292,7 +297,7 @@ watch(
bzlx: item.bzlx, bzlx: item.bzlx,
qtbm: item.qtbm, qtbm: item.qtbm,
zrks: item.zrks, zrks: item.zrks,
ywfzr: maskYwfzr(item.ywfzr), ywfzr: maskName(item.ywfzr),
fgldsj: item.fgldsj.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"), fgldsj: item.fgldsj.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"),
}; };
data.tableData.push(obj); data.tableData.push(obj);
@ -308,7 +313,7 @@ watch(
bzlx: item.bzlx, bzlx: item.bzlx,
qtbm: item.qtbm, qtbm: item.qtbm,
zrks: item.zrks, zrks: item.zrks,
ywfzr: maskYwfzr(item.ywfzr), ywfzr: maskName(item.ywfzr),
// fgldsj: item.fgldsj, // fgldsj: item.fgldsj,
fgldsj: item.fgldsj.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"), fgldsj: item.fgldsj.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"),
}; };

View File

@ -327,9 +327,9 @@ const getRegisteredDB = () => {
ElMessage.warning({ ElMessage.warning({
message: res.message, message: res.message,
}); });
router.replace({ // router.replace({
path: "/error/403", // path: "/error/403",
}); // });
} }
}); });
}; };