提交 ec4dc0ac authored 作者: yanpeng's avatar yanpeng

Merge branch 'pre' of http://8.140.26.4:10003/caijian/risk-monitor into yp-dev

......@@ -30,7 +30,7 @@
</div>
<div class="header-footer">
<div class="header-footer-left">
<ActiveTag v-for="tag, index in activeTagList" :key="index" :tagName="tag"
<ActiveTag v-for="tag, index in activeTagList" :key="index" :tagName="tag.name"
@close="handleCloseCurTag(tag, index)" />
</div>
<div class="header-footer-right">
......@@ -62,7 +62,7 @@
</div>
<div class="content-main">
<ChartContainer :chartTitle="curChartTitle" :chartTypeList="curChartTypeList"
@clickChartItem="handleSwitchActiveChart">
@clickChartItem="handleSwitchActiveChart" @download="handleDownloadCurChartData">
<template #chart-box>
<LineChart v-if="activeChart === '折线图'" :lineChartData="curChartData" />
<BarChart v-if="activeChart === '柱状图'" :barChartData="curChartData" />
......@@ -293,38 +293,100 @@ const timeList = ref([
const activeTagList = computed(() => {
const arr = []
if (selectedArea.value && selectedArea.value !== '全部领域') {
arr.push(selectedArea.value)
arr.push(
{
tag: '科技领域',
name: selectedArea.value
}
)
}
if (selectedDate.value === '自定义') {
arr.push(customTime.value.join('至'))
arr.push(
{
tag: '提出时间',
name: customTime.value.join('至')
}
)
}
if (selectedParty.value && selectedParty.value !== '全部党派') {
arr.push(selectedParty.value)
arr.push(
{
tag: '所属党派',
name: selectedParty.value
}
)
}
if (selectedCongress.value && selectedCongress.value !== '全部议院') {
arr.push(selectedCongress.value)
arr.push(
{
tag: '提出议院',
name: selectedCongress.value
}
)
}
if (selectedOrg.value && selectedOrg.value !== '全部委员会') {
arr.push(selectedOrg.value)
arr.push(
{
tag: '委员会',
name: selectedOrg.value
}
)
}
if (selectedmember.value && selectedmember.value !== '全部议员') {
arr.push(selectedmember.value)
arr.push(
{
tag: '提出议员',
name: selectedmember.value
}
)
}
if (selectedStatus.value && selectedStatus.value !== '全部阶段') {
arr.push(selectedStatus.value)
arr.push(
{
tag: '所处阶段',
name: selectedStatus.value
}
)
}
if (isInvolveCn.value) {
const involveStr = '涉华'
arr.push(involveStr)
arr.push(
{
tag: '是否涉华',
name: involveStr
}
)
}
return arr
})
const handleCloseCurTag = (tag, index) => {
// alert(tag.name)
activeTagList.value.splice(index, 1)
switch (tag.tag) {
case '科技领域':
selectedArea.value = '全部领域'
break
case '提出时间':
selectedDate.value = ''
break
case '所属党派':
selectedParty.value = '全部党派'
break
case '提出议院':
selectedCongress.value = '全部议院'
break
case '委员会':
selectedOrg.value = '全部委员会'
break
case '提出议员':
selectedmember.value = '全部议员'
break
case '所处阶段':
selectedStatus.value = '全部阶段'
break
case '是否涉华':
isInvolveCn.value = false
break
}
}
const activeChart = ref('') // 当前激活的图表
......@@ -624,13 +686,25 @@ const statusList = ref([
id: '全部阶段'
},
{
name: '提出',
id: '0'
name: '提出法案',
id: '提出法案'
},
{
name: '通过',
id: '1'
}
name: '通过法案',
id: '通过法案'
},
{
name: '众议院通过',
id: '众议院通过'
},
{
name: '参议院通过',
id: '参议院通过'
},
{
name: '双院通过',
id: '双院通过'
},
])
const selectedStatus = ref('全部阶段')
......@@ -668,8 +742,6 @@ const handleSwitchFolderAll = () => {
isFolderAll.value = !isFolderAll.value
}
const tableRef = ref(null)
// 表格数据
......@@ -722,7 +794,7 @@ const fetchTableData = async () => {
originDepart: selectedOrg.value === '全部委员会' ? null : selectedOrg.value,
sponsorPersonName: selectedmember.value === '全部议员' ? null : selectedmember.value,
status: selectedStatus.value === '通过' ? 1 : 0,
sleStatus: isInvolveCn ? 'Y' : 'N',
isInvolveCn: isInvolveCn ? 'Y' : 'N',
sort: isSort.value ? 0 : 1 // 0 先按分数降序 后按时间降序 1 先按分数降序,再按时间升序
}
try {
......@@ -788,6 +860,38 @@ const fetchTableData = async () => {
})
}
const allData = ref([])
// 获取筛选条件下全部表格数据
const fetchAllData = async () => {
const params = {
page: 1,
size: 9999,
keyword: '',
type: 1, // type 1= 法案 2= 政令 3 =智库 4=智库报告 5=实体清单【制裁记录】 6= 人物 7= 机构 8=新闻 9= 社媒
domains: selectedArea.value === '全部领域' ? null : [selectedArea.value],
proposedDateStart: customTime.value[0],
proposedDateEnd: customTime.value[1],
affiliation: selectedParty.value === '全部党派' ? null : selectedParty.value,
originChamber: selectedCongress.value === '全部议院' ? null : selectedCongress.value,
originDepart: selectedOrg.value === '全部委员会' ? null : selectedOrg.value,
sponsorPersonName: selectedmember.value === '全部议员' ? null : selectedmember.value,
status: selectedStatus.value === '通过' ? 1 : 0,
isInvolveCn: isInvolveCn ? 'Y' : 'N',
sort: isSort.value ? 0 : 1 // 0 先按分数降序 后按时间降序 1 先按分数降序,再按时间升序
}
try {
const res = await search(params)
console.log('搜索结果', res);
if (res.code === 200 && res.data) {
allData.value = res.data.records
}
} catch (error) {
ElMessage.error('加载全部数据出错!')
}
}
// 单选事件
const handleSelect = (selection, row) => {
if (selection.some(item => item.id === row.id)) {
......@@ -832,10 +936,10 @@ const handleSelectAllPage = () => {
)
if (currentPageSelected) {
// 已全选,则取消当前页的全选
// 已全选,则不动当前页的全选
tableData.value.forEach(row => {
tableRef.value.toggleRowSelection(row, false)
selectedMap.value.delete(row.id)
// selectedMap.value.delete(row.id)
})
} else {
// 未全选,则全选当前页
......@@ -848,39 +952,47 @@ const handleSelectAllPage = () => {
}
}
// 处理全选
const handleSelectAllChange = () => {
// 全选最大1万条提示
const isShowAllDataMaxLengthTip = ref(false)
const loading = ref(false) // 加载数据loading
// 处理 全选(全部数据)
const handleSelectAllChange = async () => {
if (isSelectedAll.value) {
if (totalNum.value > 10000) {
isShowAllDataMaxLengthTip.value = true
}
loading.value = true
await fetchAllData()
handleSelectAllPage()
allData.value.forEach(row => {
if (!selectedMap.value.has(row.id)) {
selectedMap.value.set(row.id, row)
}
})
loading.value = false
} else {
handleClearAll()
}
// if (isSelectedAll.value) {
// // 全选:将当前页所有数据添加到 Map
// tableData.value.forEach(row => {
// if (!selectedMap.value.has(row.id)) {
// selectedMap.value.set(row.id, row)
// }
// })
// } else {
// // 全不选:从 Map 中移除当前页的所有数据
// tableData.value.forEach(row => {
// selectedMap.value.delete(row.id)
// })
// }
}
// 清空所有选择
const handleClearAll = () => {
isSelectedAll.value = false
selectedMap.value.clear()
tableRef.value?.clearSelection()
}
// 翻页
const handleCurrentChange = (val) => {
const handleCurrentChange = async (val) => {
currentPage.value = val
fetchTableData()
await fetchTableData()
if (isSelectedAll.value) {
handleSelectAllPage()
}
}
......@@ -898,6 +1010,20 @@ watch(tableData, () => {
// 当前图表数据
const curChartData = ref(null)
// 下载当前图表数据
const handleDownloadCurChartData = () => {
const jsonStr = JSON.stringify(curChartData.value, null, 2);
const blob = new Blob([jsonStr], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = 'chartData.json';
link.click();
URL.revokeObjectURL(url);
}
// 跳转到当前页 初始化筛选条件
const initParam = () => {
const hasQuery = Object.keys(route.query).length > 0;
......
......@@ -600,8 +600,8 @@ onMounted(() => {
<style lang="scss">
.data-library-wrapper {
width: 1920px;
height: 1080px;
width: 100%;
height: 100%;
overflow: hidden;
// background: orange;
......@@ -682,7 +682,7 @@ onMounted(() => {
}
.data-library-main {
height: calc(100% - 64px);
height: 100%;
background: #F7F8F9;
display: flex;
......@@ -816,8 +816,9 @@ onMounted(() => {
.main-box {
width: 1600px;
height: 968px;
height: calc(100% - 48px);
overflow: hidden;
overflow-y: auto;
}
.select-box {
......
......@@ -555,7 +555,7 @@ body {
}
.main-container1 {
width: 100%;
height: calc(100vh - 64px) !important;
height: calc(100vh - 64px);
position: relative;
overflow: hidden;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论