<template>
	<div class="home-wrapper">
		<div class="home-main" ref="containerRef">
			<div class="home-top-bg"></div>
			<div class="home-main-header">
				<div class="home-main-header-center">
					<SearchContainer style="margin-bottom: 0;margin-top: 48px;  height: fit-content" v-if="containerRef"
						placeholder="搜索市场准入限制调查" :containerRef="containerRef" areaName="" />
				</div>
				<div class="date-box" v-if="sortInfo.length">
					<div class="date-icon">
						<img :src="tipsTcon" alt="">
					</div>
					<div class="date-text">近期美国各联邦政府机构市场准入限制调查数量汇总</div>
					<TimeTabPane @time-click="handleGetStatSort" activeTime="近一年" />
				</div>
				<div class="home-main-header-card-box">
					<div :class="getCardClass(item.sortCode)" v-for="item in sortInfo" :key="item.sortCode" @click="onNavigateToCase(item)">
						<div class="header">
							<div class="header-left">{{ item.sortName }}</div>
							<div class="header-right">{{ `${item.sortCount}项` }}</div>
						</div>
						<div class="content-box">
							<div class="item">{{ item.sortMeasure }}</div>
							<div class="item">
								{{ item.sortDescription }}
							</div>
						</div>
						<div class="item-dot" v-if="item.addInvestCount">+{{ item.addInvestCount }}</div>
					</div>
				</div>
			</div>
			<div class="home-main-center">
				<DivideHeader id="position1" class="divide-header" :titleText="'最新动态'"></DivideHeader>
				<div class="center-top">
					<div class="box1">
						<overviewMainBox title="调查进展" @toDetail="handleClickToDetail()">
							<template #header-icon>
								<img style="width:100%; height:100%" src="./assets/icons/icon_1599.png" alt="" />
							</template>
							<el-carousel ref="carouselRef" height="395px" :autoplay="true" :interval="3000" arrow="never" indicator-position="none">
								<el-carousel-item v-for="(item, index) in box1DataList" :key="index">
									<div class="box1-main">
										<div class="box1-head-box">
											<div :class="`box1-head-code box1-tags-${item.searchsort}`">{{ item.searchsort }}调查</div>
											<div class="box1-head-name one-line-ellipsis">{{ item.searchname }}</div>
											<div class="box1-head-tags" v-if="item.searchArea.length">
												<AreaTag v-for="(val, idx) in item.searchArea.slice(0, 2)" :key="idx" :tagName="val" />
											</div>
										</div>
										<CarouselItem337 v-if="item.searchsort==337" :baseInfo="item"></CarouselItem337>
										<CarouselItem301 v-if="item.searchsort==301" :baseInfo="item"></CarouselItem301>
										<CarouselItem232 v-if="item.searchsort==232" :baseInfo="item"></CarouselItem232>
									</div>
								</el-carousel-item>
							</el-carousel>
							<div class="box1-left" @click="handleSwithCurSurvey('left')"> <LeftBtn /> </div>
							<div class="box1-right" @click="handleSwithCurSurvey('right')"> <RightBtn /> </div>
						</overviewMainBox>
					</div>
					<RiskSignal :list="box2Data" @more-click="handleToMoreRiskSignal" @item-click="handleRiskSignalItemToManage" postDate="signalTime" name="signalTitle" riskLevel="signalLevel" />
					<RiskSignalOverviewDetailDialog
						v-model="isRiskOverviewDetailOpen"
						:row="riskOverviewDetailRow"
						name-field="signalTitle"
						post-date-field="signalTime"
						risk-level-field="signalLevel"
					/>
				</div>

				<DivideHeader id="position2" class="divide-header" :titleText="'资讯要闻'"></DivideHeader>
				<div class="center-center">
					<NewsList :newsList="newsList" @item-click="handleToNewsAnalysis" @more-click="handleToMoreNews"
						img="newsImage" title="newsTitle" content="newsContent" from="from" />
					<MessageBubble :messageList="messageList" @person-click="handleClickPerson" @more-click="handleToSocialDetail"
						source="orgName" content="remarks" name="personName" imageUrl="personImage">
					</MessageBubble>
				</div>

				<DivideHeader id="position3" class="divide-header" :titleText="'数据总览'"></DivideHeader>
				<div class="center-footer">
					<div class="box5">
						<OverviewNormalBox title="数量变化趋势">
							<template #header-icon>
								<img style="width: 100%; height: 100%;" src="./assets/icons/icon2.svg" alt="" />
							</template>
							<template #header-right>
								<div class="box-header-right">
									<div class="box5-header-right-btn-box">
										<div :class="['right-box', { 'box5-active': box5Active==1 }]" @click="hadleGetStatNum(1)">按月度</div>
										<div :class="['right-box', { 'box5-active': box5Active==12 }]" @click="hadleGetStatNum(12)">按年度</div>
									</div>
								</div>
							</template>
							<div class="box-echart-main">
								<div class="box-echart-content">
									<el-empty v-if="!box5ChartData.title.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
									<div v-if="box5ChartData.title.length" style="width: 100%; height: 100%;" ref="box5Ref"></div>
								</div>
								<TipTab text="美对华发起调查案件数量变化趋势，数据来源：美国国际贸易委员会、商务部、贸易代表办公室官网" style="margin-top: 16px;" />
								<div class="ai-pane">
									<AiButton />
									<AiPane :aiContent="aiContent.content5" />
								</div>
							</div>
						</OverviewNormalBox>
					</div>
					<div class="box6">
						<OverviewNormalBox title="领域分布情况" width="521px">
							<template #header-icon>
								<img style="width: 100%; height: 100%;" src="./assets/icons/icon3.svg" alt="" />
							</template>
							<template #header-right>
								<div class="box-header-right">
									<el-select v-model="box6SelectedYear" @change="handleChangeBox6Year" placeholder="选择时间" style="width: 120px">
										<el-option v-for="item in box7YearList" :key="item.value" :label="item.label" :value="item.value" />
									</el-select>
								</div>
							</template>
							<div class="box-echart-main">
								<div class="box-echart-content">
									<el-empty v-if="!box6Data.title.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
									<div v-if="box6Data.title.length" style="width: 100%; height: 100%;" id="box6Chart"></div>
								</div>
								<TipTab text="美对华发起调查案件领域分布情况，数据来源：美国国际贸易委员会、商务部、贸易代表办公室官网" ellipsis style="padding-right: 50px;" />
								<div class="ai-pane">
									<AiButton />
									<AiPane :aiContent="aiContent.content6" />
								</div>
							</div>
						</OverviewNormalBox>
					</div>
				</div>
				<div class="center-footer1">
					<div class="box7">
						<OverviewNormalBox title="国家分布情况" width="1064px">
							<template #header-icon>
								<img style="width: 100%; height: 100%;" src="./assets/icons/icon4.svg" alt="" />
							</template>
							<template #header-right>
								<div class="box-header-right">
									<div class="box7-header-right-select-box">
										<el-select v-model="box7SelectedSurvey" @change="handleBox7()" placeholder="选择调查" style="width: 120px">
											<el-option v-for="item in box8SurveyList" :key="item.value" :label="item.label" :value="item.value" />
										</el-select>
										<el-select v-model="box7SelectedYear" @change="handleBox7()" placeholder="选择时间" style="width: 120px">
											<el-option v-for="item in box7YearList" :key="item.value" :label="item.label" :value="item.value" />
										</el-select>
									</div>
								</div>
							</template>
							<div class="box-echart-main">
								<div class="box-echart-content">
									<el-empty v-if="!box7Data.data.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
									<div v-if="box7Data.data.length" style="width: 100%; height: 100%;" id="box7Chart"></div>
								</div>
								<TipTab :text="`美发起调查案件的被调查国家分布情况，数据来源：${box7TipText}`" style="margin-top: 10px;" />
								<div class="ai-pane">
									<AiButton />
									<AiPane :aiContent="aiContent.content7" />
								</div>
							</div>
						</OverviewNormalBox>
					</div>
					<div class="box8">
						<OverviewNormalBox title="结果分布情况" width="521px">
							<template #header-icon>
								<img style="width: 100%; height: 100%" src="./assets/icons/icon5.svg" alt="" />
							</template>
							<template #header-right>
								<div class="box-header-right">
									<el-select v-model="box8SelectedSurvey" @change="handleGetBox8Data()" placeholder="选择调查" style="width: 120px">
										<el-option v-for="item in box8SurveyList" :key="item.value" :label="item.label" :value="item.value" />
									</el-select>
								</div>
							</template>
							<div class="box-echart-main">
								<div class="box-echart-content">
									<el-empty v-if="!box8Data.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
									<div v-if="box8Data.length" style="width: 100%; height: 100%;" ref="box8Ref"></div>
								</div>
								<TipTab :text="`美发起调查案件的被调查国家分布情况，数据来源：${box8TipText}`" ellipsis style="padding-right: 50px;" />
								<div class="ai-pane">
									<AiButton />
									<AiPane :aiContent="aiContent.content8" />
								</div>
							</div>
						</OverviewNormalBox>
					</div>
				</div>
			</div>

			<div class="home-main-footer">
				<DivideHeader id="position4" class="divide-header" :titleText="'资源库'"></DivideHeader>
				<div class="home-main-footer-header">
					<SourceTabList :sourceTabList="categoryList" :activeSouceTabId="activeCateId" @clickTab="handleClickCate"></SourceTabList>
					<div class="select-box">
						<el-select v-model="isSort" placeholder="发布时间" style="width: 166px" @change="handlePxChange">
							<template #prefix>
								<div style="display: flex; align-items: center; height: 100%">
									<img src="@/assets/icons/jiangxu1.png" style="width: 14px; height: 14px" />
								</div>
							</template>
							<el-option v-for="item in releaseTimeList" :key="item.value" :label="item.label" :value="item.value" />
						</el-select>
					</div>
				</div>
				<div class="home-main-footer-main">
					<div class="left">
						<!-- 科技领域 -->
						<div class="check-box">
							<div class="check-head">
								<div class="head-name">{{ "科技领域" }}</div>
							</div>
							<el-checkbox-group class="check-list" v-model="checkedAreaList" @change="handleCheckedAreasChange">
								<el-checkbox class="check-item" v-for="item in surveyAreaList" :key="item.id" :label="item.id">
									{{ item.name }}
								</el-checkbox>
							</el-checkbox-group>
						</div>
						<!-- 发布时间 -->
						<div class="check-box">
							<div class="check-head">
								<div class="head-name">{{ "发布时间" }}</div>
							</div>
							<div class="left-main">
								<el-checkbox-group class="check-list" v-model="checkedYearList" @change="handleCheckedYearsChange">
									<el-checkbox class="check-item" v-for="item in surveyYearList" :key="item.id" :label="item.id">
										{{ item.name }}
									</el-checkbox>
								</el-checkbox-group>
							</div>
						</div>
						<!-- 发布机构 -->
						<div class="check-box">
							<div class="check-head">
								<div class="head-name">{{ "发布机构" }}</div>
							</div>
							<div class="left-main">
								<el-checkbox-group class="check-list" v-model="checkedOrgList" @change="handleChangeCheckedIns">
									<el-checkbox class="check-item" v-for="item in surveyOrgList" :key="item.id" :label="item.id">
										{{ item.name }}
									</el-checkbox>
								</el-checkbox-group>
							</div>
						</div>
						<!-- 受调查国家/地区 -->
						<div class="check-box">
							<div class="check-head">
								<div class="head-name">{{ "受调查国家/地区" }}</div>
							</div>
							<div class="left-main">
								<el-checkbox-group class="check-list" v-model="checkedCountryList" @change="handleCheckedCountriesChange">
									<el-checkbox class="check-item" v-for="item in surveyCountryList" :key="item.id" :label="item.id">
										{{ item.name }}
									</el-checkbox>
								</el-checkbox-group>
							</div>
						</div>
					</div>
					<div class="right">
						<div class="right-header">
							<div class="icon">
								<img src="./assets/icons/icon6.svg" alt="" />
							</div>
							<div class="title">{{ "市场准入限制调查" }}</div>
						</div>
						<SurveyHistory :surveyList="surveyInfoList"></SurveyHistory>
						<div class="right-footer">
							<div class="footer-left">
								{{ `共 ${totalDiscussNum} 项` }}
							</div>
							<div class="footer-right">
								<el-pagination @current-change="handleCurrentChange" :pageSize="pageSize" :current-page="currentPage"
									background layout="prev, pager, next" :total="totalDiscussNum" />
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script setup>
import { onMounted, ref, nextTick, reactive, computed } from "vue";

