提交 49d4b995 authored 作者: 张伊明's avatar 张伊明

feat 接入议员合作关系接口 新增议员查询正序倒序按钮

style 优化议员合作关系列表样式
上级 a28f1990
......@@ -135,6 +135,16 @@ export function getBillsPerson(params, signal) {
})
}
// 获取议员合作关系
export function getBillsPersonRel(params, signal) {
return request({
method: 'GET',
url: `/api/BillOverview/billsPersonRel`,
params,
signal
})
}
// 获取提出部门列表
export function getPostOrgList() {
return request({
......
......@@ -560,31 +560,24 @@ const handleBox7Data = async () => {
try {
const res = await getBillPostOrg({ year: box7selectetedTime.value });
console.log("法案提出部门", res);
if (res.code === 200 && res.data && res.data.length > 0) {
const orgBillNumList = res?.data?.orgBillNumList || [];
const orgBillNumMap = res?.data?.orgBillNumMap || {};
if (res.code === 200 && Array.isArray(orgBillNumList) && orgBillNumList.length > 0) {
box7HasData.value = true;
// 必须等待DOM更新,因为v-if切换可能导致元素刚被创建
await nextTick();
const apiData = res.data;
const houseItems = apiData.filter(i => i.congressName === "House");
const senateItems = apiData.filter(i => i.congressName === "Senate");
const houseTotal = houseItems.reduce((sum, i) => sum + i.countBill, 0);
const senateTotal = senateItems.reduce((sum, i) => sum + i.countBill, 0);
const data1 = [];
if (houseItems.length > 0) {
data1.push({ name: "众议院", value: houseTotal });
}
if (senateItems.length > 0) {
data1.push({ name: "参议院", value: senateTotal });
}
const data2 = [...houseItems, ...senateItems].map(item => ({
name: item.originDepart,
value: item.countBill,
type: item.congressName === "House" ? "众议院" : "参议院"
const houseTotal = Number(orgBillNumMap?.H || 0);
const senateTotal = Number(orgBillNumMap?.S || 0);
if (houseTotal > 0) data1.push({ name: "众议院", value: houseTotal });
if (senateTotal > 0) data1.push({ name: "参议院", value: senateTotal });
const data2 = orgBillNumList.map(item => ({
name: item.orgName,
value: Number(item.count || 0),
percent: typeof item.percent === "number" ? item.percent : Number(item.percent || 0),
type: item.orgType === "S" ? "参议院" : "众议院"
}));
const box7Chart = getDoublePieChart(data1, data2);
......@@ -719,6 +712,14 @@ const box8MockDataByYear = {
};
const getBox8ChartOption = stageList => {
const truncateLabel = (value, maxLen = 6) => {
if (value === null || value === undefined) return "";
const str = String(value);
const chars = Array.from(str);
if (chars.length <= maxLen) return str;
return `${chars.slice(0, maxLen).join("")}...`;
};
const axisMax = 100;
const countList = stageList.map(item => item.count || 0);
const totalCount = countList.reduce((sum, cur) => sum + cur, 0);
......@@ -774,6 +775,7 @@ const getBox8ChartOption = stageList => {
axisTick: { show: false },
axisLine: { show: false },
axisLabel: {
formatter: value => truncateLabel(value, 6),
color: "#3b414b",
fontSize: 16
}
......@@ -2049,16 +2051,13 @@ onUnmounted(() => {
.box9-main {
height: 100%;
box-sizing: border-box;
}
.box5-main {
padding: 8px 16px;
padding: 8px 30px;
}
.box8-main {
height: 100%;
box-sizing: border-box;
padding: 12px 20px 18px;
padding: 12px 30px 18px;
.box8-desc {
height: 24px;
......@@ -2077,18 +2076,18 @@ onUnmounted(() => {
}
.box9-main {
padding: 10px 20px;
padding: 10px 30px;
}
}
}
.home-content-footer {
width: 100%;
height: 1740px;
min-height: 1740px;
background: rgba(248, 249, 250, 1);
margin-bottom: 20px;
overflow: hidden;
margin-top: 36px;
overflow: visible;
.divide4 {
margin: 0 auto;
......
const truncateLabel = (value, maxLen = 6) => {
if (value === null || value === undefined) return ''
const str = String(value)
const chars = Array.from(str)
if (chars.length <= maxLen) return str
return `${chars.slice(0, maxLen).join('')}...`
}
const getDoublePieChart = (data1, data2) => {
const colorList = ['#8AC4FF', '#FFD591']
const colorList1 = ['#055FC2', '#FFA940']
......@@ -42,7 +50,12 @@ const getDoublePieChart = (data1, data2) => {
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{time|{c} 条 {d}%}',
formatter: params => {
const name = truncateLabel(params?.name, 6)
const value = params?.value ?? 0
const percent = typeof params?.percent === 'number' ? params.percent : 0
return `{name|${name}}\n{time|${value}${percent}%}`
},
minMargin: 5,
edgeDistance: 10,
lineHeight: 20,
......@@ -82,6 +95,7 @@ const getDoublePieChart = (data1, data2) => {
return {
name: item.name,
value: item.value,
percent: item.percent,
itemStyle: {
color: item.type === '参议院' ? '#8AC4FF' : '#FFD591'
......
......@@ -68,8 +68,15 @@ const getMultiLineChart = (dataX, dataY1, dataY2, dataY3) => {
axisLabel: {
formatter: '{value}项',
color: '#666'
},
splitLine: {
show: true,
lineStyle: {
color: '#e7f3ff',
type: 'dashed',
}
},
},
{
type: 'value',
position: 'right',
......@@ -84,6 +91,7 @@ const getMultiLineChart = (dataX, dataY1, dataY2, dataY3) => {
show: true,
lineStyle: {
color: '#e7f3ff',
type: 'dashed',
}
},
}
......@@ -92,6 +100,7 @@ const getMultiLineChart = (dataX, dataY1, dataY2, dataY3) => {
{
name: '提出法案',
type: 'line',
smooth: true,
symbol: 'emptyCircle',
symbolSize: 6,
areaStyle: {
......@@ -111,6 +120,7 @@ const getMultiLineChart = (dataX, dataY1, dataY2, dataY3) => {
{
name: '通过法案',
type: 'line',
smooth: true,
symbol: 'emptyCircle',
symbolSize: 6,
areaStyle: {
......@@ -131,6 +141,7 @@ const getMultiLineChart = (dataX, dataY1, dataY2, dataY3) => {
name: '通过率',
type: 'line',
yAxisIndex: 1,
smooth: true,
symbol: 'emptyCircle',
symbolSize: 4,
lineStyle: {
......
const truncateLabel = (value, maxLen = 6) => {
if (value === null || value === undefined) return ''
const str = String(value)
const chars = Array.from(str)
if (chars.length <= maxLen) return str
return `${chars.slice(0, maxLen).join('')}...`
}
const getPieChart = (data, colorList) => {
let option = {
// color: colorList,
......@@ -14,7 +22,12 @@ const getPieChart = (data, colorList) => {
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{time|{c} 条 {d}%}',
formatter: params => {
const name = truncateLabel(params?.name, 6)
const value = params?.value ?? 0
const percent = typeof params?.percent === 'number' ? params.percent : 0
return `{name|${name}}\n{time|${value}${percent}%}`
},
minMargin: 5,
edgeDistance: 10,
lineHeight: 22,
......
......@@ -2,6 +2,14 @@ import "echarts-wordcloud";
const getWordCloudChart = (data = []) => {
const option = {
tooltip: {
show: true,
formatter: params => {
const name = params?.data?.fullName ?? params?.name ?? ''
const value = params?.value ?? ''
return `${name}${value !== '' ? `:${value}` : ''}`
},
},
grid: {
left: 0,
top: 0,
......@@ -57,7 +65,14 @@ const getWordCloudChart = (data = []) => {
},
},
// 设置词云数据
data: data,
data: (Array.isArray(data) ? data : []).map(item => {
const name = item?.name ?? ''
return {
...item,
fullName: name,
name,
}
}),
},
],
}
......
......@@ -228,10 +228,10 @@ const mainHeaderBtnList = ref([
const activeTitle = ref("法案概况");
const handleClickMainHeaderBtn = item => {
if (["影响分析", "相关情况"].includes(item.name)) {
ElMessage.warning("当前功能正在开发中,敬请期待!");
return;
}
// if (["影响分析", "相关情况"].includes(item.name)) {
// ElMessage.warning("当前功能正在开发中,敬请期待!");
// return;
// }
activeTitle.value = item.name;
window.sessionStorage.setItem("activeTitle", activeTitle.value);
router.push({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论