refactor: 移除高优先级投标功能及相关代码
This commit is contained in:
@@ -44,8 +44,8 @@
|
|||||||
</el-header>
|
</el-header>
|
||||||
|
|
||||||
<el-main>
|
<el-main>
|
||||||
<DashboardAI v-if="activeIndex === '1'" :bids="bids" :high-priority-bids="highPriorityBids" />
|
<DashboardAI v-if="activeIndex === '1'" :bids="bids" />
|
||||||
<Dashboard v-if="activeIndex === '2'" :today-bids="todayBids" :high-priority-bids="highPriorityBids"
|
<Dashboard v-if="activeIndex === '2'" :today-bids="todayBids"
|
||||||
:keywords="keywords" :loading="loading" :is-crawling="isCrawling" @refresh="fetchData"
|
:keywords="keywords" :loading="loading" :is-crawling="isCrawling" @refresh="fetchData"
|
||||||
@update-bids="updateBidsByDateRange" />
|
@update-bids="updateBidsByDateRange" />
|
||||||
|
|
||||||
@@ -76,7 +76,6 @@ import CrawlInfo from './components/CrawlInfo.vue'
|
|||||||
const activeIndex = ref('1')
|
const activeIndex = ref('1')
|
||||||
const bids = ref<any[]>([])
|
const bids = ref<any[]>([])
|
||||||
const todayBids = ref<any[]>([])
|
const todayBids = ref<any[]>([])
|
||||||
const highPriorityBids = ref<any[]>([])
|
|
||||||
const keywords = ref<any[]>([])
|
const keywords = ref<any[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const isCrawling = ref(false)
|
const isCrawling = ref(false)
|
||||||
@@ -109,7 +108,7 @@ const handleFetchBids = async (page: number, limit: number, source?: string) =>
|
|||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const [bidsRes, recentRes, highRes, kwRes, sourcesRes, statusRes] = await Promise.all([
|
const [bidsRes, recentRes, kwRes, sourcesRes, statusRes] = await Promise.all([
|
||||||
axios.get('/api/bids', {
|
axios.get('/api/bids', {
|
||||||
params: {
|
params: {
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -117,7 +116,6 @@ const fetchData = async () => {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
axios.get('/api/bids/recent'),
|
axios.get('/api/bids/recent'),
|
||||||
axios.get('/api/bids/high-priority'),
|
|
||||||
axios.get('/api/keywords'),
|
axios.get('/api/keywords'),
|
||||||
axios.get('/api/bids/sources'),
|
axios.get('/api/bids/sources'),
|
||||||
axios.get('/api/crawler/status')
|
axios.get('/api/crawler/status')
|
||||||
@@ -125,7 +123,6 @@ const fetchData = async () => {
|
|||||||
bids.value = bidsRes.data.items
|
bids.value = bidsRes.data.items
|
||||||
total.value = bidsRes.data.total
|
total.value = bidsRes.data.total
|
||||||
todayBids.value = recentRes.data
|
todayBids.value = recentRes.data
|
||||||
highPriorityBids.value = highRes.data
|
|
||||||
keywords.value = kwRes.data
|
keywords.value = kwRes.data
|
||||||
sourceOptions.value = sourcesRes.data
|
sourceOptions.value = sourcesRes.data
|
||||||
isCrawling.value = statusRes.data.isCrawling
|
isCrawling.value = statusRes.data.isCrawling
|
||||||
|
|||||||
@@ -7,39 +7,6 @@
|
|||||||
获取 AI 推荐
|
获取 AI 推荐
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</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-row :gutter="20">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-card class="box-card" shadow="hover">
|
<el-card class="box-card" shadow="hover">
|
||||||
@@ -160,7 +127,6 @@ interface AIRecommendation {
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
bids: any[]
|
bids: any[]
|
||||||
highPriorityBids: any[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
@@ -171,7 +137,6 @@ const dateRange = ref<[string, string] | null>(null)
|
|||||||
const showAllBids = ref(false)
|
const showAllBids = ref(false)
|
||||||
const bidsLoading = ref(false)
|
const bidsLoading = ref(false)
|
||||||
const bidsByDateRange = ref<any[]>([])
|
const bidsByDateRange = ref<any[]>([])
|
||||||
const highPriorityCollapsed = ref(false)
|
|
||||||
|
|
||||||
// 从 localStorage 加载保存的日期范围
|
// 从 localStorage 加载保存的日期范围
|
||||||
const loadSavedDateRange = () => {
|
const loadSavedDateRange = () => {
|
||||||
@@ -190,18 +155,6 @@ watch(dateRange, (newDateRange) => {
|
|||||||
localStorage.setItem('dashboardAI_dateRange', JSON.stringify(newDateRange))
|
localStorage.setItem('dashboardAI_dateRange', JSON.stringify(newDateRange))
|
||||||
}, { deep: true })
|
}, { 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 推荐
|
// 从数据库加载最新的 AI 推荐
|
||||||
const loadLatestRecommendations = async () => {
|
const loadLatestRecommendations = async () => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -7,38 +7,6 @@
|
|||||||
立刻抓取
|
立刻抓取
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</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 />
|
<el-divider />
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
|
||||||
<h3 style="margin: 0;">Today's Bids</h3>
|
<h3 style="margin: 0;">Today's Bids</h3>
|
||||||
@@ -100,7 +68,6 @@ import { Refresh, ArrowDown } from '@element-plus/icons-vue'
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
todayBids: any[]
|
todayBids: any[]
|
||||||
highPriorityBids: any[]
|
|
||||||
keywords: any[]
|
keywords: any[]
|
||||||
loading: boolean
|
loading: boolean
|
||||||
isCrawling: boolean
|
isCrawling: boolean
|
||||||
@@ -118,7 +85,6 @@ const selectedKeywords = ref<string[]>([])
|
|||||||
const dateRange = ref<[string, string] | null>(null)
|
const dateRange = ref<[string, string] | null>(null)
|
||||||
const crawling = ref(false)
|
const crawling = ref(false)
|
||||||
const updating = ref(false)
|
const updating = ref(false)
|
||||||
const highPriorityCollapsed = ref(false)
|
|
||||||
const isInitialized = ref(false)
|
const isInitialized = ref(false)
|
||||||
const isManualClick = ref(false)
|
const isManualClick = ref(false)
|
||||||
|
|
||||||
@@ -139,18 +105,6 @@ watch(dateRange, (newDateRange) => {
|
|||||||
localStorage.setItem('dashboard_dateRange', JSON.stringify(newDateRange))
|
localStorage.setItem('dashboard_dateRange', JSON.stringify(newDateRange))
|
||||||
}, { deep: true })
|
}, { 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 加载保存的关键字
|
// 从 localStorage 加载保存的关键字
|
||||||
const loadSavedKeywords = () => {
|
const loadSavedKeywords = () => {
|
||||||
const saved = localStorage.getItem('selectedKeywords')
|
const saved = localStorage.getItem('selectedKeywords')
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ export class BidsController {
|
|||||||
return this.bidsService.getRecentBids();
|
return this.bidsService.getRecentBids();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('high-priority')
|
|
||||||
getHighPriority() {
|
|
||||||
return this.bidsService.getHighPriorityCorrected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get('sources')
|
@Get('sources')
|
||||||
getSources() {
|
getSources() {
|
||||||
return this.bidsService.getSources();
|
return this.bidsService.getSources();
|
||||||
|
|||||||
@@ -17,15 +17,6 @@ export class BidItem {
|
|||||||
@Column()
|
@Column()
|
||||||
source: string;
|
source: string;
|
||||||
|
|
||||||
@Column({ default: false })
|
|
||||||
isRead: boolean;
|
|
||||||
|
|
||||||
@Column({ default: 0 })
|
|
||||||
priority: number;
|
|
||||||
|
|
||||||
@Column({ nullable: true })
|
|
||||||
unit: string;
|
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|
||||||
|
|||||||
@@ -33,24 +33,6 @@ export class BidsService {
|
|||||||
return { items, total };
|
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>) {
|
async createOrUpdate(data: Partial<BidItem>) {
|
||||||
// Use title or a hash of title to check for duplicates
|
// Use title or a hash of title to check for duplicates
|
||||||
let item = await this.bidRepository.findOne({ where: { title: data.title } });
|
let item = await this.bidRepository.findOne({ where: { title: data.title } });
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ export class BidCrawlerService {
|
|||||||
url: item.url,
|
url: item.url,
|
||||||
publishDate: item.publishDate,
|
publishDate: item.publishDate,
|
||||||
source: crawler.name,
|
source: crawler.name,
|
||||||
unit: '',
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +163,6 @@ export class BidCrawlerService {
|
|||||||
url: item.url,
|
url: item.url,
|
||||||
publishDate: item.publishDate,
|
publishDate: item.publishDate,
|
||||||
source: crawler.name,
|
source: crawler.name,
|
||||||
unit: '',
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user