<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="home-main-header-footer" v-show="!isShow">
					<div class="home-main-header-footer-item">
						<div class="item-top">3.8T</div>
						<div class="item-footer">数据量</div>
					</div>
					<div class="home-main-header-footer-item">
						<div class="item-top">28</div>
						<div class="item-footer">科技动向</div>
					</div>
					<div class="home-main-header-footer-item">
						<div class="item-top">326</div>
						<div class="item-footer">总统政令</div>
					</div>
					<div class="home-main-header-footer-item">
						<div class="item-top">341</div>
						<div class="item-footer">通过法案</div>
					</div>
					<div class="home-main-header-footer-item">
						<div class="item-top">285</div>
						<div class="item-footer">分析报告</div>
					</div>
				</div> -->
				<div class="date-box" v-if="keyOrganizationList.length">
					<div class="date-icon">
						<img :src="tipsTcon" alt="">
					</div>
					<div class="date-text">近期美国各联邦政府机构发布涉华政令数量汇总</div>
					<TimeTabPane @time-click="onKeyOrganization" activeTime="近一年" />
				</div>
				<div class="home-main-header-item-box" v-if="keyOrganizationList.length">
					<div class="organization-item" v-for="(item, index) in keyOrganizationList" :key="index">
						<div class="item-left">
							<img :src="item.imgUrl || DefaultIcon2" alt="" />
						</div>
						<div class="item-right one-line-ellipsis" @click="handleToInstitution(item)">{{ item.orgName }}</div>
						<el-popover content="跳转至数据资源库" placement="top">
							<template #reference>
								<div class="item-total" @click="handleToDataLibrary(item)">{{ item.totalOrderNum }}项</div>
							</template>
						</el-popover>
						<el-icon color="var(--color-primary-100)">
							<ArrowRightBold />
						</el-icon>
						<div class="item-dot" v-if="item.recentOrderNum">+{{ item.recentOrderNum }}</div>
					</div>
					<div class="organization-item" @click="onNavigateTo()">
						<div class="item-more">查看全部机构 ({{ govInsList.length }}家)</div>
						<el-icon color="var(--color-primary-100)">
							<ArrowRightBold />
						</el-icon>
					</div>
				</div>
			</div>
			<DivideHeader id="position1" class="divide" :titleText="'最新动态'"></DivideHeader>
			<div class="home-main-center">
				<div class="center-top">
					<!-- <div class="box1">
						<div class="box1-left" @click="handleSwithCurDecree('left')">
							<div class="icon">
								<img src="./assets/images/box1-left.svg" alt="" />
							</div>
						</div>
						<div class="box1-right" @click="handleSwithCurDecree('right')">
							<div class="icon">
								<img src="./assets/images/box1-right.svg" alt="" />
							</div>
						</div>
						<div class="box1-header">
							<div class="box1-header-left">
								<div class="icon">
									<img src="./assets/images/box1-header-icon.png" alt="" />
								</div>
								<div class="title">{{ "最新科技政令" }}</div>
							</div>
							<div class="box1-header-right" @click="handleClickOrder">
								{{ "查看详情 >" }}
							</div>
						</div>
						<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-main-left">
										<img v-if="item.imageUrl" :src="item.imageUrl" alt="" />
										<div v-else class="box1-main-left-img-mock">
											<img class="img-mock-badge-img" src="./assets/images/badge.png" />
											<p class="img-mock-badge-title">行政令</p>
											<p class="img-mock-badge-title">{{ item.name }}</p>
										</div>
									</div>
									<div class="box1-main-right">
										<div class="box1-main-right-title">
											{{ item.name }}
										</div>
										<div class="box1-main-right-info">
											<AreaTag v-for="(tag, index) in item.industryList" :key="index" :tagName="tag.industryName" />
										</div>
										<div class="box1-main-right-center">
											{{ item.describe }}
										</div>
										<div class="box1-main-right-footer">
											<div class="footer-left">{{ item.postDate }}</div>
											<div class="footer-right">
												<div class="footer-right-item1">
													{{ item.officialUrl }}
												</div>
												<div class="footer-right-item2">
													<img src="./assets/images/open-icon.png" alt="" />
												</div>
											</div>
										</div>
									</div>
								</div>
							</el-carousel-item>
						</el-carousel>
					</div> -->
					<OverviewMainBox class="box1" title="最新科技政令" @toDetail="handleClickOrder">
						<template #header-icon>
							<img style="width: 100%; height: 100%" src="./assets/images/box1-header-icon.png" alt="" />
						</template>
						<div class="box1-left" @click="handleSwithCurDecree('left')">
							<div class="icon">
								<img src="./assets/images/box1-left.svg" alt="" />
							</div>
						</div>
						<div class="box1-right" @click="handleSwithCurDecree('right')">
							<div class="icon">
								<img src="./assets/images/box1-right.svg" alt="" />
							</div>
						</div>
						<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-main-left">
										<img v-if="item.imageUrl" :src="item.imageUrl" alt="" />
										<div v-else class="box1-main-left-img-mock">
											<img class="img-mock-badge-img" src="./assets/images/badge.png" />
											<p class="img-mock-badge-title">行政令</p>
											<p class="img-mock-badge-title">{{ item.name }}</p>
											<!-- <p class="img-mock-badge-org">The White House</p> -->
										</div>
									</div>
									<div class="box1-main-right">
										<div class="box1-main-right-title">
											{{ item.name }}
										</div>
										<div class="box1-main-right-info">
											<AreaTag v-for="(tag, index) in item.industryList" :key="index" :tagName="tag.industryName" />
										</div>
										<div class="box1-main-right-center">
											{{ item.describe }}
										</div>
										<div class="box1-main-right-footer">
											<div class="footer-left">{{ item.postDate }}</div>
											<div class="footer-right">
												<div class="footer-right-item1">
													{{ item.officialUrl }}
												</div>
												<div class="footer-right-item2">
													<img src="./assets/images/open-icon.png" alt="" />
												</div>
											</div>
										</div>
									</div>
								</div>
							</el-carousel-item>
						</el-carousel>
					</OverviewMainBox>
					<RiskSignal :list="warningList" @item-click="onNavigateToDetail" @more-click="handleToMoreRiskSignal"
						riskLevel="signalLevel" postDate="signalTime" name="signalTitle">
					</RiskSignal>
				</div>
				<DivideHeader id="position2" class="divide2" :titleText="'资讯要闻'"></DivideHeader>
				<div class="center-center">
					<NewsList :newsList="newsList" @item-click="handleToNewsAnalysis" @more-click="handleToMoreNews" />
					<MessageBubble :messageList="messageList" @person-click="handleClickPerson" @info-click="handleGetMessage"
						imageUrl="img" @more-click="handleToSocialDetail" />
				</div>
				<DivideHeader id="position3" class="divide3" :titleText="'数据总览'"></DivideHeader>
				<div class="center-footer">
					<div class="box5">
						<div class="box5-header">
							<div class="box5-header-icon">
								<img src="./assets/images/box3-header-icon.png" alt="" />
							</div>
							<div class="box5-header-title">{{ "数量变化趋势" }}</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleBox5" v-model="box5Params.proposeName" :empty-values="[null, undefined]"
									style="width:150px">
									<el-option label="全部政府部门" value="" />
									<el-option v-for="item in keyOrganizationList" :key="item.orgId" :label="item.orgName"
										:value="item.orgId" />
								</el-select>
							</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleBox5" v-model="box5Params.domainId" :empty-values="[null, undefined]"
									style="width:120px">
									<el-option label="全部领域" value="" />
									<el-option v-for="item in areaList" :key="item.id" :label="item.name" :value="item.id" />
								</el-select>
							</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleBox5" v-model="box5Params.year" placeholder="选择时间" style="width:120px">
									<el-option v-for="item in yearList" :key="item.value" :label="item.label" :value="item.value" />
								</el-select>
							</div>
						</div>
						<div class="box5-main" v-loading="box5Params.loading">
							<div class="box5-chart" id="chart1"></div>
						</div>
						<div class="data-origin-box">
							<div class="data-origin-icon">
								<img :src="tipsTcon" alt="">
							</div>
							<div class="data-origin-text">科技政令数量变化趋势，数据来源：美国各行政机构官网</div>
						</div>
						<div class="ai-pane">
							<AiButton />
							<AiPane :aiContent="summarize1" />
						</div>
					</div>

					<div class="box5">
						<div class="box5-header">
							<div class="box5-header-icon">
								<img src="./assets/images/box4-header-icon.png" alt="" />
							</div>
							<div class="box5-header-title">{{ "领域分布情况" }}</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleBox6YearChange" v-model="box6Params.proposeName"
									:empty-values="[null, undefined]" style="width:150px">
									<el-option label="全部政府部门" value="" />
									<el-option v-for="item in keyOrganizationList" :key="item.orgId" :label="item.orgName"
										:value="item.orgId" />
								</el-select>
							</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleBox6YearChange" v-model="box6Params.year" placeholder="选择时间"
									style="width: 120px">
									<el-option v-for="item in yearList" :key="item.value" :label="item.label" :value="item.value" />
								</el-select>
							</div>
						</div>
						<div class="box5-main" v-loading="box6Params.loading">
							<div class="box5-chart" id="chart2"></div>
						</div>
						<div class="data-origin-box">
							<div class="data-origin-icon">
								<img :src="tipsTcon" alt="">
							</div>
							<div class="data-origin-text">科技政令领域分布情况，数据来源：美国各行政机构官网</div>
						</div>
						<div class="ai-pane">
							<AiButton />
							<AiPane :aiContent="summarize2" />
						</div>
					</div>
				</div>
				<div class="center-footer1">
					<div class="box7">
						<div class="box7-header">
							<div class="header-icon">
								<img src="./assets/images/box5-header-icon.png" alt="" />
							</div>
							<div class="header-title">{{ "关键科技政令" }}</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleGetKeyDecree" v-model="box7Params.proposeName"
									:empty-values="[null, undefined]" style="width:150px">
									<el-option label="全部政府部门" value="" />
									<el-option v-for="item in keyOrganizationList" :key="item.orgId" :label="item.orgName"
										:value="item.orgId" />
								</el-select>
							</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleGetKeyDecree" v-model="box7Params.domainId" :empty-values="[null, undefined]"
									style="width:120px">
									<el-option label="全部领域" value="" />
									<el-option v-for="item in areaList" :key="item.id" :label="item.name" :value="item.id" />
								</el-select>
							</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleGetKeyDecree" v-model="box7Params.year" placeholder="选择时间"
									style="width:120px">
									<el-option v-for="item in yearList" :key="item.value" :label="item.label" :value="item.value" />
								</el-select>
							</div>
						</div>
						<div class="box7-main" v-loading="box7Params.loading">
							<div class="box7-list">
								<div class="box7-item" v-for="(item, index) in keyDecreeList" :key="index"
									@click="onNavigateToDetail(item)">
									<div class="icon">
										<img src="./assets/images/warning.png" alt="" />
									</div>
									<div class="info">
										<div class="info-header">
											<div class="title one-line-ellipsis">{{ item.title }}</div>
											<div class="time">{{ item.time }}</div>
										</div>
										<div class="info-content one-line-ellipsis">{{ item.content || "暂无数据" }}</div>
									</div>
								</div>
							</div>
						</div>
						<SimplePagination v-model:current-page="keyDecreeInfo.page" :page-size="keyDecreeInfo.size"
							:total="keyDecreeInfo.total" @page-change="handleGetKeyDecree" />
						<div class="data-origin-box">
							<div class="data-origin-icon">
								<img :src="tipsTcon" alt="">
							</div>
							<div class="data-origin-text">关键科技政令列表，数据来源：美国各行政机构官网</div>
						</div>
					</div>
					<div class="box8">
						<div class="box8-header">
							<div class="header-icon">
								<img src="./assets/images/box5-header-icon.png" alt="" />
							</div>
							<div class="header-title">{{ "关键条款词云" }}</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleGetDecreeKeyInstruction" v-model="box8Params.proposeName"
									:empty-values="[null, undefined]" style="width:150px">
									<el-option label="全部政府部门" value="" />
									<el-option v-for="item in keyOrganizationList" :key="item.orgId" :label="item.orgName"
										:value="item.orgId" />
								</el-select>
							</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleGetDecreeKeyInstruction" v-model="box8Params.domainId"
									:empty-values="[null, undefined]" style="width:120px">
									<el-option label="全部领域" value="" />
									<el-option v-for="item in areaList" :key="item.id" :label="item.name" :value="item.id" />
								</el-select>
							</div>
							<div style="margin-right: 20px;">
								<el-select @change="handleGetDecreeKeyInstruction" v-model="box8Params.year" placeholder="选择时间"
									style="width:120px">
									<el-option v-for="item in yearList" :key="item.value" :label="item.label" :value="item.value" />
								</el-select>
							</div>
						</div>
						<div class="box8-content" v-loading="box8Params.loading">
							<WordCloudChart v-if="wordCloudData?.length" :data="wordCloudData" width="100%" height="100%" />
						</div>
						<div class="data-origin-box">
							<div class="data-origin-icon">
								<img :src="tipsTcon" alt="">
							</div>
							<div class="data-origin-text">科技政令重点条款词云，数据来源：美国各行政机构官网</div>
						</div>
					</div>
				</div>
			</div>
			<div class="home-main-footer">
				<DivideHeader id="position4" class="divide4" :titleText="'科技政令库'"></DivideHeader>
				<div class="home-main-footer-header">
					<div class="search-box">
						<el-select v-model="searchType" :empty-values="[null, undefined]" style="width: 100%" filterable>
							<el-option label="全部政府部门" value="" />
							<el-option v-for="item in govInsList" :key="item.orgId" :label="item.orgName" :value="item.orgId" />
						</el-select>
					</div>
					<div style="flex: auto;"></div>
					<el-checkbox v-model="isChina">只看涉华政令</el-checkbox>
					<div class="select-box">
						<el-select v-model="isSort" placeholder="发布时间" style="width:120px; margin-left:8px;">
							<template #prefix>
								<div class="icon1">
									<img v-if="isSort" src="@/assets/icons/shengxu1.png" alt="" />
									<img v-else src="@/assets/icons/jiangxu1.png" alt="" />
								</div>
							</template>
							<el-option label="正序" :value="true" />
							<el-option label="倒序" :value="false" />
						</el-select>
					</div>
				</div>
				<div class="home-main-footer-main">
					<div class="left">
						<div class="select-box">
							<div class="select-box-header">
								<div class="icon"></div>
								<div class="title">{{ "政令类型" }}</div>
							</div>
							<div class="select-main">
								<div class="checkbox-group">
									<el-checkbox v-for="type in decreeTypeList" :key="type.id" v-model="checkedDecreeType"
										:label="type.typeId" style="width: 180px" class="filter-checkbox"
										@change="handleChangeCheckedDecreeType">
										{{ type.typeName }}
									</el-checkbox>
								</div>
							</div>
						</div>
						<div class="select-box">
							<div class="select-box-header">
								<div class="icon"></div>
								<div class="title">{{ "科技领域" }}</div>
							</div>
							<div class="select-main">
								<el-checkbox-group class="checkbox-group" v-model="activeAreaList" @change="handleAreaChange">
									<el-checkbox label="" class="filter-checkbox">{{ "全部领域" }}</el-checkbox>
									<el-checkbox v-for="area in areaList" :key="area.id" :label="area.id" class="filter-checkbox">
										{{ area.name }}
									</el-checkbox>
								</el-checkbox-group>
							</div>
						</div>
						<div class="select-box">
							<div class="select-box-header">
								<div class="icon"></div>
								<div class="title">{{ "发布时间" }}</div>
							</div>
							<div class="select-main">
								<el-checkbox-group class="checkbox-group" v-model="activePubTime" @change="handlePubTimeChange">
									<el-checkbox v-for="time in pubTime" :key="time.id" :label="time.id" class="filter-checkbox">
										{{ time.name }}
									</el-checkbox>
								</el-checkbox-group>
							</div>
						</div>
					</div>
					<div class="right">
						<div class="content-header">
							<div class="icon">
								<img src="./assets/images/footer-header-icon.png" alt="" />
							</div>
							<div class="title">{{ "政令库" }}</div>
						</div>
						<div class="content-box" v-show="decreeList">
							<div class="main-item" v-for="(item, index) in decreeList" :key="index" @click="onNavigateToDetail(item)">
								<div class="main-item-left">
									<div class="left-left">
										{{ item.time?.split("-")[0] }}<br />{{ item.time?.split("-")[1] }}月{{
											item.time?.split("-")[2]
										}}日
									</div>
									<div class="left-right">
										<div class="icon">
											<img :src="item.img ? item.img : DefaultIcon2" alt="" />
										</div>
										<div class="line" v-if="index !== 9 && index !== totalDecreesNum - 1"></div>
									</div>
								</div>
								<div class="main-item-center">
									<div class="center-header">
										<div class="title">{{ item.title }}</div>
										<!-- <div class="type-box type1">{{ item.type }}</div> -->
									</div>
									<div class="desc">{{ item.desc }}</div>
									<div class="tag-box">
										<AreaTag v-for="(tag, index) in item.tagList" :key="index" :tagName="tag.industryName" />
									</div>
								</div>
							</div>
						</div>
						<div class="footer-box">
							<div class="footer-left">
								{{ `共 ${totalDecreesNum} 项` }}
							</div>
							<div class="footer-right">
								<el-pagination @current-change="handleCurrentChange" :pageSize="10" :current-page="currentPage"
									background layout="prev, pager, next" :total="totalDecreesNum" />
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script setup>
import { onMounted, ref, watch, nextTick, reactive } from "vue";
import router from "@/router";
import WordCloudChart from "@/components/base/WordCloundChart/index.vue"
import SimplePagination from "@/components/SimplePagination.vue";
import TimeTabPane from '@/components/base/TimeTabPane/index.vue';
import AiButton from '@/components/base/Ai/AiButton/index.vue';
import AiPane from '@/components/base/Ai/AiPane/index.vue';
import {
	getDepartmentList,
	getLatestDecree,
	getDecreeRiskSignal,
	getDecreeYearOrder,
	getDecreeArea,
	getKeyDecree,
	getDecreeKeyInstruction,
	getDecreeOrderList,
	getDecreehylyList,
	getDecreeTypeList,
	getKeyOrganization,
} from "@/api/decree/home";
import { getPersonSummaryInfo } from "@/api/common/index";
import { getNews, getSocialMedia } from "@/api/general/index";
import DivideHeader from "@/components/DivideHeader.vue";
import { useContainerScroll } from "@/hooks/useScrollShow";
import getBarChart from "./utils/barChart";
import getPieChart from "./utils/piechart";

