<!-- 数据看板-安全隐患 -->
<template>
	<view class="hazardSources">
		<view class="small-title">
			<view class="small-title-l">安全检查校级巡查计划标题标题标题标题标题</view>
			<img class="small-title-r" src="@/pages/images/dataBoard/icon_06.png">
		</view>
		<view class="chart">
			<view class="chart-t">
				<view class="chart-t-li" :class="chartIndex==index?'color-A':'color-B'" @click="chartClick(index)"
					v-for="(item,index) in chartTitle">{{item}}</view>
			</view>
			<view class="chart-b" v-if="chartIndex==0">
				<qiun-data-charts type="column" :opts="opts" :echartsH5="true" :chartData="chartData" />
			</view>
			<view class="chart-b2" v-if="chartIndex==0">
				<view class="chart-b2-li">
					<view class="chart-b2-li-t">
						<text>1</text>
						<text>化学与药品学院</text>
					</view>
					<view class="chart-b2-li-b">132</view>
				</view>
				<view class="chart-b2-li">
					<view class="chart-b2-li-t">
						<text>1</text>
						<text>化学与药品学院</text>
					</view>
					<view class="chart-b2-li-b">132</view>
				</view>
				<view class="chart-b2-li">
					<view class="chart-b2-li-t">
						<text>1</text>
						<text>化学与药品学院</text>
					</view>
					<view class="chart-b2-li-b">132</view>
				</view>
			</view>
			<view class="chart-b-tow" v-if="chartIndex==1 || chartIndex==2">
				<qiun-data-charts type="radar" :opts="optsTow" :echartsH5="true" :chartData="chartDataTow" />
			</view>
		</view>
		<scroll-view scroll-x @scrolltolower="scrollGet">
			<view class="tabTitle_tow">
				<view class="tabTitle_tow_li" @tap="tabClickTow(item,index)" :key="index"
					v-for="(item,index) in tabTextTow">
					<view :class="{on:curTabTow==index}" class="tabTitle_tow_text">{{item}}</view>
					<view :class="{on:curTabTow==index}" class="tabTitle_tow_across"></view>
				</view>
			</view>
		</scroll-view>
		<!--安全隐患排行 -->
		<view class="table" v-if="chartType==1">
			<view class="table-border">
				<view class="table-th">
					<view class="table-th-li">
						<view>排行</view>
						<view>学院单位</view>
						<view>总隐患</view>
						<view>已整改</view>
						<view>未整改</view>
						<view>暂无法整改</view>
					</view>
				</view>
				<view class="table-tb">
					<view class="table-tb-li" v-for="(item,index) in dataList" :key="index">
						<view>{{index}}</view>
						<view>{{item.data1}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
					</view>

				</view>
			</view>
		</view>
		<!-- 一级指标排行 -->
		<view class="table-tow" v-if="chartType==2">
			<view class="table-border">
				<view class="table-th">
					<view class="table-th-li">
						<view>序号</view>
						<view>一级指标</view>
						<view>隐患数</view>
						<view>占比</view>
					</view>
				</view>
				<view class="table-tb">
					<view class="table-tb-li" v-for="(item,index) in dataList" :key="index">
						<view>{{index}}</view>
						<view>{{item.data1}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
					</view>
				</view>
			</view>
		</view>
		<!--学院单位 -->
		<view class="table-three" v-if="chartType==3">
			<view class="table-border">
				<view class="table-th">
					<view class="table-th-li">
						<view>排行</view>
						<view>学院单位</view>
						<view>总隐患</view>
						<view>实验场所</view>
						<view>安全设施</view>
						<view>化学安全</view>
						<view>基础安全</view>
						<view>生物安全</view>
						<view>特种与冷热设备</view>
					</view>
				</view>
				<view class="table-tb">
					<view class="table-tb-li" v-for="(item,index) in dataList" :key="index">
						<view>{{index}}</view>
						<view>{{item.data1}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
						<view>{{item.data2}}</view>
					</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 {
				chartType: 3,
				chartTitle: ['安全隐患排行', '一级指标排行', '暂无法整改'],
				chartIndex: 0,
				opts: {
					color: ["#149F12", "#FF0000", "#FF9D25", ],
					padding: [15, 15, 4, 5],
					enableScroll: false,
					legend: {
						position: 'top',
						fontColor: '#fff',
					},
					xAxis: {
						disableGrid: true,
						disabled: true,
						axisLine: false,
					},
					yAxis: {
						disableGrid: true,
						data: [{
							disabled: true,
						}]
					},
					extra: {
						column: {
							type: "group",
							width: 14,
							linearType: "opacity",
							linearOpacity: 0.6,
						}
					}
				},
				optsTow: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [5, 5, 5, 5],
					dataLabel: false,
					enableScroll: false,
					legend: {
						show: false,
					},
					extra: {
						radar: {
							gridType: "radar",
							gridColor: "#CCCCCC",
							gridCount: 3,
							opacity: 0.2,
							max: 200,
							labelShow: true,
							border: true
						}
					}
				},
				chartData: {},
				chartDataTow: {},
				// 查询参数
				queryParams: {
					page: 1,
					pageSize: 10,
				},
				dataList: [{
						data1: '学院学院简称',
						data2: '666',
					},
					{
						data1: '学院学院简称',
						data2: '666',
					},
					{
						data1: '学院学院简称',
						data2: '666',
					},
					{
						data1: '学院学院简称',
						data2: '666',
					},
				],
				total: 0,
				tabTextTow: ['一级指标', '学院单位'],
				curTabTow: 0,
			}
		},
		created() {

		},
		beforeMount() {

		},
		mounted() {
			this.getServerData();

		},
		methods: {
			scrollGet() {

			},
			chartClick(index) {
				this.chartIndex = index;
				this.getServerDataTow();
			},
			//顶部tab点击
			tabClickTow(item, index) {
				this.curTabTow = index;
			},
			getServerData() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						categories: ["化学与药品学院", "化学与药品学院", "化学与药品学院"],
						series: [{
								name: "已整改",
								textColor: '#fff',
								data: [35, 36, 31, ]
							},
							{
								name: "未整改",
								textColor: '#fff',
								data: [18, 27, 21, ]
							},
							{
								name: "暂无法整改",
								textColor: '#fff',
								data: [8, 7, 2, ]
							}
						]
					};
					this.chartData = JSON.parse(JSON.stringify(res));
				}, 500);
			},
			getServerDataTow() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						categories: ["维度1", "维度2", "维度3", "维度4", "维度5"],
						series: [{
								name: "成交量1",
								data: [90, 110, 165, 195, 187]
							},
							{
								name: "成交量2",
								data: [190, 210, 105, 35, 27]
							}
			 		]
					};
					this.chartDataTow = JSON.parse(JSON.stringify(res));
				}, 500);
			},
		},
	}
