<!-- 数据看板-设备管控 -->
<template>
	<view class="equipmentControl">
		<view class="statistics">
			<view class="statistics-b">
				<view class="statistics-b-li">
					<view class="statistics-b-li-t color-A">99</view>
					<view class="statistics-b-li-b">设备总数</view>
				</view>
				<view class="line"></view>
				<view class="statistics-b-li">
					<view class="statistics-b-li-t color-B">16</view>
					<view class="statistics-b-li-b">今日新增设备</view>
				</view>
				<view class="line"></view>
				<view class="statistics-b-li">
					<view class="statistics-b-li-t color-C">33</view>
					<view class="statistics-b-li-b">超期服役设备</view>
				</view>
			</view>
		</view>
		<view class="small-title">
			<view class="small-title-l">超期服役排行TOP5</view>
			<img class="small-title-r" @click="goPage('overdue')" src="@/pages/images/icon_wdwg_gd.png">
		</view>
		<view class="chart">
			<view class="chart-b">
				<qiun-data-charts type="bar" :opts="opts" :echartsH5="true" :chartData="chartData" />
			</view>
		</view>
		<view class="small-title">
			<view class="small-title-l">设备使用寿命</view>
			<img class="small-title-r" @click="goPage('life')" src="@/pages/images/icon_wdwg_gd.png">
		</view>
		<view class="chart-tow">
			<view class="chart-tow-b">
				<qiun-data-charts type="funnel" :opts="optsTow" :echartsH5="true" :chartData="chartDataTow" />
			</view>
		</view>
		<view class="small-title">
			<view class="small-title-l">特种设备与常规冷热设备安全隐患统计</view>
		</view>
		<view class="small-title-tow">
			<view class="small-title-tow-l">安全检查校级巡查计划标题标题标题标题标题</view>
			<img class="small-title-tow-r" src="@/pages/images/dataBoard/icon_06.png">
		</view>
		<view class="chart-three">
			<view class="chart-three-b">
				<qiun-data-charts type="pie" :opts="optsThree" :echartsH5="true" :chartData="chartDataThree" />
			</view>
		</view>
		<view class="chart-title">
			<view class="chart-title-l">安全指标</view>
			<view class="chart-title-r">占比</view>
		</view>
		<view class="list" v-for="(item,index) in dataList" :key="index">
			<view class="list-title">
				<view class="list-title-l">{{item.data1}}</view>
				<view class="list-title-r">{{item.data2}}</view>
			</view>
			<view class="list-li" v-for="(item2,index2) in item.child" :key="index2">{{item2.name}}</view>
		</view>
	</view>
</template>

<script>
	import {
		config
	} from '@/api/request/config.js'
	import {

	} from '@/pages_basics/api/index.js'
	export default {
		name: "equipmentControl",
		components: {

		},
		data() {
			return {
				opts: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [15, 30, 0, 5],
					enableScroll: false,
					legend: {
						show: false,
					},
					xAxis: {
						disabled: true,
						disableGrid: true,
						axisLine: false,
						fontColor: '#fff',
					},
					yAxis: {
						disabled: false,
						disableGrid: true,

						data: [{
							type: 'categories',
							fontColor: '#fff',
						}],
					},
					extra: {
						bar: {
							type: "group",
							width: 12,
							meterBorde: 1,
							meterFillColor: "#FFFFFF",
							activeBgColor: "#000000",
							activeBgOpacity: 0.08,
							linearType: "custom",
							barBorderCircle: true,
							seriesGap: 2,
							categoryGap: 2
						}
					}
				},
				chartData: {},
				optsTow: {
					color: ["#0183FA", "#38F0F0", "#2CCA73", "#FC6E21", "#FF4646", ],
					legend: {
						show: false,
					},
					padding: [15, 95, 10, 0],
					enableScroll: false,
					extra: {
						funnel: {
							type: 'triangle',
							border: false,
							labelAlign: "right",
						}
					}
				},
				chartDataTow: {},
				optsThree: {
					color: ["#10C139", "#FF8400", "#00FFE6", "#0183FA", "#73C0DE", "#3CA272", ],
					legend: {
						show: false,
					},
					padding: [5, 5, 5, 5],
					enableScroll: false,
					extra: {
						pie: {
							offsetAngle: 0,
							labelWidth: 15,
							border: true,
							borderWidth: 3,
							borderColor: "#3E414F",
						}
					}
				},
				chartDataThree: {},
				// 查询参数
				queryParams: {
					page: 1,
					pageSize: 10,
				},
				dataList: [{
						data1: '13.4加热及制冷装置管理',
						data2: '40%',
						child: [{
								name: '13.4.1 冰箱、烘箱、马弗炉等周围堆放杂物',
							},
							{
								name: '13.4.3 烘箱叠放',
							},
						]
					},
					{
						data1: '13.4加热及制冷装置管理',
						data2: '40%',
						child: [{
								name: '13.4.1 冰箱、烘箱、马弗炉等周围堆放杂物',
							},
							{
								name: '13.4.3 烘箱叠放',
							},
						]
					},

				],
				total: 0,
			}
		},
		created() {

		},
		beforeMount() {

		},
		mounted() {
			this.getServerData();
			this.getServerDataTow();
			this.getServerDataThree();
		},
		methods: {
			getServerData() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						categories: ["植物保护", "园林艺术", "生命科学", "理学院", "农学院"],
						series: [{
							name: "目标值",
							textColor: '#fff',
							data: [62, 37, 20, 41, 32]
						}, ]
					};
					this.chartData = JSON.parse(JSON.stringify(res));
				}, 500);
			},
			getServerDataTow() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						series: [{
							data: [{
								"name": "5年内",
								"value": 147,
								"labelText": "5年内 147台 26%",
								"textColor": "#fff",
							}, {
								"name": "10年内",
								"value": 136,
								"labelText": "10年内 136台 24%",
								"textColor": "#fff",
							}, {
								"name": "12年内",
								"value": 124,
								"labelText": "12年内 124台 22%",
								"textColor": "#fff",
							}, {
								"name": "20年内",
								"value": 96,
								"labelText": "20年内 96台 17%",
								"textColor": "#fff",
							}, {
								"name": "超期服役",
								"value": 67,
								"labelText": "超期服役 67台 11%",
								"textColor": "#fff",
							}]
						}]
					};
					this.chartDataTow = JSON.parse(JSON.stringify(res));
				}, 500);
			},
			getServerDataThree() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						series: [{
							data: [{
								"name": "13.2压力容器30%",
								"value": 50,
								"textColor": "#fff",
							}, {
								"name": "13.1起重类设备10%",
								"value": 30,
								"textColor": "#fff",
							}, {
								"name": "13.4加热及制冷装置管理40%",
								"value": 20,
								"textColor": "#fff",
							}, {
								"name": "13.3场（厂）内专用机动车辆20%",
								"value": 18,
								"textColor": "#fff",
							}]
						}]
					};
					this.chartDataThree = JSON.parse(JSON.stringify(res));
				}, 500);
			},
			dateClick(index) {
				this.dateIndex = index;
			},
			goPage(type) {
				if (type == 'overdue') {
					uni.navigateTo({
						url: '/pages/views/dataBoard/equipmentControlOverdue?pageType=1'
					});
				} else if (type == 'life') {
					uni.navigateTo({
						url: '/pages/views/dataBoard/equipmentControlOverdue?pageType=2'
					});
				}
			},
		},
	}
