From 13ac4e9e272309065b4748b8502da799013a97e8 Mon Sep 17 00:00:00 2001 From: yaoyuhao Date: Wed, 14 Aug 2024 10:23:47 +0800 Subject: [PATCH] gx --- src/view/sy_map.vue | 126 ++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index 307fb53..b8177ba 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -232,7 +232,10 @@ import xcbg from "@/assets/images/map/xcbg.png"; import AED from "@/assets/images/map/AED.png"; import Dialog from "./dialog/dialogMapDp.vue"; import personDetail from "./person/index.vue"; +import { ElLoading } from "element-plus"; //--------定义参数------- +//加载 +var loading; //是否打开人物详情 const openD = ref(true); const message = ref({}); @@ -958,8 +961,14 @@ const buten = async (item) => { } } } else { - getData(item.age); - getDatas(cfJd.value, item.age); + loading = ElLoading.service({ + lock: true, + text: "加载中...", + background: "rgba(0, 0, 0, 0)", + }); + await getData(item.age); + await getDatas(cfJd.value, item.age); + loading.close(); } }; //点击特殊标签(关键字存name) @@ -996,6 +1005,11 @@ const buten2 = async (item) => { } } } else { + loading = ElLoading.service({ + lock: true, + text: "加载中...", + background: "rgba(0, 0, 0, 0)", + }); getDataBqs(cfJd.value, cfCs.value, item.id); } }; @@ -1420,7 +1434,8 @@ const getDataBq = async (jd, cs) => { }; const getDataBqs = async (jd, cs, bq) => { await getDataBqJD(bq); - getDataBqs2(cfJd.value, cfCs.value, bq); + await getDataBqs2(cfJd.value, cfCs.value, bq); + loading.close(); }; //特殊标签获取街道内部人数 const getDataBqs2 = async (jd, cs, bq) => { @@ -2269,21 +2284,31 @@ const addPolygonCounty = () => { }); map.addOverlay(polygon); - polygon.addEventListener("click", () => { + polygon.addEventListener("click", async () => { // townName.value = item.name; if (item.name == cfJd.value) { } else { + loading = ElLoading.service({ + lock: true, + text: "加载中...", + background: "rgba(0, 0, 0, 0)", + }); clear(); xkzDk.length = 0; cfJd.value = item.name; let jdCenter = []; - // if (item.name == "溪口镇") { BMAP(); loadCs(item.name); addPolygonCountyCs(); - getDataBq(cfJd.value, ""); + mapTownCount.map((itemm) => { + if (itemm.name == item.name) { + jdCenter = itemm.center; + } + }); + goMapCenter(jdCenter, 13); + await getDataBq(cfJd.value, ""); if (choose.value.person == "") { - getDatas(cfJd.value, ""); + await getDatas(cfJd.value, ""); } if ( choose.value.person == "残疾人" || @@ -2296,13 +2321,13 @@ const addPolygonCounty = () => { choose.value.person == "孤儿" || choose.value.person == "特困" ) { - getDataBqs2(cfJd.value, cfCs.value, choose.value.person); - getDatas(cfJd.value, "", false); + getDataBqs2(cfJd.value, cfCs.value, choose.value.person); + getDatas(cfJd.value, "", false); } else if (choose.value.person != "") { if (choose.value.person == "9999") { - getDatas(cfJd.value, ""); + await getDatas(cfJd.value, ""); } else { - getDatas(cfJd.value, choose.value.person); + await getDatas(cfJd.value, choose.value.person); } } if (title_jd.value == item.name) { @@ -2310,24 +2335,7 @@ const addPolygonCounty = () => { title_jd.value = item.name; } - mapTownCount.map((itemm) => { - if (itemm.name == item.name) { - jdCenter = itemm.center; - } - }); - goMapCenter(jdCenter, 13); - // } - // else { - // loadCs(item.name); - // addPolygonCountyCs(); - // // map.removeEventListener("click", markera); - // // if (currentMarker !== null) { - // // map.removeOverlay(currentMarker); - // // } - // // clear(); - // // getData(); - // // getDataBq(); - // } + loading.close(); } }); } @@ -2530,8 +2538,12 @@ const addPolygonCountyCs = () => { zIndex: 99, }); map.addOverlay(cs_qk_arr.value[index]); - cs_qk_arr.value[index].addEventListener("click", () => { - // console.log("名字", item.name); + cs_qk_arr.value[index].addEventListener("click", async () => { + loading = ElLoading.service({ + lock: true, + text: "数据加载中...", + background: "rgba(0, 0, 0, 0)", + }); cs_dd_arr.value = []; cfCs.value = item.name; title_cs.value = item.name; @@ -2551,6 +2563,8 @@ const addPolygonCountyCs = () => { unChooseList.value.push(itemm); } }); + addCsChoose(); + addCsUnChoose(); cs_qk_arr.value.forEach((item, index) => { map.removeOverlay(cs_qk_arr.value[index]); }); @@ -2560,7 +2574,7 @@ const addPolygonCountyCs = () => { cs_number_name_arr.value.forEach((item, index) => { map.removeOverlay(cs_number_name_arr.value[index]); }); - getDataBq(cfJd.value, cfCs.value); + await getDataBq(cfJd.value, cfCs.value); if ( choose.value.person == "残疾人" || choose.value.person == "低边" || @@ -2572,29 +2586,13 @@ const addPolygonCountyCs = () => { choose.value.person == "孤儿" || choose.value.person == "特困" ) { - getDataBqs3(cfJd.value, cfCs.value, choose.value.person); + await getDataBqs3(cfJd.value, cfCs.value, choose.value.person); } else { - // 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); - // } - getDatas2(cfJd.value, choose.value.person, cfCs.value); - // getDatas2(cfJd.value, choose.value.person, cfCs.value); - addCsChoose(); - addCsUnChoose(); - // if (choose.value.person == "") { - // cs_dd_arr.value.map((item, index) => { - // DGcreateCs(item, index); - // }); - // } else { - // cs_dd_arr.value.map((item, index) => { - // DGcreateCs2(item, index); - // }); - // } + + await getDatas2(cfJd.value, choose.value.person, cfCs.value); + + loading.close(); }); } }); @@ -2641,7 +2639,12 @@ const addCsUnChoose = () => { zIndex: 99, }); map.addOverlay(cs_un_choose_arr.value[index]); - cs_un_choose_arr.value[index].addEventListener("click", () => { + cs_un_choose_arr.value[index].addEventListener("click", async () => { + loading = ElLoading.service({ + lock: true, + text: "数据加载中...", + background: "rgba(0, 0, 0, 0)", + }); cfCs.value = item.name; title_cs.value = cfCs.value; sfdd.value = true; @@ -2671,11 +2674,10 @@ const addCsUnChoose = () => { unChooseList.value.push(itemm); } }); - - getDataBq(cfJd.value, cfCs.value); - - getDatas2(cfJd.value, choose.value.person, cfCs.value); - + addCsChoose(); + addCsUnChoose(); + await getDataBq(cfJd.value, cfCs.value); + await getDatas2(cfJd.value, choose.value.person, cfCs.value); if ( choose.value.person == "残疾人" || choose.value.person == "低边" || @@ -2687,11 +2689,9 @@ const addCsUnChoose = () => { choose.value.person == "孤儿" || choose.value.person == "特困" ) { - getDataBqs3(cfJd.value, cfCs.value, choose.value.person); + await getDataBqs3(cfJd.value, cfCs.value, choose.value.person); } - - addCsChoose(); - addCsUnChoose(); + loading.close(); }); } });