diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index 6394910..a73c3e0 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -33,7 +33,7 @@ class="content_item" v-for="(item, index) in tsbqTotal" :class="{ choose: item.id == choose.person }" - @click="changebq(item.id)" + @click="buten2(item)" :key="index" >
{{ item.name }}
@@ -517,6 +517,7 @@ const addPolygonCounty = () => { BMAP(); if (choose.value.person == 0) { getDatas("溪口镇", ""); + getDataBq(cfJd.value,'') } else { getDatas("溪口镇", choose.value.person); } @@ -2059,8 +2060,10 @@ const buten = async (item) => { getDatas("溪口镇", item.age); }; const buten2 = async (item) => { - getDataBq(item.id, item.age); + console.log(item.id); + // getDataBq(item.id, item.age); // getDatas("溪口镇", item.age); + getDataBqs(cfJd.value, cfCs.value, item.id); }; //获取人口数 const getData = async (i, e) => { @@ -2219,10 +2222,11 @@ const getDatas2 = async (e, i, cs) => { }); }; //获取特殊标签 -const getDataBq = async (i, e) => { +const getDataBq = async (jd, cs) => { await http - .get(`/api/ggfwyth/ysyzt/getTsbq?csq=${e || ""}&xzjd=${i || ""}`) + .get(`/api/ggfwyth/ysyzt/getTsbq?csq=${cs || ""}&xzjd=${jd || ""}`) .then((res) => { + console.log(66666666666); if (res.code == 200) { if (cfJd.value == "") { tsbqTotal.value.length = 0; @@ -2260,48 +2264,54 @@ const getDataBq = async (i, e) => { } }); }; -const getDataBqs= async(i,e,v)=>{ - await http - .get(`/api/ggfwyth/ysyzt/getTsbqByXzjdOrCsq?csq=${e || ""}&xzjd=${i || ""}&tsbq=${i || ""}`) - .then((res) => { - if (res.code == 200) { - if (cfJd.value == "") { - - 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; - } +const getDataBqs = async (jd, cs, bq) => { + let data = {}; + let vv = 0; + if (cs == "" && jd == "") { + data = { + tsbq: bq, + }; + vv = 1; + } else if (cs == "") { + data = { + xzjd: jd, + tsbq: bq, + }; + vv = 2; + } else { + data = { + xzjd: jd, + tsbq: bq, + csq: cs, + }; + vv = 3; + } + await http.get(`/api/ggfwyth/ysyzt/getTsbqByXzjdOrCsq`, data).then((res) => { + if (res.code == 200) { + // if (cfJd.value == "") { + // res.data.forEach((item, index) => { + // tsbqTotal.value.push({ + // id: index + 1, + // rksl: item.rksl, + // age: item.age + "", + // ages: item.age + "岁", + // }); + // }); + // } + if (vv == 1) { + mapTownCount.map((item) => { + item.number = 0; + res.data.map((items) => { + if (items.xzjd == item.name) { + item.number = items.rs; } - 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; - // } - // }); - // }); + }); + }); } - }); -} + changeRs(bq) + } + }); +}; const reset_font = () => { let width = document.documentElement.clientWidth || document.body.clientWidth; let height =