import LeftBtn from "@/components/base/pageBtn/LeftBtn.vue";
import RightBtn from "@/components/base/pageBtn/RightBtn.vue";
import RiskSignal from "@/components/base/riskSignal/index.vue";
import RiskSignalOverviewDetailDialog from "@/components/base/RiskSignalOverviewDetailDialog/index.vue";
import TipTab from "@/components/base/TipTab/index.vue"
import MessageBubble from "@/components/base/messageBubble/index.vue"
import NewsList from "@/components/base/newsList/index.vue";
import DivideHeader from "@/components/DivideHeader.vue";
import SurveyHistory from "@/views/marketAccessRestrictions/com/SurveyHistory.vue"
import TimeTabPane from '@/components/base/TimeTabPane/index.vue';
import CarouselItem337 from '@/views/marketAccessRestrictions/marketAccessHome/com/CarouselItem337.vue';
import CarouselItem301 from '@/views/marketAccessRestrictions/marketAccessHome/com/CarouselItem301.vue';
import CarouselItem232 from '@/views/marketAccessRestrictions/marketAccessHome/com/CarouselItem232.vue';

import setChart from "@/utils/setChart";
import { getDateBefore, getAIReport, getNearYearList } from "@/views/marketAccessRestrictions/utils/index.ts";
import router from "@/router";
import { navigateToViewRiskSignal } from "@/utils/riskSignalOverviewNavigate";

