diff --git a/src/views/user/ab98/index.vue b/src/views/user/ab98/index.vue index fd750dc..22ca413 100644 --- a/src/views/user/ab98/index.vue +++ b/src/views/user/ab98/index.vue @@ -19,11 +19,12 @@ defineOptions({ const router = useRouter(); const formRef = ref(); const tagOptions = ref([]); -const searchFormParams = reactive({ +const searchFormParams = reactive({ name: undefined, tel: undefined, idnum: undefined, - tagName: undefined + tagName: undefined, + search: undefined }); const pageLoading = ref(false); @@ -54,6 +55,27 @@ async function getList() { pagination.total = data.total; } +const handleSearchInput = (value) => { + // 身份证号正则(18位) + const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/; + // 手机号正则 + const phoneRegex = /^1[3-9]\d{9}$/; + + if (idCardRegex.test(value)) { + searchFormParams.idnum = value; + searchFormParams.name = ''; + searchFormParams.tel = ''; + } else if (phoneRegex.test(value)) { + searchFormParams.tel = value; + searchFormParams.name = ''; + searchFormParams.idnum = ''; + } else { + searchFormParams.name = value; + searchFormParams.tel = ''; + searchFormParams.idnum = ''; + } +}; + const resetForm = formEl => { if (!formEl) return; formEl.resetFields(); @@ -92,17 +114,9 @@ onMounted(() => {
- - - - - - - - + +