<template>
	<!-- 包装机 -->
	<view class="packingMachineDtl">
		<commons-header title='包装机'></commons-header>
		<view class="equ-img">
			<image src="../../static/bzj.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">
						离线
					</view>
				</view>
			</view>
			<view class="state-box">
				<image src="../../static/icon_gzms.png" mode=""></image>
				<view class="text">
					<view class="label">
						工作模式
					</view>
					<view class="state-text">
						离线
					</view>
				</view>
			</view>
		</view>
		<view class="echarts">
			<view class="title">
				<image src="../../static/btn_kanban_blue.png" mode=""></image>
				<span>产量数据</span>
			</view>
			<view class="content">
				<view class="text">
					12小时产量
				</view>
				<qiun-data-charts type="line" :opts="opts" :chartData="chartData" />
			</view>
		</view>
		<view class="state">
			<view class="state-box">
				<image src="../../static/icon_jhcl.png" mode=""></image>
				<view class="text" style="margin-left:20rpx;line-height: 40rpx;">
					<view class="label" style="font-size: 30rpx;font-weight: bold;">
						0
						
					</view>
					<view class="state-text" style="color:#666">
						计划产量
					</view>
					
				</view>
				
			</view>
			<view class="state-box">
				<image src="../../static/icon_mfzbs.png" mode=""></image>
				<view class="text" style="margin-left:20rpx;line-height: 40rpx;">
					<view class="label" style="font-size: 30rpx;font-weight: bold;">
						0
					</view>
					<view class="state-text" style="color:#666">
						每分钟版数
					</view>
				</view>
			</view>
		</view>
		<view class="parts-list">
			<ul>
				
				<li>
					<view class="temperature">
						0
					</view>
					<view>
						每模个数
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe74a;</span>
					</view>
				</li>
				<li>
					<view class="temperature">
						0
					</view>
					<view>
						单模距离
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe74c;</span>
					</view>
				</li>
				<li>
					<view class="temperature">
						0
					</view>
					<view>
						对版距离
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe74c;</span>
					</view>
				</li>
				
			</ul>
			<ul style="margin-top:20rpx">
				<li>
					<view class="temperature">
						0
					</view>
					<view>
						点动速度
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe74b;</span>
					</view>
				</li>
				<li>
					<view class="temperature">
						0
					</view>
					<view>
						链条速度
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe74b;</span>
					</view>
				</li>
				<li>
					<view class="temperature">
						0
					</view>
					<view>
						对版速度
					</view>
					<view class="before-icon">
						<span class="iconfont">&#xe74b;</span>
					</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: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>
	.packingMachineDtl {
		background-color: #f0f0f0;
		min-height: 100vh;
		margin-top: 128rpx;
		.footer-btn{
			margin: 20rpx;
			background: blue;
			color: #fff;
		}
		.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;
				}
			}
		}
		.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>