import createLineChart from "@/views/marketAccessRestrictions/utils/baseLineChart";
import createPieChart from "@/views/marketAccessRestrictions/utils/basePiechart.js";
import getRadarChart from "./utils/radarChart";
import getBarChart from "./utils/barChart1";
import AiButton from '@/components/base/Ai/AiButton/index.vue';
import AiPane from '@/components/base/Ai/AiPane/index.vue';

import { getPersonSummaryInfo } from "@/api/common/index";
import {
	getStatSort,
	getStatNum,
	getStatDetails,
	getStatArea,
	getHylyList,
	getSurveyList,
	getSearchCountry,
	getSearchResult,
	getSearchAllOrg,
	getSearchAllCountry,
} from "@/api/marketAccessRestrictions/index";
import { getRiskSignal, getNews, getRemarks } from "@/api/common/index";
import { ElMessage } from "element-plus";
import { useGotoNewsDetail } from '@/router/modules/news';
import tipsTcon from "./assets/icons/tips-icon.png";

const getCardClass = (code) => ['theme-card', `theme-${code}`]

// 获取AI智能报告
const aiContent = reactive({
	content5: "正在生成...",
	content6: "正在生成...",
	content7: "正在生成...",
	content8: "正在生成...",
})
const onAIReport = (data, key) => {
	getAIReport(data).then(res => { aiContent[key] = res })
}

const handleToPosi = id => {
	const element = document.getElementById(id);
	if (element && containerRef.value) {
		// // 1. 如果是从完整搜索框跳转，先强制切换状态稳定布局
		// if (!isShow.value) {
		// 	isShow.value = true;
		// }

		// 2. 使用 nextTick 等待 DOM 布局（如高度切换）完成后再进行坐标计算
		nextTick(() => {
			const containerRect = containerRef.value.getBoundingClientRect();
			const elementRect = element.getBoundingClientRect();
			// 使用 getBoundingClientRect 计算元素相对于容器顶部的绝对距离
			const top = elementRect.top - containerRect.top + containerRef.value.scrollTop;

			containerRef.value.scrollTo({
				top: top,
				behavior: "smooth"
			});
		});
	}
};

let containerRef = ref(null);
// 首页分类
const sortInfo = ref([]);
const handleGetStatSort = async (event) => {
	let day = 365
	if (event?.time === '近一周') day = 7
	if (event?.time === '近一月') day = 30
	if (event?.time === '近一年') day = 365
	try {
		const res = await getStatSort({startDate: getDateBefore(day)});
		console.log("首页分类", res);
		// sortInfo.value = res.data.sort((a, b) => a.sortCode - b.sortCode);
		sortInfo.value = res.data;
	} catch (error) {}
};

// 调查进展
const box1DataList = ref([]);
const handleGetBox1Data = async () => {
	try {
		const res = await getStatDetails();
		console.log("调查进展", res);
		if (res.code === 200 && res.data) {
			box1DataList.value = res.data;
		}
	} catch (error) { }
};


const carouselRef = ref(null);
const handleClickToDetail = () => {
	let index = carouselRef.value?.activeIndex || 0;
	let item = box1DataList.value[index];
	if (item) onNavigateToDetail(item)
};

// 跳转调查案件
const onNavigateToCase = (item) => {
	const route = router.resolve({
		path: "/marketAccessLayout",
		query: { id: item.sortCode }
	});
	window.open(route.href, "_blank");
};

// 跳转调查详情
const onNavigateToDetail = (item) => {
	console.log(item)
	let curTabName = item.searchname || item.signalTitle;
	let id = item.sortcode || item.sortCode || item.searchsort;
	let searchId = item.searchid || item.searchId;

	window.sessionStorage.setItem("curTabName", curTabName);
	const route = router.resolve({
		path: "/marketSingleCaseLayout/overview",
		query: { id, searchId },
	});
	window.open(route.href, "_blank");
};

// 切换当前调查
const handleSwithCurSurvey = name => {
	if (name === "left") {
		carouselRef.value.prev();
	} else {
		carouselRef.value.next();
	}
};

// 风险信号
const box2Data = ref([]);
const handleGetBox2Data = async () => {
	const params = {
		moduleId: "0104"
	};
	try {
		const res = await getRiskSignal(params);
		console.log("风险信号", res);
		if (res.code === 200 && res.data) {
			box2Data.value = res.data;
		}
	} catch (error) { }
};

// 新闻资讯
const newsList = ref([]);
const handleGetBox3Data = async () => {
	try {
		const res = await getNews({moduleId: "0104"});
		console.log("新闻资讯", res);
		if (res.code === 200 && res.data) {
			newsList.value = res.data.map(item => {
				return {
					...item,
					from: item.newsDate + " · " + item.newsOrg
				};
			});
		}
	} catch (error) { }
};
// 查看新闻资讯详情
const gotoNewsDetail = useGotoNewsDetail()
const handleToNewsAnalysis = news => {
	gotoNewsDetail(news.newsId)
};

// 社交媒体
const messageList = ref([]);
const handleGetBox4Data = async () => {
	try {
		const res = await getRemarks({moduleId: "0104"});
		console.log("社交媒体", res);
		if (res.code === 200 && res.data) {
			messageList.value = res.data;
			messageList.value.forEach(item => {
				item.time = item.time.replace('T', ' ')
			})
		}
	} catch (error) { }
};
// 查看社交媒体详情
const handleToSocialDetail = item => {
	const route = router.resolve({
		path: "/characterPage",
		query: {
			personId: item.id
		}
	});
	window.open(route.href, "_blank");
};
// 点击人物头像，跳转到人物主页
const handleClickPerson = async item => {
	console.log("person", item);
	const personTypeList = JSON.parse(window.sessionStorage.getItem("personTypeList"));
	console.log("personTypeList", personTypeList);
	let type;
	let personTypeName = "";
	const params = {
		personId: item.personId
	};
	try {
		const res = await getPersonSummaryInfo(params);
		console.log("人物全局信息", res);
		if (res.code === 200 && res.data) {
			const arr = personTypeList.filter(item => {
				return item.typeId === res.data.personType;
			});
			console.log("arr", arr);

			if (arr && arr.length > 0) {
				personTypeName = arr[0].typeName;
				console.log("personTypeName", personTypeName);

				if (personTypeName === "科技企业领袖") {
					type = 1;
				} else if (personTypeName === "国会议员") {
					type = 2;
				} else if (personTypeName === "智库研究人员") {
					type = 3;
				} else {
					personTypeName = "";
					ElMessage.warning("找不到当前人员的类型值！");
					return;
				}
				window.sessionStorage.setItem("curTabName", item.personName);
				const route = router.resolve({
					path: "/characterPage",
					query: {
						type: type, // type=1为科技企业领袖，2为国会议员，3为智库研究人员
						personId: item.personId
					}
				});
				window.open(route.href, "_blank");
			} else {
				personTypeName = "";
				ElMessage.warning("找不到当前人员的类型值！");
				return;
			}
		} else {
			ElMessage.warning("找不到当前人员的类型值！");
			return;
		}
	} catch (error) { }
};

