feat(资讯精选): 添加精选资讯总数显示功能
新增获取精选资讯总数的API接口并在表格组件中显示 重构页面数据初始化逻辑为独立函数
This commit is contained in:
parent
380ba60717
commit
3709b61c5a
|
|
@ -366,3 +366,11 @@ export const searchCompany = (params?: any) => {
|
|||
params,
|
||||
});
|
||||
};
|
||||
|
||||
export const getRealTotal = (params?: any) => {
|
||||
return request({
|
||||
url: '/news/getRealTotal',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
>
|
||||
<div style="font-size: 14px; color: rgba(0, 0, 0, 0.6)">
|
||||
<text>搜索共 {{ tableData.total }} 项数据</text>
|
||||
<text v-if="tableData.jingxuan > 0">,精选资讯共 XXX项数据</text>
|
||||
<text v-if="tableData.realTotal > 0">,精选资讯共 {{ tableData.realTotal }} 项数据</text>
|
||||
</div>
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -501,6 +501,7 @@ import {
|
|||
getSignalRules,
|
||||
doRecover,
|
||||
searchCompany,
|
||||
getRealTotal,
|
||||
} from '/@/api/api';
|
||||
import { highlightTitle } from '/@/utils/highlight';
|
||||
import clipboard from 'clipboard';
|
||||
|
|
@ -575,6 +576,29 @@ function handleSearch() {
|
|||
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);
|
||||
// 获取列表
|
||||
async function getData() {
|
||||
|
|
@ -584,29 +608,9 @@ async function getData() {
|
|||
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 {
|
||||
tableLoading.value = true;
|
||||
let { code, data, total } = await getNews({
|
||||
...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,
|
||||
});
|
||||
let { code, data, total } = await getNews(initPageData());
|
||||
tableLoading.value = false;
|
||||
if (code == 200) {
|
||||
tableData.data = data;
|
||||
|
|
@ -631,18 +635,21 @@ async function getData() {
|
|||
}
|
||||
});
|
||||
|
||||
// console.log('🚀 ~ getData ~ route.path:', route.path);
|
||||
// if (Session.get('userInfoLocal').userType != '01') {
|
||||
// hadExpand.value = false;
|
||||
// } else {
|
||||
// hadExpand.value = true;
|
||||
// }
|
||||
getRealTotalFn();
|
||||
}
|
||||
} catch (error) {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getRealTotalFn() {
|
||||
getRealTotal(initPageData()).then((res) => {
|
||||
if (res.code == 200) {
|
||||
tableData.realTotal = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function doApprovalFn(item, status) {
|
||||
let str = '确认初审完成并提交复核?送审后不支持再次编辑';
|
||||
if (status == 3) {
|
||||
|
|
|
|||
|
|
@ -699,6 +699,7 @@ import {
|
|||
doNewCheck,
|
||||
doNewReturn,
|
||||
getSignalRules,
|
||||
getRealTotal,
|
||||
} from '/@/api/api';
|
||||
import { highlightTitle } from '/@/utils/highlight';
|
||||
import clipboard from 'clipboard';
|
||||
|
|
@ -773,6 +774,29 @@ function handleSearch() {
|
|||
tableData.page = 1;
|
||||
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(false);
|
||||
// 获取列表
|
||||
async function getData() {
|
||||
|
|
@ -782,29 +806,9 @@ async function getData() {
|
|||
return;
|
||||
}
|
||||
|
||||
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)) : '';
|
||||
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
let { code, data, total } = await getNews({
|
||||
...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,
|
||||
});
|
||||
let { code, data, total } = await getNews(initPageData());
|
||||
tableLoading.value = false;
|
||||
if (code == 200) {
|
||||
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') {
|
||||
hadExpand.value = false;
|
||||
} else {
|
||||
// 会进来这里说明这个页面是资讯精选
|
||||
getRealTotalFn();
|
||||
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) {
|
||||
let str = '确认初审完成并提交复核?送审后不支持再次编辑';
|
||||
if (status == 3 || status == 4) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue