提交 480bc53b authored 作者: coderBryanFu's avatar coderBryanFu

feat:更新数据资源库

上级 57a3db48
...@@ -17,4 +17,11 @@ export function getThinkTankList() { ...@@ -17,4 +17,11 @@ export function getThinkTankList() {
method: 'GET', method: 'GET',
url: `/temporarySearch/search-info/all-organization-names`, url: `/temporarySearch/search-info/all-organization-names`,
}) })
}
export function getStatusList() {
return request({
method: 'GET',
url: `/temporarySearch/search-info/dBillStage`,
})
} }
\ No newline at end of file
...@@ -165,7 +165,7 @@ import { useRoute } from "vue-router"; ...@@ -165,7 +165,7 @@ import { useRoute } from "vue-router";
import router from '@/router' import router from '@/router'
import { getPostOrgList, getPostMemberList } from '@/api/bill/billHome' import { getPostOrgList, getPostMemberList } from '@/api/bill/billHome'
import { search } from '@/api/comprehensiveSearch' import { search, getStatusList } from '@/api/comprehensiveSearch'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import getDateRange from '@/utils/getDateRange' import getDateRange from '@/utils/getDateRange'
...@@ -345,10 +345,13 @@ const activeTagList = computed(() => { ...@@ -345,10 +345,13 @@ const activeTagList = computed(() => {
) )
} }
if (selectedStatus.value && selectedStatus.value !== '全部阶段') { if (selectedStatus.value && selectedStatus.value !== '全部阶段') {
const statusName = statusList.value.filter(item => {
return item.id === selectedStatus.value
})[0].name
arr.push( arr.push(
{ {
tag: '所处阶段', tag: '所处阶段',
name: selectedStatus.value name: statusName
} }
) )
} }
...@@ -711,6 +714,31 @@ const statusList = ref([ ...@@ -711,6 +714,31 @@ const statusList = ref([
}, },
]) ])
const handleGetStatusList = async () => {
try {
const res = await getStatusList()
console.log('获取立法阶段列表', res);
if (res.code === 200) {
const arr = res.data.map(item => {
return {
name: item.name,
id: item.number
}
})
statusList.value = [
{
name: '全部阶段',
id: '全部阶段'
},
...arr
]
}
} catch (error) {
}
}
const selectedStatus = ref('全部阶段') const selectedStatus = ref('全部阶段')
const statusPlaceHolder = ref('请选择立法阶段') const statusPlaceHolder = ref('请选择立法阶段')
const handleSelectStauts = value => { const handleSelectStauts = value => {
...@@ -737,6 +765,7 @@ const handleClear = () => { ...@@ -737,6 +765,7 @@ const handleClear = () => {
// 确定 // 确定
const handleConfirm = () => { const handleConfirm = () => {
currentPage.value = 1
fetchTableData() fetchTableData()
} }
...@@ -785,6 +814,9 @@ const fetchTableData = async () => { ...@@ -785,6 +814,9 @@ const fetchTableData = async () => {
// isSelectedAll.value = false // isSelectedAll.value = false
// selectedMap.value.clear() // selectedMap.value.clear()
// 调用接口获取数据... // 调用接口获取数据...
loading.value = true
const params = { const params = {
page: currentPage.value, page: currentPage.value,
size: pageSize.value, size: pageSize.value,
...@@ -843,12 +875,10 @@ const fetchTableData = async () => { ...@@ -843,12 +875,10 @@ const fetchTableData = async () => {
activeChart.value = curDemensionItem.chartTypeList[0] activeChart.value = curDemensionItem.chartTypeList[0]
curChartData.value = curDemensionItem.data curChartData.value = curDemensionItem.data
}) })
loading.value = false
} catch (error) { } catch (error) {
loading.value = false
} }
// tableData.value = res.data // tableData.value = res.data
// total.value = res.total // total.value = res.total
...@@ -867,6 +897,12 @@ const allData = ref([]) ...@@ -867,6 +897,12 @@ const allData = ref([])
// 获取筛选条件下全部表格数据 // 获取筛选条件下全部表格数据
const fetchAllData = async () => { const fetchAllData = async () => {
let statusParam = null
if (selectedStatus.value !== '全部阶段') {
statusParam = statusList.value.filter(item => {
return item.name === selectedStatus.value
})[0].id
}
const params = { const params = {
page: 1, page: 1,
size: 9999, size: 9999,
...@@ -879,7 +915,7 @@ const fetchAllData = async () => { ...@@ -879,7 +915,7 @@ const fetchAllData = async () => {
originChamber: selectedCongress.value === '全部议院' ? null : selectedCongress.value, originChamber: selectedCongress.value === '全部议院' ? null : selectedCongress.value,
originDepart: selectedOrg.value === '全部委员会' ? null : selectedOrg.value, originDepart: selectedOrg.value === '全部委员会' ? null : selectedOrg.value,
sponsorPersonName: selectedmember.value === '全部议员' ? null : selectedmember.value, sponsorPersonName: selectedmember.value === '全部议员' ? null : selectedmember.value,
status: selectedStatus.value === '通过' ? 1 : 0, status: selectedStatus.value === '全部阶段' ? null : selectedStatus.value,
isInvolveCn: isInvolveCn.value ? 'Y' : 'N', isInvolveCn: isInvolveCn.value ? 'Y' : 'N',
sort: isSort.value ? 0 : 1 // 0 先按分数降序 后按时间降序 1 先按分数降序,再按时间升序 sort: isSort.value ? 0 : 1 // 0 先按分数降序 后按时间降序 1 先按分数降序,再按时间升序
} }
...@@ -1038,8 +1074,10 @@ const initParam = () => { ...@@ -1038,8 +1074,10 @@ const initParam = () => {
customTime.value = JSON.parse(route.query.selectedDate) customTime.value = JSON.parse(route.query.selectedDate)
} }
isInvolveCn.value = route.query.isInvolveCn ? true : false isInvolveCn.value = route.query.isInvolveCn ? true : false
if (route.query.selectedStatus) { if (route.query.selectedStatus && route.query.selectedStatus !== '全部阶段') {
selectedStatus.value = route.query.selectedStatus selectedStatus.value = statusList.value.filter(item => {
return item.name === route.query.selectedStatus
})[0].id
} else { } else {
selectedStatus.value = '全部阶段' selectedStatus.value = '全部阶段'
} }
...@@ -1054,7 +1092,7 @@ const initParam = () => { ...@@ -1054,7 +1092,7 @@ const initParam = () => {
} else { } else {
const savedQuery = JSON.parse(sessionStorage.getItem('routeQuery') || '{}'); const savedQuery = JSON.parse(sessionStorage.getItem('routeQuery') || '{}');
selectedArea.value = savedQuery.domains ? savedQuery.domains : '全部领域' selectedArea.value = savedQuery.domains ? savedQuery.domains : '全部领域'
if (Array.isArray(JSON.parse(savedQuery.selectedDate)) && JSON.parse(savedQuery.selectedDate).length) { if (savedQuery.selectedDate && Array.isArray(JSON.parse(savedQuery.selectedDate)) && JSON.parse(savedQuery.selectedDate).length) {
selectedDate.value = '自定义' selectedDate.value = '自定义'
customTime.value = JSON.parse(savedQuery.selectedDate) customTime.value = JSON.parse(savedQuery.selectedDate)
} }
...@@ -1123,9 +1161,11 @@ const handleExport = () => { ...@@ -1123,9 +1161,11 @@ const handleExport = () => {
onMounted(async () => { onMounted(async () => {
handleGetOrgList() handleGetOrgList()
handleGetMemberList() handleGetMemberList()
initParam() await handleGetStatusList()
// 初始化 // 初始化
await fetchTableData() initParam()
fetchTableData()
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
......
...@@ -124,13 +124,13 @@ ...@@ -124,13 +124,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="data-main-box-main-content" v-loading="loading" element-loading-text="全部数据加载中,请稍候..."> <div class="data-main-box-main-content" v-loading="loading" element-loading-text="数据加载中,请稍候...">
<el-table ref="tableRef" :data="tableData" row-key="id" @selection-change="handleSelectionChange" <el-table ref="tableRef" :data="tableData" row-key="id" @selection-change="handleSelectionChange"
@select="handleSelect" @select-all="handleSelectAll" style="width: 100%" :row-style="{ height: '52px' }"> @select="handleSelect" @select-all="handleSelectAll" style="width: 100%" :row-style="{ height: '52px' }">
<el-table-column type="selection" width="40" /> <el-table-column type="selection" width="40" />
<el-table-column label="政令名称" width="720"> <el-table-column label="政令名称" width="720">
<template #default="scope"> <template #default="scope">
<span class="title-item text-compact-bold" @click="handleClickToDetail(scope.row)">{{ scope.row.title <span class="title-item text-compact-bold" @click="handleClickToDetail(scope.row)">{{ scope.row.originalTitle
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
</el-table-column> </el-table-column>
<el-table-column label="发布机构"> <el-table-column label="发布机构">
<template #default="scope"> <template #default="scope">
<span class="person-item text-compact" @click="handlePerClick(scope.row)">{{ scope.row.organizationName <span class="person-item text-compact" @click="handleOrgClick(scope.row)">{{ scope.row.organizationName
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -675,6 +675,7 @@ const handleClear = () => { ...@@ -675,6 +675,7 @@ const handleClear = () => {
// 确定 // 确定
const handleConfirm = () => { const handleConfirm = () => {
currentPage.value = 1
fetchTableData() fetchTableData()
} }
...@@ -718,6 +719,7 @@ const selectedCount = computed(() => selectedMap.value.size) ...@@ -718,6 +719,7 @@ const selectedCount = computed(() => selectedMap.value.size)
const fetchTableData = async () => { const fetchTableData = async () => {
// isSelectedAll.value = false // isSelectedAll.value = false
// selectedMap.value.clear() // selectedMap.value.clear()
loading.value = true
// 调用接口获取数据... // 调用接口获取数据...
const params = { const params = {
page: currentPage.value, page: currentPage.value,
...@@ -772,8 +774,9 @@ const fetchTableData = async () => { ...@@ -772,8 +774,9 @@ const fetchTableData = async () => {
activeChart.value = curDemensionItem.chartTypeList[0] activeChart.value = curDemensionItem.chartTypeList[0]
curChartData.value = curDemensionItem.data curChartData.value = curDemensionItem.data
}) })
loading.value = false
} catch (error) { } catch (error) {
loading.value = false
} }
// tableData.value = res.data // tableData.value = res.data
// total.value = res.total // total.value = res.total
...@@ -1003,17 +1006,18 @@ const handleClickToDetail = (curDecree) => { ...@@ -1003,17 +1006,18 @@ const handleClickToDetail = (curDecree) => {
window.open(route.href, "_blank"); window.open(route.href, "_blank");
}; };
// 跳转人物详情 // 跳转机构详情
const handlePerClick = item => { const handleOrgClick = item => {
window.sessionStorage.setItem("curTabName", item.sponsorPersonName); console.log('item', item);
const route = router.resolve({
path: "/characterPage", window.sessionStorage.setItem("curTabName", item.organizationName);
query: { const route = router.resolve({
type: 2, path: "/institution",
personId: item.personId query: {
} id: item.organizationId
}); }
window.open(route.href, "_blank"); });
window.open(route.href, "_blank");
}; };
// 导出 // 导出
...@@ -1216,6 +1220,8 @@ onMounted(async () => { ...@@ -1216,6 +1220,8 @@ onMounted(async () => {
.header-left-item2 { .header-left-item2 {
color: var(--color-primary-100); color: var(--color-primary-100);
display: flex;
gap: 8px;
} }
......
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
placeholder-name="请输入智库报告名称" /> placeholder-name="请输入智库报告名称" />
<div class="check-box"> <div class="check-box">
<div class="check-box-left text-tip-1"> <div class="check-box-left text-tip-1">
{{ '是否涉华:' }} {{ "是否涉华:" }}
</div> </div>
<div class="check-box-right"> <div class="check-box-right">
<el-checkbox v-model="isInvolveCn" class="involve-checkbox"> <el-checkbox v-model="isInvolveCn" class="involve-checkbox">
{{ '只看涉华智库报告' }} {{ "只看涉华智库报告" }}
</el-checkbox> </el-checkbox>
</div> </div>
</div> </div>
</div> </div>
<div class="header-footer"> <div class="header-footer">
<div class="header-footer-left"> <div class="header-footer-left">
<ActiveTag v-for="tag, index in activeTagList" :key="index" :tagName="tag.name" <ActiveTag v-for="(tag, index) in activeTagList" :key="index" :tagName="tag.name"
@close="handleCloseCurTag(tag, index)" /> @close="handleCloseCurTag(tag, index)" />
</div> </div>
<div class="header-footer-right"> <div class="header-footer-right">
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<div class="chart-main-box" v-if="isShowChart"> <div class="chart-main-box" v-if="isShowChart">
<div class="info-box"> <div class="info-box">
<div class="switch-box" @click="handleSwitchChartData"> <div class="switch-box" @click="handleSwitchChartData">
<img src="@/views/dataLibrary/assets/icons/chart-active.svg" alt=""> <img src="@/views/dataLibrary/assets/icons/chart-active.svg" alt="" />
</div> </div>
<div class="num-box text-title-3-bold"> <div class="num-box text-title-3-bold">
{{ `共 ${totalNum} 条数据` }} {{ `共 ${totalNum} 条数据` }}
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
@change="handleChangeTime"> @change="handleChangeTime">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
</template> </template>
</ChartHeader> </ChartHeader>
</div> </div>
...@@ -66,14 +65,13 @@ ...@@ -66,14 +65,13 @@
<RaderChart v-if="activeChart === '雷达图'" :radarChartData="curChartData" /> <RaderChart v-if="activeChart === '雷达图'" :radarChartData="curChartData" />
</template> </template>
</ChartContainer> </ChartContainer>
</div> </div>
</div> </div>
</div> </div>
<div class="data-main-box" v-else> <div class="data-main-box" v-else>
<div class="data-main-box-header"> <div class="data-main-box-header">
<div class="switch-box" @click="handleSwitchChartData"> <div class="switch-box" @click="handleSwitchChartData">
<img src="@/views/dataLibrary/assets/icons/data-active.svg" alt=""> <img src="@/views/dataLibrary/assets/icons/data-active.svg" alt="" />
</div> </div>
<div class="num-box text-title-3-bold"> <div class="num-box text-title-3-bold">
{{ `共 ${totalNum} 条数据` }} {{ `共 ${totalNum} 条数据` }}
...@@ -86,17 +84,19 @@ ...@@ -86,17 +84,19 @@
<el-checkbox v-model="isSelectedAll" label="全选" @change="handleSelectAllChange" size="large" /> <el-checkbox v-model="isSelectedAll" label="全选" @change="handleSelectAllChange" size="large" />
</div> </div>
<div class="header-left-item2 text-tip-1">{{ `已选择${selectedCount}项` }}</div> <div class="header-left-item2 text-tip-1">{{ `已选择${selectedCount}项` }}</div>
<div class="header-left-item2 text-tip-1 cancel" @click="handleClearAll" v-show="selectedCount">{{ '取消' }} <div class="header-left-item2 text-tip-1 cancel" @click="handleClearAll" v-show="selectedCount">
<div class="header-left-item3 text-tip-1" v-if="isShowAllDataMaxLengthTip">{{ `(当前最大选择不能超过1万条!)` }}</div> {{ "取消" }}
<div class="header-left-item3 text-tip-1" v-if="isShowAllDataMaxLengthTip">
{{ `(当前最大选择不能超过1万条!)` }}
</div>
</div> </div>
</div> </div>
<div class="header-right"> <div class="header-right">
<div class="header-right-item item1"> <div class="header-right-item item1">
<div class="icon"> <div class="icon">
<img src="../assets/icons/download.svg" alt=""> <img src="../assets/icons/download.svg" alt="" />
</div> </div>
<div class="text text-tip-1" @click="handleExport">{{ '导出' }}</div> <div class="text text-tip-1" @click="handleExport">{{ "导出" }}</div>
</div> </div>
<div class="header-right-item2 item2"> <div class="header-right-item2 item2">
<el-select v-model="curOperation" placeholder="批量操作" style="width: 120px"> <el-select v-model="curOperation" placeholder="批量操作" style="width: 120px">
...@@ -121,7 +121,8 @@ ...@@ -121,7 +121,8 @@
<el-table-column type="selection" width="40" /> <el-table-column type="selection" width="40" />
<el-table-column label="报告名称" width="720"> <el-table-column label="报告名称" width="720">
<template #default="scope"> <template #default="scope">
<span class="title-item text-compact-bold" @click="handleClickToDetail(scope.row)">{{ scope.row.originalTitle <span class="title-item text-compact-bold" @click="handleClickToDetail(scope.row)">{{
scope.row.originalTitle
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -130,16 +131,16 @@ ...@@ -130,16 +131,16 @@
</el-table-column> </el-table-column>
<el-table-column label="发布智库"> <el-table-column label="发布智库">
<template #default="scope"> <template #default="scope">
<span class="person-item text-compact" @click="handlePerClick(scope.row)">{{ scope.row.organizationName <span class="person-item text-compact" @click="handlePerClick(scope.row)">{{
scope.row.organizationName
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="涉及领域" width="350" class-name="date-column"> <el-table-column label="涉及领域" width="350" class-name="date-column">
<template #default="scope"> <template #default="scope">
<div class="tag-box"> <div class="tag-box">
<AreaTag v-for="tag, index in scope.row.domains" :key="index" :tagName="tag" /> <AreaTag v-for="(tag, index) in scope.row.domains" :key="index" :tagName="tag" />
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="类型" width="100"> <el-table-column label="类型" width="100">
...@@ -157,64 +158,64 @@ ...@@ -157,64 +158,64 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, watch, onMounted, nextTick } from 'vue' import { ref, computed, watch, onMounted, nextTick } from "vue";
import ChartContainer from '../components/ChartContainer/index.vue' import ChartContainer from "../components/ChartContainer/index.vue";
import ChartHeader from '../components/ChartHeader/index.vue' import ChartHeader from "../components/ChartHeader/index.vue";
import ActiveTag from '../components/ActiveTag/index.vue' import ActiveTag from "../components/ActiveTag/index.vue";
import HeaderBtnBox from '../components/HeaderBtnBox/index.vue' import HeaderBtnBox from "../components/HeaderBtnBox/index.vue";
import LineChart from '../components/LineChart/index.vue' import LineChart from "../components/LineChart/index.vue";
import PieChart from '../components/PieChart/index.vue' import PieChart from "../components/PieChart/index.vue";
import BarChart from '../components/BarChart/index.vue' import BarChart from "../components/BarChart/index.vue";
import RaderChart from '../components/RadarChart/idnex.vue' import RaderChart from "../components/RadarChart/idnex.vue";
import SelectBox from '../components/SelectBox/index.vue' import SelectBox from "../components/SelectBox/index.vue";
import InputBox from '../components/InputBox/index.vue' import InputBox from "../components/InputBox/index.vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import router from '@/router' import router from "@/router";
import { search, getThinkTankList } from '@/api/comprehensiveSearch' import { search, getThinkTankList } from "@/api/comprehensiveSearch";
import { ElMessage } from 'element-plus' import { ElMessage } from "element-plus";
import getDateRange from '@/utils/getDateRange' import getDateRange from "@/utils/getDateRange";
import { getDepartmentList } from "@/api/decree/home"; import { getDepartmentList } from "@/api/decree/home";
const route = useRoute(); const route = useRoute();
// 图表/数据 // 图表/数据
const isShowChart = ref(false) const isShowChart = ref(false);
// 点击切换数据/图表 // 点击切换数据/图表
const handleSwitchChartData = () => { const handleSwitchChartData = () => {
isShowChart.value = !isShowChart.value isShowChart.value = !isShowChart.value;
if (isShowChart.value) { if (isShowChart.value) {
const curDemensionItem = staticsDemensionList.value.filter(item => { const curDemensionItem = staticsDemensionList.value.filter(item => {
return item.name === curDemension.value return item.name === curDemension.value;
})[0] })[0];
setTimeout(() => { setTimeout(() => {
activeChart.value = curDemensionItem.chartTypeList[0] activeChart.value = curDemensionItem.chartTypeList[0];
if (curDemension.value === '发布时间') { if (curDemension.value === "发布时间") {
if (selectedTime.value === '按月度统计') { if (selectedTime.value === "按月度统计") {
curChartData.value = curDemensionItem.data curChartData.value = curDemensionItem.data;
} else if (selectedTime.value === '按季度统计') { } else if (selectedTime.value === "按季度统计") {
curChartData.value = curDemensionItem.quatarData curChartData.value = curDemensionItem.quatarData;
} else { } else {
curChartData.value = curDemensionItem.yearData curChartData.value = curDemensionItem.yearData;
} }
} else { } else {
curChartData.value = curDemensionItem.data curChartData.value = curDemensionItem.data;
} }
}) });
} }
} };
// 总计数据 // 总计数据
const totalNum = ref(0) const totalNum = ref(0);
// 统计维度列表 // 统计维度列表
const staticsDemensionList = ref([ const staticsDemensionList = ref([
{ {
name: '发布时间', name: "发布时间",
active: true, active: true,
chartTypeList: ['折线图', '柱状图'], chartTypeList: ["折线图", "柱状图"],
chartTitle: '美国智库报告数量随时间变化趋势', chartTitle: "美国智库报告数量随时间变化趋势",
data: { data: {
dataX: [], dataX: [],
dataY: [] dataY: []
...@@ -229,207 +230,192 @@ const staticsDemensionList = ref([ ...@@ -229,207 +230,192 @@ const staticsDemensionList = ref([
} }
}, },
{ {
name: '科技领域', name: "科技领域",
active: false, active: false,
chartTypeList: ['饼状图'], chartTypeList: ["饼状图"],
chartTitle: '美国智库报告领域分布', chartTitle: "美国智库报告领域分布",
data: [] data: []
}, },
{ {
name: '发布智库', name: "发布智库",
active: false, active: false,
chartTypeList: ['饼状图'], chartTypeList: ["饼状图"],
chartTitle: '美国智库报告发布智库分布', chartTitle: "美国智库报告发布智库分布",
data: [] data: []
} }
]) ]);
// 当前维度下的图表列表 // 当前维度下的图表列表
const curChartTypeList = computed(() => { const curChartTypeList = computed(() => {
let arr = staticsDemensionList.value.filter(item => item.active) let arr = staticsDemensionList.value.filter(item => item.active);
return arr[0].chartTypeList return arr[0].chartTypeList;
}) });
// 当前图表标题 // 当前图表标题
const curChartTitle = computed(() => { const curChartTitle = computed(() => {
let arr = staticsDemensionList.value.filter(item => item.active) let arr = staticsDemensionList.value.filter(item => item.active);
return arr[0].chartTitle return arr[0].chartTitle;
}) });
// 当前维度 // 当前维度
const curDemension = ref('发布时间') const curDemension = ref("发布时间");
// 点击维度item // 点击维度item
const handleClickDemensionItem = (val) => { const handleClickDemensionItem = val => {
activeChart.value = '' activeChart.value = "";
staticsDemensionList.value.forEach(item => { staticsDemensionList.value.forEach(item => {
item.active = false item.active = false;
}) });
val.active = true val.active = true;
curDemension.value = val.name curDemension.value = val.name;
setTimeout(() => { setTimeout(() => {
activeChart.value = val.chartTypeList[0] activeChart.value = val.chartTypeList[0];
if (curDemension.value === '发布时间' && selectedTime.value === '按年度统计') { if (curDemension.value === "发布时间" && selectedTime.value === "按年度统计") {
curChartData.value = val.yearData curChartData.value = val.yearData;
} else if (curDemension.value === '发布时间' && selectedTime.value === '按季度统计') { } else if (curDemension.value === "发布时间" && selectedTime.value === "按季度统计") {
curChartData.value = val.quatarData curChartData.value = val.quatarData;
} else { } else {
curChartData.value = val.data curChartData.value = val.data;
} }
}) });
} };
// 时间图表 当前选择时间 // 时间图表 当前选择时间
const selectedTime = ref('按月统计') const selectedTime = ref("按月统计");
// 时间图表-时间列表 // 时间图表-时间列表
const timeList = ref([ const timeList = ref([
{ {
label: '按年度统计', label: "按年度统计",
value: '按年度统计' value: "按年度统计"
}, },
{ {
label: '按季度统计', label: "按季度统计",
value: '按季度统计' value: "按季度统计"
}, },
{ {
label: '按月度统计', label: "按月度统计",
value: '按月度统计' value: "按月度统计"
}, }
]) ]);
const handleChangeTime = value => { const handleChangeTime = value => {
let curChart = activeChart.value let curChart = activeChart.value;
activeChart.value = '' activeChart.value = "";
if (value === '按月度统计') { if (value === "按月度统计") {
setTimeout(() => { setTimeout(() => {
activeChart.value = curChart activeChart.value = curChart;
curChartData.value = staticsDemensionList.value[0].data curChartData.value = staticsDemensionList.value[0].data;
}) });
} else if (value === '按季度统计') { } else if (value === "按季度统计") {
setTimeout(() => { setTimeout(() => {
activeChart.value = curChart activeChart.value = curChart;
curChartData.value = staticsDemensionList.value[0].quatarData curChartData.value = staticsDemensionList.value[0].quatarData;
}) });
} else { } else {
setTimeout(() => { setTimeout(() => {
activeChart.value = curChart activeChart.value = curChart;
curChartData.value = staticsDemensionList.value[0].yearData curChartData.value = staticsDemensionList.value[0].yearData;
}) });
} }
} };
// 激活的标签列表 // 激活的标签列表
const activeTagList = computed(() => { const activeTagList = computed(() => {
const arr = [] const arr = [];
if (selectedArea.value && selectedArea.value !== '全部领域') { if (selectedArea.value && selectedArea.value !== "全部领域") {
arr.push( arr.push({
{ tag: "科技领域",
tag: '科技领域', name: selectedArea.value
name: selectedArea.value });
}
)
} }
if (selectedDate.value === '自定义') { if (selectedDate.value === "自定义") {
arr.push( arr.push({
{ tag: "发布时间",
tag: '发布时间', name: customTime.value.join("至")
name: customTime.value.join('至') });
}
)
} }
if (selectedThinkTank.value && selectedThinkTank.value !== '全部智库') { if (selectedThinkTank.value && selectedThinkTank.value !== "全部智库") {
arr.push( arr.push({
{ tag: "发布智库",
tag: '发布智库', name: selectedThinkTank.value
name: selectedThinkTank.value });
}
)
} }
if (reportName.value) { if (reportName.value) {
arr.push( arr.push({
{ tag: "报告名称",
tag: '报告名称', name: reportName.value
name: reportName.value });
}
)
} }
if (isInvolveCn.value) { if (isInvolveCn.value) {
const involveStr = '涉华' const involveStr = "涉华";
arr.push( arr.push({
{ tag: "是否涉华",
tag: '是否涉华', name: involveStr
name: involveStr });
}
)
} }
return arr return arr;
});
})
// 关闭当前标签 // 关闭当前标签
const handleCloseCurTag = (tag, index) => { const handleCloseCurTag = (tag, index) => {
switch (tag.tag) { switch (tag.tag) {
case '科技领域': case "科技领域":
selectedArea.value = '全部领域' selectedArea.value = "全部领域";
break break;
case '发布时间': case "发布时间":
selectedDate.value = '' selectedDate.value = "";
customTime.value = [] customTime.value = [];
break break;
case '发布智库': case "发布智库":
selectedThinkTank.value = '全部智库' selectedThinkTank.value = "全部智库";
break break;
case '报告名称': case "报告名称":
reportName.value = '' reportName.value = "";
break break;
case '是否涉华': case "是否涉华":
isInvolveCn.value = false isInvolveCn.value = false;
break break;
} }
};
} const activeChart = ref(""); // 当前激活的图表
const activeChart = ref('') // 当前激活的图表
// 切换当前图表 // 切换当前图表
const handleSwitchActiveChart = val => { const handleSwitchActiveChart = val => {
activeChart.value = val.name activeChart.value = val.name;
} };
// 雷达图数据 // 雷达图数据
const radarChartData = ref({ const radarChartData = ref({
title: [ title: [
{ {
name: '航空航天', name: "航空航天",
max: 10 max: 10
}, },
{ {
name: '先进制造', name: "先进制造",
max: 10 max: 10
}, },
{ {
name: '量子科技', name: "量子科技",
max: 10 max: 10
}, },
{ {
name: '人工智能', name: "人工智能",
max: 10 max: 10
}, },
{ {
name: '新材料', name: "新材料",
max: 10 max: 10
}, },
{ {
name: '集成电路', name: "集成电路",
max: 10 max: 10
}, }
], ],
data: [ data: [
{ {
name: "337调查", name: "337调查",
value: [10, 5, 2, 8, 5, 7 value: [10, 5, 2, 8, 5, 7]
]
}, },
{ {
name: "232调查", name: "232调查",
...@@ -440,151 +426,148 @@ const radarChartData = ref({ ...@@ -440,151 +426,148 @@ const radarChartData = ref({
value: [5, 8, 2, 9, 1, 5] value: [5, 8, 2, 9, 1, 5]
} }
] ]
} });
)
// 数据- 是否全选 // 数据- 是否全选
const isSelectedAll = ref(false) const isSelectedAll = ref(false);
// 批量操作-当前操作 // 批量操作-当前操作
const curOperation = ref('') const curOperation = ref("");
const operationList = ref([ const operationList = ref([
{ {
name: 'aaa', name: "aaa",
id: 'aaa' id: "aaa"
}, },
{ {
name: 'bbb', name: "bbb",
id: 'bbb' id: "bbb"
}, },
{ {
name: 'ccc', name: "ccc",
id: 'ccc' id: "ccc"
}, }
]) ]);
// 科技领域 // 科技领域
const areaPlaceHolder = ref('请选择领域') const areaPlaceHolder = ref("请选择领域");
const selectedArea = ref('全部领域') const selectedArea = ref("全部领域");
const areaList = ref([ const areaList = ref([
{ {
name: '全部领域', name: "全部领域",
id: '全部领域' id: "全部领域"
}, },
{ {
name: '人工智能', name: "人工智能",
id: '人工智能' id: "人工智能"
}, },
{ {
name: '生物科技', name: "生物科技",
id: '生物科技' id: "生物科技"
}, },
{ {
name: '新一代通信网络', name: "新一代通信网络",
id: '新一代通信网络' id: "新一代通信网络"
}, },
{ {
name: '量子科技', name: "量子科技",
id: '量子科技' id: "量子科技"
}, },
{ {
name: '新能源', name: "新能源",
id: '新能源' id: "新能源"
}, },
{ {
name: '集成电路', name: "集成电路",
id: '集成电路' id: "集成电路"
}, },
{ {
name: '海洋', name: "海洋",
id: '海洋' id: "海洋"
}, },
{ {
name: '先进制造', name: "先进制造",
id: '先进制造' id: "先进制造"
}, },
{ {
name: '新材料', name: "新材料",
id: '新材料' id: "新材料"
}, },
{ {
name: '航空航天', name: "航空航天",
id: '航空航天' id: "航空航天"
}, },
{ {
name: '太空', name: "太空",
id: '太空' id: "太空"
}, },
{ {
name: '深海', name: "深海",
id: '深海' id: "深海"
}, },
{ {
name: '极地', name: "极地",
id: '极地' id: "极地"
}, },
{ {
name: '核', name: "核",
id: '核' id: "核"
}, },
{ {
name: '其他', name: "其他",
id: '其他' id: "其他"
}, }
]) ]);
const handleSelectArea = (value) => { const handleSelectArea = value => {
selectedArea.value = value selectedArea.value = value;
} };
// 提出时间 // 提出时间
const DatePlaceHolder = ref('请选择时间') const DatePlaceHolder = ref("请选择时间");
const selectedDate = ref('') const selectedDate = ref("");
const dateList = ref([ const dateList = ref([
{ {
name: '自定义', name: "自定义",
id: '自定义' id: "自定义"
}, },
{ {
name: '近一年', name: "近一年",
id: '近一年' id: "近一年"
}, },
{ {
name: '近半年', name: "近半年",
id: '近半年' id: "近半年"
}, },
{ {
name: '近三月', name: "近三月",
id: '近三月' id: "近三月"
}, },
{ {
name: '近一月', name: "近一月",
id: '近一月' id: "近一月"
} }
]) ]);
const customTime = ref([]) // 自定义时间 const customTime = ref([]); // 自定义时间
const handleCustomDate = value => { const handleCustomDate = value => {
customTime.value = value customTime.value = value;
} };
const handleSelectDate = (value) => { const handleSelectDate = value => {
selectedDate.value = value selectedDate.value = value;
if (selectedDate.value !== '自定义') { if (selectedDate.value !== "自定义") {
customTime.value = getDateRange(selectedDate.value) customTime.value = getDateRange(selectedDate.value);
} }
} };
// 发布智库 // 发布智库
const thinkTankList = ref([ const thinkTankList = ref([
{ {
name: '全部智库', name: "全部智库",
id: '全部智库' id: "全部智库"
}, }
]) ]);
const selectedThinkTank = ref('全部智库') const selectedThinkTank = ref("全部智库");
const thinkTankPlaceHolder = ref('请选择发布智库') const thinkTankPlaceHolder = ref("请选择发布智库");
const handleSelectThinkTank = value => { const handleSelectThinkTank = value => {
selectedThinkTank.value = value selectedThinkTank.value = value;
} };
const handleGetThinkTankList = async () => { const handleGetThinkTankList = async () => {
try { try {
...@@ -594,65 +577,60 @@ const handleGetThinkTankList = async () => { ...@@ -594,65 +577,60 @@ const handleGetThinkTankList = async () => {
return { return {
name: item, name: item,
id: item id: item
} };
}) });
thinkTankList.value = [...thinkTankList.value, ...arr] thinkTankList.value = [...thinkTankList.value, ...arr];
} catch (error) { }
} catch (error) { };
}
}
// 作者 // 作者
const authorList = ref([ const authorList = ref([
{ {
name: '全部作者', name: "全部作者",
id: '全部作者' id: "全部作者"
}, }
]) ]);
const selectedAuthor = ref('暂无作者信息') const selectedAuthor = ref("暂无作者信息");
const authorPlaceHolder = ref('请选择发布智库') const authorPlaceHolder = ref("请选择发布智库");
const handleSelectAuthor = value => { const handleSelectAuthor = value => {
selectedAuthor.value = value selectedAuthor.value = value;
} };
// 报告名称列表 // 报告名称列表
const reportName = ref('') const reportName = ref("");
const handleInputReportName = (value) => { const handleInputReportName = value => {
reportName.value = value reportName.value = value;
} };
// 是否涉华 // 是否涉华
const isInvolveCn = ref(false) const isInvolveCn = ref(false);
// 清空条件 // 清空条件
const handleClear = () => { const handleClear = () => {
selectedArea.value = '全部领域' selectedArea.value = "全部领域";
selectedDate.value = '' selectedDate.value = "";
customTime.value = [] customTime.value = [];
selectedThinkTank.value = '全部智库' selectedThinkTank.value = "全部智库";
reportName.value = '' reportName.value = "";
isInvolveCn.value = false isInvolveCn.value = false;
ElMessage.success('已清空条件!') ElMessage.success("已清空条件!");
} };
// 确定 // 确定
const handleConfirm = () => { const handleConfirm = () => {
fetchTableData() fetchTableData();
} };
// 展开全部 / 收起 // 展开全部 / 收起
const isFolderAll = ref(false) const isFolderAll = ref(false);
const handleSwitchFolderAll = () => { const handleSwitchFolderAll = () => {
isFolderAll.value = !isFolderAll.value isFolderAll.value = !isFolderAll.value;
} };
const tableRef = ref(null) const tableRef = ref(null);
// 表格数据 // 表格数据
const tableData = ref([ const tableData = ref([]);
])
const releaseTimeList = ref([ const releaseTimeList = ref([
{ {
...@@ -666,17 +644,17 @@ const releaseTimeList = ref([ ...@@ -666,17 +644,17 @@ const releaseTimeList = ref([
]); ]);
const isSort = ref(true); // true 倒序 false 升序 const isSort = ref(true); // true 倒序 false 升序
const handlePxChange = val => { const handlePxChange = val => {
fetchTableData() fetchTableData();
}; };
const currentPage = ref(1); const currentPage = ref(1);
const pageSize = ref(10) const pageSize = ref(10);
// 存储选中的数据(跨页)[citation:3][citation:8] // 存储选中的数据(跨页)[citation:3][citation:8]
const selectedMap = ref(new Map()) // 使用 Map 存储,key 为唯一 id const selectedMap = ref(new Map()); // 使用 Map 存储,key 为唯一 id
// 计算已选中的条数 // 计算已选中的条数
const selectedCount = computed(() => selectedMap.value.size) const selectedCount = computed(() => selectedMap.value.size);
// 获取当前页表格数据(示例) // 获取当前页表格数据(示例)
const fetchTableData = async () => { const fetchTableData = async () => {
...@@ -686,326 +664,318 @@ const fetchTableData = async () => { ...@@ -686,326 +664,318 @@ const fetchTableData = async () => {
const params = { const params = {
page: currentPage.value, page: currentPage.value,
size: pageSize.value, size: pageSize.value,
keyword: '', // keyword: '',
type: 4, // type 1= 法案 2= 政令 3 =智库 4=智库报告 5=实体清单 6= 人物 7= 机构 8=新闻 9= 社媒 type: 4, // type 1= 法案 2= 政令 3 =智库 4=智库报告 5=实体清单 6= 人物 7= 机构 8=新闻 9= 社媒
domains: selectedArea.value === '全部领域' ? null : [selectedArea.value], // 领域 domains: selectedArea.value === "全部领域" ? null : [selectedArea.value], // 领域
proposedDateStart: customTime.value[0] ? customTime.value[0] : null, // 开始日期 proposedDateStart: customTime.value[0] ? customTime.value[0] : null, // 开始日期
proposedDateEnd: customTime.value[1] ? customTime.value[1] : null, // 结束日期 proposedDateEnd: customTime.value[1] ? customTime.value[1] : null, // 结束日期
organizationName: selectedThinkTank.value === '全部智库' ? null : selectedThinkTank.value, // 智库名称 organizationName: selectedThinkTank.value === "全部智库" ? null : selectedThinkTank.value, // 智库名称
reportNameZh: reportName.value? reportName.value : null, // 报告名称 reportNameZh: reportName.value ? reportName.value : null, // 报告名称
isInvolveCn: isInvolveCn.value ? 'Y' : null, // 是否涉华 isInvolveCn: isInvolveCn.value ? "Y" : null, // 是否涉华
sort: isSort.value ? 0 : 1 // 0 先按分数降序 后按时间降序 1 先按分数降序,再按时间升序 sort: isSort.value ? 0 : 1 // 0 先按分数降序 后按时间降序 1 先按分数降序,再按时间升序
} };
try { try {
const res = await search(params) const res = await search(params);
console.log('搜索结果', res); console.log("搜索结果", res);
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
tableData.value = res.data.records tableData.value = res.data.records;
totalNum.value = res.data.total totalNum.value = res.data.total;
staticsDemensionList.value[0].data = { staticsDemensionList.value[0].data = {
dataX: Object.keys(res.data.aggregationsDate), dataX: Object.keys(res.data.aggregationsDate),
dataY: Object.values(res.data.aggregationsDate).map(value => Number(value)) dataY: Object.values(res.data.aggregationsDate).map(value => Number(value))
} };
staticsDemensionList.value[0].quatarData = { staticsDemensionList.value[0].quatarData = {
dataX: Object.keys(res.data.aggregationsQuarter), dataX: Object.keys(res.data.aggregationsQuarter),
dataY: Object.values(res.data.aggregationsQuarter).map(value => Number(value)) dataY: Object.values(res.data.aggregationsQuarter).map(value => Number(value))
} };
staticsDemensionList.value[0].yearData = { staticsDemensionList.value[0].yearData = {
dataX: Object.keys(res.data.aggregationsYear), dataX: Object.keys(res.data.aggregationsYear),
dataY: Object.values(res.data.aggregationsYear).map(value => Number(value)) dataY: Object.values(res.data.aggregationsYear).map(value => Number(value))
} };
staticsDemensionList.value[1].data = Object.entries(res.data.aggregationsDomain).map(([key, value]) => ({ staticsDemensionList.value[1].data = Object.entries(res.data.aggregationsDomain).map(([key, value]) => ({
name: key, name: key,
value: Number(value) value: Number(value)
})) }));
staticsDemensionList.value[2].data = Object.entries(res.data.aggregationsorganizationName).map(([key, value]) => ({ staticsDemensionList.value[2].data = Object.entries(res.data.aggregationsorganizationName).map(([key, value]) => ({
name: key, name: key,
value: Number(value) value: Number(value)
})) }));
} }
const curDemensionItem = staticsDemensionList.value.filter(item => { const curDemensionItem = staticsDemensionList.value.filter(item => {
return item.name === curDemension.value return item.name === curDemension.value;
})[0] })[0];
activeChart.value = '' activeChart.value = "";
setTimeout(() => { setTimeout(() => {
activeChart.value = curDemensionItem.chartTypeList[0] activeChart.value = curDemensionItem.chartTypeList[0];
curChartData.value = curDemensionItem.data curChartData.value = curDemensionItem.data;
}) });
} catch (error) { } catch (error) { }
}
// tableData.value = res.data // tableData.value = res.data
// total.value = res.total // total.value = res.total
// 数据加载后,回显已选中的行 // 数据加载后,回显已选中的行
nextTick(() => { nextTick(() => {
tableData.value.forEach(row => { tableData.value.forEach(row => {
if (selectedMap.value.has(row.id)) { if (selectedMap.value.has(row.id)) {
tableRef.value?.toggleRowSelection(row, true) tableRef.value?.toggleRowSelection(row, true);
} }
}) });
}) });
} };
const allData = ref([]) const allData = ref([]);
// 获取筛选条件下全部表格数据 // 获取筛选条件下全部表格数据
const fetchAllData = async () => { const fetchAllData = async () => {
const params = { const params = {
page: 1, page: 1,
size: 9999, size: 9999,
keyword: '', // keyword: '',
type: 4, // type 1= 法案 2= 政令 3 =智库 4=智库报告 5=实体清单【制裁记录】 6= 人物 7= 机构 8=新闻 9= 社媒 type: 4, // type 1= 法案 2= 政令 3 =智库 4=智库报告 5=实体清单【制裁记录】 6= 人物 7= 机构 8=新闻 9= 社媒
domains: selectedArea.value === '全部领域' ? null : [selectedArea.value], domains: selectedArea.value === "全部领域" ? null : [selectedArea.value],
proposedDateStart: customTime.value[0], proposedDateStart: customTime.value[0],
proposedDateEnd: customTime.value[1], proposedDateEnd: customTime.value[1],
organizationName: selectedThinkTank.value === '全部智库' ? null : selectedThinkTank.value, organizationName: selectedThinkTank.value === "全部智库" ? null : selectedThinkTank.value,
reportNameZh: reportName.value? reportName.value : null, reportNameZh: reportName.value ? reportName.value : null,
isInvolveCn: isInvolveCn.value ? 'Y' : 'N', isInvolveCn: isInvolveCn.value ? "Y" : "N",
sort: isSort.value ? 0 : 1 sort: isSort.value ? 0 : 1
} };
try { try {
const res = await search(params) const res = await search(params);
console.log('搜索结果', res); console.log("搜索结果", res);
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
allData.value = res.data.records allData.value = res.data.records;
} }
} catch (error) { } catch (error) {
ElMessage.error('加载全部数据出错!') ElMessage.error("加载全部数据出错!");
} }
} };
// 单选事件 // 单选事件
const handleSelect = (selection, row) => { const handleSelect = (selection, row) => {
if (selection.some(item => item.id === row.id)) { if (selection.some(item => item.id === row.id)) {
// 选中:添加到 Map // 选中:添加到 Map
selectedMap.value.set(row.id, row) selectedMap.value.set(row.id, row);
} else { } else {
// 取消选中:从 Map 移除 // 取消选中:从 Map 移除
selectedMap.value.delete(row.id) selectedMap.value.delete(row.id);
} }
} };
// 表格自带 当前页 全选/全不选事件 // 表格自带 当前页 全选/全不选事件
const handleSelectAll = (selection) => { const handleSelectAll = selection => {
if (selection.length > 0) { if (selection.length > 0) {
// 全选:将当前页所有数据添加到 Map // 全选:将当前页所有数据添加到 Map
tableData.value.forEach(row => { tableData.value.forEach(row => {
if (!selectedMap.value.has(row.id)) { if (!selectedMap.value.has(row.id)) {
selectedMap.value.set(row.id, row) selectedMap.value.set(row.id, row);
} }
}) });
} else { } else {
// 全不选:从 Map 中移除当前页的所有数据 // 全不选:从 Map 中移除当前页的所有数据
tableData.value.forEach(row => { tableData.value.forEach(row => {
selectedMap.value.delete(row.id) selectedMap.value.delete(row.id);
}) });
} }
} };
// 处理选择变化(用于统计) // 处理选择变化(用于统计)
const handleSelectionChange = (val) => { const handleSelectionChange = val => {
// 这里可以做一些额外的处理,但主要统计使用 selectedMap // 这里可以做一些额外的处理,但主要统计使用 selectedMap
console.log('当前页选中数量:', val.length) console.log("当前页选中数量:", val.length);
} };
// 全选当前页按钮 // 全选当前页按钮
const handleSelectAllPage = () => { const handleSelectAllPage = () => {
if (tableData.value.length === 0) return if (tableData.value.length === 0) return;
// 检查当前页是否已全选 // 检查当前页是否已全选
const currentPageSelected = tableData.value.every(row => const currentPageSelected = tableData.value.every(row => selectedMap.value.has(row.id));
selectedMap.value.has(row.id)
)
if (currentPageSelected) { if (currentPageSelected) {
// 已全选,则不动当前页的全选 // 已全选,则不动当前页的全选
tableData.value.forEach(row => { tableData.value.forEach(row => {
tableRef.value.toggleRowSelection(row, false) tableRef.value.toggleRowSelection(row, false);
// selectedMap.value.delete(row.id) // selectedMap.value.delete(row.id)
}) });
} else { } else {
// 未全选,则全选当前页 // 未全选,则全选当前页
tableData.value.forEach(row => { tableData.value.forEach(row => {
tableRef.value.toggleRowSelection(row, true) tableRef.value.toggleRowSelection(row, true);
if (!selectedMap.value.has(row.id)) { if (!selectedMap.value.has(row.id)) {
selectedMap.value.set(row.id, row) selectedMap.value.set(row.id, row);
} }
}) });
} }
} };
// 全选最大1万条提示 // 全选最大1万条提示
const isShowAllDataMaxLengthTip = ref(false) const isShowAllDataMaxLengthTip = ref(false);
const loading = ref(false) // 加载数据loading const loading = ref(false); // 加载数据loading
// 处理 全选(全部数据) // 处理 全选(全部数据)
const handleSelectAllChange = async () => { const handleSelectAllChange = async () => {
if (isSelectedAll.value) { if (isSelectedAll.value) {
if (totalNum.value > 10000) { if (totalNum.value > 10000) {
isShowAllDataMaxLengthTip.value = true isShowAllDataMaxLengthTip.value = true;
} }
loading.value = true loading.value = true;
await fetchAllData() await fetchAllData();
handleSelectAllPage() handleSelectAllPage();
allData.value.forEach(row => { allData.value.forEach(row => {
if (!selectedMap.value.has(row.id)) { if (!selectedMap.value.has(row.id)) {
selectedMap.value.set(row.id, row) selectedMap.value.set(row.id, row);
} }
}) });
loading.value = false loading.value = false;
} else { } else {
handleClearAll() handleClearAll();
} }
};
}
// 清空所有选择 // 清空所有选择
const handleClearAll = () => { const handleClearAll = () => {
isSelectedAll.value = false isSelectedAll.value = false;
selectedMap.value.clear() selectedMap.value.clear();
tableRef.value?.clearSelection() tableRef.value?.clearSelection();
} };
// 翻页 // 翻页
const handleCurrentChange = async (val) => { const handleCurrentChange = async val => {
currentPage.value = val currentPage.value = val;
await fetchTableData() await fetchTableData();
if (isSelectedAll.value) { if (isSelectedAll.value) {
handleSelectAllPage() handleSelectAllPage();
} }
} };
// 监听数据变化,回显选中状态 [citation:4][citation:8] // 监听数据变化,回显选中状态 [citation:4][citation:8]
watch(tableData, () => { watch(tableData, () => {
nextTick(() => { nextTick(() => {
tableData.value.forEach(row => { tableData.value.forEach(row => {
if (selectedMap.value.has(row.id)) { if (selectedMap.value.has(row.id)) {
tableRef.value?.toggleRowSelection(row, true) tableRef.value?.toggleRowSelection(row, true);
} }
}) });
}) });
}) });
// 当前图表数据 // 当前图表数据
const curChartData = ref(null) const curChartData = ref(null);
// 下载当前图表数据 // 下载当前图表数据
const handleDownloadCurChartData = () => { const handleDownloadCurChartData = () => {
const jsonStr = JSON.stringify(curChartData.value, null, 2); const jsonStr = JSON.stringify(curChartData.value, null, 2);
const blob = new Blob([jsonStr], { type: 'application/json' }); const blob = new Blob([jsonStr], { type: "application/json" });
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
const link = document.createElement('a'); const link = document.createElement("a");
link.href = url; link.href = url;
link.download = 'chartData.json'; link.download = "chartData.json";
link.click(); link.click();
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
} };
// 跳转到当前页 初始化筛选条件 // 跳转到当前页 初始化筛选条件
const initParam = () => { const initParam = () => {
const hasQuery = Object.keys(route.query).length > 0; const hasQuery = Object.keys(route.query).length > 0;
if (hasQuery) { if (hasQuery) {
selectedArea.value = route.query.domains ? route.query.domains : '全部领域' selectedArea.value = route.query.domains ? route.query.domains : "全部领域";
if (route.query.selectedDate && Array.isArray(JSON.parse(route.query.selectedDate)) && JSON.parse(route.query.selectedDate).length) { if (
selectedDate.value = '自定义' route.query.selectedDate &&
customTime.value = JSON.parse(route.query.selectedDate) Array.isArray(JSON.parse(route.query.selectedDate)) &&
JSON.parse(route.query.selectedDate).length
) {
selectedDate.value = "自定义";
customTime.value = JSON.parse(route.query.selectedDate);
} }
selectedThinkTank.value = route.query.orgnizationName ? route.query.orgnizationName : '全部智库' selectedThinkTank.value = route.query.orgnizationName ? route.query.orgnizationName : "全部智库";
isInvolveCn.value = route.query.isInvolveCn ? true : false isInvolveCn.value = route.query.isInvolveCn ? true : false;
reportName.value = route.query.reportName ? route.query.reportName : "";
reportName.value = route.query.reportName ? route.query.reportName : ''
const query = route.query; const query = route.query;
if (Object.keys(query).length > 0) { if (Object.keys(query).length > 0) {
sessionStorage.setItem('thinktankRouteQuery', JSON.stringify(query)); sessionStorage.setItem("thinktankRouteQuery", JSON.stringify(query));
} }
} else { } else {
const savedQuery = JSON.parse(sessionStorage.getItem('thinktankRouteQuery') || '{}'); const savedQuery = JSON.parse(sessionStorage.getItem("thinktankRouteQuery") || "{}");
selectedArea.value = savedQuery.domains ? savedQuery.domains : '全部领域' selectedArea.value = savedQuery.domains ? savedQuery.domains : "全部领域";
if (savedQuery.selectedDate && Array.isArray(JSON.parse(savedQuery.selectedDate)) && JSON.parse(savedQuery.selectedDate).length) { if (
selectedDate.value = '自定义' savedQuery.selectedDate &&
customTime.value = JSON.parse(savedQuery.selectedDate) Array.isArray(JSON.parse(savedQuery.selectedDate)) &&
JSON.parse(savedQuery.selectedDate).length
) {
selectedDate.value = "自定义";
customTime.value = JSON.parse(savedQuery.selectedDate);
} }
isInvolveCn.value = savedQuery.isInvolveCn ? true : false isInvolveCn.value = savedQuery.isInvolveCn ? true : false;
reportName.value = savedQuery.reportName ? savedQuery.reportName : '' reportName.value = savedQuery.reportName ? savedQuery.reportName : "";
} }
};
}
// 跳转政令详情 // 跳转政令详情
const handleClickToDetail = (curDecree) => { const handleClickToDetail = curReport => {
console.log('curDecree', curDecree); console.log("curReport", curReport);
window.sessionStorage.setItem("billId", curDecree.id); window.sessionStorage.setItem("billId", curReport.id);
window.sessionStorage.setItem("curTabName", curDecree.title); window.sessionStorage.setItem("curTabName", curReport.title);
const route = router.resolve({ const route = router.resolve({
path: "/decreeLayout", name: "ReportDetail",
query: { params: {
billId: curDecree.id id: curReport.id
} }
}); });
window.open(route.href, "_blank"); window.open(route.href, "_blank");
}; };
// 跳转人物详情 // 跳转智库详情
const handlePerClick = item => { const handlePerClick = item => {
window.sessionStorage.setItem("curTabName", item.sponsorPersonName); const curRoute = router.resolve({
const route = router.resolve({ name: "ThinkTankDetail",
path: "/characterPage", params: {
query: { id: item.organizationId,
type: 2, name: item.organizationName
personId: item.personId
} }
}); });
window.open(route.href, "_blank"); window.open(curRoute.href, "_blank");
}; };
// 导出 // 导出
const handleExport = () => { const handleExport = () => {
if (!selectedCount.value) { if (!selectedCount.value) {
ElMessage.warning('请选择至少一项数据!') ElMessage.warning("请选择至少一项数据!");
return return;
} }
console.log(selectedMap.value); console.log(selectedMap.value);
const arr = Array.from(selectedMap.value); const arr = Array.from(selectedMap.value);
const jsonStr = JSON.stringify(arr, null, 2); const jsonStr = JSON.stringify(arr, null, 2);
const blob = new Blob([jsonStr], { type: 'application/json' }); const blob = new Blob([jsonStr], { type: "application/json" });
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
const link = document.createElement('a'); const link = document.createElement("a");
link.href = url; link.href = url;
link.download = 'export.json'; link.download = "export.json";
link.click(); link.click();
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
}; };
onMounted(async () => { onMounted(async () => {
handleGetThinkTankList() handleGetThinkTankList();
initParam() initParam();
// 初始化 // 初始化
await fetchTableData() await fetchTableData();
});
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -1055,7 +1025,6 @@ onMounted(async () => { ...@@ -1055,7 +1025,6 @@ onMounted(async () => {
} }
} }
.header-footer { .header-footer {
margin-top: 16px; margin-top: 16px;
display: flex; display: flex;
...@@ -1176,7 +1145,6 @@ onMounted(async () => { ...@@ -1176,7 +1145,6 @@ onMounted(async () => {
.header-left-item2 { .header-left-item2 {
color: var(--color-primary-100); color: var(--color-primary-100);
} }
.header-left-item3 { .header-left-item3 {
...@@ -1256,7 +1224,6 @@ onMounted(async () => { ...@@ -1256,7 +1224,6 @@ onMounted(async () => {
flex-wrap: wrap; flex-wrap: wrap;
gap: 8px; gap: 8px;
width: 340px; width: 340px;
} }
} }
...@@ -1285,12 +1252,9 @@ onMounted(async () => { ...@@ -1285,12 +1252,9 @@ onMounted(async () => {
} }
} }
:deep(.el-table__header-wrapper) { :deep(.el-table__header-wrapper) {
// background-color: #f5f7fa; // background-color: #f5f7fa;
height: 48px; height: 48px;
} }
:deep(.el-table__header th) { :deep(.el-table__header th) {
......
...@@ -42,7 +42,12 @@ ...@@ -42,7 +42,12 @@
<img :src="item.imgUrl || DefaultIcon2" alt="" /> <img :src="item.imgUrl || DefaultIcon2" alt="" />
</div> </div>
<div class="item-right one-line-ellipsis" @click="handleToInstitution(item)">{{ item.orgName }}</div> <div class="item-right one-line-ellipsis" @click="handleToInstitution(item)">{{ item.orgName }}</div>
<div class="item-total" @click="handleToDataLibrary(item)">{{ item.totalOrderNum }}</div> <el-popover content="跳转至数据资源库" placement="top">
<template #reference>
<div class="item-total" @click="handleToDataLibrary(item)">{{ item.totalOrderNum }}</div>
</template>
</el-popover>
<el-icon color="var(--color-primary-100)"> <el-icon color="var(--color-primary-100)">
<ArrowRightBold /> <ArrowRightBold />
</el-icon> </el-icon>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论