<template>
	<!-- 灭菌柜 -->
	<view class="equipmentDtl">
		<commons-header title='灭菌柜'></commons-header>
		<view class="equ-img">
			<image src="../../static/images/mjg.png" mode=""></image>
			<!-- <view class="err-modal">
				<image src="../../static/images/icon_dqwd.png" mode=""></image>
			</view> -->
		</view>
		<view class="state">
			<view class="state-box">
				<image src="../../static/icon_sbzt.png" mode=""></image>
				<view class="text">
					<view class="label">
						设备状态
					</view>
					<view class="state-text" style="color:#3FBF31">
						{{Module.IsWorking ? '工作中' : '待机'}}
						
					</view>
				</view>
			</view>
			<view class="state-box">
				<image src="../../static/icon_gzms-1.png" mode=""></image>
				<view class="text">
					<view class="label">
						当前工序
					</view>
					<view class="state-text">
						{{ProcInfo.StepName ? Readings.StepName : '--'}}
					</view>
				</view>
			</view>
		</view>
		<view class="parts-list">
			<ul>
				<li>
					<view class="temperature">
						{{Readings.AvePressure}} bar
					</view>
					<view>
						气压
					</view>
					<view class="before-icon">
						<!-- 无基础值隐藏 -->
						<!-- <i class="iconfont">&#xe6c6;</i>   -->
					</view>
				</li>
				<li>
					<view class="temperature">
						{{Readings.GasTemperature}}℃
					</view>
					<view>
						Gas Temp
					</view>
					<view class="before-icon">
						<i class="iconfont" v-if="TechInfo.GasTemp.Target > Readings.GasTemperature" style="color:#FF8800">&#xe6c6;</i>
						<i class="iconfont" v-if="TechInfo.GasTemp.Target < Readings.GasTemperature" style="color:#FF8800">&#xe6c8;</i>
					</view>
				</li>
				<li>
					<view class="temperature">
						{{Readings.EOTemperature}}℃
					</view>
					<view>
						E.O.温度
					</view>
					<view class="before-icon">
						<!-- 无基础值隐藏 -->
						<!-- <i class="iconfont" style="color:#3FBF31">&#xe6c8;</i> -->
					</view>
				</li>
			</ul>
		</view>
		<view class="state">
			<view class="state-box">
				<image src="../../static/images/icon_sw.png" mode=""></image>
				<view class="text" style="margin-left:20rpx;line-height: 40rpx;">
					<view class="label" style="font-size: 30rpx;font-weight: bold;">
						{{Readings.WaterTemperature}}℃
						
					</view>
					<view class="state-text" style="color:#666">
						水温
					</view>
					
				</view>
				<view class="before-icon">
					<i class="iconfont" :style="TechInfo.WaterTemp.Target >= Readings.WaterTemperature ? 'color:#3FBF31' : 'color:#999999'" >&#xe6c8;</i>
				</view>
			</view>
			<view class="state-box">
				<image src="../../static/images/icon_shidu.png" mode=""></image>
				<view class="text" style="margin-left:20rpx;line-height: 40rpx;">
					<view class="label" style="font-size: 30rpx;font-weight: bold;">
						{{Readings.AveHumidity}}%
					</view>
					<view class="state-text" style="color:#666">
						湿度
					</view>
				</view>
				<view class="before-icon">
					<!-- 无基础值隐藏 -->
					<!-- <i class="iconfont" style="color:#3FBF31">&#xe6c8;</i> -->
				</view>
			</view>
		</view>
		<view class="parts-list">
			<ul>
				<li>
					<view class="temperature">
						{{Readings.AveTemperature}}℃
					</view>
					<view>
						平均温度
					</view>
					<view class="before-icon">
						<!-- 无基础值隐藏 -->
						<!-- <i class="iconfont">&#xe6c7;</i> -->
					</view>
				</li>
				<li>
					<view class="temperature">
						{{Readings.Temperatures[0]}}℃
					</view>
					<view>
						温箱1#
					</view>
					<view class="before-icon">
						<!-- 无基础值隐藏 -->
						<!-- <i class="iconfont" style="color:#FF8800">&#xe6c6;</i> -->
					</view>
				</li>
				<li>
					<view class="temperature">
						{{Readings.Temperatures[1]}}℃
					</view>
					<view>
						温箱2#
					</view>
					<view class="before-icon">
						<!-- 无基础值隐藏 -->
						<!-- <i class="iconfont" style="color:#3FBF31">&#xe6c8;</i> -->
					</view>
				</li>
			</ul>
		</view>
	</view>
