<template>
	<div class="home-container">
		<!-- <el-row :gutter="15" class="home-card-one">
			
			<el-col :span="18">
				<el-row :gutter="12" class="home-card-one mb15">
					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
						<div class="home-card-one-title">上午好，刘老师。这是今日的人才情况动态。</div>
					</el-col>
				</el-row>
				<el-row :gutter="10" class="home-card-two mb15">
					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
						<div class="home-card-item" style="margin-bottom: 10px;">
							<div class="home-card-item-title">待办事项</div>
							<div class="todo-list">
								<div class="todo-item">
									<div class="todo-item-left">
										<span class="todo-tag">4位候选人待处理</span>
										<span class="todo-text">2025年6月12日  15:00最新投递</span>
									</div>
									<div class="todo-item-right">
										<el-icon size="20"><ArrowRightBold /></el-icon>
									</div>
								</div>
								
							</div>
						</div>
					</el-col>
					<el-col :xs="24" :sm="14" :md="14" :lg="14" :xl="14">
						<div class="home-card-item">
							<div style="height: 100%" ref="homeLineRef"></div>
						</div>
					</el-col>
					<el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10" class="home-media">
						<div class="home-card-item">
							<div style="height: 100%" ref="homePieRef"></div>
						</div>
					</el-col>
				</el-row>
			</el-col>

			<el-col :span="6">
				<div class="home-right" style="margin-top: 75px;">
					<div class="home-card-item">
						<div class="home-card-item-content">
							<el-select placeholder="Select" style="margin-right: 5px;">
								<el-option label="Option 1" value="1" />
								<el-option label="Option 2" value="2" />
								<el-option label="Option 3" value="3" />
							</el-select>
							<el-select placeholder="Select" style="margin-right: 5px;">
								<el-option label="Option 1" value="1" />
								<el-option label="Option 2" value="2" />
								<el-option label="Option 3" value="3" />
							</el-select>
							<el-select placeholder="Select" style="margin-right: 5px;">
								<el-option label="Option 1" value="1" />
								<el-option label="Option 2" value="2" />
								<el-option label="Option 3" value="3" />
							</el-select>
						</div>
						<p style="margin-top: 20px; font-size: 12px;  color:#808080;">通过情况概览</p>
						<div class="demo-collapse">
							<el-collapse >
								<el-collapse-item title="在此期间共计  2 位候选人通过面试" name="1">
									<div class="score-list">
										<div class="score-item">
											<div class="score-name">张老三</div>
											<div class="score-name">男</div>
											<div class="score-name">25岁</div>
											<div class="score-name">2年经验</div>
											<div class="score-value">82%</div>
										</div>
										<div class="score-item">
											<div class="score-name">李老四</div>  
											<div class="score-name">男</div>
											<div class="score-name">42岁</div>
											<div class="score-name">5年经验</div>
											<div class="score-value">65%</div>
										</div>
									</div>
								</el-collapse-item>
							</el-collapse>
						</div>
						<p style="margin-top: 20px; font-size: 12px;  color:#808080;">招聘情况总览</p>
						<p style="font-size: 14px;  color:#808080;">共计 10 位候选人参与面试，通过率 <span style="color: #409EFF;">20%</span></p>
											
					</div>
				</div>
			</el-col>
			<el-col
				:xs="24"
				:sm="12"
				:md="12"
				:lg="6"
				:xl="6"
				v-for="(v, k) in homeOne"
				:key="k"
				:class="{ 'home-media home-media-lg': k > 1, 'home-media-sm': k === 1 }"
			>
				<div class="home-card-item flex" @click="handleCardClick(k)" style="cursor: pointer;">
					<div class="flex-margin flex w100" :class="` home-one-animation${k}`">
						<div class="flex-auto">
							<span class="font30">{{ v.num1 }}</span>
							
							<div class="mt10">{{ v.num3 }}</div>
						</div>
						<div class="home-card-item-icon flex" :style="{ background: `var(${v.color2})` }">
							<i class="flex-margin font32" :class="v.num4" :style="{ color: `var(${v.color3})` }"></i>
						</div>
					</div>
				</div>
			</el-col>
		</el-row> -->

		<!-- 添加英雄联盟数据可视化部分 -->
		<el-row :gutter="15" class="lol-data-section">
			<el-col :span="24">
				<div class="lol-container" >
					<div class="head">
						<div class="weather"><span id="showTime"></span></div>
						<h1>设备运维数据中心</h1>
					</div>

					<div class="mainbox">
						<ul class="clearfix">
							<li>
								<div class="boxall" style="height:400px;">
									<div class="alltitle">设备运行状态</div>
									<div class="navboxall" id="echart5" style="height: 95%;"></div>
								</div>
								<div class="boxall" style="height:260px; overflow: hidden;">
									<div class="alltitle">设备实时运行情况</div>
									<div class="navboxall">
										<div class="wraptit">
											<span>设备编号</span><span>运行时长</span><span>运行状态</span><span>故障次数</span>
										</div>
										<div class="wrap">
											<ul>
												<li v-for="(hero, index) in heroData" :key="index" style="width: 100%;">
													<div style="display: flex;justify-content: space-between; width: 100%;">
														<span>{{hero.name}}</span>
														<span>{{hero.appearances}}</span>
														<span>{{hero.pickRate}}</span>
														<span>{{hero.winRate}}</span>
													</div>
												</li>
											</ul>
										</div>
									</div>
								</div>
								<div class="boxall" style="height:260px; overflow: hidden;">
									<div class="alltitle">设备故障统计</div>
									<div class="navboxall" id="echart1" style="height: 95%;"></div>
								</div>
							</li>

							<li>
								<div class="boxall" style="height:230px">
									<div class="clearfix navboxall" style="height: 100%">
										<div class="pulll_left zhibiao">
											<div class="zb1">
												<span>运行<br>0个</span>
												<div id="zb1" style="height: 95%;"></div>
											</div>
											<div class="zb2">
												<span>故障<br>0个</span>
												<div id="zb2" style="height: 95%;"></div>
											</div>
											<div class="zb3">
												<span>等待<br>0个</span>
												<div id="zb3" style="height: 95%;"></div>
											</div>
										</div>
									</div>
								</div>

								<div class="boxall" style="height:350px">
									<div class="alltitle">设备实时执行情况</div>
									<div class="navboxall" id="echart4" style="height: 95%;"></div>
								</div>
								<div class="boxall" style="height:340px">
									<div class="alltitle">故障维修执行情况</div>
									<div class="navboxall" id="echart3" style="height: 95%;"></div>
								</div>
							</li>

							<li>
								<div class="boxall" style="height:300px">
									<div class="alltitle">设备故障次数排行</div>
									<div class="navboxall">
										<el-table :data="teamRankings" style="width: 100%">
											<el-table-column prop="rank" label="排名" width="80"/>
											<el-table-column prop="name" label="设备名称"/>
											<el-table-column prop="matches" label="故障次数"/>
											<el-table-column prop="winRate" label="维修用时"/>
										</el-table>
									</div>
								</div>

								<div class="boxall" style="height:320px">
									<div class="alltitle">设备维修用时排行</div>
									<div class="navboxall" id="echart2" style="height: 95%;"></div>
								</div>
								<div class="boxall" style="height:300px">
									<div class="alltitle">设备维修时间统计</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</el-col>
		</el-row>
	</div>