import setChart from "@/utils/setChart";

import DefaultIcon2 from "@/assets/icons/default-icon2.png";
import tipsTcon from "./assets/images/tips-icon.png";
import { ElMessage } from "element-plus";

import { useGotoNewsDetail } from '@/router/modules/news';

const containerRef = ref(null);
const { isShow } = useContainerScroll(containerRef);
const currentPage = ref(1);
const pageSize = ref(10);
// 处理页码改变事件
const handleCurrentChange = page => {
	currentPage.value = page;
	handleToPosi('position4')
	handleGetDecreeOrderList();
};

// 机构列表
const govInsList = ref([]);
const checkedGovIns = ref([]);
const handleGetDepartmentList = async () => {
	try {
		const res = await getDepartmentList({});
		console.log("机构列表", res);
		if (res.code === 200) {
			govInsList.value = res.data.orgList;
		}
	} catch (error) {
		console.error("获取机构列表error", error);
	}
};
// 跳转行政机构主页
const handleToInstitution = item => {
	window.sessionStorage.setItem("curTabName", item.orgName);
	const curRoute = router.resolve({
		path: "/institution",
		query: {
			id: item.orgId
		}
	});
	window.open(curRoute.href, "_blank");
	// router.push({
	// 	path: "/institution",
	// 	query: {
	// 		id: item.orgId
	// 	}
	// })
};
// 跳转全部机构页面
const onNavigateTo = () => {
	router.push({ name: "allOrganization" });
}

