需求修改1

This commit is contained in:
“zhuzihan”  2025-08-07 12:57:42 +08:00
parent 4c44096f41
commit 535042b67b
4 changed files with 270 additions and 129 deletions

View File

@ -22,24 +22,25 @@
<div class="panel-header">
<h2>科研成果</h2>
<button class="panel-link" @click="redirectToResearchEvaluation">进入评估 >></button>
<button class="panel-link" @click="redirectToResearchEvaluation2">进入管理端 >></button>
</div>
<div class="research-stats">
<div class="stat-card">
<h3>论文</h3>
<h3>论文</h3>
<div class="stat-value"><span class="stat-prefix">累计</span>0</div>
</div>
<div class="stat-card">
<h3>专利数量</h3>
<div class="stat-value"><span class="stat-prefix">本年</span>0</div>
</div>
<div class="stat-card">
<h3>高影响力论文</h3>
<h3>博士论文</h3>
<div class="stat-value"><span class="stat-prefix">累计</span>0</div>
</div>
<div class="stat-card">
<h3>科研项目数量</h3>
<div class="stat-value"><span class="stat-prefix">国家重点</span>0<span></span></div>
<h3>硕士论文</h3>
<div class="stat-value"><span class="stat-prefix">累计</span>0</div>
</div>
<div class="stat-card">
<h3>学士论文</h3>
<div class="stat-value"><span class="stat-prefix">累计</span>0</div>
</div>
</div>
</div>
@ -49,7 +50,7 @@
<h2>学术产出</h2>
<div class="output-content">
<div ref="outputChartRef" class="chart-container-65"></div>
<div class="international-impact">
<!-- <div class="international-impact">
<h3 style="font-size:25px;border-bottom: 5px solid rgb(73,134,255);text-align: left;padding-bottom:5px ">国际影响力</h3>
<div class="journal-stat">
<span class="journal-name">Nature</span>
@ -61,13 +62,13 @@
<span class="journal-count">8</span>
<span class="journal-name2"></span>
</div>
</div>
</div> -->
</div>
</div>
<!-- 研究经费 -->
<div class="dashboard-panel" style="flex: 1 1 0;">
<h2>研究经费: 500万元</h2>
<h2>学术详情</h2>
<div ref="fundingChartRef" class="chart-container-funding"></div>
</div>
</div>
@ -171,6 +172,7 @@ import {
import { CanvasRenderer } from 'echarts/renderers'
import MarkdownIt from 'markdown-it';
const md = new MarkdownIt();
//
const emit = defineEmits(['navigate', 'logout'])
const navigate = (page) => {
@ -183,8 +185,54 @@ const handleLogoClick = () => {
}
//
const redirectToResearchEvaluation = () => {
window.open('http://82.156.236.221:10004/login', '_blank');
const redirectToResearchEvaluation = async () => {
try {
const response = await fetch(`${getApiBaseUrl()}/admin-api/pg/paper/refresh`, {
method: 'get',
credentials: 'include' // cookie
});
const result = await response.json();
if (result.code === 0) {
//
await localStorage.setItem('access_token', result.data.access);
await localStorage.setItem('refresh_token', result.data.refresh);
await localStorage.setItem('user_info', JSON.stringify({
user_id: result.data.user_id,
username: result.data.username,
permission: '2'
}));
window.location.href = 'http://82.156.236.221:10004/user/file'
} else {
console.error('代理登录失败:', result.error);
}
} catch (error) {
console.error('请求失败:', error);
}
};
const redirectToResearchEvaluation2 = async () => {
try {
const response = await fetch(`${getApiBaseUrl()}/admin-api/pg/paper/adminLogin`, {
method: 'get',
credentials: 'include' // cookie
});
const result = await response.json();
if (result.code === 0) {
//
await localStorage.setItem('access_token', result.data.access);
await localStorage.setItem('refresh_token', result.data.refresh);
await localStorage.setItem('user_info', JSON.stringify({
user_id: result.data.user_id,
username: result.data.username,
permission: '1'
}))
return
window.location.href = 'http://82.156.236.221:10004/admin/manage'
} else {
console.error('代理登录失败:', result.error);
}
} catch (error) {
console.error('请求失败:', error);
}
};
// echarts
@ -214,6 +262,7 @@ const assistantPanel = ref(null)
const isResizing = ref(false)
const startY = ref(0)
const startHeight = ref(0)
//
// resize
const startResize = (e) => {
@ -266,8 +315,6 @@ const stopResize = () => {
document.body.style.userSelect = ''
}
//
const researcherData = ref({
datax: [],
@ -275,33 +322,51 @@ const researcherData = ref({
history: [],
ishistory: false
})
//
const studyData = ref({
datax: [],
datay: []
})
//
const teacherServiceData = ref({
datax: [],
datay: []
})
//
const labData = ref({
datax: [], // fieldName
series: [], // ECharts series
years: [] //
datax: [],
series: [],
years: []
})
const labLineData = ref({
datax: [],
datay: []
})
//
const outputData = ref({
months: [],
doctor: [],
master: [],
bachelor: []
})
//
const fundingData = ref({
doctor: 0,
master: 0,
bachelor: 0
})
// DeepSeek
const chatMessagesRef = ref(null)
const userInput = ref('')
const isLoading = ref(false)
const chatMessages = ref([
])
const chatMessages = ref([])
// DeepSeek API
const sendMessage = async () => {
@ -390,11 +455,12 @@ const scrollToBottom = () => {
}
});
};
//
const fundingLegendStatus = ref([true, true, true])
//
const outputLegendStatus = ref([true, true])
const outputLegendStatus = ref([true, true, true])
//
const toggleFundingLegend = (index) => {
@ -416,9 +482,9 @@ const updateFundingChart = () => {
fundingChart.setOption({
legend: {
selected: {
'政府 50%': fundingLegendStatus.value[0],
'企业 25%': fundingLegendStatus.value[1],
'其他 25%': fundingLegendStatus.value[2]
'博士': fundingLegendStatus.value[0],
'硕士': fundingLegendStatus.value[1],
'学士': fundingLegendStatus.value[2]
}
}
})
@ -432,8 +498,9 @@ const updateOutputChart = () => {
outputChart.setOption({
legend: {
selected: {
'论文总数': outputLegendStatus.value[0],
'专利总数': outputLegendStatus.value[1]
'博士': outputLegendStatus.value[0],
'硕士': outputLegendStatus.value[1],
'学士': outputLegendStatus.value[1]
}
}
})
@ -451,12 +518,10 @@ import { getApiBaseUrl } from '../config';
const fetchDashboardData = async () => {
try {
const response = await fetch(`${getApiBaseUrl()}/admin-api/pg/J-dashboard/dashboard`);
if (response.ok) {
const data = await response.json();
console.log("仪表盘数据:", data);
dashboardData.value = data.data;
// UI
if (data) {
updateChartsWithDashboardData();
}
@ -469,14 +534,15 @@ const fetchDashboardData = async () => {
loading.value = false;
}
};
const fetchDashboardData2 = async () => {
try {
const response = await fetch(`${getApiBaseUrl()}/admin-api/pg/intelligent-assistant/get-release`);
const data = await response.json();
dashboardData2.value = data.data;
if (data) {
updateChartsWithDashboardData();
}
if (data) {
updateChartsWithDashboardData();
}
} catch (error) {
console.error('获取仪表盘数据出错:', error);
} finally {
@ -552,6 +618,7 @@ const updateStudyChart = () => {
});
}
}
const updateResearcherChart = () => {
const researcherChart = echarts.getInstanceByDom(researcherChartRef.value);
if (researcherChart) {
@ -659,6 +726,59 @@ const initEngineeringKeyFields = (data) => {
console.log("Processed labData.value:", labData.value);
};
const fetchPaperData = async () => {
try {
const res = await fetch('http://82.156.236.221:10005/api/v1/review/show/details/');
if (res.ok) {
const data = await res.json();
if (data.code === 200) {
//
const paperCountEl = document.querySelector('.stat-card:nth-child(1) .stat-value');
const paperCountEl2 = document.querySelector('.stat-card:nth-child(2) .stat-value');
const paperCountEl3 = document.querySelector('.stat-card:nth-child(3) .stat-value');
const paperCountEl4 = document.querySelector('.stat-card:nth-child(4) .stat-value');
if (paperCountEl) {
paperCountEl.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">累计</span>${data.data.total.sum || 0}`;
paperCountEl2.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">累计</span>${data.data.total.doctor || 0}`;
paperCountEl3.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">累计</span>${data.data.total.master || 0}`;
paperCountEl4.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">累计</span>${data.data.total.bachelor || 0}`;
}
// 6
const currentDate = new Date();
const monthNames = [];
for (let i = 5; i >= 0; i--) {
const date = new Date(currentDate.getFullYear(), currentDate.getMonth() - i, 1);
monthNames.push(`${date.getMonth() + 1}`);
}
//
outputData.value = {
months: monthNames,
doctor: data.data.time.map(item => item[0]).reverse(), // reverse()
master: data.data.time.map(item => item[1]).reverse(), // reverse()
bachelor: data.data.time.map(item => item[2]).reverse() // reverse()
};
updateOutputChart();
//
fundingData.value = {
doctor: data.data.total.doctor,
master: data.data.total.master,
bachelor: data.data.total.bachelor
};
updateFundingChart();
}
} else {
console.error('获取论文数据失败:', res.statusText);
}
} catch (error) {
console.error('获取论文数据出错:', error);
} finally {
loading.value = false;
}
};
const fetchLabData = async () => {
try {
const res = await fetch(`${getApiBaseUrl()}/admin-api/pg/research-data-dashboard/get-release`);
@ -732,6 +852,7 @@ const updateLabBarChart = () => {
}, true);
}
}
const updateLabLineChart = () => {
const labLineChart = echarts.getInstanceByDom(labLineChartRef.value);
if (labLineChart) {
@ -747,16 +868,16 @@ const updateLabLineChart = () => {
});
}
};
// 使
const updateChartsWithDashboardData = () => {
if (!dashboardData.value) return;
if (!dashboardData2.value) return;
};
//
const initCharts = () => {
// -
//
const researcherChart = echarts.init(researcherChartRef.value)
researcherChart.setOption({
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
@ -963,26 +1084,27 @@ const initCharts = () => {
]
})
// -
// - 使API
const outputChart = echarts.init(outputChartRef.value)
outputChart.setOption({
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: {
data: ['论文总数', '专利总数'],
data: ['博士', '硕士', '学士'],
textStyle: { color: '#fff' },
selected: {
'论文总数': outputLegendStatus.value[0],
'专利总数': outputLegendStatus.value[1]
'博士': outputLegendStatus.value[0],
'硕士': outputLegendStatus.value[1],
'学士': outputLegendStatus.value[1],
}
},
grid: { left: '3%', right: '12%', bottom: '3%', containLabel: true },
yAxis: { // xAxis yAxis
yAxis: {
type: 'category',
data: ['1月', '2月', '3月', '4月', '5月'],
data: outputData.value.months,
axisLine: { lineStyle: { color: '#fff' } },
axisLabel: { color: '#fff' }
},
xAxis: { // xAxis yAxis
xAxis: {
type: 'value',
axisLine: { lineStyle: { color: '#fff' } },
axisLabel: { color: '#fff' },
@ -996,9 +1118,9 @@ const initCharts = () => {
},
series: [
{
name: '论文总数',
name: '博士',
type: 'bar',
data: [140, 160, 180, 190, 210],
data: outputData.value.doctor,
itemStyle: { color: '#4080ff' },
barWidth: '20%',
barGap: '20%',
@ -1010,9 +1132,9 @@ const initCharts = () => {
}
},
{
name: '专利总数',
name: '硕士',
type: 'bar',
data: [100, 110, 120, 130, 150],
data: outputData.value.master,
itemStyle: { color: 'rgb(107,187,196)' },
barWidth: '20%',
barGap: '20%',
@ -1022,6 +1144,20 @@ const initCharts = () => {
color: '#fff',
formatter: '{c}'
}
},
{
name: '学士',
type: 'bar',
data: outputData.value.bachelor,
itemStyle: { color: 'rgb(107,187,19)' },
barWidth: '20%',
barGap: '20%',
label: {
show: true,
position: 'right',
color: '#fff',
formatter: '{c}'
}
}
]
})
@ -1044,29 +1180,29 @@ const initCharts = () => {
{
value: studyData.value.datay,
name: '奖项分布',
areaStyle: { opacity: 0 }, //
areaStyle: { opacity: 0 },
lineStyle: { color: '#ffd700', width: 2 },
itemStyle: { color: '#ffd700' }
}
],
label: {
show: true, //
position: 'top', //
color: '#fff', //
fontSize: 10 //
show: true,
position: 'top',
color: '#fff',
fontSize: 10
},
emphasis: {
label: {
show: true, //
fontSize: 12, //
fontWeight: 'bold' //
show: true,
fontSize: 12,
fontWeight: 'bold'
}
}
}
]
})
// -
// - 使API
const fundingChart = echarts.init(fundingChartRef.value)
fundingChart.setOption({
tooltip: { trigger: 'item' },
@ -1075,26 +1211,25 @@ const initCharts = () => {
left: '5%',
top: 'center',
textStyle: { color: '#fff' },
data: ['政府 50%', '企业 25%', '其他 25%'],
data: ['博士', '硕士', '学士'],
selected: {
'政府 50%': fundingLegendStatus.value[0],
'企业 25%': fundingLegendStatus.value[1],
'其他 25%': fundingLegendStatus.value[2]
'博士': fundingLegendStatus.value[0],
'硕士': fundingLegendStatus.value[1],
'学士': fundingLegendStatus.value[2]
}
},
series: [
{
type: 'pie',
radius: ['30%', '70%'],
center: ['60%', '50%'], //
center: ['60%', '50%'],
roseType: 'area',
label: {
show: true,
formatter: '{b}',
formatter: '{b}: {d}%',
position: 'outside',
color: '#fff',
alignTo: 'labelLine',
distanceToLabelLine: 5
distanceToLabelLine: 1
},
labelLine: {
show: true,
@ -1112,9 +1247,21 @@ const initCharts = () => {
}
},
data: [
{ value: 50, name: '政府 50%', itemStyle: { color: '#9966ff' } },
{ value: 25, name: '企业 25%', itemStyle: { color: '#ff9933' } },
{ value: 25, name: '其他 25%', itemStyle: { color: '#3399ff' } }
{
value: fundingData.value.doctor,
name: '博士',
itemStyle: { color: '#9966ff' }
},
{
value: fundingData.value.master,
name: '硕士',
itemStyle: { color: '#ff9933' }
},
{
value: fundingData.value.bachelor,
name: '学士',
itemStyle: { color: '#3399ff' }
}
]
}
]
@ -1134,10 +1281,12 @@ const initCharts = () => {
// -
onMounted(async() => {
//
await fetchPaperData();
//
await fetchTeacherbData1();
await fetchTeacherbData2();
await fetchTeacherbData3(); //
await fetchTeacherbData3();
//
await fetchLabData();
await fetchLabData2();
@ -1157,63 +1306,22 @@ watch(dashboardData, () => {
updateChartsWithData();
}
}, { deep: true });
//
const updateChartsWithData = () => {
if (!dashboardData.value) return;
//
const paperCountEl = document.querySelector('.stat-card:nth-child(1) .stat-value');
const patentCountEl = document.querySelector('.stat-card:nth-child(2) .stat-value');
const highImpactPapersEl = document.querySelector('.stat-card:nth-child(3) .stat-value');
const keyProjectsEl = document.querySelector('.stat-card:nth-child(4) .stat-value');
if (paperCountEl) {
paperCountEl.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">累计</span>${dashboardData.value.paperCount || 0}`;
}
//
const updateChartsWithData = () => {
if (!dashboardData.value) return;
//
const patentCountEl = document.querySelector('.stat-card:nth-child(2) .stat-value');
const highImpactPapersEl = document.querySelector('.stat-card:nth-child(3) .stat-value');
const keyProjectsEl = document.querySelector('.stat-card:nth-child(4) .stat-value');
};
if (patentCountEl) {
patentCountEl.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">本年</span>${dashboardData.value.patentCount || 0}`;
}
if (highImpactPapersEl) {
highImpactPapersEl.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">累计</span>${dashboardData.value.highImpactPapers || 0}`;
}
if (keyProjectsEl) {
keyProjectsEl.innerHTML = `<span class="stat-prefix" style="font-size: 12px;">国家重点</span>${dashboardData.value.keyProjects || 0}<span>项</span>`;
}
//
const fundingTitle = document.querySelector('.dashboard-panel:nth-child(3) h2');
if (fundingTitle && dashboardData.value.fundingAmount) {
fundingTitle.textContent = `研究经费: ${dashboardData.value.fundingAmount}`;
}
};
// newsDataref使
const newsData = ref([]);
//
let scrollInterval
const startNewsScroll = () => {
if (!newsListRef.value) return
scrollInterval = setInterval(() => {
if (newsListRef.value.scrollTop + newsListRef.value.clientHeight >= newsListRef.value.scrollHeight) {
//
newsListRef.value.scrollTop = 0
} else {
//
newsListRef.value.scrollTop += 1
}
}, 50)
}
// newsDataref使
const newsData = ref([]);
//
onUnmounted(() => {
// resize
window.removeEventListener('resize', () => {
//
});
window.removeEventListener('resize', () => {});
})
</script>
@ -1358,7 +1466,7 @@ onUnmounted(() => {
}
.chart-container-65 {
width: 65%;
width: 100%;
height: 100%;
}

View File

@ -145,7 +145,7 @@
<el-dialog
v-model="scoreComparisonDialogVisible"
title="得分比较"
width="70%"
width="80%"
center
:append-to-body="true"
class="score-comparison-dialog"
@ -158,7 +158,7 @@
class="default-table score-comparison-table"
:row-class-name="tableRowClassName"
>
<el-table-column prop="category" label="" width="180"></el-table-column>
<el-table-column prop="category" label=""></el-table-column>
<el-table-column
v-for="(header) in scoreComparisonHeaders"
:key="header.prop"
@ -175,6 +175,19 @@
</span>
</template>
</el-table-column>
<el-table-column
prop="totalScore"
label="总分"
align="center">
<template #default="{ row }">
<span :class="{
'max-score-in-column': Number(row.totalScore) === columnStats.totalScore?.max,
'min-score-in-column': Number(row.totalScore) === columnStats.totalScore?.min
}">
{{ row.totalScore }}
</span>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
@ -514,12 +527,23 @@ const scoreComparisonTableData = computed(() => {
return selectedLabs.value.map(lab => {
const row = {
category: `${lab.basicInformation.name0}-${lab.basicInformation.name2}` // -
category: `${lab.basicInformation.name0}-${lab.basicInformation.name4}-${lab.basicInformation.name2}`
};
// radarData row
lab.result.forEach((score, index) => {
row[`score${index + 1}`] = score;
});
if (Array.isArray(lab.result)) {
let total = 0;
lab.result.forEach((score, index) => {
const numericScore = Number(score) || 0;
row[`score${index + 1}`] = numericScore;
total += numericScore;
});
// 使Math.round()
row.totalScore = Math.round(total);
} else {
row.totalScore = 0; // 0
}
return row;
});
});
@ -542,6 +566,14 @@ const columnStats = computed(() => {
};
}
});
//
const totalScores = scoreComparisonTableData.value.map(row => Number(row.totalScore));
if (totalScores.length > 0) {
stats.totalScore = {
max: Math.max(...totalScores),
min: Math.min(...totalScores)
};
}
// console.log("Calculated columnStats:", stats); //
return stats;
});

View File

@ -66,7 +66,8 @@
<div class="category-content">
<div v-for="(item, itemIndex) in categoryItem.result" :key="itemIndex" class="category-item">
<span class="item-label">{{ item.label }}:</span>
<span class="item-score">{{ labData.assessmentScore[item.prop] || '0' }}</span>
<span class="item-score">{{ labData.assessmentScore[item.prop] || '0' }} / {{ labData.maximum[item.prop] || '0' }}</span>
</div>
</div>
</div>

View File

@ -3,7 +3,7 @@ const env = import.meta.env.MODE || 'development';
const config = {
development: {
apiBaseUrl: 'http://192.168.18.9:48080',
apiBaseUrl: 'http://192.168.5.49:48080',
},
production: {
apiBaseUrl: 'http://36.103.203.89:48089',