</script>

<style lang="stylus" scoped>
	.equipmentControl {
		height: 100%;
		width: 100%;
		background: #363744;
		padding: 2rpx 0rpx 0;
		box-sizing: border-box;

		.statistics {
			width: 750rpx;
			height: 120rpx;
			background: #3E414F;

			.statistics-b {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.statistics-b-li {
					flex: 1;
					text-align: center;

					.statistics-b-li-t {
						font-weight: 400;
						font-size: 36rpx;
						line-height: 50rpx;
						margin-top: 10rpx;

					}

					.statistics-b-li-b {
						font-weight: 400;
						font-size: 24rpx;
						color: #FFFFFF;
						line-height: 34rpx;
						margin-top: 9rpx;
					}
				}

				.line {
					width: 2rpx;
					height: 30rpx;
					background: #D8D8D8;
				}

				.color-A {
					color: #0183FA;
				}

				.color-B {
					color: #FF0000;
				}

				.color-C {
					color: #FFAA00;
				}
			}
		}

		.small-title {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 0 30rpx;

			.small-title-l {
				font-weight: 400;
				font-size: 32rpx;
				color: #FFFFFF;
				line-height: 45rpx;
				text-align: left;
				margin: 28rpx 0;
			}

			.small-title-r {
				width: 15rpx;
				height: 18rpx;
			}

		}

		.chart {
			width: 690rpx;
			height: 476rpx;
			background: #3E414F;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			margin: 0 30rpx;

			.chart-b {
				width: 690rpx;
				height: 476rpx;
			}
		}

		.chart-tow {
			width: 690rpx;
			height: 436rpx;
			background: #3E414F;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			margin: 0 30rpx;

			.chart-tow-b {
				width: 690rpx;
				height: 436rpx;
			}
		}

		.small-title-tow {
			width: 750rpx;
			height: 80rpx;
			background: #3E414F;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 20rpx 0 30rpx;
			box-sizing: border-box;
			margin-top: 2rpx;

			.small-title-tow-l {
				flex: 1;
				font-weight: 400;
				font-size: 30rpx;
				color: #FFFFFF;
				line-height: 42rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			.small-title-tow-r {
				width: 14rpx;
				height: 8rpx;
			}

		}

		.chart-three {
			width: 690rpx;
			height: 394rpx;
			background: #3E414F;
			border-radius: 20rpx 20rpx 0rpx 0rpx;
			margin: 34rpx 30rpx 0;

			.chart-three-b {
				width: 690rpx;
				height: 394rpx;
			}
		}

		.chart-title {
			width: 689rpx;
			height: 80rpx;
			background: rgba(162, 162, 162, 0.2);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			padding: 0 70rpx 0 38rpx;
			box-sizing: border-box;
			margin: 0 30rpx;
			display: flex;
			justify-content: space-between;

			.chart-title-l {
				font-weight: 400;
				font-size: 30rpx;
				color: #FFFFFF;
				line-height: 80rpx;
			}

			.chart-title-r {
				font-weight: 400;
				font-size: 30rpx;
				color: #FFFFFF;
				line-height: 80rpx;
			}
		}

		.list {
			margin: 0 30rpx;
			padding: 0 30rpx;
			box-sizing: border-box;

			.list-title {
				height: 80rpx;
				display: flex;
				justify-content: space-between;
				border-bottom: 1rpx dashed rgba(216, 216, 216, 0.2);
				padding: 0 38rpx 0 10rpx;
				box-sizing: border-box;

				.list-title-l {
					font-weight: 400;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 80rpx;
				}

				.list-title-r {
					font-weight: 400;
					font-size: 28rpx;
					color: #0183FA;
					line-height: 80rpx;
				}
			}

			.list-li {
				height: 80rpx;
				display: flex;
				justify-content: space-between;
				padding: 0 38rpx 0 10rpx;
				box-sizing: border-box;
				font-weight: 400;
				font-size: 28rpx;
				color: #999999;
				line-height: 80rpx;
				text-align: left;
			}
		}
	}
</style>