// 查看更多风险信号
const handleToMoreRiskSignal = () => {
	const route = router.resolve("/viewRiskSignal");
	window.open(route.href, "_blank");
	// router.push("/viewRiskSignal")
};

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

// 最新科技政令
const box1DataList = ref([
	{
		id: 89,
		name: "",
		postDate: "",
		describe: null,
		imageUrl: null,
		officialUrl: null,
		industryList: null
	}
]);

const handleGetLatestDecree = async () => {
	try {
		const res = await getLatestDecree();
		console.log("最新科技政令", res);
		if (res.code === 200 && res.data) {
			box1DataList.value = res.data;
		}
	} catch (error) {
		console.error("最新科技政令error", error);
	}
};

const handleBox1 = async () => {
	await handleGetLatestDecree();
};

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

// 跳转政令详情
const onNavigateToDetail = (item) => {
	const route = router.resolve({
		path: "/decreeLayout",
		query: { id: item.orderId || item.id }
	});
	window.open(route.href, "_blank");
	// router.push({
	// 	path: "/decreeLayout",
	// 	query: { id: item.orderId || item.id }
	// })
}

// 风险信号
const warningList = ref([
	// {
	// 	id: 1,
	// 	name: "关于对中华人民共和国合成阿片类药物供应链...",
	// 	postDate: "一天前",
	// 	riskLevel: "特别重大"
	// }
]);
const handlegetDecreeRiskSignal = async () => {
	const params = {
		moduleId: "0101"
	};
	try {
		const res = await getDecreeRiskSignal(params);
		console.log("风险信号", res);
		if (res.code === 200 && res.data) {
			warningList.value = res.data.map(item => ({ ...item, id: item.orderId }));
		}
	} catch (error) {
		console.error("风险信号error", error);
	}
};
handlegetDecreeRiskSignal();

