feat(资讯精选): 添加精选资讯总数显示功能

新增获取精选资讯总数的API接口并在表格组件中显示
重构页面数据初始化逻辑为独立函数
This commit is contained in:
34701892@qq.com 2025-12-03 12:10:55 +08:00
parent 380ba60717
commit 3709b61c5a
4 changed files with 78 additions and 50 deletions

View File

@ -366,3 +366,11 @@ export const searchCompany = (params?: any) => {
params, params,
}); });
}; };
export const getRealTotal = (params?: any) => {
return request({
url: '/news/getRealTotal',
method: 'get',
params,
});
};

View File

@ -37,7 +37,7 @@
> >
<div style="font-size: 14px; color: rgba(0, 0, 0, 0.6)"> <div style="font-size: 14px; color: rgba(0, 0, 0, 0.6)">
<text>搜索共 {{ tableData.total }} 项数据</text> <text>搜索共 {{ tableData.total }} 项数据</text>
<text v-if="tableData.jingxuan > 0">精选资讯共 XXX项数据</text> <text v-if="tableData.realTotal > 0">精选资讯共 {{ tableData.realTotal }} 项数据</text>
</div> </div>
</el-pagination> </el-pagination>
</div> </div>

View File

@ -501,6 +501,7 @@ import {
getSignalRules, getSignalRules,
doRecover, doRecover,
searchCompany, searchCompany,
getRealTotal,
} from '/@/api/api'; } from '/@/api/api';
import { highlightTitle } from '/@/utils/highlight'; import { highlightTitle } from '/@/utils/highlight';
import clipboard from 'clipboard'; import clipboard from 'clipboard';
@ -575,6 +576,29 @@ function handleSearch() {
getData(); getData();
} }
function initPageData() {
let _sdate = '';
let _edate = '';
if (daterange.value) {
_sdate = daterange.value[0];
_edate = daterange.value[1];
}
const industry = form.value.industry?.length > 0 ? encodeURIComponent(JSON.stringify(form.value.industry)) : '';
return {
...form.value,
industry,
// page: tableData.page,
current: tableData.page,
size: tableData.size,
dateline_from: _sdate || undefined,
dateline_to: _edate || undefined,
range: Session.get('userInfoLocal').userType == '01' ? 'review' : Session.get('userInfoLocal').userType == '02' ? 'secondReview' : 'all',
includeRuleIds: includeRuleIds.value,
excludeRuleIds: excludeRuleIds.value,
};
}
const hadExpand = ref(true); const hadExpand = ref(true);
// //
async function getData() { async function getData() {
@ -584,29 +608,9 @@ async function getData() {
return; return;
} }
let _sdate = '';
let _edate = '';
if (daterange.value) {
_sdate = daterange.value[0];
_edate = daterange.value[1];
}
console.log('🚀 ~ getData ~ _edate:', _edate);
const industry = form.value.industry?.length > 0 ? encodeURIComponent(JSON.stringify(form.value.industry)) : '';
try { try {
tableLoading.value = true; tableLoading.value = true;
let { code, data, total } = await getNews({ let { code, data, total } = await getNews(initPageData());
...form.value,
industry,
// page: tableData.page,
current: tableData.page,
size: tableData.size,
dateline_from: _sdate || undefined,
dateline_to: _edate || undefined,
includeRuleIds: includeRuleIds.value,
excludeRuleIds: excludeRuleIds.value,
});
tableLoading.value = false; tableLoading.value = false;
if (code == 200) { if (code == 200) {
tableData.data = data; tableData.data = data;
@ -631,18 +635,21 @@ async function getData() {
} }
}); });
// console.log('🚀 ~ getData ~ route.path:', route.path); getRealTotalFn();
// if (Session.get('userInfoLocal').userType != '01') {
// hadExpand.value = false;
// } else {
// hadExpand.value = true;
// }
} }
} catch (error) { } catch (error) {
tableLoading.value = false; tableLoading.value = false;
} }
} }
function getRealTotalFn() {
getRealTotal(initPageData()).then((res) => {
if (res.code == 200) {
tableData.realTotal = res.data;
}
});
}
async function doApprovalFn(item, status) { async function doApprovalFn(item, status) {
let str = '确认初审完成并提交复核?送审后不支持再次编辑'; let str = '确认初审完成并提交复核?送审后不支持再次编辑';
if (status == 3) { if (status == 3) {

View File

@ -699,6 +699,7 @@ import {
doNewCheck, doNewCheck,
doNewReturn, doNewReturn,
getSignalRules, getSignalRules,
getRealTotal,
} from '/@/api/api'; } from '/@/api/api';
import { highlightTitle } from '/@/utils/highlight'; import { highlightTitle } from '/@/utils/highlight';
import clipboard from 'clipboard'; import clipboard from 'clipboard';
@ -773,15 +774,8 @@ function handleSearch() {
tableData.page = 1; tableData.page = 1;
getData(); getData();
} }
const hadExpand = ref(false);
//
async function getData() {
// return
if (form.value.minScore && form.value.maxScore && Number(form.value.maxScore) < Number(form.value.minScore)) {
ElMessage.error('最高分不能小于最低分');
return;
}
function initPageData() {
let _sdate = ''; let _sdate = '';
let _edate = ''; let _edate = '';
if (daterange.value) { if (daterange.value) {
@ -790,10 +784,7 @@ async function getData() {
} }
const industry = form.value.industry?.length > 0 ? encodeURIComponent(JSON.stringify(form.value.industry)) : ''; const industry = form.value.industry?.length > 0 ? encodeURIComponent(JSON.stringify(form.value.industry)) : '';
return {
try {
tableLoading.value = true;
let { code, data, total } = await getNews({
...form.value, ...form.value,
industry, industry,
// page: tableData.page, // page: tableData.page,
@ -804,7 +795,20 @@ async function getData() {
range: Session.get('userInfoLocal').userType == '01' ? 'review' : Session.get('userInfoLocal').userType == '02' ? 'secondReview' : 'all', range: Session.get('userInfoLocal').userType == '01' ? 'review' : Session.get('userInfoLocal').userType == '02' ? 'secondReview' : 'all',
includeRuleIds: includeRuleIds.value, includeRuleIds: includeRuleIds.value,
excludeRuleIds: excludeRuleIds.value, excludeRuleIds: excludeRuleIds.value,
}); };
}
const hadExpand = ref(false);
//
async function getData() {
// return
if (form.value.minScore && form.value.maxScore && Number(form.value.maxScore) < Number(form.value.minScore)) {
ElMessage.error('最高分不能小于最低分');
return;
}
try {
tableLoading.value = true;
let { code, data, total } = await getNews(initPageData());
tableLoading.value = false; tableLoading.value = false;
if (code == 200) { if (code == 200) {
tableData.data = data; tableData.data = data;
@ -830,10 +834,11 @@ async function getData() {
}); });
// //
console.log("🚀 ~ getData ~ Session.get('userInfoLocal').userType:", Session.get('userInfoLocal').userType);
if (Session.get('userInfoLocal').userType != '00') { if (Session.get('userInfoLocal').userType != '00') {
hadExpand.value = false; hadExpand.value = false;
} else { } else {
//
getRealTotalFn();
hadExpand.value = true; hadExpand.value = true;
} }
} }
@ -842,6 +847,14 @@ async function getData() {
} }
} }
function getRealTotalFn() {
getRealTotal(initPageData()).then((res) => {
if (res.code == 200) {
tableData.realTotal = res.data;
}
});
}
async function doApprovalFn(item, status) { async function doApprovalFn(item, status) {
let str = '确认初审完成并提交复核?送审后不支持再次编辑'; let str = '确认初审完成并提交复核?送审后不支持再次编辑';
if (status == 3 || status == 4) { if (status == 3 || status == 4) {