</template>

<script>
	import {
		getInfo
	} from "@/util/api.js";
	import Vue from 'vue'
	import commonsHeader from '../../components/commons-header/index.vue'
	export default {
		components: {
			commonsHeader
		},
		data() {
			return {
				tongdao:[
					{
						name:"通道1",
						yali:10,
						sudu:70,
					},
					{
						name:"通道1",
						yali:50,
						sudu:80,
					},
					{
						name:"通道1",
						yali:80,
						sudu:50,
					},{
						name:"通道1",
						yali:40,
						sudu:40,
					}
				],
				tongdao1:[
					{
						name:"通道1",
						yali:12,
						sudu:72,
					},
					{
						name:"通道1",
						yali:53,
						sudu:83,
					},
					{
						name:"通道1",
						yali:84,
						sudu:55,
					},{
						name:"通道1",
						yali:46,
						sudu:46,
					}
				],
				tongdao2:[
					{
						name:"通道1",
						yali:6,
						sudu:66,
					},
					{
						name:"通道1",
						yali:44,
						sudu:84,
					},
					{
						name:"通道1",
						yali:54,
						sudu:33,
					},{
						name:"通道1",
						yali:22,
						sudu:11,
					}
				],
				userInfoData: [],
				notificationData: [],
				opts: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [15, 10, 0, 15],
					legend: {},
					xAxis: {
						disableGrid: true
					},
					yAxis: {
						gridType: "dash",
						dashLength: 2
					},
					extra: {
						line: {
							type: "straight",
							width: 2
						}
					}
				},
				chartData: {
					categories: ["8", "9", "10", "11", "12", "13"],
					series: [
						{
							name: "实际产量",
							data: [200, 410, 350, 400, 440, 450]
						},{
							name: "极限产量",
							data: [500, 500, 500, 500, 500, 500]
						},
					]
				},
				qiehuantype:1,
				tongti:80,
				yeya:80,
				Readings:{
					Temperatures:['1','1']
				},
				Module:{},
				ProcInfo:{},
				TechInfo:{
					GasTemp:{
						Target:0,
					},
					WaterTemp:{
						Target:0,
					},
				},
			}
		},
		onLoad() {
			const v = this

			v.getData()
		},
		methods: {
			toRouter(j) {
				console.log(j)
				uni.navigateTo({
					url: '/pages/' + j.menuKey + '/' + j.menuKey
				})
			},
			getData(){
				const v = this
				v.$post('/api/syringe-production/dataAutoclaves/getData',{
					"nodeId": "7C581286F5B112DF605178A62AF181AD"
				}).then(res => {
					if(res.data.Readings.Temperatures.length != 2){
						
					}
					v.Readings = res.data.Readings
					v.Module = res.data.Module
					v.ProcInfo = res.data.ProcInfo
					v.TechInfo = res.data.TechInfo
					console.log(res)
					// setTimeout(function() {
					// 	// 获取当前页面的实例
					// 	let pages = getCurrentPages();
					// 	//这句话 获取的才是当前页面实例
					// 	let currentPage = pages[pages.length-1]
					// 	console.log(currentPage)
					// 	if(v.getData) v.getData()
					// }, 10000);
				})
			},
		},
	}
</script>

