From c3cbd5696b5782a3682b4b8a55b29a7ce297af02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 23 Jun 2025 21:44:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Ahjm/userVerify?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/userRole/index.ts | 20 +++- src/api/system/userRole/model/index.ts | 1 + src/api/system/userVerify/model/index.ts | 2 + .../hjm/userVerify/components/search.vue | 8 +- .../userVerify/components/userVerifyEdit.vue | 106 +++++++++++++----- src/views/hjm/userVerify/index.vue | 28 +++-- 6 files changed, 122 insertions(+), 43 deletions(-) diff --git a/src/api/system/userRole/index.ts b/src/api/system/userRole/index.ts index e1065b6..a78ae49 100644 --- a/src/api/system/userRole/index.ts +++ b/src/api/system/userRole/index.ts @@ -8,7 +8,7 @@ import { SERVER_API_URL } from '@/config/setting'; */ export async function listUserRole(params?: UserRoleParam) { const res = await request.get>( - SERVER_API_URL + '/system/user-role-role', + SERVER_API_URL + '/system/user-role', { params } @@ -20,9 +20,9 @@ export async function listUserRole(params?: UserRoleParam) { } /** - * 修改用户 + * 修改用户角色 */ -export async function updateUser(data: UserRole) { +export async function updateUserRole(data: UserRole) { const res = await request.put>( SERVER_API_URL + '/system/user-role', data @@ -32,3 +32,17 @@ export async function updateUser(data: UserRole) { } return Promise.reject(new Error(res.data.message)); } + +/** + * 添加用户角色 + */ +export async function addUserRole(data: UserRole) { + const res = await request.post>( + SERVER_API_URL + '/system/user-role', + data + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} diff --git a/src/api/system/userRole/model/index.ts b/src/api/system/userRole/model/index.ts index 926bf9b..34f10f1 100644 --- a/src/api/system/userRole/model/index.ts +++ b/src/api/system/userRole/model/index.ts @@ -24,5 +24,6 @@ export interface UserRole { */ export interface UserRoleParam extends PageParam { keywords?: any; + roleId?: number; userId?: number; } diff --git a/src/api/system/userVerify/model/index.ts b/src/api/system/userVerify/model/index.ts index 583f58d..c13c863 100644 --- a/src/api/system/userVerify/model/index.ts +++ b/src/api/system/userVerify/model/index.ts @@ -28,6 +28,8 @@ export interface UserVerify { sfz1?: string; // 反面 sfz2?: string; + // 机构名称 + organizationName?: string; // 备注 comments?: string; // 状态, 0在线, 1离线 diff --git a/src/views/hjm/userVerify/components/search.vue b/src/views/hjm/userVerify/components/search.vue index 4194d41..54511b3 100644 --- a/src/views/hjm/userVerify/components/search.vue +++ b/src/views/hjm/userVerify/components/search.vue @@ -7,10 +7,10 @@ - - 个人 - 企业 - + + + + {{ ['个人', '企业'][form.type] }} {{ ['个人', '企业'][form.type] }} + + + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + 审核通过 @@ -86,6 +102,7 @@ import {storeToRefs} from 'pinia'; import {ItemType} from 'ele-admin-pro/es/ele-image-upload/types'; import {FormInstance} from 'ant-design-vue/es/form'; import {FileRecord} from '@/api/system/file/model'; +import {listUserRole, updateUserRole} from "@/api/system/userRole"; // 是否是修改 const isUpdate = ref(false); @@ -115,6 +132,7 @@ const formRef = ref(null); const images = ref([]); const sfz1 = ref([]); const sfz2 = ref([]); +const userRoleId = ref(0); // 用户信息 const form = reactive({ @@ -128,6 +146,7 @@ const form = reactive({ birthday: undefined, sfz1: undefined, sfz2: undefined, + organizationName: undefined, status: undefined, deleted: undefined, tenantId: undefined, @@ -167,6 +186,14 @@ const rules = reactive({ trigger: 'blur' } ], + phone: [ + { + required: true, + type: 'string', + message: '请填写手机号码', + trigger: 'blur' + } + ], sfz1: [ { required: true, @@ -232,16 +259,42 @@ const onDeleteSfz2 = (index: number) => { const {resetFields} = useForm(form, rules); /* 保存编辑 */ -const save = () => { +const save = async () => { if (!formRef.value) { return; } + if(form.status == 0){ + message.error('请选择审核状态'); + return; + } + // 审核通过 + if(form.status == 1){ + const res = await listUserRole({userId: form.userId,roleId: 1701}) + const role = res[0]; + if(role){ + role.roleId = 1738; + userRoleId.value = Number(role.id); + updateUserRole(role).then(() => {}); + } + } + // 驳回 + if(form.status == 2){ + const res = await listUserRole({userId: form.userId,roleId: 1738}) + const role = res[0]; + if(role){ + role.roleId = 1701; + userRoleId.value = Number(role.id); + updateUserRole(role).then(() => {}); + } + } + formRef.value .validate() .then(() => { loading.value = true; const formData = { - ...form + ...form, + userRoleId: userRoleId.value, }; const saveOrUpdate = isUpdate.value ? updateUserVerify : addUserVerify; saveOrUpdate(formData) @@ -249,6 +302,9 @@ const save = () => { loading.value = false; message.success(msg); updateVisible(false); + if(formData.status == 1){ + + } emit('done'); }) .catch((e) => { diff --git a/src/views/hjm/userVerify/index.vue b/src/views/hjm/userVerify/index.vue index a6e94a3..a7868a0 100644 --- a/src/views/hjm/userVerify/index.vue +++ b/src/views/hjm/userVerify/index.vue @@ -113,24 +113,30 @@ const columns = ref([ width: 90 }, { - title: '类型', - dataIndex: 'type', - key: 'type', - align: 'center', - customRender: ({text}) => ['个人', '企业'][text] + title: '所属站点', + dataIndex: 'organizationName', + key: 'organizationName', + align: 'center' }, + // { + // title: '类型', + // dataIndex: 'type', + // key: 'type', + // align: 'center', + // customRender: ({text}) => ['个人', '企业'][text] + // }, { title: '真实姓名', dataIndex: 'realName', key: 'realName', align: 'center', }, - { - title: '证件号码', - dataIndex: 'idCard', - key: 'idCard', - align: 'center', - }, + // { + // title: '证件号码', + // dataIndex: 'idCard', + // key: 'idCard', + // align: 'center', + // }, { title: '手机号码', dataIndex: 'phone',