소스 검색

增加查看个人信息

yangg 2 달 전
부모
커밋
36513d3da4
2개의 변경된 파일150개의 추가작업 그리고 3개의 파일을 삭제
  1. 149 2
      src/views/JobApplication/list/crud.tsx
  2. 1 1
      src/views/position/list/index.vue

+ 149 - 2
src/views/JobApplication/list/crud.tsx

@@ -4,8 +4,10 @@ import { dictionary } from '/@/utils/dictionary';
 import { successMessage,warningMessage } from '/@/utils/message';
 import { auth } from '/@/utils/authFunction';
 import tableSelector from '/@/components/tableSelector/index.vue';
-import { shallowRef } from 'vue';
+import { shallowRef, h, createVNode, render } from 'vue';
 import { useRouter } from 'vue-router';
+import { ElDialog, ElDescriptions, ElDescriptionsItem, ElTabs, ElTabPane, ElTable, ElTableColumn, ElButton } from 'element-plus';
+import axios from 'axios';
 
 export const createCrudOptions = function ({ crudExpose, context}: CreateCrudOptionsProps): CreateCrudOptionsRet {
 	const router = useRouter();
@@ -35,6 +37,141 @@ export const createCrudOptions = function ({ crudExpose, context}: CreateCrudOpt
 		});
 	};
 
