feat: 在AI仪表板中添加高优先级投标展示

This commit is contained in:
dmy
2026-01-13 16:34:32 +08:00
parent 5024d2c502
commit 7f36e014e6
3 changed files with 51 additions and 4 deletions

View File

@@ -53,6 +53,7 @@
<DashboardAI
v-if="activeIndex === '2'"
:bids="bids"
:high-priority-bids="highPriorityBids"
/>
<Bids

View File

@@ -7,6 +7,38 @@
获取 AI 推荐
</el-button>
</div>
<el-row :gutter="20">
<el-col :span="24">
<el-card class="box-card" shadow="hover">
<template #header>
<div class="card-header" @click="toggleHighPriority" style="cursor: pointer;">
<span>High Priority Bids</span>
<div style="display: flex; align-items: center; gap: 10px;">
<el-tag type="danger">Top 10</el-tag>
<el-icon :style="{ transform: highPriorityCollapsed ? 'rotate(-90deg)' : 'rotate(0deg)', transition: 'transform 0.3s' }">
<ArrowDown />
</el-icon>
</div>
</div>
</template>
<el-collapse-transition>
<div v-show="!highPriorityCollapsed">
<el-table :data="highPriorityBids" style="width: 100%" size="small">
<el-table-column prop="title" label="Title">
<template #default="scope">
<a :href="scope.row.url" target="_blank">{{ scope.row.title }}</a>
</template>
</el-table-column>
<el-table-column prop="source" label="Source" width="240" />
<el-table-column prop="publishDate" label="Date" width="120">
<template #default="scope">{{ formatDate(scope.row.publishDate) }}</template>
</el-table-column>
</el-table>
</div>
</el-collapse-transition>
</el-card>
</el-col>
</el-row>
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
<h3 style="margin: 0;">选择日期范围</h3>
<div style="display: flex; gap: 10px;">
@@ -114,7 +146,7 @@
import { ref, watch } from 'vue'
import axios from 'axios'
import { ElMessage } from 'element-plus'
import { MagicStick, Loading, InfoFilled, List } from '@element-plus/icons-vue'
import { MagicStick, Loading, InfoFilled, List, ArrowDown } from '@element-plus/icons-vue'
interface AIRecommendation {
@@ -127,6 +159,7 @@ interface AIRecommendation {
interface Props {
bids: any[]
highPriorityBids: any[]
}
const props = defineProps<Props>()
@@ -137,6 +170,7 @@ const dateRange = ref<[string, string] | null>(null)
const showAllBids = ref(false)
const bidsLoading = ref(false)
const bidsByDateRange = ref<any[]>([])
const highPriorityCollapsed = ref(false)
// 从 localStorage 加载保存的日期范围
const loadSavedDateRange = () => {
@@ -155,6 +189,18 @@ watch(dateRange, (newDateRange) => {
localStorage.setItem('dashboardAI_dateRange', JSON.stringify(newDateRange))
}, { deep: true })
// 切换 High Priority Bids 的折叠状态
const toggleHighPriority = () => {
highPriorityCollapsed.value = !highPriorityCollapsed.value
}
// 监听 highPriorityBids当没有数据时自动折叠
watch(() => props.highPriorityBids, (newBids) => {
if (newBids.length === 0) {
highPriorityCollapsed.value = true
}
}, { immediate: true })
// 从数据库加载最新的 AI 推荐
const loadLatestRecommendations = async () => {
try {