diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index 08d2a62..a7b5466 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -1180,6 +1180,8 @@ const getCssj = async () => { .then((res) => { if (res.code == 200) { cssj = JSON.parse(res.data); + console.log(1111111111,cssj); + } }); }; @@ -2968,9 +2970,9 @@ const zyys_data = ref({ //资源要素(学校,医院)获取对应街道村社 const zyysCenter = reactive([]); const zyysDk = reactive([]); -const loadCs_zyys = async (name) => { +const loadCs_zyys = async (jdname) => { cssj.forEach((item, index) => { - if (item.name == name) { + if (item.name == jdname) { csqk.value = item.sj; } }); @@ -2998,6 +3000,7 @@ const loadCs_zyys = async (name) => { zyysCenter.push({ id: v.id, name: v.properties.name, + jdname:jdname, center: v.properties.center, }); } @@ -3017,9 +3020,11 @@ const get_dk_zyys = async (sj, xd, ssly) => { zyys_jd.forEach((item) => { loadCs_zyys(item); }); - sj.forEach((item, index) => { - zyysDk.forEach((dk) => { + zyysDk.forEach((dk) => { + let pdK = true; //判断sj有没有对应地块,没有就赋值0 + sj.forEach((item, index) => { if (item.committee == dk.name) { + pdK = false; let a = { ...dk, zt: item.zt, @@ -3027,8 +3032,19 @@ const get_dk_zyys = async (sj, xd, ssly) => { zyys_data.value.point.push(a); } }); - zyysCenter.forEach((center) => { + if (pdK) { + let a = { + ...dk, + zt: 0, + }; + zyys_data.value.point.push(a); + } + }); + zyysCenter.forEach((center) => { + let pdK = true; //判断sj有没有对应地块,没有就赋值0 + sj.forEach((item, index) => { if (item.committee == center.name) { + pdK = false; let b = { ...center, num: item.num, @@ -3040,7 +3056,42 @@ const get_dk_zyys = async (sj, xd, ssly) => { zyys_data.value.center.push(b); } }); + if (pdK) { + let b = { + ...center, + num: 0, + town: center.jdname, + committee: center.name, + ssly: ssly, + xd: xd, + }; + zyys_data.value.center.push(b); + } }); + // sj.forEach((item, index) => { + // zyysDk.forEach((dk) => { + // if (item.committee == dk.name) { + // let a = { + // ...dk, + // zt: item.zt, + // }; + // zyys_data.value.point.push(a); + // } + // }); + // zyysCenter.forEach((center) => { + // if (item.committee == center.name) { + // let b = { + // ...center, + // num: item.num, + // town: item.town, + // committee: item.committee, + // ssly: ssly, + // xd: xd, + // }; + // zyys_data.value.center.push(b); + // } + // }); + // }); }; //资源要素(渲染地块) const xr_dk_center_zyys = async () => { @@ -3097,7 +3148,8 @@ const Xr_zyysNum = (polygon, indexx) => { div.style.minWidth = "60px"; div.style.borderRadius = "12px"; // div.style.background = `url(${xcbg}) no-repeat 0/100% 100%`; - div.style.background = "linear-gradient(90deg, rgba(146,151,217,1) 0%, rgba(236,236,236,1) 100%)"; + div.style.background = + "linear-gradient(90deg, rgba(146,151,217,1) 0%, rgba(236,236,236,1) 100%)"; div.style.transform = "translate(50px, 26px)"; // div.style.transform = "translateY(50px)"; div.setAttribute("name", this.properties.title);