function transformAllData(originalData) {
	// 1. 提取所有年份并去重，排除null和undefined，然后按数字升序排序
	const allYears = [
		...new Set(
			originalData.filter(item => item.searchYorM != null && item.searchYorM !== "").map(item => String(item.searchYorM))
		)
	].sort((a, b) => Number(a) - Number(b));

	// 2. 获取所有调查类型并去重
	const allCategories = [...new Set(originalData.map(item => item.sortName))];

	// 3. 为每个类别创建值数组
	const categoryData = allCategories.map(category => {
		// 对于每个年份，查找对应的数据
		const values = allYears.map(year => {
			// 查找匹配当前类别和年份的数据
			const matchingItem = originalData.find(item => item.sortName === category && String(item.searchYorM) === year);

			// 如果找到则返回searchCount，否则返回0
			return matchingItem ? matchingItem.searchCount : 0;
		});

		return {
			name: category,
			value: values
		};
	});

	// 4. 构建最终结果
	return {
		title: allYears,
		list: categoryData
	};
}

function transformAllData1(originalData) {
	// 1. 提取所有年月并去重，排除null和undefined，然后按时间顺序排序
	const allDates = [
		...new Set(
			originalData.filter(item => item.searchYorM != null && item.searchYorM !== "").map(item => String(item.searchYorM))
		)
	].sort((a, b) => {
		// 自定义排序函数，处理年月格式
		const parseDate = dateStr => {
			if (dateStr.includes("-")) {
				// 处理 "YYYY-MM" 格式
				const [year, month] = dateStr.split("-").map(Number);
				return { year, month: month || 0 };
			} else {
				// 处理纯年份格式
				return { year: Number(dateStr), month: 0 };
			}
		};

		const dateA = parseDate(a);
		const dateB = parseDate(b);

		// 先比较年份，再比较月份
		if (dateA.year !== dateB.year) {
			return dateA.year - dateB.year;
		}
		return dateA.month - dateB.month;
	});

	// 2. 获取所有调查类型并去重
	const allCategories = [...new Set(originalData.map(item => item.sortName))];

	// 3. 为每个类别创建值数组
	const categoryData = allCategories.map(category => {
		// 对于每个日期，查找对应的数据
		const values = allDates.map(date => {
			// 查找匹配当前类别和日期的数据
			const matchingItem = originalData.find(item => item.sortName === category && String(item.searchYorM) === date);

			// 如果找到则返回searchCount，否则返回0
			return matchingItem ? matchingItem.searchCount : 0;
		});

		return {
			name: category,
			value: values
		};
	});

	// 4. 构建最终结果
	return {
		title: allDates,
		list: categoryData
	};
}

const box5ChartData = ref({
	title: [],
	list: [
		{ name: "337调查", value: [] },
		{ name: "301调查", value: [] },
		{ name: "232调查", value: [] }
	]
});
const box5Ref = ref(null)
const box5Active = ref(1);
const hadleGetStatNum = async (event) => {
	if (event) box5Active.value = event;
	try {
		let byYorM = box5Active.value
		const res = await getStatNum({byYorM});
		console.log("数量变化趋势", res);
		if (res.code === 200 && res.data) {
			if (byYorM === 1) {
				box5ChartData.value = transformAllData1(res.data);
			} else {
				box5ChartData.value = transformAllData(res.data);
			}
			onAIReport({ type: "折线图", name: "数量变化趋势", data: res.data }, "content5")
		} else {
			box5ChartData.value.title = [];
			box5ChartData.value.list = [
				{ name: "337调查", value: [] },
				{ name: "301调查", value: [] },
				{ name: "232调查", value: [] }
			]
			aiContent.content5 = "";
		}
	} catch (error) {
		box5ChartData.value.title = [];
		box5ChartData.value.list = [
			{ name: "337调查", value: [] },
			{ name: "301调查", value: [] },
			{ name: "232调查", value: [] }
		]
		aiContent.content5 = "";
	}
	nextTick(() => { createLineChart(box5Ref, box5ChartData.value) })
};

// 领域分布情况
const box6SelectedYear = ref("2025");
const handleChangeBox6Year = () => {
	handleBox6();
};
const box6Data = ref({
	title: [],
	data: [
		{ name: "337调查", value: [] },
		{ name: "232调查", value: [] },
		{ name: "301调查", value: [] }
	],
	maxNum: 0
});
const handleGetStatArea = async () => {
	const params = {
		years: box6SelectedYear.value
	};
	try {
		const res = await getStatArea(params);
		console.log("领域分布情况", res);
		if (res.code === 200 && res.data) {
			const arr = res.data.map(item => {
				return item.areaname;
			});
			box6Data.value.title = [...new Set(arr)];

			const arr1 = res.data.filter(item => {
				return item.sortname === "337调查";
			});
			const arr1Name = arr1.map(item => {
				return item.areaname;
			});
			box6Data.value.title.forEach((item, index) => {
				if (arr1Name.indexOf(item) > -1) {
					const idx = arr1Name.indexOf(item);
					box6Data.value.data[0].value[index] = arr1[idx].areacount;
				} else {
					box6Data.value.data[0].value[index] = 0;
				}
			});

			const arr2 = res.data.filter(item => {
				return item.sortname === "232调查";
			});
			const arr2Name = arr2.map(item => {
				return item.areaname;
			});
			box6Data.value.title.forEach((item, index) => {
				if (arr2Name.indexOf(item) > -1) {
					const idx = arr2Name.indexOf(item);
					box6Data.value.data[1].value[index] = arr2[idx].areacount;
				} else {
					box6Data.value.data[1].value[index] = 0;
				}
			});

			const arr3 = res.data.filter(item => {
				return item.sortname === "301调查";
			});
			const arr3Name = arr3.map(item => {
				return item.areaname;
			});
			box6Data.value.title.forEach((item, index) => {
				if (arr3Name.indexOf(item) > -1) {
					const idx = arr3Name.indexOf(item);
					box6Data.value.data[2].value[index] = arr3[idx].areacount;
				} else {
					box6Data.value.data[2].value[index] = 0;
				}
			});

			const numArr = res.data.map(item => {
				return item.AREACOUNT;
			});

			box6Data.value.maxNum = Math.max(...numArr);

			onAIReport({ type: "雷达图", name: "领域分布情况", data: res.data }, "content6")
		} else {
			box6Data.value.title = [];
			box6Data.value.data = [
				{ name: "337调查", value: [] },
				{ name: "232调查", value: [] },
				{ name: "301调查", value: [] }
			];
			box6Data.value.maxNum = 0;
			aiContent.content6 = "";
		}
	} catch (error) { }
};
const handleBox6 = async () => {
	await handleGetStatArea();
	let box6Chart = getRadarChart(box6Data.value);
	setChart(box6Chart, "box6Chart");
};