+	// 添加获取用户信息的方法
+	const getUserProfile = async (userId: number) => {
+		try {
+			const response = await axios.get(`${import.meta.env.VITE_API_URL}/api/system/wechat/user/profile/get?user_id=${userId}&tenant_id=1`);
+			return response.data;
+		} catch (error) {
+			console.error('获取用户信息失败:', error);
+			return null;
+		}
+	};
+
+	// 显示用户信息弹窗
+	const showUserProfileDialog = async (userId: number) => {
+		const profileData = await getUserProfile(userId);
+		if (!profileData || profileData.code !== 2000) {
+			warningMessage('获取用户信息失败');
+			return;
+		}
+
+		// 创建弹窗内容
+		const { user_info, profile, educations, family_members, trainings } = profileData.data;
+
+		// 创建一个容器元素
+		const container = document.createElement('div');
+		
+		// 创建对话框内容
+		const dialogContent = createVNode(
+			ElDialog,
+			{
+				title: '个人信息详情',
+				width: '70%',
+				modelValue: true,
+				'onUpdate:modelValue': (val: boolean) => {
+					if (!val) {
+						// 关闭对话框时销毁组件
+						render(null, container);
+						document.body.removeChild(container);
+					}
+				},
+				beforeClose: () => {
+					render(null, container);
+					document.body.removeChild(container);
+				}
+			},
+			{
+				default: () => createVNode(ElTabs, { type: 'border-card' }, {
+					default: () => [
+						// 基本信息标签页
+						createVNode(ElTabPane, { label: '基本信息' }, {
+							default: () => createVNode(ElDescriptions, { column: 3, border: true }, {
+								default: () => [
+									createVNode(ElDescriptionsItem, { label: '姓名' }, { default: () => user_info.name }),
+									createVNode(ElDescriptionsItem, { label: '电话' }, { default: () => user_info.phone }),
+									createVNode(ElDescriptionsItem, { label: '年龄' }, { default: () => user_info.age }),
+									createVNode(ElDescriptionsItem, { label: '出生日期' }, { default: () => user_info.birth_date }),
+									createVNode(ElDescriptionsItem, { label: '性别' }, { default: () => user_info.gender_name }),
+									createVNode(ElDescriptionsItem, { label: '身份证号' }, { default: () => user_info.id_card }),
+									createVNode(ElDescriptionsItem, { label: '政治面貌' }, { default: () => profile.political_status }),
+									createVNode(ElDescriptionsItem, { label: '民族' }, { default: () => profile.ethnicity }),
+									createVNode(ElDescriptionsItem, { label: '身高' }, { default: () => profile.height + 'cm' }),
+									createVNode(ElDescriptionsItem, { label: '体重' }, { default: () => profile.weight + 'kg' }),
+									createVNode(ElDescriptionsItem, { label: '籍贯' }, { default: () => profile.native_place }),
+									createVNode(ElDescriptionsItem, { label: '户口所在地' }, { default: () => profile.household_location }),
+									createVNode(ElDescriptionsItem, { label: '现居地址' }, { default: () => profile.current_address }),
+									createVNode(ElDescriptionsItem, { label: '婚姻状况' }, { default: () => profile.marital_status_name }),
+									createVNode(ElDescriptionsItem, { label: '是否有子女' }, { default: () => profile.has_children ? '是' : '否' }),
+									createVNode(ElDescriptionsItem, { label: '期望薪资' }, { default: () => profile.expected_salary }),
+									createVNode(ElDescriptionsItem, { label: '紧急联系人' }, { default: () => profile.emergency_contact }),
+									createVNode(ElDescriptionsItem, { label: '紧急联系电话' }, { default: () => profile.emergency_phone }),
+									createVNode(ElDescriptionsItem, { label: '特长' }, { default: () => profile.specialties }),
+									createVNode(ElDescriptionsItem, { label: '人生格言' }, { default: () => profile.life_motto }),
+									createVNode(ElDescriptionsItem, { label: '招聘来源' }, { default: () => profile.recruitment_source_name }),
+									createVNode(ElDescriptionsItem, { label: '招聘来源详情' }, { default: () => profile.recruitment_source_detail }),
+								]
+							})
+						}),
+						
+						// 教育经历标签页
+						createVNode(ElTabPane, { label: '教育经历' }, {
+							default: () => createVNode(ElTable, { data: educations, border: true, stripe: true }, {
+								default: () => [
+									createVNode(ElTableColumn, { prop: 'education_type_name', label: '学历类型' }),
+									createVNode(ElTableColumn, { prop: 'degree_name', label: '学位' }),
+									createVNode(ElTableColumn, { prop: 'school_name', label: '学校名称' }),
+									createVNode(ElTableColumn, { prop: 'major', label: '专业' }),
+									createVNode(ElTableColumn, { prop: 'start_date', label: '开始日期' }),
+									createVNode(ElTableColumn, { prop: 'end_date', label: '结束日期' }),
+								]
+							})
+						}),
+						
+						// 家庭成员标签页
+						createVNode(ElTabPane, { label: '家庭成员' }, {
+							default: () => createVNode(ElTable, { data: family_members, border: true, stripe: true }, {
+								default: () => [
+									createVNode(ElTableColumn, { prop: 'relation', label: '关系' }),
+									createVNode(ElTableColumn, { prop: 'name', label: '姓名' }),
+									createVNode(ElTableColumn, { prop: 'workplace', label: '工作单位' }),
+									createVNode(ElTableColumn, { prop: 'position', label: '职位' }),
+									createVNode(ElTableColumn, { prop: 'phone', label: '联系电话' }),
+								]
+							})
+						}),
+						
+						// 培训经历标签页
+						createVNode(ElTabPane, { label: '培训经历' }, {
+							default: () => createVNode(ElTable, { data: trainings, border: true, stripe: true }, {
+								default: () => [
+									createVNode(ElTableColumn, { prop: 'training_name', label: '培训名称' }),
+									createVNode(ElTableColumn, { prop: 'institution', label: '培训机构' }),
+									createVNode(ElTableColumn, { prop: 'start_date', label: '开始日期' }),
+									createVNode(ElTableColumn, { prop: 'end_date', label: '结束日期' }),
+									createVNode(ElTableColumn, { prop: 'description', label: '描述' }),
+									createVNode(ElTableColumn, { prop: 'certificate', label: '证书' }),
+								]
+							})
+						}),
+					]
+				}),
+				footer: () => createVNode(ElButton, {
+					onClick: () => {
+						render(null, container);
+						document.body.removeChild(container);
+					}
+				}, { default: () => '关闭' })
+			}
+		);
+
+		// 将容器添加到body
+		document.body.appendChild(container);
+		
+		// 渲染对话框到容器
+		render(dialogContent, container);
+	};
+
 	return {
 		crudOptions: {
 			request: {
@@ -73,7 +210,7 @@ export const createCrudOptions = function ({ crudExpose, context}: CreateCrudOpt
 			rowHandle: {
 				//固定右侧
 				fixed: 'right',
-				width: 200,
+				width: 280, // 增加宽度以容纳新按钮
 				buttons: {
 					view: {
 						iconRight: 'view',
@@ -87,6 +224,16 @@ export const createCrudOptions = function ({ crudExpose, context}: CreateCrudOpt
 							window.open(url, '_blank');
 						}
 					},
+					profile: { // 添加查看个人信息按钮
+						text: '查看个人信息',
+						iconRight: 'User',
+						type: 'text',
+						show: true,
+						order: 1,
+						click: ({ row }) => {
+							showUserProfileDialog(row.applicant);
+						}
+					},
 					edit: {
 						iconRight: 'Edit',
 						type: 'text',

+ 1 - 1
src/views/position/list/index.vue

@@ -57,7 +57,7 @@ async function generateQRCode(row: { id: string | number }) {
 		
 		// 调用系统API获取二维码
 		const response = await axios.post(`${import.meta.env.VITE_API_URL}/api/system/wechat/qrcode`, {
-			scene: `id=${row.id}`,
+			scene: `${row.id}`,
 			page: 'pages/index/index',
 			width: 430,
 			auto_color: false,