gxfor添加

This commit is contained in:
姚宇浩 2024-08-06 15:17:03 +08:00
parent 06c8c955b1
commit 2c42020acf
1 changed files with 50 additions and 15 deletions

View File

@ -1232,7 +1232,7 @@ const getDatas = async (e, i) => {
personTotal.value[1].ages = "近一年死亡"; personTotal.value[1].ages = "近一年死亡";
personTotal.value[1].percent = res.data.swrsPercent; personTotal.value[1].percent = res.data.swrsPercent;
res.data.age.forEach((item, index) => { res.data.age.forEach((item, index) => {
if (index == 0) { if (index == 0 && item.age == 0) {
personTotal.value.push({ personTotal.value.push({
rksl: item.rksl, rksl: item.rksl,
age: item.age + "", age: item.age + "",
@ -1240,7 +1240,6 @@ const getDatas = async (e, i) => {
percent: item.percent, percent: item.percent,
}); });
before_age = item.age; before_age = item.age;
console.log("执行111", before_age);
} else { } else {
if (item.age - before_age == 1) { if (item.age - before_age == 1) {
personTotal.value.push({ personTotal.value.push({
@ -1251,8 +1250,8 @@ const getDatas = async (e, i) => {
}); });
before_age = item.age; before_age = item.age;
} else { } else {
for (let i = 0; i < item.age - before_age - 1; i++) { for (let k = before_age; k < item.age - 1; k++) {
++before_age; before_age = before_age + 1;
personTotal.value.push({ personTotal.value.push({
rksl: 0, rksl: 0,
age: before_age + "", age: before_age + "",
@ -1407,7 +1406,44 @@ const getDatas2 = async (e, i, cs) => {
// }); // });
let before_age = ""; let before_age = "";
res.data.age.forEach((item, index) => { res.data.age.forEach((item, index) => {
if (index == 0) { // if (index == 0) {
// personTotal.value.push({
// rksl: item.rksl,
// age: item.age + "",
// ages: item.age + "",
// percent: item.percent,
// });
// before_age = item.age;
// console.log("111", before_age);
// } else {
// if (item.age - before_age == 1) {
// personTotal.value.push({
// rksl: item.rksl,
// age: item.age + "",
// ages: item.age + "",
// percent: item.percent,
// });
// before_age = item.age;
// } else {
// for (let i = 0; i < item.age - before_age - 1; i++) {
// ++before_age;
// personTotal.value.push({
// rksl: 0,
// age: before_age + "",
// ages: before_age + "",
// percent: 0.0,
// });
// }
// personTotal.value.push({
// rksl: item.rksl,
// age: item.age + "",
// ages: item.age + "",
// percent: item.percent,
// });
// before_age = item.age;
// }
// }
if (index == 0 && item.age == 0) {
personTotal.value.push({ personTotal.value.push({
rksl: item.rksl, rksl: item.rksl,
age: item.age + "", age: item.age + "",
@ -1415,7 +1451,6 @@ const getDatas2 = async (e, i, cs) => {
percent: item.percent, percent: item.percent,
}); });
before_age = item.age; before_age = item.age;
console.log("执行111", before_age);
} else { } else {
if (item.age - before_age == 1) { if (item.age - before_age == 1) {
personTotal.value.push({ personTotal.value.push({
@ -1426,8 +1461,8 @@ const getDatas2 = async (e, i, cs) => {
}); });
before_age = item.age; before_age = item.age;
} else { } else {
for (let i = 0; i < item.age - before_age - 1; i++) { for (let k = before_age; k < item.age - 1; k++) {
++before_age; before_age = before_age + 1;
personTotal.value.push({ personTotal.value.push({
rksl: 0, rksl: 0,
age: before_age + "", age: before_age + "",
@ -1878,12 +1913,12 @@ const openMessage = (e) => {
openD.value = false; openD.value = false;
reset_font2(); reset_font2();
// //
window.addEventListener('resize', reset_font2); window.addEventListener("resize", reset_font2);
}; };
// //
const closeDetail = () => { const closeDetail = () => {
openD.value = true; openD.value = true;
window.removeEventListener('resize', reset_font2); window.removeEventListener("resize", reset_font2);
}; };
// //
const person_detail = (age) => { const person_detail = (age) => {
@ -2990,7 +3025,7 @@ const reset_font2 = () => {
"scale(" + width / 1920 + "," + height / 1080 + ")"; "scale(" + width / 1920 + "," + height / 1080 + ")";
}; };
onMounted(() => { onMounted(() => {
tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d"); // tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
reset_font(); reset_font();
initMap(); initMap();
getData(); getData();