Browse Source

fix: 饼状图显示不对

master
buaixuexideshitongxue 22 hours ago
parent
commit
e9050167f5
  1. 25
      src/components/negativeInfo/depart-dialog.vue

25
src/components/negativeInfo/depart-dialog.vue

@ -47,7 +47,7 @@
<div class="problem-summary">
<div class="problem-total">
<span>问题总数</span>
<strong>{{ negativeInfo.size ?? 0 }}</strong>
<strong>{{ businessProblemTotal }}</strong>
</div>
<table class="business-table">
<thead><tr><th>业务类别</th><th>业务量</th><th>问题数</th></tr></thead>
@ -172,6 +172,11 @@ const departTitle = computed(() =>
[departInfo.value.parentName, departInfo.value.name].filter(Boolean).join(" / ") || "单位问题详情"
);
const negativeInfo = ref({});
const businessProblemTotal = computed(() =>
Number(negativeInfo.value.jcj110Size ?? 0)
+ Number(negativeInfo.value.jcj122Size ?? 0)
+ Number(negativeInfo.value.zfbaSize ?? 0)
);
const negativeList = ref([]);
@ -189,12 +194,15 @@ async function getProfileData() {
departInfo.value = data.departInfo;
negativeInfo.value = data.negativeInfo;
complaintCount.value = data.complaintCount ?? 0;
problemSourcesPieOptions.value.series[0].data = data.problemSourcesList;
problemSourcesPieOptions.value.title.text = String(data.negativeInfo.size ?? 0);
businessTypePieOptions.value.series[0].data = data.businessTypeList;
businessTypePieOptions.value.title.text = String(data.negativeInfo.size ?? 0);
problemTypePieOptions.value.series[0].data = data.problemTypeList;
problemTypePieOptions.value.title.text = String(data.negativeInfo.size ?? 0);
for (const [option, items] of [
[problemSourcesPieOptions, data.problemSourcesList],
[businessTypePieOptions, data.businessTypeList],
[problemTypePieOptions, data.problemTypeList],
]) {
const categories = items || [];
option.value.series[0].data = categories;
option.value.title.text = String(categories.reduce((total, item) => total + Number(item.value ?? 0), 0));
}
policeBarList.value = data.policeBarList;
policeLeadBarList.value = data.policeLeadBarList;
@ -291,10 +299,11 @@ const policeLeadBarList = ref([]);
for (const pieOption of [problemSourcesPieOptions, businessTypePieOptions, problemTypePieOptions]) {
Object.assign(pieOption.value, {
tooltip: { trigger: "item", formatter: "{b}<br/>数量:{c}<br/>占比:{d}%" },
color: ["#5B8FF9", "#5AD8A6", "#F6BD16", "#F6903D", "#6DC8EC"],
title: {
text: "0",
subtext: "问题总数",
subtext: "分类统计总数",
left: "30%",
top: "39%",
textAlign: "center",

Loading…
Cancel
Save