// 国家分布情况
const box7SelectedSurvey = ref("337");
const box7YearList = getNearYearList();
const box7SelectedYear = ref("2025");
const box7Data = reactive({
	title: [],
	data: []
});
const box7TipText = computed(() => {
	if (box7SelectedSurvey.value === "337") return "美国国际贸易委员会官网"
	if (box7SelectedSurvey.value === "232") return "美国商务部官网"
	if (box7SelectedSurvey.value === "301") return "美国贸易代表办公室官网"
	return ""
})
const handleGetBox7Data = async () => {
	const params = {
		sortCode: box7SelectedSurvey.value,
		years: box7SelectedYear.value
	};
	try {
		const res = await getSearchCountry(params);
		console.log("国家分布情况", res);
		if (res.code === 200 && res.data) {
			box7Data.title = res.data.map(item => {
				return {
					name: item.COUNTRY,
					img: item.COUNTRYIMAGE
				};
			});
			box7Data.data = res.data.map(item => {
				return item.NUM;
			});
			onAIReport({ type: "柱状图", name: "国家分布情况", data: res.data }, "content7")
		} else {
			box7Data.title = [];
			box7Data.data = [];
			aiContent.content7 = "";
		}
	} catch (error) {
		box7Data.title = [];
		box7Data.data = [];
		aiContent.content7 = "";
	}
};

const handleBox7 = async () => {
	await handleGetBox7Data();
	const box7Chart = getBarChart(box7Data.title, box7Data.data);
	setChart(box7Chart, "box7Chart");
};

const box8SurveyList = ref([
	{ label: "337调查", value: "337" },
	{ label: "301调查", value: "301" },
	{ label: "232调查", value: "232" },
]);
// 结果分布情况
const box8SelectedSurvey = ref("337");
const box8Data = ref([]);
const box8Ref = ref(null);
const box8TipText = computed(() => {
	if (box8SelectedSurvey.value === "337") return "美国国际贸易委员会官网"
	if (box8SelectedSurvey.value === "232") return "美国商务部官网"
	if (box8SelectedSurvey.value === "301") return "美国贸易代表办公室官网"
	return ""
})
const handleGetBox8Data = async () => {
	try {
		const res = await getSearchResult({sortCode: box8SelectedSurvey.value});
		console.log("结果分布情况", res);
		if (res.code === 200 && res.data) {
			box8Data.value = res.data.map(item => ({ name: item.RESULTNAME, value: item.RESULTNUM }))
			onAIReport({ type: "环形图", name: "结果分布情况", data: res.data }, "content8")
		} else {
			box8Data.value = []
			aiContent.content8 = "";
		}
	} catch (error) {
		box8Data.value = []
		aiContent.content8 = "";
	}
	nextTick(() => { createPieChart(box8Ref, box8Data.value, {labelType:1}) })
};

// 资源库
const pageSize = ref(10);
const currentPage = ref(1);
const totalDiscussNum = ref(0);
const handleCurrentChange = page => {
	handleToPosi("position4")
	currentPage.value = page;
	handleFetchSurveyList();
};

const categoryList = ref([
	{ name: "全部调查", id: "" },
	{ name: "337调查", id: "337" },
	{ name: "301调查", id: "301" },
	{ name: "232调查", id: "232" },
]);
const activeCateId = ref("");
const handleClickCate = item => {
	activeCateId.value = item.id;
	currentPage.value = 1;
	handleFetchSurveyList();
};

const releaseTimeList = ref([
	{ label: "按发布时间倒序", value: true },
	{ label: "按发布时间升序", value: false }
]);
const isSort = ref(true);
const handlePxChange = () => {
	currentPage.value = 1;
	handleFetchSurveyList();
};

const surveyYearList = ref([
	{ name: "全部时间", id: "" },
	{ name: "2025年", id: "2025" },
	{ name: "2024年", id: "2024" },
	{ name: "2023年", id: "2023" },
	{ name: "2022年", id: "2022" },
	{ name: "2021年", id: "2021" }
]);
const checkedYearList = ref(['']);
const handleCheckedYearsChange = event => {
	if (event.length && event[event.length-1] !== "") {
		checkedYearList.value = event.filter(item => item !== "");
	} else {
		checkedYearList.value = [""];
	}
	currentPage.value = 1;
	handleFetchSurveyList();
};

// 科技领域过滤
const surveyAreaList = ref([]);
const checkedAreaList = ref(['']);
const handleGetSearchAllArea = async () => {
	try {
		const res = await getHylyList();
		if (res.code === 200) {
			surveyAreaList.value = res.data.map(item => ({ name: item.name, id: item.id }));
		}
	} catch (error) {}
	surveyAreaList.value.unshift({ name: "全部领域", id: "" });
};
const handleCheckedAreasChange = event => {
	if (event.length && event[event.length-1] !== "") {
		checkedAreaList.value = event.filter(item => item !== "");
	} else {
		checkedAreaList.value = [""];
	}
	currentPage.value = 1;
	handleFetchSurveyList();
};

// 发布机构过滤
const surveyOrgList = ref([]);
const checkedOrgList = ref(['']);
const handleGetInsList = async () => {
	try {
		const res = await getSearchAllOrg()
		if (res.code === 200) {
			surveyOrgList.value = res.data.map(item => ({ name: item.ORGNAME, id: item.ORGID }))
		}
	} catch (error) {}
	surveyOrgList.value.unshift({ name: "全部机构", id: "" });
}
const handleChangeCheckedIns = (event) => {
	if (event.length && event[event.length-1] !== "") {
		checkedOrgList.value = event.filter(item => item !== "");
	} else {
		checkedOrgList.value = [""];
	}
	currentPage.value = 1;
	handleFetchSurveyList();
};

// 受调查国家/地区
const surveyCountryList = ref([]);
const checkedCountryList = ref(['']);
const handleGetAllSearchCountry = async () => {
	try {
		const res = await getSearchAllCountry()
		if (res.code === 200) {
			surveyCountryList.value = res.data.map(item => ({ name: item.COUNTRYNAME, id: item.COUNTRYID }))
		}
	} catch (error) {}
	surveyCountryList.value.unshift({ name: "全部", id: "" });
}
const handleCheckedCountriesChange = event => {
	if (event.length && event[event.length-1] !== "") {
		checkedCountryList.value = event.filter(item => item !== "");
	} else {
		checkedCountryList.value = [""];
	}
	currentPage.value = 1;
	handleFetchSurveyList();
};

const surveyInfoList = ref([]);

const handleFetchSurveyList = async () => {

	const params = {
		currentPage: currentPage.value - 1,
		pageSize: pageSize.value,
		sortCode: activeCateId.value || null,
		publishYear: checkedYearList.value.join(',') || null,
		Area: checkedAreaList.value.join(',') || null,
		publishOrg: checkedOrgList.value.join(',') || null,
		searchCountry: checkedCountryList.value.join(',') || null,
		sortField: "date",
		sortOrder: isSort.value ? "desc" : "asc"
	};
	try {
		const res = await getSurveyList(params);
		console.log("调查列表", res);
		if (res.code === 200 && res.data) {
			totalDiscussNum.value = res.data.totalElements;
			surveyInfoList.value = res.data.content
		} else {
			surveyInfoList.value = [];
		}
	} catch (error) { }
};

const isRiskOverviewDetailOpen = ref(false);

const riskOverviewDetailRow = ref(null);

const handleRiskSignalItemToManage = (item) => {
	riskOverviewDetailRow.value = item ?? null;
	isRiskOverviewDetailOpen.value = true;
};

