提交 ba5747a5 authored 作者: 张伊明's avatar 张伊明

合并分支 'zz-dev' 到 'pre'

feat:首页风险信号与后端对接口 查看合并请求 !367
流水线 #539 已通过 于阶段
in 1 分 56 秒
......@@ -17,6 +17,14 @@ export function getLatestRisks() {
});
}
// 中美博弈概览V2:首页最新风险动态(10条 + 各类数量/总数)
export function getLatestRisk() {
return request({
method: "GET",
url: `/api/rivalryIndexV2/LatestRisk`
});
}
// 中美博弈概览V2:美对华制裁措施数量趋势
export function geDomainContainmentTrend(params) {
return request({
......
......@@ -43,15 +43,10 @@
<div style="display: flex">
<!-- 风险信号列表 -->
<div class="risk-signals" ref="riskSignalsRef">
<div
class="risk-signals-item"
v-for="(item, index) in warningList"
<div class="risk-signals-item" v-for="(item, index) in warningList"
:key="item.signalId != null ? String(item.signalId) : 'risk-' + index"
@mouseenter="onMouseEnter(item, index)"
@mouseleave="onMouseLeave"
@click.stop
:class="['risk-signals-item', { 'risk-signals-item-hightLight': riskSignalActiveIndex === index }]"
>
@mouseenter="onMouseEnter(item, index)" @mouseleave="onMouseLeave" @click.stop
:class="['risk-signals-item', { 'risk-signals-item-hightLight': riskSignalActiveIndex === index }]">
<div class="item-left" :class="{
'item-status-1': item.signalLevel === '特别重大',
'item-status-2': item.signalLevel === '重大风险',
......@@ -132,7 +127,8 @@
import { color } from "echarts";
import { onMounted, ref, onUnmounted, computed } from "vue";
import WaveBall from "./WaveBall.vue";
import { getLatestRiskUpdates, getLatestRisks } from "@/api/zmOverview/risk/index.js";
import { getLatestRisk } from "@/api/zmOverview/risk/index.js";
import { getRiskSignalInfoById } from "@/api/riskSignal/index.js";
import router from "@/router/index";
import { navigateToViewRiskSignal } from "@/utils/riskSignalOverviewNavigate";
import icon1 from "./icon/title-1.svg";
......@@ -315,12 +311,14 @@ const cardShowIndex4 = ref(0);
// 最新风险动态统计
const handleGetLatestRiskUpdates = async () => {
try {
const params = {
currentDate: "本周"
};
const res = await getLatestRiskUpdates(params);
console.log("最新风险动态统计1", res);
const res = await getLatestRisk();
console.log("最新风险动态", res);
if (res.code === 200 && res.data) {
const d = res.data;
const formatChange = (n) => {
const v = Number(n) || 0;
return v === 0 ? "无新增" : String(v);
};
sections.value = [
{
// title: res.data.policiesRegulations.hotspotTitle,
......@@ -328,16 +326,16 @@ const handleGetLatestRiskUpdates = async () => {
waveBall: [
{
percent: 30, // 估算的百分比
count: res.data.bill.total,
change: res.data.bill.dailyIncrement,
count: d.billRiskTotal ?? 0,
change: formatChange(d.billRiskNum),
unit: "项",
title: "法案(提出)",
type: "法案"
},
{
percent: 20, // 估算的百分比
count: res.data.administrativeOrder.total,
change: res.data.administrativeOrder.dailyIncrement,
count: d.orderRiskTotal ?? 0,
change: formatChange(d.orderRiskNum),
unit: "个",
title: "政令",
type: "行政令"
......@@ -350,8 +348,8 @@ const handleGetLatestRiskUpdates = async () => {
waveBall: [
{
percent: 10, // 估算的百分比
count: res.data.Entities.total,
change: res.data.Entities.dailyIncrement,
count: d.entityRiskTotal ?? 0,
change: formatChange(d.entityRiskNum),
unit: "次",
title: "实体清单",
......@@ -359,8 +357,8 @@ const handleGetLatestRiskUpdates = async () => {
},
{
percent: 20, // 估算的百分比
count: res.data.CCL.total,
change: res.data.CCL.dailyIncrement,
count: d.cclRiskTotal ?? 0,
change: formatChange(d.cclRiskNum),
unit: "次",
title: "CCL",
type: "CCL"
......@@ -373,16 +371,16 @@ const handleGetLatestRiskUpdates = async () => {
waveBall: [
{
percent: 15, // 估算的百分比
count: res.data.SDN.total,
change: res.data.SDN.dailyIncrement,
count: d.sdnRiskTotal ?? 0,
change: formatChange(d.sdnRiskNum),
unit: "次",
title: "SDN",
type: "SDN"
},
{
percent: 5, // 估算的百分比
count: res.data.militaryInvolvement.total,
change: res.data.militaryInvolvement.dailyIncrement,
count: d.armyRiskTotal ?? 0,
change: formatChange(d.armyRiskNum),
unit: "家",
title: "涉军企业",
type: "涉军企业"
......@@ -395,24 +393,24 @@ const handleGetLatestRiskUpdates = async () => {
waveBall: [
{
percent: 3, // 估算的百分比
count: res.data["337Survey"].total,
change: res.data["337Survey"].dailyIncrement,
count: d.m337RiskTotal ?? 0,
change: formatChange(d.m337RiskNum),
unit: "次",
title: "337调查",
type: "337调查"
},
{
percent: 3, // 估算的百分比
count: res.data["232Survey"].total,
change: res.data["232Survey"].dailyIncrement,
count: d.m232RiskTotal ?? 0,
change: formatChange(d.m232RiskNum),
unit: "次",
title: "232调查",
type: "232调查"
},
{
percent: 3, // 估算的百分比
count: res.data["301Survey"].total,
change: res.data["301Survey"].dailyIncrement,
count: d.m301RiskTotal ?? 0,
change: formatChange(d.m301RiskNum),
unit: "次",
title: "301调查",
type: "301调查"
......@@ -454,12 +452,60 @@ const hotNewsList = ref([
//最新风险信号
const handleGetLatestRisks = async () => {
try {
const res = await getLatestRisks();
console.log("最新风险信号", res);
const res = await getLatestRisk();
console.log("最新风险动态(列表)", res);
if (res.code === 200 && res.data) {
warningList.value = res.data.riskVOS;
hotNewsList.value = res.data.hotspotVOS;
riskTotal.value = res.data.riskCount;
const d = res.data;
const list = Array.isArray(d.riskSignals) ? d.riskSignals : [];
const getEventTypeFromModule = (code) => {
const c = String(code ?? "").trim();
if (c === "0100") return "法案";
if (c === "0101") return "行政令";
if (c === "0102") return "智库报告";
if (c === "0103") return "出口管制";
if (c === "0104") return "市场准入";
if (c === "0105") return "创新主体";
if (c === "0106") return "合作限制";
if (c === "0107") return "科研资助体系";
if (c === "0108") return "规则限制";
if (c === "0109") return "投融资限制";
if (c === "01031") return "实体清单";
if (c === "01032") return "CCL";
if (c === "01091") return "SDN";
if (c === "01092") return "涉军企业";
if (c === "01041") return "337调查";
if (c === "01042") return "232调查";
if (c === "01043") return "301调查";
return c;
};
warningList.value = list.map((x) => ({
signalId: x.id,
signalTitle: x.title,
signalTime: x.eventTime,
signalLevel: x.riskLevel,
signalCountryId: x.riskCountryId,
dealStatus: x.dealStatus,
eventType: getEventTypeFromModule(x.sanModuleCode)
}));
riskTotal.value = warningList.value.length;
// 右侧轮播:同样使用 LatestRisk 的 riskSignals(字段映射到现有模板使用的热点字段名)
hotNewsList.value = list.map((x) => ({
signalId: x.id,
hotspotID: x.id,
hotspotType: getEventTypeFromModule(x.sanModuleCode),
hotspotTitle: x.title,
// 轮播题目右侧标签:切换轮播时用详情接口 domains 覆盖
hotspotTag: "",
hotspotDesc: x.description || "",
hotspotDate: x.eventTime || "",
domainList: [],
eventTitle: x.issuingOrgId || ""
}));
// 首次加载:主动拉取当前轮播项详情以展示题目右侧标签
await fetchCarouselDetailForIndex(curHotNewsListIndex.value || 0);
cardList1.value = warningList.value
.filter(item => {
return item.eventType === "法案" || item.eventType === "行政令";
......@@ -520,11 +566,46 @@ const handleGetLatestRisks = async () => {
const curNews = ref({});
const carouselRef = ref(null);
const curHotNewsListIndex = ref(0);
const carouselDetailCache = ref({});
const applyHotspotTagById = (id, tagText) => {
const sid = String(id ?? "").trim();
if (!sid) return;
hotNewsList.value = (hotNewsList.value || []).map((n) => {
if (String(n.hotspotID ?? "").trim() !== sid) return n;
return { ...n, hotspotTag: tagText };
});
};
const fetchCarouselDetailForIndex = async (index) => {
const item = hotNewsList.value?.[index];
if (!item) return;
const id = String(item.hotspotID ?? "").trim();
if (!id) return;
if (carouselDetailCache.value[id]) {
applyHotspotTagById(id, carouselDetailCache.value[id]);
return;
}
try {
const res = await getRiskSignalInfoById(id);
if (res && res.code === 200 && res.data) {
const tagText = String(res.data.domains ?? "").trim();
if (tagText) {
carouselDetailCache.value = { ...carouselDetailCache.value, [id]: tagText };
applyHotspotTagById(id, tagText);
}
}
} catch (error) {
console.error("轮播风险信号详情获取失败", error);
}
};
const handleCarouselChange = index => {
curHotNewsListIndex.value = index;
if (hotNewsList.value && hotNewsList.value.length > 0) {
curNews.value = hotNewsList.value[index];
}
fetchCarouselDetailForIndex(index);
};
// 查看详情
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论