// 新闻资讯
const newsList = ref([
	// {
	// 	img: News1,
	// 	title: "美政府停摆仍持续，拨款法案存缺陷，但两党磋商露曙光",
	// 	content: `美国政府停摆已持续34天，距离历史上最长的停摆纪录仅差一天，参议院已先后13次尝试...`,
	// 	from: "11-4 · 华盛顿邮报"
	// },
	// {
	// 	img: News2,
	// 	title: "美参议院通过决议，要求终止特朗普全球关税政策",
	// 	content: `参议院以51票赞成、47票反对通过一项决议，旨在终止特朗普实施的全面关税政策，四名......`,
	// 	from: "11-4 · 纽约时报"
	// }
]);
const handleGetNews = async () => {
	try {
		const res = await getNews({ moduleId: "0101" });
		console.log("新闻资讯", res);
		if (res.code === 200 && res.data) {
			newsList.value = (res.data ?? []).map(item => {
				return {
					newsId: item.newsId,
					img: item.newsImage,
					title: item.newsTitle,
					content: item.newsContent,
					from: item.newsDate + " · " + item.newsOrg
				};
			});
		}
	} catch (error) {
		console.error("新闻资讯error", error);
	}
};
// 点击新闻条目，跳转到新闻分析页
const gotoNewsDetail = useGotoNewsDetail()
const handleToNewsAnalysis = news => {
	gotoNewsDetail(news.newsId)
};

// 社交媒体
const messageList = ref([
	// {
	// 	img: Message1,
	// 	name: "唐纳德·特朗普",
	// 	time: "15:23 · 发布于真实社交",
	// 	content: `埃隆·马斯克在强力支持我竞选总统之前，早就知道我强烈反对‘电动汽车强制令’。这太荒谬了，这一直是我竞选活动的主要部分。电动汽车没问题，但不应该强迫每个人都拥有一辆。埃隆获得的补贴可能远远超过历史上任何一个人。如果没有补贴，埃隆可能不得不关门大吉，回到南非老家。`
	// },
	// {
	// 	img: Message2,
	// 	name: "埃隆·马斯克",
	// 	time: "14:49 · 发布于X",
	// 	content: `如果这个疯狂的支出法案获得通过，‘美国党’将在第二天成立。`
	// }
]);
const handleGetMessage = async () => {
	const params = {
		moduleId: "0101"
	};
	try {
		const res = await getSocialMedia(params);
		console.log("社交媒体", res);
		messageList.value = res.data.map(item => {
			return {
				img: item.personImage,
				name: item.personName,
				// time: item.time.replace("T", " ") + " · 发布于" + item.orgName,
				time: item.time.replace("T", " "),
				source: item.orgName,
				content: item.remarks,
				personId: item.personId,
				remarksId: item.remarksId
			};
		});
	} catch (error) { }
};
handleGetMessage();

// 点击人物头像，跳转到人物主页
const handleClickPerson = async item => {
	console.log("person", item);
	const personTypeList = JSON.parse(window.sessionStorage.getItem("personTypeList"));
	console.log("personTypeList", personTypeList);

	let type = 0;
	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.name);
				const route = router.resolve({
					path: "/characterPage",
					query: {
						type: type, // type=1为科技企业领袖，2为国会议员，3为智库研究人员
						personId: item.personId
					}
				});
				window.open(route.href, "_blank");
				// router.push(
				// 	{
				// 	path: "/characterPage",
				// 	query: {
				// 		type: type, // type=1为科技企业领袖，2为国会议员，3为智库研究人员
				// 		personId: item.personId
				// 	}
				// }
				// )
			} else {
				personTypeName = "";
				ElMessage.warning("找不到当前人员的类型值！");
				return;
			}
		} else {
			ElMessage.warning("找不到当前人员的类型值！");
			return;
		}
	} catch (error) { }
};

// 获取最近年份列表
const currentYear = new Date().getFullYear();
const getYearList = (count = 6) => {
	const yearOptions = [];
	for (let i = 0; i < count; i++) {
		const year = currentYear - i;
		yearOptions.push({ label: year.toString(), value: year.toString() });
	}
	return yearOptions;
};
const yearList = getYearList();

// 行政令发布频度
const chart1Data = ref({
	dataX: [],
	dataY: []
});
const box5Params = reactive({
	year: yearList[0].value,
	domainId: '',
	proposeName: '',
	loading: false,
})
const summarize1 = ref()
const handleGetDecreeYearOrder = async () => {
	box5Params.loading = true
	try {
		let { year, domainId, proposeName } = box5Params;
		const res = await getDecreeYearOrder({
			year,
			domainId: domainId || undefined,
			orgId: proposeName || undefined
		});
		console.log("行政令发布频度", res);
		if (res.code === 200 && res.data) {
			chart1Data.value.dataX = res.data.map(item => {
				return item.year;
			});
			chart1Data.value.dataY = res.data.map(item => {
				return item.count;
			});
			onChartInterpretation({ type: "柱状图", name: "数量变化趋势", data: res.data }, summarize1)
		}
	} catch (error) {
		console.error("行政令发布频度error", error);
	}
	box5Params.loading = false
};
// AI智能总结
const onChartInterpretation = async (text, param) => {
	param.value = "正在生成..."

	// 👇 新增：超时 + 终止请求（只加这一段）
	const controller = new AbortController();
	const timeout = setTimeout(() => controller.abort(), 10000); // 10秒超时

	try {
		const response = await fetch('/aiAnalysis/chart_interpretation', {
			method: 'POST',
			headers: {
				"X-API-Key": "aircasKEY19491001",
				'Content-Type': 'application/json',
			},
			body: JSON.stringify({ text }),
			signal: controller.signal // 👇 新增：绑定中断信号
		});

		clearTimeout(timeout); // 👇 新增：请求成功清除定时器
		if (!response.ok) throw new Error(`HTTP 错误 ${response.status}`);
		const reader = response.body.getReader();
		const decoder = new TextDecoder();

		let buffer = '';
		let summarize = '';

		while (true) {
			const { done, value } = await reader.read();
			if (done) break;

			buffer += decoder.decode(value, { stream: true });
			const lines = buffer.split('\n');
			buffer = lines.pop() || '';

			for (const line of lines) {
				if (line.startsWith('data: ')) {
					const content = line.substring(6);
					const textMatch = content.match(/"解读":\s*"([^"]*)"/);
					if (textMatch && textMatch[1]) summarize = textMatch[1];
				}
			}
		}
		param.value = summarize
	} catch (err) {
		param.value = "系统异常，生成失败";
	}
}