<style lang="less" scoped>
	.equipmentDtl {
		background-color: #f0f0f0;
		min-height: 100vh;
		margin-top: 128rpx;
		.pressure-chart{
			height: 100rpx;
			width: 100rpx;
			// background-image: conic-gradient(from 135deg ,#fff 90deg, #EEEEEE 26%);
			background: url(../../static/images/ybp.png);
			background-size: 100% 100%;
			border-radius: 50%;
			margin: 20rpx auto;
			position: relative;
			.pressure-zhen{
				position: absolute;
				z-index: 2;
				top:0;
				left: 0;
				right: 0;
				bottom: 0;
				transform: rotate(70deg);
				transition: all ease .5s;
				image{
					width:36rpx;
					height: 36rpx;
					margin-top: 22rpx;
					
				}
			}
			.pressure-line{
				position: absolute;
				top:0;
				left: 0;
				right: 0;
				bottom: 0;
				z-index: 1;
				// background-image: conic-gradient(from 135deg ,#fff 90deg,#FFAF53 90deg,#FF8800 0%, #EEEEEE 0%);
				border-radius: 50%;
				transition: all ease .5s;
				
				
			}
			.pressure-line::before{
				position: absolute;
				display: block;
				top:20rpx;
				left: 20rpx;
				right: 20rpx;
				bottom: 20rpx;
				content:" ";
				background-color: #fff;
				border-radius: 50%;
			}
		}
		.pressure-chart::before{
			position: absolute;
			display: block;
			inset: 20rpx 20rpx 20rpx 20rpx;
			content:" ";
			background-color: #fff;
			border-radius: 50%;
		}
		.pressure-warp{
			display: flex;
			justify-content: space-between;
			padding: 0 24rpx;
			margin-top: 24rpx;
			li{
				width: 23%;
				text-align: center;
				background-color: #fff;
				padding: 32rpx 0;
				border-radius: 10rpx;
				font-size: 24rpx;
				color: #666666;
				.pressure-chart{
					
				}
				.label{
					color: #333333;
					font-size: 28rpx;
				}
				.pressure{
					font-size: 32rpx;
					color: #333;
					margin: 10rpx 0;
				}
				.line{
					width: 100rpx;
					height: 20rpx;
					background: #EEEEEE;
					border-radius: 10rpx;
					margin: 16rpx auto 0;
					.box{
						width:80%;
						background: linear-gradient(270deg, #3370FF 0%, #A0BBFB 100%);
						height: 100%;
						border-radius: 10rpx;
						transition: all ease .5s;
					}
				}
			}
		}
		.parts-list{
			padding: 0 24rpx;
			margin-top: 24rpx;
			ul{
				display: flex;
				justify-content: space-between;
			}
			li{
				width: 32%;
				padding: 30rpx 0;
				text-align: center;
				position: relative;
				background-color: #fff;
				.temperature{
					font-size: 40rpx;
					font-weight: bold;
					height: 60rpx;
					margin: 0 auto 20rpx;
					line-height: 60rpx;
				}
				image{
					width: 60rpx;
					height: 60rpx;
					display: block;
					margin: 0 auto 20rpx;
				}
			}
			.before-icon{
				width: 30rpx;
				height: 30rpx;
				position: absolute;
				right: 10rpx;
				top: 10rpx;
				i{
					color: #F54A45;
				}
			}
			.before{
				width: 30rpx;
				height: 30rpx;
				border-radius: 50%;
				background-color: rgba(204,204,204,0.2);
				display: block;
				position: absolute;
				right: 16rpx;
				top: 16rpx;
			}
			.before::before{
				position: absolute;
				display: block;
				top: 7rpx;
				left: 7rpx;
				width: 19rpx; 
				height: 19rpx;
				border-radius: 50%;
				content:" ";
				background: #cccccc;
				
			}
			.before.succes{
				background-color: rgba(63,191,49,0.2);
			}
			.before.succes::before{
				background: #3FBF31;
			}
		}
		.echarts {
			background: #fff;
			margin: 24rpx 24rpx 0;
			.content{
				
				.text{
					font-size: 28rpx;
					font-weight: 700;
					color: #333;
					text-align: center;
					margin-bottom: 40rpx;
				}
			}
			.title{
				font-size: 28rpx;
				height: 90rpx;
				line-height: 90rpx;
				display: flex;
				padding: 0 24rpx;
				font-weight: 500;
				image{
					width: 40rpx;
					height: 40rpx;
					margin-top: 25rpx;
					margin-right: 16rpx;
				}
			}
		}

		.parts-list {}

		.equ-img {
			padding: 24rpx;
			background-color: #ffffff;
			position: relative;
			image {
				width: 100%;
				height: 395rpx;
			}
			.err-modal{
				position: absolute;
				left: 0;
				right: 0;
				bottom: 0;
				top: 0;
				background: rgba(0,0,0,0.60);
				text-align: center;
				display: flex;
				align-items: center;
				
				image{
					width: 160rpx;
					height: 160rpx;
					margin: 0 auto;
				}
			}
		}

		.state {
			display: flex;
			justify-content: space-between;
			margin: 24rpx 24rpx 0;

			.state-box {
				padding: 20rpx;
				width: 48%;
				background-color: #fff;
				display: flex;
				box-sizing: border-box;
				border-radius: 10rpx;
				position: relative;
				.before-icon{
					width: 30rpx;
					height: 30rpx;
					position: absolute;
					right: 10rpx;
					top: 10rpx;
					i{
						color: #F54A45;
					}
				}
				.text{
					padding: 12rpx 0;
				}
				.state-text{
					font-size: 26rpx;
					color: #FF8800;
					font-weight: bold;
					margin-top: 5rpx;
				}
				.label{
					font-weight: 400;
					font-size: 28rpx;
				}
				image {
					width: 110rpx;
					height: 110rpx;
				}
			}
		}
	}
</style>