// 查看更多风险信号
const handleToMoreRiskSignal = () => {
	navigateToViewRiskSignal(router);
};

// 查看更多新闻资讯
const handleToMoreNews = () => {
	const route = router.resolve("/newsBrief");
	window.open(route.href, "_blank");
};

onMounted(async () => {
	handleGetBox1Data();
	handleGetStatSort();
	handleGetBox2Data();
	handleGetBox3Data();
	handleGetBox4Data();
	hadleGetStatNum();
	handleBox6();
	handleBox7();
	handleGetBox8Data();
	handleGetAllSearchCountry()
	handleGetInsList()
	handleGetSearchAllArea();
	handleFetchSurveyList();
});
</script>

<style lang="scss" scoped>
:deep(.el-input__wrapper) {
	box-shadow: none;
}

.box-echart-main {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	padding: 12px 30px 20px;
	position: relative;
	.box-echart-content {
		width: 100%;
		height: 20px;
		flex: auto;
	}
	.ai-pane {
		position: absolute;
		right: 0px;
		bottom: 15px;
		z-index: 2;

		:deep(.ai-pane-wrapper) {
			display: none;
		}

		:deep(.ai-button-wrapper) {
			display: flex;
		}

		&:hover {
			width: 100%;
			bottom: 0px;

			:deep(.ai-pane-wrapper) {
				display: block;
			}

			:deep(.ai-button-wrapper) {
				display: none;
			}
		}
	}
}

