<template>
	<!-- 注塑机 -->
	<view class="equipmentDtl">
		<commons-header :title="$t('injection.name')"></commons-header>
		<view class="equ-img">
			<image src="../../static/images/zsj.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">
						{{$t('equipment.equipmentStatus')}}
					</view>
					<view class="state-text">
						{{$t('equipment.offLine')}}
					</view>
				</view>
			</view>
			<view class="state-box">
				<image src="../../static/icon_gzms.png" mode=""></image>
				<view class="text">
					<view class="label">
						{{$t('equipment.operatingMode')}}
					</view>
					<view class="state-text">
						{{$t('equipment.offLine')}}
					</view>
				</view>
			</view>
		</view>
		<view class="echarts">
			<view class="title">
				<image src="../../static/btn_kanban_blue.png" mode=""></image>
				<span>{{$t('equipment.productionData')}}</span>
			</view>
			<view class="content">
				<view class="text">
					{{$t('equipment.productionData')}}
					
				</view>
				<qiun-data-charts type="line" :opts="opts" :chartData="chartData" />
			</view>
		</view>
		<view class="parts-list">
			<ul>
				<li>
					<image src="../../static/btn_kanban_blue.png" mode=""></image>
					<view>
						{{$t('injection.hydraulicPress')}}
					</view>
					<view class="before succes">
					</view>
				</li>
				<li>
					<view class="temperature">
						{{yeya}}℃
					</view>
					<view>
						{{$t('injection.hydraulicOilTemperature')}}
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe6c2;</span>
					</view>
				</li>
				<li>
					<view class="temperature">
						{{tongti}}℃
					</view>
					<view>
						{{$t('injection.cylinderTemperature')}}
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe6c2;</span>
					</view>
				</li>
			</ul>
		</view>
		<ul class="pressure-warp">
			<li v-for="(i,index) in tongdao">
				<view class="label">
					{{$t('injection.channel')}}{{index + 1}}
				</view>
				<view class="pressure-chart">
					<view class="pressure-zhen"
						:style="'transform: rotate('+ (i.yali - 50) *2.7 +'deg);'"
					>
						<image src="../../static/images/zhen.png" mode=""></image>
					</view>
					<!-- :style="'background-image: conic-gradient(from 135deg ,#fff 90deg,#FFAF53 90deg,#FF8800 '+ (i.yali * 0.75 + 25) +'%, #EEEEEE 0%);'" -->
					<view class="pressure-line"
						
					>
						
					</view>
				</view>
				<view class="pressure">
					{{i.yali}} Bar
				</view>
				<view style="padding-bottom: 40rpx;border-bottom:1rpx solid #DDDDDD;margin:0 40rpx">
					{{$t('injection.pressure')}}{{index + 1}}
				</view>
				<view style="margin-top:40rpx">
					{{$t('injection.speed')}}{{index + 1}}
				</view>
				<view class="num">
					{{i.sudu}}%
				</view>
				<view class="line">
					<view class="box" :style="'width:' + i.sudu + '%'"></view>
				</view>
			</li>
		</ul>
		<button class="footer-btn" @click="toInstructionsVideo">{{$t('injection.videoInstruction')}}</button>
	</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:0,
						sudu:0,
					},
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},{
						name:"通道1",
						yali:0,
						sudu:0,
					}
				],
				tongdao1:[
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},{
						name:"通道1",
						yali:0,
						sudu:0,
					}
				],
				tongdao2:[
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},
					{
						name:"通道1",
						yali:0,
						sudu:0,
					},{
						name:"通道1",
						yali:0,
						sudu:0,
					}
				],
				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: [0, 0, 0, 0, 0, 0]
						},{
							name: "极限产量",
							data: [0, 0, 0, 0, 0, 0]
						},
					]
				},
				qiehuantype:1,
				tongti:0,
				yeya:0,
			}
		},
		onLoad() {
			const v = this
			//v.qiehuan()
		},
		methods: {
			toInstructionsVideo(){
				uni.navigateTo({
					url: '/pages/equipment/instructionsVideo'
				})
			},
			qiehuan(){
				const tongdao = [
					{
						name:"通道1",
						yali:10 + (Math.round(Math.random()*100) - 50) / 10,
						sudu:70 + (Math.round(Math.random()*100) - 50) / 10,
					},
					{
						name:"通道1",
						yali:50 + (Math.round(Math.random()*100) - 50) / 10,
						sudu:80 + (Math.round(Math.random()*100) - 50) / 10,
					},
					{
						name:"通道1",
						yali:80 + (Math.round(Math.random()*100) - 50) / 10,
						sudu:50 + (Math.round(Math.random()*100) - 50) / 10,
					},{
						name:"通道1",
						yali:40 + (Math.round(Math.random()*100) - 50) / 10,
						sudu:40 + (Math.round(Math.random()*100) - 50) / 10,
					}
				]
				this.tongdao = tongdao
				this.tongti = 82 + (Math.round(Math.random()*100) - 50) / 10
				this.yeya = 82 + (Math.round(Math.random()*100) - 50) / 10
				
				setTimeout(()=>{
					this.qiehuan()
				},5000)
			},
			toRouter(j) {
				console.log(j)
				uni.navigateTo({
					url: '/pages/' + j.menuKey + '/' + j.menuKey
				})
			},
		},
	}
</script>

<style lang="less" scoped>
	.equipmentDtl {
		background-color: #f0f0f0;
		min-height: 100vh;
		margin-top: 128rpx;
		.footer-btn{
			margin: 20rpx;
			background: blue;
			color: #fff;
		}
		.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: 16rpx;
				top: 16rpx;
				i{
					color: #3FBF31;
				}
			}
			.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;
				.text{
					padding: 12rpx 0;
				}
				.state-text{
					font-size: 32rpx;
					font-weight: bold;
					margin-top: 5rpx;
				}
				.label{
					font-weight: 400;
					font-size: 28rpx;
				}
				image {
					width: 110rpx;
					height: 110rpx;
				}
			}
		}
	}
</style>
