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

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

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