<!-- 数据看板-危险源 -->
<template>
	<view class="hazardSources">
		<view class="statistics">
			<view class="statistics-t">
				<view class="statistics-t-l">危险源总数：</view>
				<view class="statistics-t-r">739 </view>
			</view>
			<view class="statistics-b">
				<view class="statistics-b-li">
					<view class="statistics-b-li-t color-A">2</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">30</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">200</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" 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="table">
			<view class="table-border">
				<view class="table-th">
					<view>排行</view>
					<view>学院单位</view>
					<view>总数</view>
					<view>危化品数</view>
					<view>冷热设备数</view>
				</view>
				<view class="table-tb" v-for="(item,index) in dataList" :key="index">
					<view>
						<text
							:class="index==0?'sortOne':(index==1?'sortTow':(index==2?'sortThree':'sortFive'))">{{index+1}}</text>
					</view>
					<view>{{item.data1}}</view>
					<view>{{item.data2}}</view>
					<view>{{item.data3}}</view>
					<view>{{item.data4}}</view>
				</view>
			</view>

		</view>
	</view>
</template>

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

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

		},
		data() {
			return {
				opts: {
					color: ["#FF8C00", "#0183FA", ],
					padding: [2, 20, 0, 0],
					enableScroll: false,
					legend: {
						position: 'top',
						legendShape: 'square',
						fontColor: '#fff',
					},
					xAxis: {
						disabled: true,
						axisLine: false,
						disableGrid: true,
						fontColor: '#fff',
					},
					yAxis: {},
					extra: {
						bar: {
							type: "stack",
							width: 30,
							meterBorde: 1,
							meterFillColor: "#FFFFFF",
							activeBgColor: "#000000",
							activeBgOpacity: 0.08,
							categoryGap: 2
						}
					}
				},
				chartData: {},
				// 查询参数
				queryParams: {
					page: 1,
					pageSize: 10,
				},
				dataList: [{
						data1: '植物保护',
						data2: '499',
						data3: '47',
						data4: '220',
						data5: '137',
					},
					{
						data1: '资源环境',
						data2: '199',
						data3: '7',
						data4: '120',
						data5: '37',
					},
					{
						data1: '生命科学',
						data2: '299',
						data3: '71',
						data4: '10',
						data5: '37',
					},
					{
						data1: '资源环境',
						data2: '199',
						data3: '7',
						data4: '120',
						data5: '37',
					},
					{
						data1: '生命科学',
						data2: '299',
						data3: '71',
						data4: '10',
						data5: '37',
					},
				],
				total: 0,
			}
		},
		created() {

		},
		beforeMount() {

		},
		mounted() {
			this.getServerData();
		},
		methods: {
			dateClick(index) {
				this.dateIndex = index;
			},
			getServerData() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						categories: ["化学与药物", "植物保护", "资源环境", "理学院", "园林艺术"],
						series: [{
								name: "危险品",
								textColor: "#FFFFFF",
								data: [35, 36, 31, 33, 13]
							},
							{
								name: "冷热设备与特种设备",
								textColor: "#FFFFFF",
								data: [18, 27, 21, 24, 6]
							}
						]
					};
					this.chartData = JSON.parse(JSON.stringify(res));
				}, 500);
			},
		},
	}
</script>

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

		.small-title {
			display: flex;
			justify-content: space-between;

			.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: 400rpx;
			background: #3E414F;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			padding: 34rpx 30rpx 26rpx;
			box-sizing: border-box;

			.chart-b {
				width: 630rpx;
				height: 344rpx;
			}
		}

		.statistics {
			width: 690rpx;
			height: 241rpx;
			background: #3E414F;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			margin-top: 20rpx;

			.statistics-t {
				height: 100rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1rpx solid #52545F;
				padding: 0 42rpx 0 38rpx;
				box-sizing: border-box;

				.statistics-t-l {
					font-weight: 400;
					font-size: 32rpx;
					color: #FFFFFF;
					line-height: 45rpx;
				}

				.statistics-t-r {
					font-weight: 400;
					font-size: 36rpx;
					color: #FFFFFF;
					line-height: 50rpx;
				}
			}

			.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: 28rpx;
					}

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

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

				.color-A {
					color: #FF8C00;
				}

				.color-B {
					color: #26C736;
				}

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

		.table {
			width: 720rpx;
			margin-top: 20rpx;

			.table-border {
				overflow: auto;

			}

			.table-th {
				width: 860rpx;
				height: 80rpx;
				background: rgba(162, 162, 162, 0.2);
				border-radius: 20rpx 20rpx 0rpx 0rpx;
				display: flex;
				justify-content: flex-start;
				padding: 0 30rpx;
				box-sizing: border-box;

				>view {
					font-weight: 400;
					font-size: 30rpx;
					color: #FFFFFF;
					line-height: 80rpx;
					text-align: center;
					margin-right: 38rpx;
					width: 120rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				>view:nth-of-type(1) {
					width: 64rpx;
				}

				>view:nth-of-type(2) {
					width: 168rpx;
				}

				>view:last-child {
					margin-right: 0;
					width: 168rpx;
				}
			}


			.table-tb {
				width: 860rpx;
				height: 80rpx;
				border-bottom: 1rpx dashed rgba(216, 216, 216, 0.2);
				display: flex;
				justify-content: flex-start;
				align-items: center;
				background: #3E414F;
				padding: 0 30rpx;
				box-sizing: border-box;

				>view {
					font-weight: 400;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 80rpx;
					text-align: center;
					margin-right: 38rpx;
					width: 120rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;

				}

				>view:nth-of-type(1) {
					width: 64rpx;

				}

				>view:nth-of-type(2) {
					width: 168rpx;
				}

				>view:last-child {
					margin-right: 0;
					width: 168rpx;
				}
			}

			.sortOne {
				display: inline-block;
				width: 40rpx;
				height: 40rpx;
				padding: 4rpx;
				box-sizing: border-box;
				background: rgba(255, 0, 0, 0.2);
				font-weight: 400;
				font-size: 28rpx;
				color: #FF0000;
				line-height: 40rpx;
				text-align: center;
				border-radius: 20rpx;
			}

			.sortTow {
				display: inline-block;
				width: 40rpx;
				height: 40rpx;
				padding: 4rpx;
				box-sizing: border-box;
				background: rgba(255, 153, 0, 0.2);
				font-weight: 400;
				font-size: 28rpx;
				color: #FF9900;
				line-height: 40rpx;
				text-align: center;
				border-radius: 20rpx;
			}

			.sortThree {
				display: inline-block;
				width: 40rpx;
				height: 40rpx;
				padding: 4rpx;
				box-sizing: border-box;
				background: rgba(255, 242, 0, 0.2);
				font-weight: 400;
				font-size: 28rpx;
				color: #FFF200;
				line-height: 40rpx;
				text-align: center;
				border-radius: 20rpx;
			}

			.sortFive {
				display: inline-block;
				width: 40rpx;
				height: 40rpx;
				padding: 4rpx;
				box-sizing: border-box;
				background: rgba(1, 131, 250, 0.2);
				font-weight: 400;
				font-size: 28rpx;
				color: #0183FA;
				line-height: 40rpx;
				text-align: center;
				border-radius: 20rpx;
			}
		}
	}
</style>
