From 8992c743cf04c2d609301fc78c9454075f468584 Mon Sep 17 00:00:00 2001 From: duanxiaohai <1812246227@qq.com> Date: Fri, 28 Jun 2024 14:15:27 +0800 Subject: [PATCH] gx --- src/view/yl.vue | 55 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/src/view/yl.vue b/src/view/yl.vue index 02d6a3c..15075f0 100644 --- a/src/view/yl.vue +++ b/src/view/yl.vue @@ -161,12 +161,12 @@
男性总人数
-
2307303
+
{{ data.ylLnrkgk.rkzsman }}
女性总人数
-
230730
+
{{ data.ylLnrkgk.rkzswomen }}
@@ -480,19 +480,19 @@ const getTownDetail = () => { }; const btList = ref([ { - name: "60-70岁", + name: "61-70岁", value: ["17824", "17824", "17824"], }, { - name: "70-80岁", + name: "71-80岁", value: ["18742", "18742", "18742"], }, { - name: "80-90岁", + name: "81-90岁", value: ["3407", "3407", "3407"], }, { - name: "90-100岁", + name: "91-100岁", value: ["144", "144", "144"], }, { @@ -500,6 +500,13 @@ const btList = ref([ value: ["10", "10", "10"], }, ]); +const ageGroups = [ + { ageRange: "6170", index: 0 }, + { ageRange: "7180", index: 1 }, + { ageRange: "8190", index: 2 }, + { ageRange: "91100", index: 3 }, + { ageRange: "100", index: 4 }, +]; //扇形图颜色数据 const colorList = [ { color2: "#FFE35F" }, @@ -549,7 +556,23 @@ const data = reactive({ data: [{ nf: "2024", yf: "5", rq: "22", fwcs: "16", sc: "22" }], day: ["5.22"], }, + ylLnrkgk: { + rkzs: "390545", + rkzsman: "390545", + rkzswomen: "390545", + man6170: "28896", + man7180: "20001", + man8190: "5619", + man91100: "754", + man100: "8", + women6170: "28905", + women7180: "20835", + women8190: "5646", + women91100: "1155", + women100: "19", + }, }); + onBeforeMount(() => { getData(); }); @@ -600,6 +623,26 @@ const getData = () => { data.oldAgeTotal = res.data.lnrgnljzb.oldAgeTotal; data.rkgk = res.data.lnrgnljzb.rkgk; + // 更新 data.ylLnrkgk + data.ylLnrkgk = res.data.ylLnrkgk; + data.ylLnrkgk.rkzsman = ageGroups.reduce( + (acc, group) => acc + parseInt(data.ylLnrkgk[`man${group.ageRange}`]), + 0 + ); + data.ylLnrkgk.rkzswomen = ageGroups.reduce( + (acc, group) => acc + parseInt(data.ylLnrkgk[`women${group.ageRange}`]), + 0 + ); + + // 更新 btList + ageGroups.forEach((group) => { + const manCount = parseInt(data.ylLnrkgk[`man${group.ageRange}`]); + const womenCount = parseInt(data.ylLnrkgk[`women${group.ageRange}`]); + btList.value[group.index].value[0] = manCount + womenCount; + btList.value[group.index].value[1] = manCount; + btList.value[group.index].value[2] = womenCount; + }); + // 计划生育 res.data.familyPlanning.familyPlanningData.forEach((element) => { data.centerBottom1.push(element.jhsyrs); // 人次