<template>
	<view class="container">
		<u-navbar class="u-navbar" title="日计划制定" placeholder @leftClick="leftClick" leftIconColor="#fff"
			bgColor="#00337A" :titleStyle="{ color: '#FFF', fontSize: '32rpx' }" />
		<!-- Project Header -->
		<view class="project-header">
			<text class="project-title">XXXXXXXXXXXXXXXXXXXXXXXXX工程</text>
			<view class="completion-rates">
				<text>作业计划完成率：70%</text>
				<text>月作业计划完成率：70%</text>
			</view>
		</view>

		<!-- Total Plan Input -->
		<view class="total-plan">
			<text>计划作业人数：</text>
			<input type="number" v-model="totalPlan" class="total-input" />
		</view>

		<!-- Project Table -->
		<view class="table-container">
			<view class="table-header">
				<text class="col-index">序号</text>
				<text class="col-name">项目名称</text>
				<text class="col-desc">项目描述</text>
				<text class="col-completion">本日计划完成量</text>
			</view>

			<view class="table-body">
				<view v-for="(item, index) in tableData" :key="index" class="table-row">
					<text class="col-index">{{ item.index }}</text>
					<text class="col-name">{{ item.name }}</text>
					<view class="col-desc">
						<text>区域：{{ item.location }}</text>
						<text>{{ item.power }}</text>
					</view>
					<view class="col-completion">
						<input type="number" v-model="item.completion" class="completion-input" />
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				totalPlan: '3345',
				tableData: [{
						index: 1,
						name: '放点（个）',
						location: '#2场址',
						power: '(29.891MWp)',
						completion: '3345'
					},
					{
						index: 2,
						name: '桩基打孔（个）',
						location: '#2场址',
						power: '(29.891MWp)',
						completion: '3345'
					},
					{
						index: 3,
						name: '放点（个）',
						location: '#2场址',
						power: '(29.891MWp)',
						completion: '3345'
					},
					{
						index: 4,
						name: '桩基打孔（个）',
						location: '#2场址',
						power: '(29.891MWp)',
						completion: '3345'
					}
				]
			}
		},

		methods: {
			// 返回
			leftClick() {
				console.log('返回')
				uni.navigateBack({
					delta: 1 // 返回
				});
			}
		}
	}
</script>

<style>
	.container {
		padding: 30rpx;
		background-color: #fff;
	}

	.project-header {
		margin-bottom: 30rpx;
	}

	.project-title {
		font-size: 32rpx;
		font-weight: bold;
		margin-bottom: 20rpx;
	}

	.completion-rates {
		display: flex;
		justify-content: space-between;
		color: #666;
		font-size: 28rpx;
	}

	.total-plan {
		display: flex;
		align-items: center;
		margin-bottom: 30rpx;
		font-size: 28rpx;
	}

	.total-input {
		width: 200rpx;
		height: 60rpx;
		border: 1px solid #ddd;
		padding: 0 20rpx;
		margin-left: 20rpx;
	}

	.table-container {
		border: 1px solid #ddd;
	}

	.table-header {
		display: flex;
		background-color: #f5f5f5;
		padding: 20rpx;
		font-size: 28rpx;
		font-weight: bold;
		border-bottom: 1px solid #ddd;
	}

	.table-body {
		background-color: #fff;
	}

	.table-row {
		display: flex;
		padding: 20rpx;
		font-size: 28rpx;
		border-bottom: 1px solid #ddd;
		align-items: center;
	}

	/* 隔行变色 */
	.table-row:nth-child(even) {
		background-color: #fafafa;
	}

	.table-row:last-child {
		border-bottom: none;
	}

	.col-index {
		width: 80rpx;
		flex-shrink: 0;
	}

	.col-name {
		width: 200rpx;
		flex-shrink: 0;
	}

	.col-desc {
		flex: 1;
		display: flex;
		flex-direction: column;
	}

	.col-completion {
		width: 200rpx;
		flex-shrink: 0;
		box-sizing: border-box;
		padding: 0 10rpx;
	}

	.completion-input {
		width: 100%;
		height: 60rpx;
		border: 1px solid #ddd;
		padding: 0 10rpx;
		box-sizing: border-box;
		font-size: 28rpx;
	}

	input {
		background-color: #fff;
	}
</style>