</script>

<style lang="stylus" scoped>
	.hazardSources {
		height: 100%;
		width: 100%;
		background: #363744;

		.small-title {
			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-l {
				flex: 1;
				font-weight: 400;
				font-size: 30rpx;
				color: #FFFFFF;
				line-height: 42rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

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

		}


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

			.chart-t {
				width: 570rpx;
				height: 50rpx;
				display: flex;
				justify-content: flex-start;
				border: 1rpx solid #52545F;
				border-radius: 10rpx;
				margin: 30rpx 0 0 72rpx;

				.chart-t-li {
					width: 190rpx;
					font-weight: 400;
					font-size: 28rpx;

					line-height: 50rpx;
					text-align: center;
					background: none;
				}

				.chart-t-li:nth-of-type(1) {
					border-right: 1rpx solid #52545F;
				}

				.chart-t-li:nth-of-type(2) {
					border-right: 1rpx solid #52545F;
				}

				.color-A {
					color: #FFFFFF;
					background: #52545F;
				}

				.color-B {
					color: #999999;
					background: none;
				}
			}

			.chart-b {
				width: 630rpx;
				height: 334rpx;
				margin-left: 30rpx;
			}

			.chart-b2 {
				width: 630rpx;
				margin: 0 30rpx;
				height: 106rx;
				display: flex;
				justify-content: flex-start;
				align-items: center;

				.chart-b2-li {
					flex: 1;

					.chart-b2-li-t {
						margin-top: 10rpx;

						>text:nth-of-type(1) {
							display: inline-block;
							width: 24rpx;
							height: 24rpx;
							background: #FF0000;
							border-radius: 6rpx 6rpx 6rpx 6rpx;
							margin-right: 10rpx;
							font-weight: 400;
							font-size: 22rpx;
							color: #FFFFFF;
							line-height: 24rpx;
							text-align: center;
						}

						>text:nth-of-type(2) {
							font-weight: 400;
							font-size: 24rpx;
							color: #FFFFFF;
							line-height: 34rpx;
						}
					}

					.chart-b2-li-b {
						margin-top: 10rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #FFFFFF;
						line-height: 34rpx;
						text-align: center;
					}
				}
			}

			.chart-b-tow {
				width: 630rpx;
				height: 440rpx;
				margin-left: 30rpx;
			}
		}

		.tabTitle_tow {
			width: 750rpx;
			height: 80rpx;
			white-space: nowrap;
			display: inline-flex;
			background: #3E414F;
			margin-top: 20rpx;
			padding-left: 35rpx;

			.tabTitle_tow_li {
				position: relative;
				width: 152rpx;
				height: 80rpx;
				text-align center;
				padding-top: 18rpx;
				box-sizing: border-box;

				.tabTitle_tow_text {
					display: inline-block;
					font-size: 32rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					line-height: 46rpx;
					position: relative;

					&.on {
						color: #0183FA;
					}
				}

				.tabTitle_tow_across {
					width: 50rpx;
					height: 4rpx;
					background: #0183FA;
					border-radius: 2rpx;
					margin-left: 33%;
					margin-top: 16rpx;
					display none;

					&.on {
						display block;
					}
				}

			}
		}

		.table {
			width: 720rpx;
			margin: 20rpx 0 0 30rpx;

			.table-border {
				width: auto;
				overflow: auto;

				.table-th {
					width: 860rpx;
					padding: 0 30rpx;
					box-sizing: border-box;
					background: rgba(162, 162, 162, 0.2);
					border-radius: 20rpx 20rpx 0rpx 0rpx;

					.table-th-li {
						height: 80rpx;
						display: flex;
						justify-content: flex-start;

						>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: 116rpx;
							text-align: left;
							margin-right: 0;
						}

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

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

				}


				.table-tb {
					width: 860rpx;
					background: #3E414F;
					padding: 0 30rpx;
					box-sizing: border-box;

					.table-tb-li {
						height: 80rpx;
						border-bottom: 1rpx dashed rgba(216, 216, 216, 0.2);
						display: flex;
						justify-content: flex-start;

						>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: 116rpx;
							text-align: left;
							margin-right: 0;
						}

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

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


				}
			}


		}

		.table-tow {
			width: 690rpx;
			margin: 20rpx 0 0 30rpx;

			.table-border {
				width: auto;
				overflow: auto;

				.table-th {
					width: 690rpx;
					padding: 0 30rpx;
					box-sizing: border-box;
					background: rgba(162, 162, 162, 0.2);
					border-radius: 20rpx 20rpx 0rpx 0rpx;

					.table-th-li {
						height: 80rpx;
						display: flex;
						justify-content: flex-start;

						>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;
							text-align: left;
							margin-right: 0;
						}

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

						>view:last-child {
							margin-right: 0;

						}
					}

				}


				.table-tb {
					width: 690rpx;
					background: #3E414F;
					padding: 0 30rpx;
					box-sizing: border-box;

					.table-tb-li {
						height: 80rpx;
						border-bottom: 1rpx dashed rgba(216, 216, 216, 0.2);
						display: flex;
						justify-content: flex-start;

						>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;
							text-align: left;
							margin-right: 0;
						}

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

						>view:last-child {
							margin-right: 0;

						}
					}


				}
			}


		}

		.table-three {
			width: 720rpx;
			margin: 20rpx 0 0 30rpx;

			.table-border {
				width: auto;
				overflow: auto;

				.table-th {
					width: 1510rpx;
					padding: 0 30rpx;
					box-sizing: border-box;
					background: rgba(162, 162, 162, 0.2);
					border-radius: 20rpx 20rpx 0rpx 0rpx;

					.table-th-li {
						height: 80rpx;
						display: flex;
						justify-content: flex-start;

						>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: 116rpx;
							text-align: left;
							margin-right: 0;
						}

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

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

				}


				.table-tb {
					width: 1510rpx;
					background: #3E414F;
					padding: 0 30rpx;
					box-sizing: border-box;

					.table-tb-li {
						height: 80rpx;
						border-bottom: 1rpx dashed rgba(216, 216, 216, 0.2);
						display: flex;
						justify-content: flex-start;

						>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: 116rpx;
							text-align: left;
							margin-right: 0;
						}

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

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


				}
			}


		}

	}
</style>
