2025-05-13 08:03:00 +08:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, reactive, ref, watch } from "vue";
|
|
|
|
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
|
|
|
|
import { getAb98UserListApi, type Ab98UserDTO, Ab98UserQuery } from "@/api/ab98/user";
|
|
|
|
|
import { type PaginationProps } from "@pureadmin/table";
|
|
|
|
|
import { CommonUtils } from "@/utils/common";
|
|
|
|
|
|
|
|
|
|
import Search from "@iconify-icons/ep/search";
|
|
|
|
|
import Refresh from "@iconify-icons/ep/refresh";
|
|
|
|
|
import View from "@iconify-icons/ep/view";
|
|
|
|
|
import { useRouter } from "vue-router";
|
2025-05-17 09:57:22 +08:00
|
|
|
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
2025-05-22 15:43:38 +08:00
|
|
|
|
import { getAb98UserTagNamesApi } from "@/api/ab98/tag";
|
2025-05-13 08:03:00 +08:00
|
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
|
name: "Ab98User"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const formRef = ref();
|
2025-05-22 15:43:38 +08:00
|
|
|
|
const tagOptions = ref<string[]>([]);
|
2025-05-24 16:24:03 +08:00
|
|
|
|
const searchFormParams = reactive<Ab98UserQuery & { search?: string }>({
|
2025-05-13 08:03:00 +08:00
|
|
|
|
name: undefined,
|
|
|
|
|
tel: undefined,
|
2025-05-22 15:43:38 +08:00
|
|
|
|
idnum: undefined,
|
2025-05-24 16:24:03 +08:00
|
|
|
|
tagName: undefined,
|
|
|
|
|
search: undefined
|
2025-05-13 08:03:00 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const pageLoading = ref(false);
|
|
|
|
|
const dataList = ref<Ab98UserDTO[]>([]);
|
|
|
|
|
const pagination = reactive<PaginationProps>({
|
|
|
|
|
total: 0,
|
|
|
|
|
pageSize: 12,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
background: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
async function onSearch() {
|
2025-05-26 10:23:05 +08:00
|
|
|
|
handleSearchInput(searchFormParams.search);
|
2025-05-13 08:03:00 +08:00
|
|
|
|
pagination.currentPage = 1;
|
|
|
|
|
getList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function getList() {
|
|
|
|
|
CommonUtils.fillPaginationParams(searchFormParams, pagination);
|
|
|
|
|
|
|
|
|
|
pageLoading.value = true;
|
|
|
|
|
const { data } = await getAb98UserListApi(searchFormParams).finally(
|
|
|
|
|
() => {
|
|
|
|
|
pageLoading.value = false;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
dataList.value = data.rows;
|
|
|
|
|
pagination.total = data.total;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-24 16:24:03 +08:00
|
|
|
|
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 = '';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-13 08:03:00 +08:00
|
|
|
|
const resetForm = formEl => {
|
|
|
|
|
if (!formEl) return;
|
|
|
|
|
formEl.resetFields();
|
|
|
|
|
onSearch();
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-17 09:57:22 +08:00
|
|
|
|
const handleViewDetail = (row: Ab98UserDTO) => {
|
|
|
|
|
// 保存信息到标签页
|
|
|
|
|
useMultiTagsStoreHook().handleTags("push", {
|
|
|
|
|
path: `/user/ab98/detail`,
|
|
|
|
|
name: "ab98Detail",
|
|
|
|
|
query: { id: row.ab98UserId },
|
|
|
|
|
meta: {
|
|
|
|
|
title: `${row.name}`,
|
|
|
|
|
dynamicLevel: 3
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-05-13 08:03:00 +08:00
|
|
|
|
router.push({
|
|
|
|
|
path: '/user/ab98/detail',
|
|
|
|
|
query: {
|
|
|
|
|
id: row.ab98UserId
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList();
|
2025-05-22 15:43:38 +08:00
|
|
|
|
getAb98UserTagNamesApi().then(res => {
|
|
|
|
|
tagOptions.value = res.data;
|
|
|
|
|
});
|
2025-05-13 08:03:00 +08:00
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="main">
|
|
|
|
|
<div class="float-right w-full">
|
|
|
|
|
<el-form ref="formRef" :inline="true" :model="searchFormParams"
|
2025-05-28 10:22:50 +08:00
|
|
|
|
class="search-form bg-bg_color flex w-[99/100] pl-[22px] pt-[12px]">
|
2025-05-28 10:03:32 +08:00
|
|
|
|
<el-form-item prop="search">
|
2025-05-24 16:24:03 +08:00
|
|
|
|
<el-input v-model="searchFormParams.search" placeholder="请输入姓名/手机号/身份证" clearable class="!w-[300px]"
|
2025-05-26 10:23:05 +08:00
|
|
|
|
@keydown.enter.prevent="onSearch" @change="handleSearchInput" />
|
2025-05-13 08:03:00 +08:00
|
|
|
|
</el-form-item>
|
2025-05-28 10:03:32 +08:00
|
|
|
|
<el-form-item prop="tagName">
|
|
|
|
|
<el-select v-model="searchFormParams.tagName" placeholder="请选择用户标签" clearable class="!w-[160px]">
|
2025-05-22 15:43:38 +08:00
|
|
|
|
<el-option v-for="item in tagOptions" :key="item" :label="item" :value="item" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2025-05-13 08:03:00 +08:00
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" :icon="useRenderIcon(Search)" :loading="pageLoading" @click="onSearch">
|
|
|
|
|
搜索
|
|
|
|
|
</el-button>
|
2025-05-15 10:03:15 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
2025-05-13 08:03:00 +08:00
|
|
|
|
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)">
|
|
|
|
|
重置
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<div class="grid-container">
|
2025-05-20 14:58:51 +08:00
|
|
|
|
<el-row :gutter="12">
|
2025-05-13 08:03:00 +08:00
|
|
|
|
<el-col v-for="(item, index) in dataList" :key="item.ab98UserId" :xs="24" :sm="12" :md="8" :lg="6">
|
|
|
|
|
<el-card class="user-card" :body-style="{ padding: '8px 20px' }">
|
|
|
|
|
<div class="card-content">
|
|
|
|
|
<el-avatar :size="80" :src="item.faceImg" fit="cover" shape="square" class="avatar">
|
|
|
|
|
<template v-if="!item.faceImg">
|
|
|
|
|
<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
<circle cx="50" cy="50" r="48" fill="#f5f5f5" stroke="#e0e0e0" stroke-width="1" />
|
|
|
|
|
<circle cx="50" cy="40" r="12" fill="#9e9e9e" />
|
|
|
|
|
<rect x="40" y="52" width="20" height="30" rx="2" fill="#9e9e9e" />
|
|
|
|
|
</svg>
|
|
|
|
|
</template>
|
|
|
|
|
</el-avatar>
|
|
|
|
|
<div class="user-info">
|
|
|
|
|
<div class="name">姓名:{{ item.name }}</div>
|
|
|
|
|
<div class="gender">性别:{{ item.sex === '男' ? '男' : item.sex === '女' ? '女' : '' }}</div>
|
|
|
|
|
<div class="tel">电话:{{ item.tel }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="idnum">身份证号:{{ item.idnum }}</div>
|
|
|
|
|
<div class="address">住 址:{{ item.address }}</div>
|
|
|
|
|
<el-divider class="divider" />
|
|
|
|
|
<el-button class="detail-btn" :icon="useRenderIcon(View)" @click="handleViewDetail(item)" />
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<div class="pagination-wrapper">
|
|
|
|
|
<el-pagination background layout="prev, pager, next" :page-size="pagination.pageSize"
|
|
|
|
|
:total="pagination.total" v-model:current-page="pagination.currentPage" @current-change="getList"
|
|
|
|
|
@size-change="getList" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
:deep(.el-dropdown-menu__item i) {
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-form {
|
|
|
|
|
:deep(.el-form-item) {
|
|
|
|
|
margin-bottom: 12px;
|
2025-05-28 10:22:50 +08:00
|
|
|
|
margin-right: 12px;
|
2025-05-13 08:03:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-card {
|
2025-05-20 14:58:51 +08:00
|
|
|
|
margin-bottom: 12px;
|
2025-05-13 08:03:00 +08:00
|
|
|
|
min-height: 210px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.card-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
margin: 15px 0px;
|
|
|
|
|
gap: 15px;
|
|
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
|
align-self: flex-start;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-info {
|
|
|
|
|
text-align: left;
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
.name,
|
|
|
|
|
.gender,
|
|
|
|
|
.tel {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #606266;
|
|
|
|
|
margin-bottom: 6px;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.name {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #303133;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.idnum,
|
|
|
|
|
.address {
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
color: #606266;
|
|
|
|
|
margin: 4px 0;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.divider {
|
|
|
|
|
margin: 10px 0px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.detail-btn {
|
|
|
|
|
width: 100%;
|
|
|
|
|
border: 0;
|
|
|
|
|
margin-top: auto;
|
|
|
|
|
padding: 12px 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.grid-container {
|
2025-05-20 14:58:51 +08:00
|
|
|
|
margin: 12px 0;
|
|
|
|
|
padding-bottom: 0px;
|
2025-05-13 08:03:00 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
.el-row {
|
|
|
|
|
margin-bottom: -20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pagination-wrapper {
|
|
|
|
|
position: relative;
|
|
|
|
|
background: var(--el-bg-color);
|
2025-05-20 14:58:51 +08:00
|
|
|
|
padding: 9px 12px;
|
2025-05-13 08:03:00 +08:00
|
|
|
|
margin-top: 20px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
|
|
:deep(.el-pagination) {
|
|
|
|
|
margin: 0;
|
2025-05-20 14:58:51 +08:00
|
|
|
|
padding: 0;
|
2025-05-13 08:03:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|