refactor: 移除高优先级投标功能及相关代码

This commit is contained in:
dmy
2026-01-13 20:42:34 +08:00
parent 6825885005
commit 4f4355c1cd
7 changed files with 3 additions and 133 deletions

View File

@@ -44,8 +44,8 @@
</el-header>
<el-main>
<DashboardAI v-if="activeIndex === '1'" :bids="bids" :high-priority-bids="highPriorityBids" />
<Dashboard v-if="activeIndex === '2'" :today-bids="todayBids" :high-priority-bids="highPriorityBids"
<DashboardAI v-if="activeIndex === '1'" :bids="bids" />
<Dashboard v-if="activeIndex === '2'" :today-bids="todayBids"
:keywords="keywords" :loading="loading" :is-crawling="isCrawling" @refresh="fetchData"
@update-bids="updateBidsByDateRange" />
@@ -76,7 +76,6 @@ import CrawlInfo from './components/CrawlInfo.vue'
const activeIndex = ref('1')
const bids = ref<any[]>([])
const todayBids = ref<any[]>([])
const highPriorityBids = ref<any[]>([])
const keywords = ref<any[]>([])
const loading = ref(false)
const isCrawling = ref(false)
@@ -109,7 +108,7 @@ const handleFetchBids = async (page: number, limit: number, source?: string) =>
const fetchData = async () => {
loading.value = true
try {
const [bidsRes, recentRes, highRes, kwRes, sourcesRes, statusRes] = await Promise.all([
const [bidsRes, recentRes, kwRes, sourcesRes, statusRes] = await Promise.all([
axios.get('/api/bids', {
params: {
page: 1,
@@ -117,7 +116,6 @@ const fetchData = async () => {
}
}),
axios.get('/api/bids/recent'),
axios.get('/api/bids/high-priority'),
axios.get('/api/keywords'),
axios.get('/api/bids/sources'),
axios.get('/api/crawler/status')
@@ -125,7 +123,6 @@ const fetchData = async () => {
bids.value = bidsRes.data.items
total.value = bidsRes.data.total
todayBids.value = recentRes.data
highPriorityBids.value = highRes.data
keywords.value = kwRes.data
sourceOptions.value = sourcesRes.data
isCrawling.value = statusRes.data.isCrawling

View File

@@ -7,39 +7,6 @@
获取 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>
<el-row :gutter="20">
<el-col :span="24">
<el-card class="box-card" shadow="hover">
@@ -160,7 +127,6 @@ interface AIRecommendation {
interface Props {
bids: any[]
highPriorityBids: any[]
}
const props = defineProps<Props>()
@@ -171,7 +137,6 @@ 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 = () => {
@@ -190,18 +155,6 @@ 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 {

View File

@@ -7,38 +7,6 @@
立刻抓取
</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>
<el-divider />
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
<h3 style="margin: 0;">Today's Bids</h3>
@@ -100,7 +68,6 @@ import { Refresh, ArrowDown } from '@element-plus/icons-vue'
interface Props {
todayBids: any[]
highPriorityBids: any[]
keywords: any[]
loading: boolean
isCrawling: boolean
@@ -118,7 +85,6 @@ const selectedKeywords = ref<string[]>([])
const dateRange = ref<[string, string] | null>(null)
const crawling = ref(false)
const updating = ref(false)
const highPriorityCollapsed = ref(false)
const isInitialized = ref(false)
const isManualClick = ref(false)
@@ -139,18 +105,6 @@ watch(dateRange, (newDateRange) => {
localStorage.setItem('dashboard_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 })
// 从 localStorage 加载保存的关键字
const loadSavedKeywords = () => {
const saved = localStorage.getItem('selectedKeywords')

View File

@@ -15,11 +15,6 @@ export class BidsController {
return this.bidsService.getRecentBids();
}
@Get('high-priority')
getHighPriority() {
return this.bidsService.getHighPriorityCorrected();
}
@Get('sources')
getSources() {
return this.bidsService.getSources();

View File

@@ -17,15 +17,6 @@ export class BidItem {
@Column()
source: string;
@Column({ default: false })
isRead: boolean;
@Column({ default: 0 })
priority: number;
@Column({ nullable: true })
unit: string;
@CreateDateColumn()
createdAt: Date;

View File

@@ -33,24 +33,6 @@ export class BidsService {
return { items, total };
}
getHighPriority() {
return this.bidRepository.find({
where: { priority: LessThan(0) }, // This is just a placeholder logic, priority should be > 0
order: { priority: 'DESC', publishDate: 'DESC' },
take: 10,
});
}
// Update logic for priority
async getHighPriorityCorrected() {
return this.bidRepository.createQueryBuilder('bid')
.where('bid.priority > 0')
.orderBy('bid.priority', 'DESC')
.addOrderBy('bid.publishDate', 'DESC')
.limit(10)
.getMany();
}
async createOrUpdate(data: Partial<BidItem>) {
// Use title or a hash of title to check for duplicates
let item = await this.bidRepository.findOne({ where: { title: data.title } });

View File

@@ -112,7 +112,6 @@ export class BidCrawlerService {
url: item.url,
publishDate: item.publishDate,
source: crawler.name,
unit: '',
});
}
@@ -164,7 +163,6 @@ export class BidCrawlerService {
url: item.url,
publishDate: item.publishDate,
source: crawler.name,
unit: '',
});
}