提交 fcaf505e authored 作者: 朱政's avatar 朱政

feat:智库和风险列表加入加载状态,同时修改智库数量变化趋势图表调用

上级 2a5ddbf3
流水线 #448 已通过 于阶段
in 1 分 44 秒
......@@ -113,7 +113,7 @@ service.interceptors.response.use(
}
// 特殊处理:风险信号管理页面接口偶发 500,不弹出提示
// 覆盖接口:/api/riskSignal/getCountInfo | /api/riskSignal/getDailyCount | /api/riskSignal/pageQuery
// 覆盖接口:/api/riskSignal/baseInfo | /api/riskSignal/pageQuery
try {
const errUrl = String(error?.config?.url || '')
if (error?.response?.status === 500 && errUrl.includes('/api/riskSignal/')) {
......
import request from "@/api/request.js";
// 基本统计信息
export function getCountInfo() {
return request({
method: 'GET',
url: `/api/riskSignal/getCountInfo`,
})
}
// 每日统计信息
export function getDailyCount() {
return request({
method: 'GET',
url: `/api/riskSignal/getDailyCount`,
})
/** 风险信号管理页:统计 + 日历热力数据(原 getCountInfo + getDailyCount) */
export function getRiskSignalBaseInfo() {
return request({
method: "GET",
url: `/api/riskSignal/baseInfo`
});
}
// 按条件分页查询风险信号信息
export function getPageQuery(data) {
return request({
method: 'POST',
url: `/api/riskSignal/pageQuery`,
url: `/api/riskSignal/PageLimit`,
data: data
})
}
......@@ -53,6 +53,25 @@ export function getThinkTankPolicyIndustryChange(params) {
});
}
/**
* 智库概览-数量变化趋势(按领域统计)
* GET /thinkTankReport/domainStats
* @param {{ startDate: string, endDate: string }} params
*/
export function getThinkTankReportDomainStats(params) {
return request({
method: "GET",
url: `/api/thinkTankReport/domainStats`,
params: {
startDate: params.startDate,
endDate: params.endDate
},
// 与 policyIndustryChange 一致:无数据年份可能返回 400/500,避免走全局错误提示
validateStatus: (status) =>
(status >= 200 && status < 300) || status === 400 || status === 500
});
}
// 政策建议领域分布
export function getThinkTankPolicyIndustry(params) {
return request({
......
......@@ -21,7 +21,7 @@
<span class="tag-text"> {{ tag }} ({{ tagCountMap[tag] || 0 }} 项)</span>
</span>
</div>
<div class="item-box">
<div class="item-box" v-loading="loading">
<div class="item" v-for="(item, index) in filteredOpinions" :key="item.id || index"
:class="{ 'item-active': index === activeItemIndex }" @click="
() => {
......@@ -138,6 +138,7 @@ import {
import { useRouter } from "vue-router";
import DefaultNewsImg from '@/assets/images/default-icon-news.png'
const router = useRouter();
const loading = ref(false);
const searchOpinions = ref("");
// 政策建议相关情况(当前页/当前筛选展示的数据)
const box1Data = ref([]);
......@@ -277,6 +278,7 @@ const updateTagsFromAllData = () => {
const handleGetThinkTankReportPolicyAction = async () => {
try {
loading.value = true;
const params = {
reportId: router.currentRoute._value.params.id,
// 这里请求全量数据,前端自行分页
......@@ -312,6 +314,8 @@ const handleGetThinkTankReportPolicyAction = async () => {
box1Data.value = [];
allTags.value = [];
tagCountMap.value = {};
} finally {
loading.value = false;
}
};
// 按当前标签与页码从全量数据中截取一页
......@@ -765,6 +769,7 @@ onMounted(async () => {
width: 20px;
height: 20px;
margin-left: auto;
cursor: pointer;
img {
width: 100%;
......@@ -815,6 +820,7 @@ onMounted(async () => {
width: 20px;
height: 20px;
margin-left: auto;
cursor: pointer;
img {
width: 100%;
......
......@@ -1284,6 +1284,7 @@ onMounted(() => {
height: 24px;
margin-top: 12px;
margin-left: 18px;
cursor: pointer;
}
......
......@@ -226,7 +226,7 @@
</div>
</div>
</div>
<div class="right">
<div class="right" v-loading="loading">
<div class="right-main">
<div class="right-main-item" v-for="item in policyList" :key="item.id">
<div class="item-left">
......@@ -308,6 +308,8 @@ import { useRouter } from "vue-router";
const router = useRouter();
const loading = ref(false);
/** 与 AreaTag 一致的领域色(取 tag 的文字色) */
const AREA_TAG_COLOR_BY_NAME = {
"人工智能": "rgba(245, 34, 45, 1)", // tag1
......@@ -1247,6 +1249,7 @@ const handleCurrentChange = page => {
const handleGetThinkPolicy = async () => {
try {
loading.value = true;
const thinkTankId = router.currentRoute._value.params.id;
const domainIds = selectedAreaList.value
.filter((id) => id != null && id !== "" && id !== POLICY_FILTER_ALL_AREA)
......@@ -1292,6 +1295,8 @@ const handleGetThinkPolicy = async () => {
console.error("获取智库政策error", error);
policyList.value = [];
total.value = 0;
} finally {
loading.value = false;
}
};
......
......@@ -456,7 +456,7 @@ import ThinkTankPolicyAdviceOverview from "./components/ThinkTankPolicyAdviceOve
import {
getThinkTankList,
getThinkTankRiskSignal,
getThinkTankPolicyIndustryChange,
getThinkTankReportDomainStats,
getThinkTankPolicyIndustry,
getThinkTankDonation,
getAllThinkTankList,
......@@ -1003,10 +1003,25 @@ const changeBox5Data = year => {
// 政策建议趋势分布
const handleGetThinkTankPolicyIndustryChange = async range => {
try {
const res = await getThinkTankPolicyIndustryChange(range);
console.log("政策建议趋势分布", res);
const res = await getThinkTankReportDomainStats(range);
console.log("智库报告数量变化趋势(domainStats)", res);
if (res.code === 200 && res.data) {
const originalData = res.data;
const rawList = Array.isArray(res.data) ? res.data : [];
// domainStats:季度维度 + areaList;旧逻辑使用 industryList,这里做字段归一(不改图表样式/结构)
const originalData = rawList
.map((item) => {
const industryList = Array.isArray(item?.industryList)
? item.industryList
: Array.isArray(item?.areaList)
? item.areaList
: [];
return {
...item,
year: item?.year,
industryList
};
})
.filter((item) => Array.isArray(item.industryList) && item.industryList.length > 0);
// 提取年份
const years = originalData.map(item => item.year);
// 提取所有行业名称
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论