From f8107a4e47a48c3a998ed08d3ee37bca3c7b2141 Mon Sep 17 00:00:00 2001 From: yaoyuhao Date: Thu, 25 Jul 2024 15:50:52 +0800 Subject: [PATCH] gx --- src/view/sy_map.vue | 191 ++++++++++++++++++++++++++------------------ 1 file changed, 112 insertions(+), 79 deletions(-) diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index 5afb118..6b6cddb 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -32,12 +32,12 @@
{{ item.name }}
-
{{ item.value }}
+
{{ item.rksl }}
@@ -133,7 +133,7 @@ import b6 from "@/assets/images/map/b6.png"; import xcbg from "@/assets/images/map/xcbg.png"; import http from "@/utils/request.js"; import AED from "@/assets/images/map/AED.png"; -//删除 +//删除(存放渲染的地块及图标) const jdm_arr = ref([]); const jdm_number_arr = ref([]); const fwq_list_arr = ref([]); @@ -143,10 +143,7 @@ const cs_number_name_arr = ref([]); const cs_choose_arr = ref([]); const cs_un_choose_arr = ref([]); const cs_dd_arr = ref([]); -//点击点 -const marker = ref([]); -// -const cfjiedao = ref(""); +//是否进入村社 const jrcs = ref(false); const title_choose = ref(""); //是否单点社区 @@ -186,6 +183,29 @@ const colorList = [ bg: "RGBA(27, 91, 55, 1)", }, ]; +//存放特殊标签中文对应的简写 +const tsbq_id_total = ref([ + { + name: "残疾人", + id: "cjr", + }, + { + name: "低边", + id: "dibian", + }, + { + name: "低保", + id: "db", + }, + { + name: "高血压", + id: "gxy", + }, + { + name: "糖尿病", + id: "tnb", + }, +]); //点击龙游县初始化 const csh = () => { xuanzhongCs.value = []; @@ -495,7 +515,6 @@ const addPolygonCounty = () => { let jdCenter = []; if (item.name == "溪口镇") { BMAP(); - console.log("cjhsbchjs vbchsj", choose.value.person); if (choose.value.person == 0) { getDatas("溪口镇", ""); } else { @@ -512,13 +531,11 @@ const addPolygonCounty = () => { jdCenter = item.center; } }); - console.log(jrcs.value); if (choose.value.person == "") { addCs(); } else { addCs2(); } - console.log("dbfjdsbfjds", choose.value.person); goMapCenter(jdCenter, 13); } else { map.removeEventListener("click", markera); @@ -653,7 +670,6 @@ const addPolygonCountyCs = () => { map.addOverlay(cs_qk_arr.value[index]); cs_qk_arr.value[index].addEventListener("click", () => { cfCs.value = item.name; - console.log("cfCs.value", cfCs.value); sfdd.value = true; xkzCenter.forEach((a, b) => { if (a.name == item.name) { @@ -690,8 +706,6 @@ const addPolygonCountyCs = () => { }); } getDatas2(cfJd.value, choose.value.person, cfCs.value); - console.log("chooseCsList.value", chooseCsList.value); - console.log("unChooseList.value", unChooseList.value); addCsChoose(); addCsUnChoose(); }); @@ -701,7 +715,6 @@ const addPolygonCountyCs = () => { //添加选中社区 const addCsChoose = () => { chooseCsList.value.map((item, index) => { - console.log("item11", item.name); sqname.value = item.name; let fillColor = "blue"; //地区的坐标范围 @@ -742,15 +755,13 @@ const addCsUnChoose = () => { }); map.addOverlay(cs_un_choose_arr.value[index]); cs_un_choose_arr.value[index].addEventListener("click", () => { - console.log(cfCs.value, cfCs.value.length); title_choose.value = title_choose.value.slice( 0, -(cfCs.value.length + 1) ); - console.log("删除后", title_choose.value); + cfCs.value = item.name; title_choose.value = title_choose.value + `>${cfCs.value}`; - console.log("添加后", title_choose.value); sfdd.value = true; @@ -784,7 +795,6 @@ const addCsUnChoose = () => { map.removeOverlay(cs_qk_arr.value[index]); }); if (choose.value.person == "") { - console.log(1111111111, cs_dd_arr.value); cs_dd_arr.value.map((item, index) => { DGcreateCs(item, index); }); @@ -915,7 +925,6 @@ const addCs = () => { //创建村社(人数,标签) const addCs2 = () => { xkzCenter.map((item, index) => { - // console.log("addCs2", item); createCs2(item, index); }); }; @@ -1036,7 +1045,6 @@ const createCs = (polygon, indexx) => { }; //添加单个村社 const DGcreateCs = (polygon, indexx) => { - console.log("ppppppppp", polygon); function createLabelDOM() { var content = document.createElement("div"); content.style.display = "flex"; @@ -1086,7 +1094,6 @@ const DGcreateCs = (polygon, indexx) => { type: "customOverlay", }, }); - console.log(cs_dd_arr.value); map.addOverlay(cs_dd_arr.value[indexx]); }; const DGcreateCs2 = (polygon, indexx) => { @@ -1268,74 +1275,40 @@ const choose = ref({ }); const changeRs = (id) => { if (choose.value.person == id) { - console.log("重复"); - // chooseArr.value = chooseArr.value.filter((item) => item !== "person"); choose.value.person = ""; jdm_number_arr.value.forEach((item, index) => { map.removeOverlay(jdm_number_arr.value[index]); }); - // if (cs_number_name_arr.value?.length) { - // cs_number_name_arr.value.forEach((item, index) => { - // map.removeOverlay(cs_number_name_arr.value[index]); - // }); - // cs_number_name_arr.value.length = 0; - // addCs(); - // } addJd(); - // if (chooseArr.value.includes("jd_number")) { - // removeAllPolygon("person"); - // xuanran(); - // loadCs(); - // addPolygonCountyCs(); - // addCs(); - // } else { - // removeAllPolygon("person"); - // xuanran(); - // addJd(); - // } } else { - // if(chooseArr.value.includes("jd_number")){ - // chooseArr.value = chooseArr.value.filter((item) => item !== "jd_number"); - // chooseArr.value.push("jd_noNumber"); - // } - // chooseArr.value.push("person"); - console.log("new"); - choose.value.person = id; - choose.value.bq = 9999; jdm_arr.value.forEach((item, index) => { map.removeOverlay(jdm_arr.value[index]); }); jdm_number_arr.value.forEach((item, index) => { map.removeOverlay(jdm_number_arr.value[index]); }); - addJd2(); - - // if (cs_name_arr.value?.length) { - // cs_name_arr.value.forEach((item, index) => { - // map.removeOverlay(cs_name_arr.value[index]); - // }); - // cs_name_arr.value.length = 0; - // addCs2(); - // } - // if (jdm_number_arr.value?.length) { - // jdm_number_arr.value.forEach((item, index) => { - // map.removeOverlay(jdm_number_arr.value[index]); - // }); - // jdm_number_arr.value.length = 0; - // } - // jdm_arr.value.forEach((item, index) => { - // map.removeOverlay(jdm_arr.value[index]); - // }); - - // removeAllPolygon("person"); - // xuanran(); } }; const changebq = (id) => { - choose.value.bq = id; - choose.value.person = ""; + if (choose.value.person == id) { + choose.value.person = ""; + jdm_number_arr.value.forEach((item, index) => { + map.removeOverlay(jdm_number_arr.value[index]); + }); + // addJd(); + } else { + choose.value.person = id; + jdm_arr.value.forEach((item, index) => { + map.removeOverlay(jdm_arr.value[index]); + }); + jdm_number_arr.value.forEach((item, index) => { + map.removeOverlay(jdm_number_arr.value[index]); + }); + // addJd2(); + } + // choose.value.person = id; }; const changeFwq = (id, list, center) => { if (choose.value.fwq == id) { @@ -2081,8 +2054,12 @@ const buten = async (item) => { getData(item.id, item.age); getDatas("溪口镇", item.age); }; +const buten2 = async (item) => { + getDataBq(item.id, item.age); + // getDatas("溪口镇", item.age); +}; +//获取人口数 const getData = async (i, e) => { - console.log("iiii", i); await http .get(`/api/ggfwyth/ysyzt/getXzjdrksl?age=${e || ""}`) .then((res) => { @@ -2163,7 +2140,7 @@ const getDatas = async (e, i) => { // }); // }); xkzCenter.map((item) => { - item.number=0; + item.number = 0; res.data.committee.map((items) => { if (items.committee == item.name) { item.number = items.rksl; @@ -2171,7 +2148,6 @@ const getDatas = async (e, i) => { }); }); - console.log(xkzCenter); cs_name_arr.value.forEach((item, index) => { map.removeOverlay(cs_name_arr.value[index]); }); @@ -2179,17 +2155,14 @@ const getDatas = async (e, i) => { map.removeOverlay(cs_number_name_arr.value[index]); }); - console.log(cs_dd_arr.value, "cs_dd_arr.value"); if (title_choose.value == "") { } else { if (sfdd.value) { - console.log("yyyy"); if (choose.value.person == "") { cs_dd_arr.value.forEach((item, index) => { map.removeOverlay(cs_dd_arr.value[index]); }); cs_dd_arr.value = [...xuanzhongCs.value]; - console.log("rrrrrrrrr", cs_dd_arr.value); cs_dd_arr.value.map((item, index) => { DGcreateCs(item, index); }); @@ -2198,7 +2171,6 @@ const getDatas = async (e, i) => { map.removeOverlay(cs_dd_arr.value[index]); }); cs_dd_arr.value = [...xuanzhongCs.value]; - console.log("rrrrriiii", cs_dd_arr.value); cs_dd_arr.value.map((item, index) => { DGcreateCs2(item, index); }); @@ -2242,6 +2214,66 @@ const getDatas2 = async (e, i, cs) => { } }); }; +//获取特殊标签 +const getDataBq = async (i, e) => { + await http + .get(`/api/ggfwyth/ysyzt/getTsbq?csq=${e || ""}&xzjd=${i || ""}`) + .then((res) => { + if (res.code == 200) { + if (cfJd.value == "") { + // personTotal.value = [ + // { + // id: "0", + // ages: "总人口", + // age: "", + // value: "res.data.total", + // }, + // ]; + // personTotal.value[0].rksl = res.data.total; + // personTotal.value[0].ages = "总人口"; + // res.data.age.forEach((item, index) => { + // personTotal.value.push({ + // id: index + 1, + // rksl: item.rksl, + // age: item.age + "", + // ages: item.age + "岁", + // }); + // }); + tsbqTotal.value.length = 0; + for (let name in res.data) { + let idd = ""; + for (let v = 0; v < tsbq_id_total.value.length; v++) { + if (tsbq_id_total.value[v].name == name) { + idd = tsbq_id_total.value[v].id; + } + } + tsbqTotal.value.push({ + id: idd, + name: name, + rksl: res.data[name], + }); + } + console.log(1111111111, tsbqTotal.value); + // res.data.forEach((item, index) => { + // tsbqTotal.value.push({ + // id: index + 1, + // rksl: item.rksl, + // age: item.age + "", + // ages: item.age + "岁", + // }); + // }); + } + // mapTownCount.map((item) => { + // item.number = 0; + // res.data.town.map((items) => { + // if (items.town == item.name) { + // item.number = items.rksl; + // } + // }); + // }); + } + }); +}; const reset_font = () => { let width = document.documentElement.clientWidth || document.body.clientWidth; let height = @@ -2262,6 +2294,7 @@ onMounted(() => { reset_font(); initMap(); getData(); + getDataBq(); BMAP(); });