Browse Source

fix: 饼状图显示不对

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

Loading…
Cancel
Save