@@ -159,14 +159,14 @@
:pagination="pagination"
@close="close"
@handle="handlePagination"
- @openMessage="openMessage"
+ @openMessage="openMessage"
>
居住
未居住
-
{
};
//点击人口数
const buten = async (item) => {
- getData(item.id, item.age);
+ getData(item.age);
getDatas(cfJd.value, item.age);
};
//点击特殊标签
@@ -1113,7 +1112,8 @@ const buten2 = async (item) => {
getDataBqs(cfJd.value, cfCs.value, item.id);
};
//人口
-const getData = async (i, e) => {
+const getData = async (e) => {
+ let e1=e;
if (e == "9999") {
e = "";
}
@@ -1125,7 +1125,7 @@ const getData = async (i, e) => {
{
id: "9999",
ages: "总人口",
- age: "",
+ age: "9999",
value: "res.data.total",
},
{
@@ -1133,7 +1133,7 @@ const getData = async (i, e) => {
name: "近一年死亡",
value: "5650",
ages: "近一年死亡",
- age: "1000",
+ age: "6666",
percent: "",
},
];
@@ -1195,8 +1195,8 @@ const getData = async (i, e) => {
} catch (error) {
console.error("Error fetching data:", error);
}
- if (i) {
- changeRs(i);
+ if (e1) {
+ changeRs(e1);
}
};
const getDatas = async (e, i) => {
@@ -1211,33 +1211,64 @@ const getDatas = async (e, i) => {
} else if (cfJd.value !== "") {
personTotal.value = [
{
- id: "9999",
+ // id: "9999",
ages: "总人口",
- age: "",
+ age: "9999",
value: "res.data.total",
},
{
- id: "6666",
+ // id: "6666",
name: "近一年死亡",
value: "5650",
ages: "近一年死亡",
- age: "1000",
+ age: "6666",
percent: "",
},
];
+ let before_age = "";
personTotal.value[0].rksl = res.data.total;
personTotal.value[0].ages = "总人口";
personTotal.value[1].rksl = res.data.swrs;
personTotal.value[1].ages = "近一年死亡";
personTotal.value[1].percent = res.data.swrsPercent;
res.data.age.forEach((item, index) => {
- personTotal.value.push({
- id: index + 1,
- rksl: item.rksl,
- age: item.age + "",
- ages: item.age + "岁",
- percent: item.percent,
- });
+ 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 (cfJd.value != "") {
@@ -1346,17 +1377,18 @@ const getDatas2 = async (e, i, cs) => {
if (res.code == 200) {
personTotal.value = [
{
- id: "9999",
+ // id: "9999",
+ name: "总人口",
ages: "总人口",
- age: "",
+ age: "9999",
value: "res.data.total",
},
{
- id: "6666",
+ // id: "6666",
name: "近一年死亡",
value: "5650",
ages: "近一年死亡",
- age: "1000",
+ age: "6666",
},
];
personTotal.value[0].rksl = res.data.total;
@@ -1364,14 +1396,54 @@ const getDatas2 = async (e, i, cs) => {
personTotal.value[1].rksl = res.data.swrs;
personTotal.value[1].ages = "近一年死亡";
personTotal.value[1].percent = res.data.swrsPercent;
+ // res.data.age.forEach((item, index) => {
+ // personTotal.value.push({
+ // id: index + 1,
+ // rksl: item.rksl,
+ // age: item.age + "",
+ // ages: item.age + "岁",
+ // percent: item.percent,
+ // });
+ // });
+ let before_age = "";
res.data.age.forEach((item, index) => {
- personTotal.value.push({
- id: index + 1,
- rksl: item.rksl,
- age: item.age + "",
- ages: item.age + "岁",
- percent: item.percent,
- });
+ 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;
+ }
+ }
});
xkzCenter.map((item) => {
item.swrs = 0;
@@ -1722,11 +1794,12 @@ const to_jd = (item_name) => {
if (choose.value.person == "9999") {
getDatas(cfJd.value, "");
} else {
- if (choose.value.person == 1) {
- getDatas(cfJd.value, "0"); //0岁传字符串
- } else {
- getDatas(cfJd.value, choose.value.person - 1);
- }
+ // if (choose.value.person == 1) {
+ // getDatas(cfJd.value, "0"); //0岁传字符串
+ // } else {
+ // getDatas(cfJd.value, choose.value.person);
+ // }
+ getDatas(cfJd.value, choose.value.person);
}
}
// if (title_jd.value == item.name) {
@@ -1746,18 +1819,29 @@ const to_jd = (item_name) => {
//详情
const open_detail = () => {
let age = "";
+ // if (choose.value.person == "9999") {
+ // age = "";
+ // person_detail(age);
+ // dialogShow.value = true;
+ // } else if (choose.value.person == "6666") {
+ // age = "";
+ // } else if (choose.value.person == 1) {
+ // age = "0";
+ // person_detail(age);
+ // dialogShow.value = true;
+ // } else {
+ // age = choose.value.person - 1;
+ // person_detail(age);
+ // dialogShow.value = true;
+ // }
if (choose.value.person == "9999") {
age = "";
person_detail(age);
dialogShow.value = true;
} else if (choose.value.person == "6666") {
age = "";
- } else if (choose.value.person == 1) {
- age = "0";
- person_detail(age);
- dialogShow.value = true;
} else {
- age = choose.value.person - 1;
+ age = choose.value.person;
person_detail(age);
dialogShow.value = true;
}
@@ -1765,21 +1849,26 @@ const open_detail = () => {
const close = () => {
dialogShow.value = false;
pagination.total = 100;
-
- pagination.currentPage = 1;
};
//表格分页
const handlePagination = (current) => {
pagination.currentPage = current;
let age = "";
+ // if (choose.value.person == "9999") {
+ // age = "";
+ // } else if (choose.value.person == "6666") {
+ // age = "";
+ // } else if (choose.value.person == 1) {
+ // age = "0";
+ // } else {
+ // age = choose.value.person - 1;
+ // }
if (choose.value.person == "9999") {
age = "";
} else if (choose.value.person == "6666") {
age = "";
- } else if (choose.value.person == 1) {
- age = "0";
} else {
- age = choose.value.person - 1;
+ age = choose.value.person;
}
person_detail(age);
};
@@ -1796,7 +1885,7 @@ const closeDetail = () => {
openD.value = true;
window.removeEventListener('resize', reset_font2);
};
-//获取人口详情接口
+//获取人口列表接口
const person_detail = (age) => {
http
.get(
@@ -2140,11 +2229,13 @@ const addPolygonCounty = () => {
if (choose.value.person == "9999") {
getDatas(cfJd.value, "");
} else {
- if (choose.value.person == 1) {
- getDatas(cfJd.value, "0"); //0岁传字符串
- } else {
- getDatas(cfJd.value, choose.value.person - 1);
- }
+ // if (choose.value.person == 1) {
+ // getDatas(cfJd.value, "0"); //0岁传字符串
+ // } else {
+ // getDatas(cfJd.value, choose.value.person - 1);
+ // }
+
+ getDatas(cfJd.value, choose.value.person);
}
}
if (title_jd.value == item.name) {
@@ -2415,11 +2506,12 @@ const addPolygonCountyCs = () => {
// getDataBqs(cfJd.value, cfCs.value);
}
//这段注意
- if (choose.value.person == 1) {
- getDatas2(cfJd.value, "0", cfCs.value); //0岁传字符串
- } else {
- getDatas2(cfJd.value, choose.value.person - 1, cfCs.value);
- }
+ // if (choose.value.person == 1) {
+ // getDatas2(cfJd.value, "0", cfCs.value); //0岁传字符串
+ // } else {
+ // getDatas2(cfJd.value, choose.value.person - 1, cfCs.value);
+ // }
+ getDatas2(cfJd.value, choose.value.person, cfCs.value);
// getDatas2(cfJd.value, choose.value.person, cfCs.value);
addCsChoose();
addCsUnChoose();
@@ -2513,11 +2605,12 @@ const addCsUnChoose = () => {
// });
// getDataBqs(cfJd.value, cfCs.value);
getDataBq(cfJd.value, cfCs.value);
- if (choose.value.person == 1) {
- getDatas2(cfJd.value, "0", cfCs.value); //0岁传字符串
- } else {
- getDatas2(cfJd.value, choose.value.person - 1, cfCs.value);
- }
+ // if (choose.value.person == 1) {
+ // getDatas2(cfJd.value, "0", cfCs.value); //0岁传字符串
+ // } else {
+ // getDatas2(cfJd.value, choose.value.person - 1, cfCs.value);
+ // }
+ getDatas2(cfJd.value, choose.value.person, cfCs.value);
// getDatas2(cfJd.value, choose.value.person, cfCs.value);
// if (
// choose.value.person == "cjr" ||
@@ -2888,8 +2981,6 @@ const reset_font = () => {
}
};
const reset_font2 = () => {
- console.log(111111);
-
let width = document.documentElement.clientWidth || document.body.clientWidth;
let height =
document.documentElement.clientHeight || document.body.clientHeight;
@@ -2899,13 +2990,12 @@ const reset_font2 = () => {
"scale(" + width / 1920 + "," + height / 1080 + ")";
};
onMounted(() => {
- // tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
+ tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
reset_font();
initMap();
getData();
getDataBq();
BMAP();
-
});