.home-wrapper {
	width: 100%;
	height: 100%;
	position: relative;
	overflow-y: hidden;

	.home-main {
		width: 100%;
		height: 100%;
		overflow-y: auto;
		// background: url("./assets/images/background.png");
		// background-size: 100% 100%;
		position: relative;

		.home-top-bg {
			background:
				url("./assets/images/background.png"),
				linear-gradient(180deg, rgba(229, 241, 254, 1) 0%, rgba(246, 251, 255, 0) 30%);
			background-size: 100% 100%;
			position: absolute;
			width: 100%;
			height: 100%;
			z-index: -100;
			top: -64px;
		}

		.home-main-header {
			display: flex;
			flex-direction: column;
			align-items: center;

			.home-main-header-footer {
				margin-top: 38px;
				width: 688px;
				height: 64px;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;

				.home-main-header-footer-item {
					padding: 0 10px;
					text-align: center;

					.item-top {
						height: 22px;
						color: rgba(20, 89, 187, 1);
						font-family: Source Han Sans CN;
						font-size: 36px;
						font-weight: 700;
						line-height: 22px;
					}

					.item-footer {
						margin-top: 10px;
						height: 30px;
						color: rgba(95, 101, 108, 1);
						font-family: Source Han Sans CN;
						font-size: 16px;
						font-weight: 400;
						line-height: 30px;
					}
				}
			}

			.home-main-header-btn-box {
				width: 688px;
				margin: 0 auto;
				margin-top: 39px;
				display: flex;
				justify-content: space-between;

				.btn {
					display: flex;
					align-items: center;
					gap: 9px;
					width: 160px;
					height: 48px;
					border: 1px solid #aed6ff;
					box-sizing: border-box;
					border-radius: 24px;
					background: #e7f3ff;
					cursor: pointer;
					position: relative;

					&:hover {
						background: #cae3fc;
					}

					.btn-text {
						width: 80px;
						color: var(--color-main-active);
						font-family: Source Han Sans CN;
						font-size: 20px;
						font-weight: 400;
						line-height: 48px;
						margin-left: 36px;
						text-align: center;
					}

					.btn-icon {
						position: absolute;
						top: 16px;
						right: 19px;
						width: 6px;
						height: 12px;

						img {
							width: 100%;
							height: 100%;
						}
					}
				}
			}

			.date-box {
				display: flex;
				align-items: center;
				width: 1600px;
				margin-top: 48px;

				.date-icon {
					width: 16px;
					height: 16px;
					font-size: 0px;
					margin-right: 6px;

					img {
						width: 100%;
						height: 100%;
					}
				}

				.date-text {
					width: 20px;
					flex: auto;
					font-size: 18px;
					line-height: 18px;
					font-family: Source Han Sans CN;
					color: var(--text-primary-80-color);
				}
			}

			.home-main-header-card-box {
				width: 1600px;
				margin: 20px auto 0;
				height: 142px;
				display: flex;
				justify-content: space-between;

				.theme-card {
					transition: transform 0.3s ease, box-shadow 0.3s ease;
					width: 520px;
					height: 142px;
					background: #fff;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(60, 87, 126, 0.2);
					position: relative;
					cursor: pointer;

					&::before {
						content: "";
						position: absolute;
						left: 0;
						top: 15px;
						width: 4px;
						height: 111px;
					}

					.item-dot {
						position: absolute;
						right: -13px;
						top: -10px;
						padding: 4px 8px 6px;
						background-color: #FF4D4F;
						color: white;
						font-size: 16px;
						line-height: 16px;
						font-family: Source Han Sans CN;
						border-radius: 14px;
						letter-spacing: 1px;
					}

					.header {
						height: 56px;
						display: flex;
						justify-content: space-between;

						.header-left {
							margin-left: 30px;
							margin-top: 26px;
							color: rgba(59, 65, 75, 1);
							font-family: Source Han Sans CN;
							font-size: 20px;
							font-weight: 700;
							line-height: 26px;
						}

						.header-right {
							margin-top: 28px;
							margin-right: 35px;
							height: 24px;
							font-family: Source Han Sans CN;
							font-size: 30px;
							font-weight: 700;
							line-height: 24px;
						}
					}

					.content-box {
						margin-left: 30px;

						.item {
							width: 485px;
							height: 24px;
							color: rgba(95, 101, 108, 1);
							font-family: Source Han Sans CN;
							font-size: 16px;
							font-weight: 400;
							line-height: 24px;
							margin-top: 8px;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
						}
					}

					&:hover {
						transform: translateY(-3px);
						box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
					}
				}

				.theme-301 {
					&::before {
						background: rgba(250, 140, 22, 1);
					}
					.header {
						.header-right {
							color: rgba(250, 140, 22, 1);
						}
					}
				}
				.theme-232 {
					&::before {
						background: rgba(114, 46, 209, 1);
					}
					.header {
						.header-right {
							color: rgba(114, 46, 209, 1);
						}
					}
				}
				.theme-337 {
					&::before {
						background: var(--color-main-active);
					}
					.header {
						.header-right {
							color: var(--color-main-active);
						}
					}
				}
			}
		}

		.home-main-center {
			margin-top: 34px;

			.center-top {
				height: 450px;
				display: flex;
				justify-content: center;
				gap: 20px;

				.box1 {
					width: 1064px;
					height: 450px;

					.box1-left {
						position: absolute;
						left: 0;
						top: 220px;
						width: 24px;
						height: 48px;
						cursor: pointer;

						img {
							width: 100%;
							height: 100%;
						}
					}

					.box1-right {
						position: absolute;
						right: 0;
						top: 220px;
						width: 24px;
						height: 48px;
						cursor: pointer;

						img {
							width: 100%;
							height: 100%;
						}
					}

					.box1-header {
						height: 48px;
						border-bottom: 1px solid rgba(240, 242, 244, 1);
						display: flex;
						justify-content: space-between;

						.box1-header-left {
							display: flex;
							.icon {
								width: 19px;
								height: 18px;
								margin-top: 15px;
								margin-left: 22px;
								img {
									width: 100%;
									height: 100%;
								}
							}
							.title {
								width: 112px;
								height: 48px;
								margin-left: 19px;
								color: #fff;
								background: var(--color-main-active);
								font-family: Source Han Sans CN;
								font-size: 20px;
								font-weight: 700;
								line-height: 48px;
								text-align: center;
							}
						}

						.box1-header-right {
							margin-top: 19px;
							margin-right: 40px;
							height: 16px;
							color: var(--color-main-active);
							font-family: Source Han Sans CN;
							font-size: 16px;
							font-weight: 400;
							line-height: 16px;
							cursor: pointer;
						}
					}

					.box1-main {
						width: 100%;
						height: 354px;
						padding: 0 40px;
						.box1-head-box {
							width: 100%;
							height: 60px;
							display: flex;
							align-items: center;

							.box1-head-code {
								height: 26px;
								line-height: 26px;
								font-size: 14px;
								padding: 0 8px;
								font-family: Microsoft YaHei;
								border-radius: 4px;
								font-weight: bold;
								margin-right: 10px;
							}
							.box1-tags-337 {
								border: 1px solid #91caff;
								background: #e6f4ff;
								color: #055fc2;
							}
							.box1-tags-232 {
								border: 1px solid #b37feb;
								background: #f9f0ff;
								color: #722ed1;
							}
							.box1-tags-301 {
								border: 1px solid #ffd591;
								background: #fff7e6;
								color: #fa8c16;
							}
							.box1-head-name {
								width: 20px;
								flex: auto;
								color: var(--color-main-active);
								font-family: Source Han Sans CN;
								font-size: 20px;
								font-weight: bold;
								line-height: 26px;
							}
							.box1-head-tags {
								margin-left: 40px;
								display: flex;
								gap: 8px;
							}
						}
					}
				}

				.box2 {
					width: 521px;
					height: 450px;
					position: relative;

					.box2-header {
						height: 48px;
						border-bottom: 1px solid rgba(240, 242, 244, 1);
						display: flex;

						.icon {
							width: 24px;
							height: 22px;
							margin-left: 18px;
							margin-top: 14px;

							img {
								width: 100%;
								height: 100%;
							}
						}

						.title {
							display: flex;
							width: 148px;
							height: 48px;
							background: rgba(206, 79, 81, 1);
							margin-left: 25px;

							.text {
								margin-left: 16px;
								margin-top: 11px;
								height: 26px;
								color: #fff;
								font-family: Source Han Sans CN;
								font-size: 20px;
								font-weight: 700;
								line-height: 26px;
							}

							.num {
								width: 24px;
								height: 20px;
								line-height: 20px;
								text-align: center;
								color: rgba(255, 255, 255, 1);
								font-family: Source Han Sans CN;
								font-size: 12px;
								margin-left: 15px;
								margin-top: 15px;
								border-radius: 100px;
								background: rgba(255, 255, 255, 0.3);
							}
						}

						.more {
							margin-top: 16px;
							margin-left: 200px;
							color: rgba(20, 89, 187, 1);
							font-family: Source Han Sans CN;
							font-size: 16px;
							font-weight: 400;
							line-height: 16px;
							cursor: pointer;
						}
					}

					.box2-main {
						margin-top: 2px;
						height: 330px;
					}

					.box2-footer {
						position: absolute;
						left: 30px;
						bottom: 20px;
						width: 460px;
						height: 42px;
						display: flex;
						flex-direction: row;
						justify-content: center;
						align-items: center;
						border-radius: 6px;
						background: var(--color-main-active);
						gap: 8px;
						cursor: pointer;

						.icon {
							width: 16px;
							height: 16px;

							img {
								width: 100%;
								height: 100%;
							}
						}

						.text {
							color: rgba(255, 255, 255, 1);
							font-family: Source Han Sans CN;
							font-size: 16px;
							font-weight: 400;
							line-height: 22px;
						}
					}
				}
			}

			.center-center {
				margin-top: 21px;
				height: 450px;
				display: flex;
				justify-content: center;
				gap: 16px;

				.box3 {
					width: 792px;
					height: 450px;

					.box3-header {
						height: 48px;
						border-bottom: 1px solid rgba(240, 242, 244, 1);
						margin: 0 auto;
						display: flex;
						justify-content: space-between;
						position: relative;

						.box3-header-left {
							display: flex;

							.box3-header-icon {
								margin-top: 16px;
								margin-left: 21px;
								width: 19px;
								height: 19px;

								img {
									width: 100%;
									height: 100%;
								}
							}

							.box3-header-title {
								margin-top: 11px;
								margin-left: 20px;
								height: 26px;
								color: var(--color-main-active);
								font-family: Source Han Sans CN;
								font-size: 20px;
								font-weight: 700;
								line-height: 26px;
							}

							.more {
								width: 49px;
								height: 24px;
								position: absolute;
								top: 14px;
								right: 27px;
								color: rgba(20, 89, 187, 1);
								font-family: Source Han Sans CN;
								font-size: 16px;
								font-weight: 400;
								line-height: 24px;
								cursor: pointer;
							}
						}
					}

					.box3-main {
						height: 402px;
						overflow-y: auto;
						overflow-x: hidden;
						padding-top: 6px;

						.box3-item {
							display: flex;
							height: 77px;
							width: 749px;
							margin-left: 21px;
							border-bottom: 1px solid rgba(240, 242, 244, 1);
							cursor: pointer;

							&:hover {
								background: var(--color-bg-hover);
							}

							.left {
								width: 72px;
								height: 48px;
								margin-top: 15px;

								img {
									width: 100%;
									height: 100%;
								}
							}

							.right {
								width: 657px;
								margin-left: 20px;

								.right-top {
									width: 657px;
									display: flex;
									justify-content: space-between;

									.title {
										margin-top: 13px;
										width: 470px;
										height: 24px;
										color: rgba(59, 65, 75, 1);
										font-family: Source Han Sans CN;
										font-size: 16px;
										font-weight: 700;
										line-height: 24px;
										overflow: hidden;
										text-overflow: ellipsis;
										white-space: nowrap;
									}

									.time {
										width: 187px;
										text-align: right;
										height: 22px;
										margin-top: 15px;
										color: rgba(95, 101, 108, 1);
										font-family: Source Han Sans CN;
										font-size: 14px;
										font-weight: 400;
										line-height: 22px;
										overflow: hidden;
										text-overflow: ellipsis;
										white-space: nowrap;
									}
								}

								.right-footer {
									width: 657px;
									height: 24px;
									color: rgba(59, 65, 75, 1);
									font-family: Source Han Sans CN;
									font-size: 16px;
									font-weight: 400;
									line-height: 24px;
									overflow: hidden;
									text-overflow: ellipsis;
									white-space: nowrap;
								}
							}
						}
					}
				}

				.box4 {
					width: 792px;
					height: 450px;

					.box4-header {
						width: 792px;
						height: 48px;
						border-bottom: 1px solid rgba(240, 242, 244, 1);
						display: flex;
						box-sizing: border-box;
						position: relative;

						.header-icon {
							margin-top: 17px;
							margin-left: 21px;
							width: 19px;
							height: 18px;

							img {
								width: 100%;
								height: 100%;
							}
						}

						.header-title {
							margin-top: 11px;
							margin-left: 20px;
							height: 26px;
							color: var(--color-main-active);
							font-family: Source Han Sans CN;
							font-size: 20px;
							font-weight: 700;
							line-height: 26px;
						}

						.more {
							width: 49px;
							height: 24px;
							position: absolute;
							top: 14px;
							right: 27px;
							color: rgba(20, 89, 187, 1);
							font-family: Source Han Sans CN;
							font-size: 16px;
							font-weight: 400;
							line-height: 24px;
							cursor: pointer;
						}
					}

					.box4-main {
						height: 402px;
						overflow: hidden;
						overflow-y: auto;
						box-sizing: border-box;
						padding-top: 8px;
						padding-left: 31px;
					}
				}
			}

			.center-footer {
				margin-top: 21px;
				height: 460px;
				display: flex;
				justify-content: center;
				gap: 15px;

				.box5 {
					width: 1064px;
					height: 460px;

					.box-header-right {
						height: 48px;
						display: flex;
						justify-content: flex-end;
						align-items: center;
						gap: 8px;

						.box5-header-right-btn-box {
							display: flex;
							justify-content: flex-end;
							gap: 8px;
							width: 178px;
							height: 28px;

							.right-box {
								height: 28px;
								padding: 0 8px;
								text-align: center;
								box-sizing: border-box;
								border: 1px solid rgba(230, 231, 232, 1);
								border-radius: 4px;
								background: rgba(255, 255, 255, 1);
								color: rgba(59, 65, 75, 1);
								font-family: Source Han Sans CN;
								font-size: 16px;
								font-weight: 400;
								line-height: 28px;
								cursor: pointer;
							}

							.box5-active {
								color: var(--color-main-active);
								border: 1px solid var(--color-main-active);
								border-radius: 4px;
								background: rgba(231, 243, 255, 1);
							}
						}
					}
				}

				.box6 {
					width: 521px;
					height: 460px;

					.box-header-right {
						height: 48px;
						display: flex;
						justify-content: flex-end;
						align-items: center;
						gap: 8px;
					}
				}
			}

			.center-footer1 {
				margin-top: 16px;
				display: flex;
				justify-content: center;
				gap: 15px;

				.box7 {
					width: 1064px;
					height: 460px;

					.box-header-right {
						height: 48px;

						.box7-header-right-select-box {
							height: 48px;
							display: flex;
							justify-content: flex-end;
							box-sizing: border-box;
							align-items: center;
							gap: 12px;
						}
					}
				}

				.box8 {
					width: 521px;
					height: 460px;

					.box-header-right {
						height: 48px;
						display: flex;
						justify-content: flex-end;
						align-items: center;
						gap: 8px;
					}
				}
			}
		}

		.home-main-footer {
			margin-top: 36px;
			background: rgba(248, 249, 250, 1);
			overflow: hidden;
			padding-bottom: 100px;

			.home-main-footer-header {
				width: 1600px;
				height: 42px;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;

				.btn-box {
					width: 1000px;
					display: flex;

					.btn {
						color: rgba(95, 101, 108, 1);
						font-family: Source Han Sans CN;
						font-size: 16px;
						font-weight: 400;
						line-height: 42px;
						padding: 0 24px;
						border-radius: 21px;
						background: rgba(20, 89, 187, 0);
						margin-right: 20px;
						cursor: pointer;

						&:hover {
							background: rgba(20, 89, 187, 0.1);
						}
					}

					.btnActive {
						padding: 0 24px;
						border-radius: 21px;
						background: rgba(20, 89, 187, 1);
						color: #fff;

						&:hover {
							color: #fff;
							background: rgba(20, 89, 187, 1);
						}
					}
				}

				.select-box {
					height: 42px;
					box-sizing: border-box;
					padding: 5px 0;

				}
			}

			.home-main-footer-main {
				width: 1600px;
				margin: 0 auto;
				margin-top: 34px;
				display: flex;
				align-items: flex-start;
				gap: 16px;

				.left {
					width: 360px;
					height: max-content;
					padding-bottom: 20px;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(60, 87, 126, 0.2);
					background: rgba(255, 255, 255, 1);

					.check-box {
						margin-top: 18px;
						.check-head {
							position: relative;
							margin-bottom: 12px;
							&::before {
								content: "";
								position: absolute;
								top: 0px;
								left: 0px;
								width: 8px;
								height: 100%;
								background: var(--color-primary-100);
								border-radius: 0 2px 2px 0;
							}
							.head-name {
								margin-left: 25px;
								color: var(--color-primary-100);
								font-size: 16px;
								line-height: 16px;
								font-family: Source Han Sans CN;
								font-weight: bold;
							}
						}
						.check-list {
							padding: 0 10px 0 25px;
							display: grid;
							grid-template-columns: repeat(2, 1fr);
							grid-gap: 0 12px;
							.check-item {
								width: 100%;
								height: 32px;
								:deep(.el-checkbox__label) {
									font-family: Source Han Sans CN;
									font-size: 16px;
									color: var(--text-primary-65-color);
								}
							}
						}
					}
				}

				.right {
					width: 1224px;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(60, 87, 126, 0.2);
					background: rgba(255, 255, 255, 1);
					overflow: hidden;

					.right-header {
						height: 48px;
						display: flex;

						.icon {
							width: 24px;
							height: 24px;
							margin-top: 13px;
							margin-left: 19px;

							img {
								width: 100%;
								height: 100%;
							}
						}

						.title {
							height: 26px;
							margin-top: 11px;
							margin-left: 19px;
							color: var(--color-main-active);
							font-family: Source Han Sans CN;
							font-style: Bold;
							font-size: 20px;
							font-weight: 700;
							line-height: 26px;
							letter-spacing: 0px;
							text-align: left;
						}
					}

					.right-footer {
						box-sizing: border-box;
						padding-top: 15px;
						height: 60px;
						display: flex;
						justify-content: space-between;

						.footer-left {
							color: rgba(59, 65, 75, 1);
							font-family: Source Han Sans CN;
							font-size: 14px;
							font-weight: 400;
							line-height: 18px;
							margin-left: 24px;
							margin-top: 6px;
						}

						.footer-right {
							margin-right: 24px;
						}
					}
				}
			}
		}
	}
}

.divide-header {
	margin: 52px auto 30px;
}

:deep(.el-input__wrapper) {
	box-shadow: none;
	border-radius: 10px;
}

:deep(.el-input__wrapper:hover) {
	box-shadow: none !important;
}

:deep(.el-input__wrapper.is-focus) {
	box-shadow: none !important;
}

.filter-checkbox {
	width: 140px;
}
</style>
