<template>
	<view class="page-body">
		<page-header :name="pageData.name" :bg="'#1560e0'" :showLeft="true" @goBack="goBack()"></page-header>
		<view class="scroll-wrap">
			<view class="basic-info-wrap">
				<view class="info-wrap">
					<view class="data-wrap">
						<view class="data-item-wrap" v-for="(item, index) in list">
							<view class="title">{{ item.name }}</view>
							<view class="data">{{ item.params }}</view>
						</view>
					</view>
				</view>
				<view class="radius-wrap"></view>
			</view>
			<view class="detail-info-wrap">
				<page-card v-for="(item, index) in itemList" :key="index" style="margin-bottom: 30rpx;" :notShow="true" :name="item.name">
					<template v-slot:content>
						<simple-table :tableHead="tableHead" :list="item.params"></simple-table>
					</template>
				</page-card>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				activeData: {}, // 当前选中的项
				list: [{ // 基础信息
					name: '1#管路流量',
					params: '818547.8m³/h'
				}, {
					name: '2#管路流量',
					params: '206.2m³/h'
				}, {
					name: '3#管路流量',
					params: '639019.3m³/h'
				}, {
					name: '1#水位',
					params: '1.50m'
				}, {
					name: '2#水位',
					params: '1.49m'
				}], // 基础信息,
				allData: [],
				pageData: {}, // 页头信息
				tableHead: ['名称', '参数'], // 表名
				itemList: [{
					name: '一号泵控制',
					params: [{
						name: '负压',
						params: ['0.000Mpa']
					}, {
						name: '正压',
						params: ['0.03Mpa']
					}, {
						name: '电压',
						params: ['00.00V']
					}]
				}, {
					name: '二号泵控制',
					params: [{
						name: '负压',
						params: ['-0.002Mpa']
					}, {
						name: '正压',
						params: ['0.06Mpa']
					}, {
						name: '电压',
						params: ['00.00V']
					}]
				}, {
					name: '三号泵控制',
					params: [{
						name: '负压',
						params: ['0.000Mpa']
					}, {
						name: '正压',
						params: ['0.00Mpa']
					}, {
						name: '电压',
						params: ['00.00V']
					}]
				}, {
					name: '五号泵控制',
					params: [{
						name: '负压',
						params: ['0.000Mpa']
					}, {
						name: '正压',
						params: ['0.00Mpa']
					}, {
						name: '电压',
						params: ['00.00V']
					}]
				}, {
					name: '六号泵控制',
					params: [{
						name: '负压',
						params: ['0.000Mpa']
					}, {
						name: '正压',
						params: ['0.00Mpa']
					}, {
						name: '电压',
						params: ['00.00V']
					}]
				}]
			}
		},
		onLoad(option) {
			this.pageData = JSON.parse(option.data)
			this.getData()
		},
		methods: {
			goBack() { // 返回上一頁面
				uni.navigateBack()
			},
			async getData() {
				let res = await this.$http({
					url: `/qsy/dcs/transform/qsy786sbf`,
					method: 'POST'
				})
				this.list = res.data.data.list
				this.itemList = res.data.data.itemList
			}
		}
	}
</script>

<style scoped lang="scss">
	.page-body {
		.scroll-wrap {
			height: calc(100vh - 85rpx);
			overflow: scroll;

			.basic-info-wrap {
				position: relative;
				height: auto;
				padding: 50rpx 49rpx 0;
				background: url(../../../../static/page_bg.png);
				background-size: 150%;

				.info-wrap {
					display: flex;
					flex-wrap: wrap;
					border-bottom: 1rpx dashed #fff;
					padding-bottom: 85rpx;
				}

				.img-wrap {
					padding-top: 34rpx;
					text-align: center;

					image {
						width: 324rpx;
						height: 128rpx;
					}

					view {
						margin-top: 26rpx;
						color: #fff;
						font-size: 26rpx;
					}
				}

				.data-wrap {
					display: flex;
					flex-wrap: wrap;
					width: 100%;

					.data-item-wrap {
						width: 33.33333%;
						padding: 9rpx 0;
						min-height: 81rpx;
						text-align: center;
						margin-top: 60rpx;

						.title {
							font-size: 22rpx;
							color: #FFFFFF;
							margin-bottom: 14rpx;
						}

						.data {
							font-weight: 700;
							font-size: 36rpx;
							color: #FFF600;
							word-wrap: break-word;
						}
					}

					.data-item-wrap:nth-child(-n+3) {
						margin-top: 0;
					}
				}

				.status-list {
					width: 100%;
					padding-top: 60rpx;
					
					.item-wrap {
						display: flex;
						font-size: 26rpx;
						color: #FFFFFF;
						padding: 23rpx 32rpx;
					}
					
					.active {
						background: #3495FA;
						box-shadow: 0rpx 3rpx 7rpx 0rpx rgba(0,8,35,0.31);
						border-radius: 14rpx;
					}
					
					/deep/ .tip-wrap {
						margin-left: 12rpx;
					}
				}
				
				.radius-wrap {
					position: absolute;
					left: 0;
					bottom: 0;
					width: 100vw;
					height: 30rpx;
					background-color: #fff;
					border-radius: 35rpx 35rpx 0 0;
				}
			}

			.detail-info-wrap {
				padding: 40rpx 35rpx;

				/deep/ .card-wrap:last-child {
					margin-bottom: 0 !important;
				}
			}
		}
	}
</style>