const handleBox5 = async () => {
	await handleGetDecreeYearOrder();
	let chart1 = getBarChart(chart1Data.value.dataX, chart1Data.value.dataY);
	chart1.yAxis.name = "数量";
	chart1.yAxis.nameTextStyle = { align: 'right' }
	let org = '全部机构'
	if (box5Params.proposeName) {
		org = keyOrganizationList.value.filter(item => {
			return item.orgId === box5Params.proposeName
		})[0].orgName
	}
	let domain = '全部领域'
	if (box5Params.domainId) {
		domain = areaList.value.filter(item => {
			return item.id === box5Params.domainId
		})[0].name
	}
	const selectParam = {
		moduleType: '政令',
		orgnizationName: org,
		domains: domain,
		selectDate: box5Params.year
	}
	setChart(chart1, "chart1", true, selectParam);
};

// 政令科技领域
const chart2Data = ref([
	// {
	// 	name: "集成电路",
	// 	value: 50
	// },
	// {
	// 	name: "人工智能",
	// 	value: 46
	// },
]);
// const colorList = ["#69B1FF", "#FFC069", "#87E8DE", "#85A5FF", "#FF7875", "#B37FEB", "#4096FF"];

const box6Params = reactive({
	year: yearList[0].value,
	proposeName: '',
	loading: false,
});
const summarize2 = ref()
const handleGetDecreeArea = async () => {
	box6Params.loading = true
	try {
		let { year, proposeName } = box6Params;
		const res = await getDecreeArea({
			year,
			orgId: proposeName || undefined
		});
		console.log("政令科技领域", res);
		if (res.code === 200 && res.data) {
			chart2Data.value = res.data.map(item => {
				return {
					name: item.industry,
					value: item.count
				};
			});
			onChartInterpretation({ type: "环形图", name: "领域分布情况", data: res.data }, summarize2)
		}
	} catch (error) {
		console.error("政令科技领域error", error);
	}
	box6Params.loading = false
};
const handleBox6 = async () => {
	await handleGetDecreeArea();
	let org = '全部机构'
	if (box6Params.proposeName) {
		org = keyOrganizationList.value.filter(item => {
			return item.orgId === box6Params.proposeName
		})[0].orgName
	}
	const selectParam = {
		moduleType: '政令',
		orgnizationName: org,
		selectedDate: JSON.stringify([box6Params.year + '-01-01', box6Params.year + '-12-31'])
	}
	let chart2 = getPieChart(chart2Data.value);
	setChart(chart2, "chart2", true, selectParam);
};

const handleBox6YearChange = () => {
	handleBox6();
};

// 关键行政令
const keyDecreeList = ref([]);
const keyDecreeInfo = reactive({
	total: 0,
	page: 1,
	size: 4,
})
const box7Params = reactive({
	year: yearList[0].value,
	domainId: '',
	proposeName: '',
	loading: false,
})
const handleGetKeyDecree = async () => {
	box7Params.loading = true
	try {
		let { year, domainId, proposeName } = box7Params;
		const res = await getKeyDecree({
			pageSize: keyDecreeInfo.size,
			pageNum: keyDecreeInfo.page - 1,
			year,
			domainId: domainId || undefined,
			orgId: proposeName || undefined
		});
		console.log("关键行政令", res);
		if (res.code === 200 && res.data?.total) {
			keyDecreeInfo.total = res.data.total || 0;
			keyDecreeList.value = res.data.list.map(item => {
				return {
					title: item.name,
					content: item.describe,
					time: item.postDate,
					id: item.orderId
				};
			});
		}
	} catch (error) { }
	box7Params.loading = false
};

// 政令重点条款
const wordCloudData = ref([]);
const box8Params = reactive({
	year: yearList[0].value,
	domainId: '',
	proposeName: '',
	loading: false,
})
const handleGetDecreeKeyInstruction = async () => {
	box8Params.loading = true
	wordCloudData.value = []
	try {
		let { year, domainId, proposeName } = box8Params;
		const res = await getDecreeKeyInstruction({
			year,
			domainId: domainId || undefined,
			orgId: proposeName || undefined
		});
		console.log("政令重点条款", res);
		if (res.code == 200) {
			wordCloudData.value = res.data.map(item => ({ name: item.clause, value: item.count }));
		} else {
			wordCloudData.value = []
		}
	} catch (error) {
		wordCloudData.value = []
		console.error("政令重点条款error", error);
	}
	box8Params.loading = false
};

// 资源库
const searchType = ref("");
const isChina = ref(false);
const isSort = ref(false); // true 升序  false 降序

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"
			});
		});
	}
};

// 政令类型
const decreeTypeList = ref([]);
const checkedDecreeType = ref([]);

const handleGetDecreeTypeList = async () => {
	try {
		const res = await getDecreeTypeList();
		console.log("政令类型", res);
		if (res.code === 200 && res.data) {
			decreeTypeList.value = res.data;
		}
	} catch (error) { }
};
// 查看社交媒体详情
const handleToSocialDetail = item => {
	const route = router.resolve({
		path: "/characterPage",
		query: {
			personId: item.id
		}
	});
	window.open(route.href, "_blank");
};
const handleChangeCheckedDecreeType = () => {
	handleGetDecreeOrderList();
};

const pubTime = ref([
	{ id: "", name: "全部时间" },
	{ id: "2026", name: "2026年" },
	{ id: "2025", name: "2025年" },
	{ id: "2024", name: "2024年" },
	{ id: "2023", name: "2023年" },
	{ id: "2022", name: "2022年" },
	{ id: "2021", name: "2021年" },
	{ id: "2020", name: "2020年" }
]);
const activePubTime = ref(["2026"]);
// 处理发布时间全选逻辑
const handlePubTimeChange = (event) => {
	if (event.length && event[event.length-1] !== "") {
		activePubTime.value = event.filter(item => item !== "");
	} else {
		activePubTime.value = [""];
	}
	currentPage.value = 1;
	handleGetDecreeOrderList();
};

const activeAreaList = ref([""]);
const handleAreaChange = (event) => {
	if (event.length && event[event.length-1] !== "") {
		activeAreaList.value = event.filter(item => item !== "");
	} else {
		activeAreaList.value = [""];
	}

	currentPage.value = 1;
	handleGetDecreeOrderList();
};

const areaList = ref([
	// { id: "人工智能", name: "人工智能" },
	// { id: "集成电路", name: "集成电路" },
	// { id: "通信网络", name: "通信网络" },
	// { id: "量子科技", name: "量子科技" }
]);

// 修改获取科技领域列表，添加全选选项
const handleGetAreaList = async () => {
	try {
		const res = await getDecreehylyList();
		console.log("行业领域列表", res);
		if (res.code === 200 && res.data) {
			areaList.value = res.data;
			// 获取列表后重新查询
			handleGetDecreeOrderList();
		}
	} catch (error) { }
};

const totalDecreesNum = ref(0);

const decreeList = ref([]);

