<!-- 数据看板-安全隐患 -->
<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">61</view>
				</view>
				<view class="chart-b2-li">
					<view class="chart-b2-li-t">
						<text>2</text>
						<text>理学院</text>
					</view>
					<view class="chart-b2-li-b">70</view>
				</view>
				<view class="chart-b2-li">
					<view class="chart-b2-li-t">
						<text>3</text>
						<text>生命科学</text>
					</view>
					<view class="chart-b2-li-b">54</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" v-if="chartIndex!=0">
			<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="chartIndex==0">
			<uni-card>
				<view style="height: 200px">
					<zb-table :columns="column" :stripe="false" :border="false" :data="dataList"></zb-table>
				</view>
			</uni-card>
		</view>
		<!-- 一级指标排行 -->
		<view class="table-tow" v-if="chartIndex!=0 && curTabTow==0">
			<uni-card>
				<view style="height: 200px">
					<zb-table :columns="column2" :stripe="false" :border="false" :data="dataList"></zb-table>
				</view>
			</uni-card>
		</view>
		<!--学院单位 -->
		<view class="table-three" v-if="chartIndex!=0 && curTabTow==1">
			<uni-card>
				<view style="height: 200px">
					<zb-table :columns="column3" :stripe="false" :border="false" :data="dataList"></zb-table>
				</view>
			</uni-card>
		</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,
							labelColor: '#fff',
						}
					}
				},
				chartData: {},
				chartDataTow: {},
				// 查询参数
				queryParams: {
					page: 1,
					pageSize: 10,
				},
				column: [{
						type: 'index',
						label: '排行',
						fixed: true,
						width: 60,
						align: 'center',
					},
					{
						name: 'data1',
						label: '学院单位',
						fixed: true,
						width: 80,
						align: 'center',
					},
					{
						name: 'data2',
						label: '总隐患',
						align: 'center',
					},
					{
						name: 'data3',
						label: '已整改',
						align: 'center',
					},
					{
						name: 'data4',
						label: '未整改',
						align: 'center',
					},
					{
						name: 'data5',
						label: '暂无法整改',
						align: 'center',
					},

				],
				column2: [{
						type: 'index',
						label: '序号',
						fixed: true,
						width: 60,
						align: 'center',
					},
					{
						name: 'data1',
						label: '一级指标',
						fixed: true,
						width: 80,
						align: 'center',
					},
					{
						name: 'data2',
						label: '隐患数',
						align: 'center',
					},
					{
						name: 'data3',
						label: '占比',
						align: 'center',
					},

				],
				column3: [{
						type: 'index',
						label: '排行',
						fixed: true,
						width: 60,
						align: 'center',
					},
					{
						name: 'data1',
						label: '学院单位',
						fixed: true,
						width: 80,
						align: 'center',
					},
					{
						name: 'data2',
						label: '总隐患',
						align: 'center',
					},
					{
						name: 'data3',
						label: '实验场所',
						align: 'center',
					},
					{
						name: 'data4',
						label: '安全设施',
						align: 'center',
					},
					{
						name: 'data5',
						label: '化学安全',
						align: 'center',
					},
					{
						name: 'data6',
						label: '基础安全',
						align: 'center',
					},
					{
						name: 'data7',
						label: '生物安全',
						align: 'center',
					},
					{
						name: 'data8',
						label: '特种与冷热设备',
						align: 'center',
					},

				],
				dataList: [{
						data1: '植物保护',
						data2: '102',
						data3: '47',
						data4: '22',
						data5: '13',
						data6: '4',
						data7: '12',
						data8: '23',
						data9: '21',
					},
					{
						data1: '资源环境',
						data2: '74',
						data3: '8',
						data4: '32',
						data5: '18',
						data6: '2',
						data7: '3',
						data8: '23',
						data9: '12',
					},
					{
						data1: '生命科学',
						data2: '66',
						data3: '28',
						data4: '10',
						data5: '8',
						data6: '56',
						data7: '22',
						data8: '13',
						data9: '12',
					},
					{
						data1: '园林艺术',
						data2: '56',
						data3: '23',
						data4: '17',
						data5: '5',
						data6: '12',
						data7: '24',
						data8: '53',
						data9: '14',
					},
					{
						data1: '化学与药物',
						data2: '34',
						data3: '12',
						data4: '11',
						data5: '21',
						data6: '54',
						data7: '11',
						data8: '23',
						data9: '12',
					},
				],
				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: ["生物安全", "基础安全", "安全设施", "化学安全"],
						series: [{
								name: "",
								data: [55, 31, 61, 48]
							},
						]
					};
					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-align: center;

						>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: 690rpx;
			margin-top: 20rpx;
			margin-left: 30rpx;
			border-radius: 20rpx 20rpx 0 0;
			overflow: hidden;

		}

		.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;
		}

		.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>