</template>

<script lang="ts">
import { toRefs, reactive, defineComponent, onMounted, ref, watch, nextTick, onActivated } from 'vue';
import * as echarts from 'echarts';
import { storeToRefs } from 'pinia';
import { useThemeConfig } from '/@/stores/themeConfig';
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
import { GetList } from './api';
import { useRouter } from 'vue-router';

// 定义API数据接口
interface ApiData {
	total_applications: number;
	total_positions: number;
	total_questions: number;
	total_reports: number;
	application_trend: Array<{
		date: string;
		count: number;
	}>;
}

let global: any = {
	homeChartOne: null,
	homeChartTwo: null,
	homeCharThree: null,
	dispose: [null, '', undefined],
};

export default defineComponent({
	name: 'home',
	setup() {
		const homeLineRef = ref();
		const homePieRef = ref();
		const homeBarRef = ref();
		const storesTagsViewRoutes = useTagsViewRoutes();
		const storesThemeConfig = useThemeConfig();
		const { themeConfig } = storeToRefs(storesThemeConfig);
		const { isTagsViewCurrenFull } = storeToRefs(storesTagsViewRoutes);
		const state = reactive({
			homeOne: [
				{
					num1: '0',
					num2: '0',
					num3: '申请总数',
					num4: 'fa fa-meetup',
					color1: '#6690F9',
					color2: '--next-color-primary-lighter',
					color3: '--el-color-primary',
				},
				{
					num1: '0',
					num2: '0',
					num3: '职位总数',
					num4: 'iconfont icon-ditu',
					color1: '#6690F9',
					color2: '--next-color-success-lighter',
					color3: '--el-color-success',
				},
				/* {
					num1: '0',
					num2: '0',
					num3: '问题总数',
					num4: 'iconfont icon-zaosheng',
					color1: '#6690F9',
					color2: '--next-color-warning-lighter',
					color3: '--el-color-warning',
				}, */
				{
					num1: '0',
					num2: '0',
					num3: '报告总数',
					num4: 'fa fa-github-alt',
					color1: '#6690F9',
					color2: '--next-color-danger-lighter',
					color3: '--el-color-danger',
				},
			],
			homeThree: [
				{
					icon: 'iconfont icon-yangan',
					label: '浅粉红',
					value: '2.1%OBS/M',
					iconColor: '#F72B3F',
				},
				{
					icon: 'iconfont icon-wendu',
					label: '深红(猩红)',
					value: '30℃',
					iconColor: '#91BFF8',
				},
				{
					icon: 'iconfont icon-shidu',
					label: '淡紫红',
					value: '57%RH',
					iconColor: '#88D565',
				},
				{
					icon: 'iconfont icon-shidu',
					label: '弱紫罗兰红',
					value: '107w',
					iconColor: '#88D565',
				},
				{
					icon: 'iconfont icon-zaosheng',
					label: '中紫罗兰红',
					value: '57DB',
					iconColor: '#FBD4A0',
				},
				{
					icon: 'iconfont icon-zaosheng',
					label: '紫罗兰',
					value: '57PV',
					iconColor: '#FBD4A0',
				},
				{
					icon: 'iconfont icon-zaosheng',
					label: '暗紫罗兰',
					value: '517Cpd',
					iconColor: '#FBD4A0',
				},
				{
					icon: 'iconfont icon-zaosheng',
					label: '幽灵白',
					value: '12kg',
					iconColor: '#FBD4A0',
				},
				{
					icon: 'iconfont icon-zaosheng',
					label: '海军蓝',
					value: '64fm',
					iconColor: '#FBD4A0',
				},
			],
			myCharts: [],
			charts: {
				theme: '',
				bgColor: '',
				color: '#303133',
			},
			apiData: null as ApiData | null,
			
			// 添加英雄联盟数据
			heroData: [
				{ name: 'DEV001', appearances: '168h', pickRate: '正常', winRate: '2次' },
				{ name: 'DEV002', appearances: '145h', pickRate: '正常', winRate: '1次' },
				{ name: 'DEV003', appearances: '132h', pickRate: '故障', winRate: '3次' },
				{ name: 'DEV004', appearances: '120h', pickRate: '正常', winRate: '0次' },
				{ name: 'DEV005', appearances: '96h', pickRate: '等待', winRate: '1次' },
				{ name: 'DEV006', appearances: '72h', pickRate: '正常', winRate: '1次' },
				{ name: 'DEV007', appearances: '48h', pickRate: '故障', winRate: '2次' },
				{ name: 'DEV008', appearances: '36h', pickRate: '正常', winRate: '0次' },
				{ name: 'DEV009', appearances: '24h', pickRate: '正常', winRate: '1次' },
				{ name: 'DEV010', appearances: '12h', pickRate: '等待', winRate: '0次' }
			],
			teamRankings: [
				{ rank: 1, name: 'DEV003', matches: 15, winRate: '2.5h' },
				{ rank: 2, name: 'DEV007', matches: 12, winRate: '1.8h' },
				{ rank: 3, name: 'DEV001', matches: 8, winRate: '1.2h' },
				{ rank: 4, name: 'DEV005', matches: 6, winRate: '1.0h' },
				{ rank: 5, name: 'DEV002', matches: 4, winRate: '0.8h' }
			]
		});
		const router = useRouter();
		// 折线图
		const initLineChart = () => {
			if (!global.dispose.some((b: any) => b === global.homeChartOne)) global.homeChartOne.dispose();
			global.homeChartOne = <any>echarts.init(homeLineRef.value, state.charts.theme);
			const option = {
				backgroundColor: state.charts.bgColor,
				title: {
					text: '申请趋势',
					x: 'left',
					textStyle: { fontSize: '15', color: state.charts.color },
				},
				grid: { top: 70, right: 20, bottom: 30, left: 30 },
				tooltip: { trigger: 'axis' },
				legend: { data: ['申请数量'], right: 0 },
				xAxis: {
					data: state.apiData?.application_trend?.map((item: {date: string; count: number}) => item.date.substring(5)) || 
						['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
				},
				yAxis: [
					{
						type: 'value',
						name: '数量',
						splitLine: { show: true, lineStyle: { type: 'dashed', color: '#f5f5f5' } },
					},
				],
				series: [
					{
						name: '申请数量',
						type: 'line',
						symbolSize: 6,
						symbol: 'circle',
						smooth: true,
						data: state.apiData?.application_trend?.map((item: {date: string; count: number}) => item.count) || 
							[0, 41.1, 30.4, 65.1, 53.3, 53.3, 53.3, 41.1, 30.4, 65.1, 53.3, 10],
						lineStyle: { color: '#fe9a8b' },
						itemStyle: { color: '#fe9a8b', borderColor: '#fe9a8b' },
						areaStyle: {
							color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
								{ offset: 0, color: '#fe9a8bb3' },
								{ offset: 1, color: '#fe9a8b03' },
							]),
						},
					}
				],
			};
			(<any>global.homeChartOne).setOption(option);
			(<any>state.myCharts).push(global.homeChartOne);
		};
		// 饼图
		const initPieChart = () => {
			if (!global.dispose.some((b: any) => b === global.homeChartTwo)) global.homeChartTwo.dispose();
			global.homeChartTwo = <any>echarts.init(homePieRef.value, state.charts.theme);
			var getname = ['申请总数', '职位总数', '问题总数', '报告总数'];
			var getvalue = [];
			
			if (state.apiData) {
				getvalue = [
					state.apiData.total_applications,
					state.apiData.total_positions,
					state.apiData.total_questions,
					state.apiData.total_reports
				];
			} else {
				getvalue = [34.2, 38.87, 17.88, 9.05];
			}
			
			var data = [];
			for (var i = 0; i < getname.length; i++) {
				data.push({ name: getname[i], value: getvalue[i] });
			}
			const colorList = ['#51A3FC', '#36C78B', '#FEC279', '#968AF5', '#E790E8'];
			const option = {
				backgroundColor: state.charts.bgColor,
				title: {
					text: '数据统计',
					x: 'left',
					textStyle: { fontSize: '15', color: state.charts.color },
				},
				tooltip: { trigger: 'item', formatter: '{b} <br/> {c}%' },
				graphic: {
					elements: [
						{
							type: 'image',
							z: -1,
							style: {
								image: themeConfig.value.isIsDark
									? ''
									: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK0AAACtCAYAAADCr/9DAAAcoElEQVR4Xu19e7wcRZn28/ZM90xXzzknOYEkIAEiBAUUFyFc4wKCCAt8gHhBUEDFG8K3Iri6+3ETL0hQ9FthvYC4gAb0cwFRQcUlKiIIbpRbEBGUREJIyHWmq2e6Z+r9fjU5iQnJOWcuPV195nT/l5yq93nep57p6amueouQXV0rwMzW6tWrS4XCsFvPVQWIyAphKweR3ShUGw2EAwMIAfhE1OgacJIHoEme/7jpM3O+UgnnWFZuDpF6pQJ2JtDOBJ4JwgxmmgbwEABr3GAAM1Ah8CqAVgC8nEBLFWgJQz1Liv7sefZTRBS0EGvSNslMu9nQL1u2TEyZsv3rARygwK8nxuvIwh7McBJ0iL4T/xXgR8DW75nxcL2ef2jKFFqTIIdUQ01q02qTDg5v/wZLqSMZ9I8AtGHtFI6YAmExFO4jsu6N3Ny9Q0SrU8gzEUqTzrSrV8ud7aJ1okW54wg4jJmLiSgdL4i+Gz8Moh9xQ91ZKhUeizd8uqNNCtNKya9QqnYqWdbbAcwF0Fd5M/AnZv5/UFgwMFBYnG7Ldc+urwZvczmY2Q6CxolMfDaYjwKQ616uCRHhd2BcX63at0ybRusnBOM2SfadaYOAd2W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aNNuZt7dGxx9HIwz+m8LdiyjrgC6k8BXCuE8GEtEg0H6wrQb9SuXebqVr38IjA8BvINBXVMBrauiE3Bjo66+MjhY/FMqSMVAoq9Mu9kPNrsShCdZZJ0N5iNTd5pLDAM3TohFYFwnpf2dfjw4pS9Nu/mASilnKcq9i0CngfGa3vvFGMJSBt+KHL5dKhQeNcYiAeC+N+3mGpZrtb0shVNY0UlE2Heir+Mlwp9B9AMo3Oa6+QeIiBPwjHGISWXazdX2fd4RiI4lwlEMvBHAdOOjMQ4B/YwK5vssop/V6/zTwcHCH9POuRf8Jq1pXy5muVzb08rTPCg+CBbNBUNvvsz3QvQWYzIB+hDthxXUb4mt+4WwF2WnUsZUCbzFQZhQzZr1yGbM2Jsb2Nti3pMZc0C0GzN2IcKUGJPxwVgComcY/Azp9/+NxuJ6PXi004M0YuSWylDZnbaDYdGFo2u12g5K5WbUWW1nWTTFYgwo6OqIVgEKNpPKE6MGywqJEQJcY4ZPZK1pEK9GXa1Qylk+NEQdlwvtgHpfdPn/ixNifr4QLGYAAAAASUVORK5CYII=',
								width: 230,
								height: 230,
							},
							left: '16.5%',
							top: 'center',
						},
					],
				},
				legend: {
					type: 'scroll',
					orient: 'vertical',
					right: '0%',
					left: '65%',
					top: 'center',
					itemWidth: 14,
					itemHeight: 14,
					data: getname,
					textStyle: {
						rich: {
							name: {
								fontSize: 14,
								fontWeight: 400,
								width: 200,
								height: 35,
								padding: [0, 0, 0, 60],
								color: state.charts.color,
							},
							rate: {
								fontSize: 15,
								fontWeight: 500,
								height: 35,
								width: 40,
								padding: [0, 0, 0, 30],
								color: state.charts.color,
							},
						},
					},
				},
				series: [
					{
						type: 'pie',
						radius: ['82', themeConfig.value.isIsDark ? '50' : '102'],
						center: ['32%', '50%'],
						itemStyle: {
							color: function (params: any) {
								return colorList[params.dataIndex];
							},
						},
						label: { show: false },
						labelLine: { show: false },
						data: data,
					},
				],
			};
			(<any>global.homeChartTwo).setOption(option);
			(<any>state.myCharts).push(global.homeChartTwo);
		};
		// 柱状图
		const initBarChart = () => {
			if (!global.dispose.some((b: any) => b === global.homeCharThree)) global.homeCharThree.dispose();
			global.homeCharThree = <any>echarts.init(homeBarRef.value, state.charts.theme);
			const option = {
				backgroundColor: state.charts.bgColor,
				title: {
					text: '地热开发利用',
					x: 'left',
					textStyle: { fontSize: '15', color: state.charts.color },
				},
				tooltip: { trigger: 'axis' },
				legend: { data: ['供温', '回温', '压力值(Mpa)'], right: 0 },
				grid: { top: 70, right: 80, bottom: 30, left: 80 },
				xAxis: [
					{
						type: 'category',
						data: ['1km', '2km', '3km', '4km', '5km', '6km'],
						boundaryGap: true,
						axisTick: { show: false },
					},
				],
				yAxis: [
					{
						name: '供回温度(℃）',
						nameLocation: 'middle',
						nameTextStyle: { padding: [3, 4, 50, 6] },
						splitLine: { show: true, lineStyle: { type: 'dashed', color: '#f5f5f5' } },
						axisLine: { show: false },
						axisTick: { show: false },
						axisLabel: { color: state.charts.color, formatter: '{value} ' },
					},
					{
						name: '压力值(Mpa)',
						nameLocation: 'middle',
						nameTextStyle: { padding: [50, 4, 5, 6] },
						splitLine: { show: false },
						axisLine: { show: false },
						axisTick: { show: false },
						axisLabel: { color: state.charts.color, formatter: '{value} ' },
					},
				],
				series: [
					{
						name: '供温',
						type: 'line',
						smooth: true,
						showSymbol: true,
						// 矢量画五角星
						symbol: 'path://M150 0 L80 175 L250 75 L50 75 L220 175 Z',
						symbolSize: 12,
						yAxisIndex: 0,
						areaStyle: {
							color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
								{ offset: 0, color: 'rgba(250,180,101,0.3)' },
								{ offset: 1, color: 'rgba(250,180,101,0)' },
							]),
							shadowColor: 'rgba(250,180,101,0.2)',
							shadowBlur: 20,
						},
						itemStyle: { color: '#FF8000' },
						// data中可以使用对象，value代表相应的值，另外可加入自定义的属性
						data: [
							{ value: 1, stationName: 's1' },
							{ value: 3, stationName: 's2' },
							{ value: 4, stationName: 's3' },
							{ value: 9, stationName: 's4' },
							{ value: 3, stationName: 's5' },
							{ value: 2, stationName: 's6' },
						],
					},
					{
						name: '回温',
						type: 'line',
						smooth: true,
						showSymbol: true,
						symbol: 'emptyCircle',
						symbolSize: 12,
						yAxisIndex: 0,
						areaStyle: {
							color: new echarts.graphic.LinearGradient(
								0,
								0,
								0,
								1,
								[
									{ offset: 0, color: 'rgba(199, 237, 250,0.5)' },
									{ offset: 1, color: 'rgba(199, 237, 250,0.2)' },
								],
								false
							),
						},
						itemStyle: {
							color: '#3bbc86',
						},
						data: [
							{ value: 31, stationName: 's1' },
							{ value: 36, stationName: 's2' },
							{ value: 54, stationName: 's3' },
							{ value: 24, stationName: 's4' },
							{ value: 73, stationName: 's5' },
							{ value: 22, stationName: 's6' },
						],
					},
					{
						name: '压力值(Mpa)',
						type: 'bar',
						barWidth: 30,
						yAxisIndex: 1,
						itemStyle: {
							color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
								{ offset: 0, color: 'rgba(108,80,243,0.3)' },
								{ offset: 1, color: 'rgba(108,80,243,0)' },
							]),
							//柱状图圆角
							borderRadius: [30, 30, 0, 0],
						},
						data: [
							{ value: 11, stationName: 's1' },
							{ value: 34, stationName: 's2' },
							{ value: 54, stationName: 's3' },
							{ value: 39, stationName: 's4' },
							{ value: 63, stationName: 's5' },
							{ value: 24, stationName: 's6' },
						],
					},
				],
			};
			(<any>global.homeCharThree).setOption(option);
			(<any>state.myCharts).push(global.homeCharThree);
		};
		// 批量设置 echarts resize
		const initEchartsResizeFun = () => {
			nextTick(() => {
				for (let i = 0; i < state.myCharts.length; i++) {
					setTimeout(() => {
						(<any>state.myCharts[i]).resize();
					}, i * 1000);
				}
			});
		};
		// 批量设置 echarts resize
		const initEchartsResize = () => {
			window.addEventListener('resize', initEchartsResizeFun);
		};
		// 页面加载时
		onMounted(() => {
			fetchApiData();
			initEchartsResize();
			initTime(); // 初始化时间显示
			//initLolCharts(); // 初始化英雄联盟相关图表
			initHeroScroll(); // 添加英雄数据轮播初始化
			nextTick(() => {
				initLolCharts();
			});
		});
		// 由于页面缓存原因，keep-alive
		onActivated(() => {
			initEchartsResizeFun();
		});
		// 监听 vuex 中的 tagsview 开启全屏变化，重新 resize 图表，防止不出现/大小不变等
		watch(
			() => isTagsViewCurrenFull.value,
			() => {
				initEchartsResizeFun();
			}
		);
		// 监听 vuex 中是否开启深色主题
		watch(
			() => themeConfig.value.isIsDark,
			(isIsDark) => {
				nextTick(() => {
					state.charts.theme = isIsDark ? 'dark' : '';
					state.charts.bgColor = isIsDark ? 'transparent' : '';
					state.charts.color = isIsDark ? '#dadada' : '#303133';
					setTimeout(() => {
						initLineChart();
					}, 500);
					setTimeout(() => {
						initPieChart();
					}, 700);
					setTimeout(() => {
						initBarChart();
					}, 1000);
				});
			},
			{
				deep: true,
				immediate: true,
			}
		);
		// 获取API数据
		const fetchApiData = async () => {
			/* try {
				const res = await GetList({});
				if (res.code === 2000) {
					state.apiData = res.data;
					updateHomeData(res.data);
				}
			} catch (error) {
				console.error('获取统计数据失败:', error);
			} */
		};
		// 更新首页数据
		const updateHomeData = (data: ApiData) => {
			// 更新顶部卡片数据
			state.homeOne[0].num1 = data.total_applications.toString();
			state.homeOne[1].num1 = data.total_positions.toString();
			state.homeOne[2].num1 = data.total_questions.toString();
			state.homeOne[3].num1 = data.total_reports.toString();
			
			// 更新折线图数据
			updateLineChart(data.application_trend);
		};
		// 更新折线图数据
		const updateLineChart = (trendData: Array<{date: string; count: number}>) => {
			if (!global.homeChartOne) return;
			
			const option = {
				xAxis: {
					data: trendData.map((item: {date: string; count: number}) => item.date.substring(5)), // 只显示月-日
				},
				series: [
					{
						name: '申请数量',
						data: trendData.map((item: {date: string; count: number}) => item.count),
					}
				]
			};
			
			(<any>global.homeChartOne).setOption(option);
		};
		// 添加卡片点击跳转功能
		const handleCardClick = (index: number) => {
			const routes = [
				'/JobApplication/list/index', // 申请总数
				'/position/list',    // 职位总数
				'/questionBank/list',    // 问题总数
				'/JobApplication/list/index'       // 报告总数
			];
			
			if (index >= 0 && index < routes.length) {
				router.push(routes[index]);
			}
		};

		// 初始化时间显示
		const initTime = () => {
			const showTime = () => {
				const dt = new Date();
				const y = dt.getFullYear();
				const mt = dt.getMonth() + 1;
				const day = dt.getDate();
				const h = dt.getHours();
				const m = dt.getMinutes();
				const s = dt.getSeconds();
				document.getElementById("showTime")!.innerHTML = 
					y + "年" + mt + "月" + day + "日" + h + "时" + m + "分" + s + "秒";
			};
			showTime();
			setInterval(showTime, 1000);
		};
		//
		/* function echarts_3() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('echart3'));

		option3 

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        window.addEventListener("resize", function() {
            myChart.resize();
        });
    } */
		// 初始化英雄联盟相关图表
		const initLolCharts = () => {
			// 设备运行状态图
			const echart5 = echarts.init(document.getElementById('echart5'));
			const option5 = {
				tooltip: {
					trigger: 'axis',
					axisPointer: {
						type: 'shadow'
					}
				},
				legend: {
					data: ['运行时长', '故障次数', '维修时间'],
					textStyle: {
						color: '#fff'
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis: {
					type: 'category',
					data: ['DEV001', 'DEV002', 'DEV003', 'DEV004', 'DEV005'],
					axisLabel: {
						color: '#fff'
					}
				},
				yAxis: {
					type: 'value',
					axisLabel: {
						color: '#fff'
					}
				},
				series: [
					{
						name: '运行时长',
						type: 'bar',
						data: [168, 145, 132, 120, 96],
						itemStyle: {
							color: '#91cc75'
						}
					},
					{
						name: '故障次数',
						type: 'bar',
						data: [2, 1, 3, 0, 1],
						itemStyle: {
							color: '#ee6666'
						}
					},
					{
						name: '维修时间',
						type: 'line',
						data: [2.5, 1.8, 3.2, 0, 1.5],
						itemStyle: {
							color: '#fac858'
						}
					}
				]
			};
			echart5.setOption(option5);

			// 故障维修执行情况
			const echart3 = echarts.init(document.getElementById('echart3'));
			const option3 = {
				tooltip: {
					trigger: 'axis',
					axisPointer: {
						lineStyle: {
							color: '#57617B'
						}
					}
				},
				legend: {
					data: ['故障数', '已修复', '待修复'],
					top: '0',
					textStyle: {
						color: "#fff"
					},
					itemGap: 20,
				},
				grid: {
					left: '0',
					right: '20',
					top: '10',
					bottom: '20',
					containLabel: true
				},
				xAxis: [{
					type: 'category',
					boundaryGap: false,
					axisLabel: {
						show: true,
						textStyle: {
							color: 'rgba(255,255,255,1)',
							fontSize: 11
						}
					},
					axisLine: {
						lineStyle: {
							color: 'rgba(255,255,255,.1)'
						}
					},
					data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
				}],
				yAxis: [{
					axisLabel: {
						show: true,
						textStyle: {
							color: 'rgba(255,255,255,.6)'
						}
					},
					axisLine: {
						lineStyle: {
							color: 'rgba(255,255,255,.1)'
						}
					},
					splitLine: {
						lineStyle: {
							color: 'rgba(255,255,255,.1)'
						}
					}
				}],
				series: [{
					name: '故障数',
					type: 'line',
					smooth: true,
					data: [5, 3, 4, 6, 2, 5, 3, 4, 5, 3, 4, 5]
				}, {
					name: '已修复',
					type: 'line',
					smooth: true,
					data: [4, 2, 4, 5, 2, 4, 3, 3, 5, 2, 3, 4]
				}, {
					name: '待修复',
					type: 'line',
					smooth: true,
					data: [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1]
				}]
			};
			echart3.setOption(option3);

			// 设备实时执行情况
			const echart4 = echarts.init(document.getElementById('echart4'));
			const option4 = {
				tooltip: {
					trigger: 'axis'
				},
				legend: {
					data: ['运行设备', '故障设备'],
					textStyle: {
						color: '#fff'
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis: {
					type: 'category',
					data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00'],
					axisLabel: {
						color: '#fff'
					}
				},
				yAxis: {
					type: 'value',
					axisLabel: {
						color: '#fff'
					}
				},
				series: [
					{
						name: '运行设备',
						type: 'bar',
						data: [150, 145, 160, 155, 158, 152],
						itemStyle: {
							color: '#91cc75'
						}
					},
					{
						name: '故障设备',
						type: 'bar',
						data: [8, 12, 5, 7, 10, 6],
						itemStyle: {
							color: '#ee6666'
						}
					}
				]
			};
			echart4.setOption(option4);

			// 设备维修用时排行
			const echart2 = echarts.init(document.getElementById('echart2'));
			const option2 = {
				tooltip: {
					trigger: 'item'
				},
				legend: {
					top: '5%',
					left: 'center',
					textStyle: {
						color: '#fff'
					}
				},
				series: [
					{
						name: '维修用时',
						type: 'pie',
						radius: ['40%', '70%'],
						avoidLabelOverlap: false,
						itemStyle: {
							borderRadius: 10,
							borderColor: '#fff',
							borderWidth: 2
						},
						label: {
							show: true,
							formatter: '{b}: {c}h'
						},
						data: [
							{ value: 2.5, name: 'DEV003' },
							{ value: 1.8, name: 'DEV007' },
							{ value: 1.2, name: 'DEV001' },
							{ value: 1.0, name: 'DEV005' },
							{ value: 0.8, name: 'DEV002' }
						]
					}
				]
			};
			echart2.setOption(option2);

			// 指标图表
			const zb1 = echarts.init(document.getElementById('zb1'));
			const zb2 = echarts.init(document.getElementById('zb2'));
			const zb3 = echarts.init(document.getElementById('zb3'));

			const zbOption = (value: number, color: string) => ({
				series: [{
					type: 'gauge',
					startAngle: 180,
					endAngle: 0,
					min: 0,
					max: 100,
					splitNumber: 10,
					itemStyle: {
						color: color
					},
					progress: {
						show: true,
						roundCap: true,
						width: 8
					},
					pointer: {
						show: false
					},
					axisLine: {
						roundCap: true,
						lineStyle: {
							width: 8
						}
					},
					axisTick: {
						show: false
					},
					splitLine: {
						show: false
					},
					axisLabel: {
						show: false
					},
					title: {
						show: false
					},
					detail: {
						show: true,
						fontSize: 14,
						offsetCenter: [0, '20%'],
						color: '#fff',
						formatter: value + '%'
					},
					data: [{
						value: value
					}]
				}]
			});

			// 设备故障统计
			const echart1 = echarts.init(document.getElementById('echart1'));
			const option1 = {
				tooltip: {
					trigger: 'item',
					formatter: '{b}: {c}台 ({d}%)'
				},
				legend: {
					orient: 'vertical',
					right: 10,
					top: 'center',
					textStyle: {
						color: '#fff'
					}
				},
				series: [{
					type: 'pie',
					radius: ['50%', '70%'],
					label: {
						show: true,
						formatter: '{b}: {c}台'
					},
					data: [
						{value: 150, name: '正常运行'},
						{value: 10, name: '故障维修'},
						{value: 5, name: '待机状态'},
						{value: 3, name: '停机维护'}
					]
				}]
			};
			echart1.setOption(option1);

			zb1.setOption(zbOption(89, '#91cc75')); // 运行
			zb2.setOption(zbOption(6, '#ee6666')); // 故障
			zb3.setOption(zbOption(5, '#fac858')); // 等待

			// 监听窗口大小变化
			window.addEventListener('resize', () => {
				echart5.resize();
				echart4.resize();
				echart3.resize();
				echart2.resize();
				echart1.resize();
				zb1.resize();
				zb2.resize();
				zb3.resize();
			});
		};

		// 初始化英雄数据轮播
		const initHeroScroll = () => {
			const wrap = document.querySelector('.wrap') as HTMLElement;
			if (!wrap) return;
			
			const ul = wrap.querySelector('ul') as HTMLElement;
			if (!ul) return;
			
			// 克隆列表项用于无缝滚动
			const cloneItems = ul.innerHTML;
			ul.innerHTML = cloneItems + cloneItems;
			
			let scrollHeight = 0;
			const itemHeight = 32; // 每个列表项的高度
			const totalItems = state.heroData.length;
			
			const scroll = () => {
				scrollHeight++;
				if (scrollHeight >= totalItems * itemHeight) {
					scrollHeight = 0;
					ul.style.transition = 'none';
					ul.style.transform = `translateY(0)`;
					// 强制回流
					ul.offsetHeight;
					ul.style.transition = 'transform 0.5s linear';
				} else {
					ul.style.transform = `translateY(-${scrollHeight}px)`;
				}
			};
			
			// 每3秒滚动一次
			setInterval(() => {
				scroll();
			}, 3000);
		};
		return {
			homeLineRef,
			homePieRef,
			homeBarRef,
			handleCardClick,
			...toRefs(state),
		};
	},
});
</script>

<style scoped lang="scss">
$homeNavLengh: 8;
.home-container {
	
	overflow: hidden;
	.home-card-one,
	.home-card-two,
	.home-card-three {
		.home-card-one-title{
			padding: 20px 0px;
			color:#808080;
			font-size: 14px;
			letter-spacing: 3px;
		}
		.home-card-item {
			width: 100%;
			height: 130px;
			border-radius: 16px;
			transition: all ease 0.3s;
			padding: 20px;
			overflow: hidden;
			background: var(--el-color-white);
			color: var(--el-text-color-primary);
			border: 1px solid var(--next-border-color-light);
			&:hover {
				box-shadow: 0 2px 12px var(--next-color-dark-hover);
				transition: all ease 0.3s;
			}
			&-icon {
				width: 70px;
				height: 70px;
				border-radius: 100%;
				flex-shrink: 1;
				i {
					color: var(--el-text-color-placeholder);
				}
			}
			&-title {
				font-size: 15px;
				font-weight: bold;
				height: 30px;
			}
		}
	}
	.home-card-one {
		@for $i from 0 through 3 {
			.home-one-animation#{$i} {
				opacity: 0;
				animation-name: error-num;
				animation-duration: 0.5s;
				animation-fill-mode: forwards;
				animation-delay: calc($i/10) + s;
			}
		}
	}
	.home-card-two,
	.home-card-three {
		.home-card-item {
			height: 400px;
			width: 100%;
			overflow: hidden;
			.home-monitor {
				height: 100%;
				.flex-warp-item {
					width: 25%;
					height: 111px;
					display: flex;
					.flex-warp-item-box {
						margin: auto;
						text-align: center;
						color: var(--el-text-color-primary);
						display: flex;
						border-radius: 5px;
						background: var(--next-bg-color);
						cursor: pointer;
						transition: all 0.3s ease;
						&:hover {
							background: var(--el-color-primary-light-9);
							transition: all 0.3s ease;
						}
					}
					@for $i from 0 through $homeNavLengh {
						.home-animation#{$i} {
							opacity: 0;
							animation-name: error-num;
							animation-duration: 0.5s;
							animation-fill-mode: forwards;
							animation-delay: calc($i/10) + s;
						}
					}
				}
			}
		}
	}
	.home-right {
		.home-card-item {
			height: 500px;
			border-radius: 16px;
			transition: all ease 0.3s;
			padding: 20px;
			overflow: hidden;
			background: var(--el-color-white);
			color: var(--el-text-color-primary);
			border: 1px solid var(--next-border-color-light);
			.home-card-item-content{
				display: flex;
			}
			::v-deep(.el-collapse-item__header){
				border: none;
			}
			::v-deep(.el-collapse-item__wrap){
				border: none;
			}
			::v-deep(.el-collapse-item__content){
				padding: 0;
			}
			&-title {
				font-size: 15px;
				font-weight: bold;
				height: 30px;
				border-bottom: 1px solid var(--next-border-color-light);
				padding-bottom: 10px;
				margin-bottom: 10px;
			}

			&:hover {
				box-shadow: 0 2px 12px var(--next-color-dark-hover);
				transition: all ease 0.3s;
			}
		}
	}

	// 响应式处理
	@media screen and (max-width: 1200px) {
		.el-col-18 {
			width: 100%;
		}
		.el-col-6 {
			width: 100%;
			margin-top: 15px;
		}
		.home-right .home-card-item {
			height: auto;
			min-height: 300px;
		}
	}
	
	.todo-list {
		padding: 10px 20px; 
		margin-top: 15px;
		margin-left: 50px;
		.todo-item {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 8px 0;
			border-bottom: 1px solid var(--next-border-color-light);
			.todo-item-left {
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				.todo-tag {
					margin-right: 10px;
				}
			}
			
			&:last-child {
				border-bottom: none;
			}
			
			.todo-date {
				color: var(--el-text-color-secondary);
				font-size: 13px;
			}
			
			:deep(.el-checkbox__label) {
				color: var(--el-text-color-primary);
			}
		}
	}
	.score-list {
		padding: 10px 0;
		.score-item {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 8px 15px;
			margin: 5px 0;
			background: var(--el-fill-color-light);
			border-radius: 4px;
			
			.score-name {
				font-size: 14px;
				color: var(--el-text-color-primary);
			}
			
			.score-value {
				font-size: 14px;
				color: var(--el-color-primary);
				font-weight: 500;
			}
		}
	}

	// 添加英雄联盟数据可视化样式
	.lol-data-section {
	
		
		.lol-container {
			border-radius: 16px;
			
			color: #fff;
			background: url(/@/assets/img/bg.png) center top #000d4a;
			.head {
				height: 105px;
				background: url(/@/assets/img/head_bg.png) no-repeat center center;
				text-align: center;
				position: relative;

				h1 {
					font-size: 24px;
					color: #fff;
					line-height: 90px;
					text-align: center;
				}

				.weather {
					position: absolute;
					right: 20px;
					top: 0;
					line-height: 85px;
				}
			}

			.mainbox {
				/* min-height: 600px; */
				height: 100vh;
				padding: 10px 20px;

				.boxall {
					border: 1px solid rgba(25, 186, 139, 0.17);
					padding: 15px;
					background: rgba(255, 255, 255, 0.04);
					margin-bottom: 15px;
					border-radius: 8px;

					// 添加表格透明样式
					:deep(.el-table) {
						background-color: transparent;
						
						&::before {
							display: none;
						}
						
						tr {
							background-color: transparent;
						}
						
						th {
							background-color: transparent;
							border-bottom-color: rgba(255, 255, 255, 0.1);
							color: #fff;
						}
						
						td {
							background-color: transparent;
							border-bottom-color: rgba(255, 255, 255, 0.1);
							color: #fff;
						}
						
						.el-table__cell {
							background-color: transparent;
						}

						// 添加表头背景透明
						.el-table__header {
							background-color: transparent;
							
							tr {
								background-color: transparent;
							}
							
							th.el-table__cell {
								background-color: transparent !important;
							}
						}

						// 添加表体背景透明
						.el-table__body {
							background-color: transparent;
							
							tr {
								background-color: transparent !important;
								
								&:hover > td.el-table__cell {
									background-color: rgba(255, 255, 255, 0.1) !important;
								}
							}
						}
					}

					.alltitle {
						font-size: 16px;
						color: #fff;
						padding-left: 12px;
						margin-bottom: 10px;
						position: relative;
					}
					.alltitle:before {
						width: 5px;
						height: 20px;
						top: 2px;
						position: absolute;
						content: "";
						background: #49bcf7;
						border-radius: 20px;
						left: 0;
					}
				}

				ul.clearfix {
					display: flex;
					justify-content: space-between;
					margin: 0;
					padding: 0;
					list-style: none;

					li {
						width: 32%;
					}
				}

				.wrap {
					height: 200px;
					overflow: hidden;

					ul {
						list-style: none;
						padding: 0;
						margin: 0;
						transition: transform 0.5s linear;

						li {
							line-height: 32px;
							font-size: 14px;

							p {
								display: flex;
								justify-content: space-between;
								margin: 0;
								padding: 0 10px;
								color: #fff;

								span {
									flex: 1;
									text-align: center;
									
									&:first-child {
										text-align: left;
									}
								}
							}

							&:hover {
								background: rgba(255, 255, 255, 0.1);
							}
						}
					}
				}

				.wraptit {
					display: flex;
					justify-content: space-between;
					padding: 0 10px;
					margin-bottom: 10px;
					color: #fff;
					font-weight: bold;

					span {
						flex: 1;
						text-align: center;
						
						&:first-child {
							text-align: left;
						}
					}
				}
				.wrap {
					span{
						flex: 1;
						text-align: center;
						&:first-child {
							text-align: left;
						}
					}
				}

				.zhibiao {
					display: flex;
					justify-content: space-around;
					
					.zb1, .zb2, .zb3 {
						width: 33%;
						height: 100%;
						text-align: center;
						color: #fff;
						font-size: 14px;
						padding: 10px;
					}
				}
			}
		}
	}
}
</style>
