<!-- components/ProjectTable.vue -->
<template>
	<view class="project-table">
		<!-- 表格内容 -->
		<view class="table-row">
			<view class="row-label">项目编号</view>
			<view class="row-value">{{ project.projectNumber }}</view>
		</view>
		<view class="table-row">
			<view class="row-label">项目名称</view>
			<view class="row-value">{{ project.projectName }}</view>
		</view>
		<view class="table-row">
			<view class="row-label">项目负责人</view>
			<view class="row-value">
			<UserFormatter :userId="project.projectLeader" />
			</view>
		</view>

		<!-- 空数据提示 -->
		<view v-if="!project || Object.keys(project).length === 0" class="empty-tips">
			暂无项目信息
		</view>
	</view>
</template>

<script>
	import UserFormatter from '@/pages/components/UserFormatter.vue';
	export default {
		name: 'ProjectTable',
		components: {
			UserFormatter
		},
		props: {
			project: {
				type: Object,
			}
		},
		data() {
			return {
				userMap: {} // 用户信息缓存
			};
		},
		methods: {
			// 更新用户信息缓存
			handleUpdateUserMap(newUserMap) {
				this.userMap = newUserMap;
			}
		}
	};
</script>

<style lang="scss" scoped>
	.project-table {
		width: 100%;
		background-color: #fff;
		border-radius: 8px;
		overflow: hidden;
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
		padding: 16px;
	}

	.table-row {
		display: flex;
		align-items: center;
		padding: 12px 0;
		border-bottom: 1px solid #e5e5e5;

		&:last-child {
			border-bottom: none;
		}

		.row-label {
			flex: 1;
			font-size: 14px;
			font-weight: 500;
			color: #333;
		}

		.row-value {
			flex: 2;
			font-size: 14px;
			color: #666;
			text-align: right;
		}
	}

	.empty-tips {
		text-align: center;
		padding: 20px;
		color: #999;
		font-size: 14px;
	}
</style>