// 修改请求方法，处理全选时不传参数的情况
const handleGetDecreeOrderList = async () => {
	const params = {
		currentPage: currentPage.value,
		pageSize: pageSize.value,
		researchTypeIds: activeAreaList.value.join(',') || null,
		sortFun: isSort.value,
		isCN: isChina.value ? 1 : 0,
		proposeName: searchType.value,
		years: activePubTime.value.join(',') || null,
		typeIds: checkedDecreeType.value.toString()
	};

	try {
		const res = await getDecreeOrderList(params);
		console.log("资源库列表", res);
		if (res.code === 200 && res.data) {
			totalDecreesNum.value = res.data.totalElements;
			decreeList.value = res.data.content.map(item => {
				return {
					id: item.id,
					time: item.postDate,
					title: item.proposeOrgName + ": " + item.name,
					desc: item.describe,
					img: item.orgImage,
					tagList: item.industryList
				};
			});
		} else {
			decreeList.value = [];
			totalDecreesNum.value = 0;
		}
	} catch (error) {
		console.error("资源库列表error", error);
		decreeList.value = [];
		totalDecreesNum.value = 0;
	}
};

watch([checkedGovIns, isSort, isChina, searchType], val => {
	// 切换页码到第一页
	currentPage.value = 1;
	handleGetDecreeOrderList();
});

// 切换当前政令
const handleSwithCurDecree = name => {
	if (name === "left") {
		carouselRef.value.prev();
	} else {
		carouselRef.value.next();
	}
};

// 关键机构
const keyOrganizationList = ref([]);
const onKeyOrganization = async (event) => {
	let day = 365
	if (event?.time === '近一周') day = 7
	if (event?.time === '近一月') day = 30
	if (event?.time === '近一年') day = 365
	try {
		const res = await getKeyOrganization({ day });
		console.log("关键机构", res);
		if (res.code === 200) {
			keyOrganizationList.value = res.data;
		}
	} catch (error) { }
}

// 下钻至数据资源库
const handleToDataLibrary = (item) => {
	const selectParam = {
		orgnizationName: item.orgName,
		isInvolveCn: true
	}
	const route = router.resolve({
		path: "/dataLibrary/dataDecree",
		query: selectParam
	});
	window.open(route.href, "_blank");
}

onMounted(async () => {
	onKeyOrganization();
	handleGetDepartmentList();
	handleGetNews();
	handleGetDecreeTypeList();
	handleGetAreaList();
	handleGetDecreeOrderList();
	handleBox1(); // 最新科技政令
	handleGetKeyDecree();
	handleBox5();
	handleBox6();
	handleGetDecreeKeyInstruction();
});
</script>

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

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

.data-origin-box {
	width: 100%;
	display: flex;
	align-items: center;
	padding: 16px 22px;

	.data-origin-icon {
		width: 16px;
		height: 16px;
		font-size: 0px;
		margin-right: 8px;

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

	.data-origin-text {
		font-family: Source Han Sans CN;
		font-size: 14px;
		color: var(--text-primary-50-color);
	}
}

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

	.home-main {
		position: relative;
		width: 100%;
		height: 100%;
		overflow-y: auto;

		.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-top {
				width: 100%;
				height: 64px;
				background: url("./assets/images/header-bg.png");
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				padding: 0 160px;
			}

			.home-main-header-footer {
				margin-top: 38px;
				width: 960px;
				height: 64px;
				box-sizing: border-box;
				padding: 0 108px;
				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: Microsoft YaHei;
						font-size: 36px;
						font-weight: 700;
						line-height: 22px;
					}

					.item-footer {
						margin-top: 10px;
						height: 30px;
						color: rgba(95, 101, 108, 1);
						font-family: Microsoft YaHei;
						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: Microsoft YaHei;
						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-item-box {
				margin: 20px 0 64px;
				width: 1600px;
				display: grid;
				grid-template-columns: repeat(4, 1fr);
				grid-auto-rows: 80px;
				gap: 16px;
				font-family: Microsoft YaHei;

				.organization-item {
					padding: 0 16px;
					display: flex;
					box-sizing: border-box;
					background: rgba(255, 255, 255, 0.65);
					border: 1px solid rgba(255, 255, 255, 1);
					border-radius: 10px;
					box-shadow: 0px 0px 20px 0px rgba(25, 69, 130, 0.1);
					align-items: center;
					justify-content: center;
					cursor: pointer;
					transition: transform 0.3s ease, box-shadow 0.3s ease;
					position: relative;

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

					.item-left {
						width: 48px;
						height: 48px;
						font-size: 0px;

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

					.item-right {
						width: 20px;
						flex: auto;
						color: rgba(59, 65, 75, 1);
						font-size: 20px;
						font-weight: 700;
						line-height: 20px;
						margin: 0 16px;

						&:hover {
							color: var(--color-primary-100);
							text-decoration: underline;
						}
					}

					.item-total {
						font-size: 20px;
						margin-right: 2px;
						white-space: nowrap;
						font-weight: 700;
						line-height: 20px;
						color: var(--color-primary-100);

						&:hover {
							text-decoration: underline;
						}
					}

					.item-more {
						font-size: 16px;
						margin-right: 12px;
						white-space: nowrap;
						font-weight: 700;
						line-height: 16px;
						color: var(--color-primary-100);
					}

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

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

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

				.box1 {
					width: 1064px;
					height: 450px;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(22, 119, 255, 0.1);
					background: #fff;
					box-sizing: border-box;
					position: relative;

					.box1-left {
						position: absolute;
						z-index: 9999;
						left: 0;
						top: 200px;
						width: 24px;
						height: 48px;
						display: flex;
						justify-content: center;
						align-items: center;
						cursor: pointer;

						.icon {
							width: 24px;
							height: 48px;

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

					.box1-right {
						position: absolute;
						z-index: 9999;
						right: 0;
						top: 200px;
						width: 24px;
						height: 48px;
						display: flex;
						justify-content: center;
						align-items: center;
						cursor: pointer;

						.icon {
							width: 24px;
							height: 48px;

							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: 18px;
								height: 18px;
								margin-left: 19px;
								margin-top: 14px;

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

							.title {
								width: 152px;
								height: 48px;
								margin-left: 18px;
								color: #fff;
								background: var(--color-main-active);
								font-family: Microsoft YaHei;
								font-size: 20px;
								font-weight: 700;
								line-height: 48px;
								text-align: center;
							}
						}

						.box1-header-right {
							margin-top: 16px;
							height: 16px;
							color: var(--color-main-active);
							font-family: Microsoft YaHei;
							font-size: 16px;
							font-weight: 400;
							line-height: 16px;
							cursor: pointer;
							margin-right: 39px;
						}
					}

					.box1-main {
						display: flex;
						justify-content: space-between;
						width: 1064px;
						height: 354px;
						margin-top: 22px;
						padding-left: 31px;
						padding-right: 41px;
						box-sizing: border-box;

						.box1-main-left {
							width: 450px;
							height: 353px;
							position: relative;

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

							.box1-main-left-img-mock {
								width: 100%;
								height: 100%;
								margin-left: 24px;
								border-radius: 4px;
								background-color: #0b1932;
								display: flex;
								align-items: center;
								flex-direction: column;
								justify-content: space-around;
								padding: 24px;

								.img-mock-badge-img {
									width: 80px;
									height: 80px;
								}

								.img-mock-badge-title {
									text-align: center;
									font-size: 24px;
									line-height: 36px;
									color: #fff;
								}

								// .img-mock-badge-org {
								// 	text-align: center;
								// 	font-size: 14px;
								// 	color: #fff;
								// }
							}
						}

						.box1-main-right {
							width: 500px;
							height: 100%;
							display: flex;
							flex-direction: column;
							justify-content: space-between;

							.box1-main-right-title {
								width: 100%;
								// height: 26px;
								color: var(--color-main-active);
								font-family: Microsoft YaHei;
								font-size: 20px;
								font-weight: 700;
								line-height: 26px;

								display: -webkit-box;
								-webkit-line-clamp: 2;
								-webkit-box-orient: vertical;
								overflow: hidden;
								text-overflow: ellipsis;
							}

							.box1-main-right-info {
								margin-top: 14px;
								display: flex;
								height: 24px;
								gap: 8px;
							}

							.box1-main-right-center {
								margin-top: 10px;
								height: 180px;
								color: rgba(59, 65, 75, 1);
								font-family: Microsoft YaHei;
								font-size: 16px;
								font-weight: 400;
								line-height: 30px;
								display: -webkit-box;
								-webkit-line-clamp: 6;
								-webkit-box-orient: vertical;
								overflow: hidden;
								text-overflow: ellipsis;
							}

							.box1-main-right-footer {
								margin-top: 50px;
								height: 24px;
								display: flex;
								justify-content: space-between;

								.footer-left {
									height: 24px;
									line-height: 24px;
									color: rgba(95, 101, 108, 1);
									font-family: Microsoft YaHei;
									font-size: 16px;
									font-weight: 400;
									line-height: 24px;
								}

								.footer-right {
									display: flex;

									.footer-right-item1 {
										height: 24px;
										color: var(--color-main-active);
										font-family: Microsoft YaHei;
										font-size: 16px;
										font-weight: 400;
										line-height: 24px;
									}

									.footer-right-item2 {
										width: 16px;
										height: 16px;
										margin-top: 4px;
										margin-left: 11px;

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

			.divide2 {
				width: 1600px;
				margin: 0 auto;
				margin-top: 68px;
				margin-bottom: 36px;
			}

			.center-center {
				width: 1600px;
				margin: 0 auto;
				margin-top: 21px;
				height: 450px;
				display: flex;
				gap: 16px;

				.box3 {
					width: 792px;
					height: 450px;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(25, 69, 130, 0.2);
					background: rgba(255, 255, 255, 1);

					.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-left: 21px;
								margin-top: 16px;
								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: Microsoft YaHei;
								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: Microsoft YaHei;
							font-size: 16px;
							font-weight: 400;
							line-height: 24px;
							cursor: pointer;
						}
					}

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

						.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: 500px;
										height: 24px;
										color: rgba(59, 65, 75, 1);
										font-family: Microsoft YaHei;
										font-size: 16px;
										font-weight: 700;
										line-height: 24px;
										overflow: hidden;
										text-overflow: ellipsis;
										white-space: nowrap;
									}

									.time {
										width: 157px;
										text-align: right;
										height: 22px;
										margin-top: 19px;
										color: rgba(95, 101, 108, 1);
										font-family: Microsoft YaHei;
										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: Microsoft YaHei;
									font-size: 16px;
									font-weight: 400;
									line-height: 24px;
									overflow: hidden;
									text-overflow: ellipsis;
									white-space: nowrap;
								}
							}
						}
					}
				}

				.box4 {
					margin-left: 20px;
					width: 792px;
					height: 450px;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(25, 69, 130, 0.2);
					background: rgba(255, 255, 255, 1);

					.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-left: 21px;
							margin-top: 17px;
							width: 20px;
							height: 20px;

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

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

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

			.divide3 {
				width: 1600px;
				margin: 0 auto;
				margin-top: 68px;
				margin-bottom: 36px;
			}

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

				.box5 {
					width: 792px;
					height: 100%;
					box-shadow: 0px 0px 15px 0px rgba(22, 119, 255, 0.1);
					background: rgba(255, 255, 255, 1);
					border-radius: 10px;
					position: relative;
					display: flex;
					flex-direction: column;

					.box5-header {
						width: 100%;
						height: 48px;
						border-bottom: 1px solid rgba(240, 242, 244, 1);
						display: flex;
						align-items: center;

						.box5-header-icon {
							margin-left: 24px;
							width: 17px;
							height: 17px;

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

						.box5-header-title {
							width: 20px;
							flex: auto;
							margin-left: 19px;
							height: 26px;
							color: var(--color-main-active);
							font-family: Microsoft YaHei;
							font-size: 20px;
							font-weight: 700;
							line-height: 26px;
						}
					}

					.box5-main {
						flex: auto;
						height: 20px;
						padding-top: 16px;

						.box5-chart {
							height: 100%;
						}
					}
				}
			}

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

				.box7 {
					width: 792px;
					height: 100%;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(22, 119, 255, 0.1);
					background: rgba(255, 255, 255, 1);
					display: flex;
					flex-direction: column;

					.box7-header {
						width: 792px;
						height: 48px;
						display: flex;
						align-items: center;
						border-bottom: 1px solid rgba(240, 242, 244, 1);

						.header-icon {
							width: 22px;
							height: 20px;
							margin-left: 25px;

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

						.header-title {
							width: 20px;
							flex: auto;
							height: 26px;
							margin-left: 13px;
							color: var(--color-main-active);
							font-family: Microsoft YaHei;
							font-size: 20px;
							font-weight: 700;
							line-height: 26px;
						}
					}

					.box7-main {
						height: 20px;
						flex: auto;

						.box7-list {
							padding: 10px 24px 0;

							.box7-item {
								display: flex;
								padding: 10px 0;
								cursor: pointer;

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

								.icon {
									margin-top: 8px;
									width: 24px;
									height: 22px;
									font-size: 0px;

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

								.info {
									margin-left: 13px;
									width: 20px;
									flex: auto;

									.info-header {
										height: 24px;
										display: flex;
										margin-top: 4px;
										justify-content: space-between;

										.title {
											width: 600px;
											height: 24px;
											color: rgba(59, 65, 75, 1);
											font-family: Microsoft YaHei;
											font-size: 18px;
											font-weight: 700;
											line-height: 24px;
										}

										.time {
											width: 91px;
											height: 24px;
											color: rgba(95, 101, 108, 1);
											font-family: Microsoft YaHei;
											font-size: 16px;
											font-weight: 400;
											line-height: 24px;
											overflow: hidden;
											text-overflow: ellipsis;
											white-space: nowrap;
										}
									}

									.info-content {
										height: 24px;
										margin-top: 6px;
										color: rgba(95, 101, 108, 1);
										font-family: Microsoft YaHei;
										font-size: 16px;
										font-weight: 400;
										line-height: 24px;
									}
								}
							}
						}
					}

					:deep(.simple-pagination) {
						padding: 0;
					}
				}

				.box8 {
					margin-left: 16px;
					width: 792px;
					height: 100%;
					border-radius: 10px;
					box-shadow: 0px 0px 15px 0px rgba(22, 119, 255, 0.1);
					background: rgba(255, 255, 255, 1);
					display: flex;
					flex-direction: column;

					.box8-header {
						width: 100%;
						height: 48px;
						display: flex;
						align-items: center;
						border-bottom: 1px solid rgba(240, 242, 244, 1);

						.header-icon {
							width: 22px;
							height: 20px;
							margin-left: 25px;

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

						.header-title {
							width: 20px;
							flex: auto;
							height: 26px;
							margin-left: 13px;
							color: var(--color-main-active);
							font-family: Microsoft YaHei;
							font-size: 20px;
							font-weight: 700;
							line-height: 26px;
						}
					}

					.box8-content {
						width: 100%;
						height: 20px;
						flex: auto;
					}
				}
			}
		}

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

			.divide4 {
				margin: 0 auto;
				margin-top: 52px;
				margin-bottom: 6px;
			}

			.home-main-footer-header {
				width: 1600px;
				height: 50px;
				margin: 0 auto 16px;
				display: flex;
				align-items: center;

				.btn-box {
					margin-top: 10px;
					width: 1450px;
					overflow-x: auto;
					overflow-y: hidden;
					display: flex;
					gap: 8px;
					white-space: nowrap;

					.btn {
						min-width: min-content;
						height: 42px;
						color: rgba(95, 101, 108, 1);
						font-family: Microsoft YaHei;
						font-size: 20px;
						font-weight: 400;
						line-height: 42px;
						padding: 0 24px;
						border-radius: 21px;
						background: rgba(20, 89, 187, 0);
						cursor: pointer;

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

					.btnActive {
						font-weight: 700;
						background: rgba(20, 89, 187, 1);
						color: #fff;

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

				.search-box {
					width: 360px;
				}

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

					.icon1 {
						width: 11px;
						height: 14px;
						font-size: 0px;

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

					:deep(.el-select__selected-item) {
						text-align: center;
						font-size: 16px;
						font-family: Microsoft YaHei;
					}
				}
			}

			.home-main-footer-main {
				width: 1600px;
				margin: 0 auto;
				display: flex;
				gap: 16px;

				.left {
					width: 360px;
					height: 100%;
					padding-bottom: 24px;
					box-sizing: border-box;
					border: 1px solid rgba(234, 236, 238, 1);
					border-radius: 10px;
					box-shadow: 0px 0px 20px 0px rgba(94, 95, 95, 0.1);
					background: rgba(255, 255, 255, 1);
					position: relative;

					.select-box {
						margin-top: 16px;

						.select-box-header {
							display: flex;
							gap: 17px;

							.icon {
								margin-top: 4px;
								width: 8px;
								height: 16px;
								background: var(--color-main-active);
								border-radius: 0 4px 4px 0;
							}

							.title {
								height: 24px;
								color: var(--color-main-active);
								font-family: "Source Han Sans CN";
								font-size: 16px;
								font-weight: 700;
								line-height: 24px;
								letter-spacing: 1px;
								text-align: left;
							}
						}

						.select-main {
							margin-left: 24px;
							margin-top: 12px;

							.checkbox-group {
								display: grid;
								grid-template-columns: repeat(2, 160px);
								gap: 8px 4px;

								.filter-checkbox {
									width: 100px;
									height: 24px;
									margin-right: 0 !important;
								}
							}
						}
					}
				}

				.right {
					width: 20px;
					flex: auto;
					box-shadow: 0px 0px 15px 0px rgba(60, 87, 126, 0.2);
					background: rgba(255, 255, 255, 1);
					box-sizing: border-box;
					border-radius: 10px;

					.content-header {
						height: 48px;
						display: flex;
						border-bottom: 1px solid rgba(234, 236, 238, 1);

						.icon {
							width: 23px;
							height: 18px;
							margin-top: 16px;
							margin-left: 20px;

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

						.title {
							height: 26px;
							margin-top: 11px;
							margin-left: 17px;
							color: var(--color-main-active);
							font-family: Microsoft YaHei;
							font-size: 20px;
							font-weight: 700;
							line-height: 26px;
						}
					}

					.content-box {
						border-bottom: 1px solid rgba(234, 236, 238, 1);
						overflow: hidden;
						min-height: 790px;
						box-sizing: border-box;

						.main-item {
							display: flex;
							width: 100%;
							min-height: 100px;
							// height: 136px;
							// background: orange;
							box-sizing: border-box;
							padding: 16px 36px 0px 0px;
							cursor: pointer;

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

							.main-item-left {
								display: flex;
								gap: 18px;
								justify-content: flex-end;

								.left-left {
									margin-left: 30px;
									width: 80px;
									height: 48px;
									color: var(--color-main-active);
									font-family: Microsoft YaHei;
									font-size: 16px;
									font-weight: 700;
									line-height: 20px;
									letter-spacing: 1px;
									text-align: right;
								}

								.left-right {
									.icon {
										width: 30px;
										height: 30px;
										border-radius: 50%;
										overflow: hidden;

										img {
											width: 100%;
											height: 100%;
											object-fit: contain;
										}
									}

									.line {
										height: 100%;
										width: 2px;
										background: var(--border-black-5);
										margin-left: 14px;
									}
								}
							}

							.main-item-center {
								padding-left: 21px;
								padding-bottom: 16px;
								box-sizing: border-box;
								width: 20px;
								flex: auto;

								.center-header {
									width: 100%;
									overflow: hidden;
									display: flex;
									align-items: center;
									gap: 16px;

									.title {
										height: 26px;
										color: rgba(59, 65, 75, 1);
										font-family: Microsoft YaHei;
										font-size: 20px;
										font-weight: 700;
										line-height: 26px;
										letter-spacing: 0px;
										flex: auto;
										overflow: hidden;
										text-overflow: ellipsis;
										white-space: nowrap;
									}

									.type-box {
										flex: none;
										height: 28px;
										line-height: 28px;
										padding: 0 8px;
										text-align: center;
										font-family: Microsoft YaHei;
										font-size: 16px;
										font-weight: 400;
										letter-spacing: 0px;
										border-radius: 4px;
									}

									.type1 {
										color: rgba(232, 189, 11, 1);
										background: rgba(232, 189, 11, 0.1);
									}

									.type2 {
										color: rgba(255, 149, 77, 1);
										background: rgba(255, 149, 77, 0.1);
									}
								}

								.desc {
									margin-top: 8px;
									color: rgba(95, 101, 108, 1);
									font-family: Microsoft YaHei;
									font-size: 16px;
									font-weight: 400;
									line-height: 28px;
									letter-spacing: 0px;
									text-align: justify;

									overflow: hidden;
									display: -webkit-box;
									-webkit-box-orient: vertical;
									-webkit-line-clamp: 2;
								}

								.tag-box {
									margin-top: 9px;
									display: flex;
									flex-wrap: wrap;
									gap: 8px;
								}
							}
						}
					}

					.footer-box {
						margin: 20px 30px;
						height: 32px;
						display: flex;
						justify-content: space-between;

						.footer-left {
							color: rgba(59, 65, 75, 1);
							font-family: Microsoft YaHei;
							font-size: 16px;
							font-weight: 400;
							line-height: 32px;
						}
					}
				}
			}
		}
	}
}

.divide {
	margin: 0 auto;
}

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

:deep(.el-checkbox__label) {
	color: rgba(95, 101, 108, 1);

	font-family: Source Han Sans CN;
	font-style: Regular;
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
	letter-spacing: 0px;
	text-align: justify;
}

:deep(.el-checkbox__input.is-checked + .el-checkbox__label) {
	color: rgba(95, 101, 108, 1);
}
</style>
