This commit is contained in:
姚宇浩 2024-07-31 11:36:51 +08:00
parent 584700303b
commit 94a435ff34
3 changed files with 207036 additions and 107 deletions

206904
src/assets/json/cssj.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,14 +23,10 @@
:key="index" :key="index"
> >
<div class="content_item_name">{{ ageLess0(item.ages) }}</div> <div class="content_item_name">{{ ageLess0(item.ages) }}</div>
<div
class="content_item_bg"
v-if="index != 0 && index != 1"
></div>
<div class="content_item_value">
<div class="content_item_percent" v-if="item.ages != '总人口'"> <div class="content_item_percent" v-if="item.ages != '总人口'">
{{ item.percent }}% ({{ item.percent }}%)
</div> </div>
<div class="content_item_value">
{{ item.rksl }} {{ item.rksl }}
</div> </div>
</div> </div>
@ -120,7 +116,8 @@ import tools from "@/utils/tools";
import initializeMap from "@/utils/mapInitializer.js"; import initializeMap from "@/utils/mapInitializer.js";
import http from "@/utils/request.js"; import http from "@/utils/request.js";
import mapTown from "@/assets/json/ly.json"; import mapTown from "@/assets/json/ly.json";
import xkz from "@/assets/json/xkz.json"; // import xkz from "@/assets/json/xkz.json";
import cssj from "@/assets/json/cssj.json";
import j0 from "@/assets/images/map/j0.png"; import j0 from "@/assets/images/map/j0.png";
import j1 from "@/assets/images/map/j1.png"; import j1 from "@/assets/images/map/j1.png";
import j2 from "@/assets/images/map/j2.png"; import j2 from "@/assets/images/map/j2.png";
@ -158,6 +155,8 @@ const cs_number_name_arr = ref([]); //社区名(+数量)
const cs_choose_arr = ref([]); //() const cs_choose_arr = ref([]); //()
const cs_un_choose_arr = ref([]); //() const cs_un_choose_arr = ref([]); //()
const cs_dd_arr = ref([]); // const cs_dd_arr = ref([]); //
//
const csqk = ref({});
// //
const title_choose = ref(""); const title_choose = ref("");
const title_jd = ref(""); const title_jd = ref("");
@ -833,7 +832,7 @@ const initMap = () => {
// //
const csh = () => { const csh = () => {
clear(); clear();
xkzDk.length = 0;
map.removeEventListener("click", markera); map.removeEventListener("click", markera);
if (currentMarker !== null) { if (currentMarker !== null) {
map.removeOverlay(currentMarker); map.removeOverlay(currentMarker);
@ -851,6 +850,7 @@ const clear = () => {
title_cs.value = ""; title_cs.value = "";
cfJd.value = ""; cfJd.value = "";
cfCs.value = ""; cfCs.value = "";
cs_un_choose_arr.value.forEach((item, index) => { cs_un_choose_arr.value.forEach((item, index) => {
map.removeOverlay(cs_un_choose_arr.value[index]); map.removeOverlay(cs_un_choose_arr.value[index]);
}); });
@ -912,7 +912,7 @@ const markera = (e) => {
// //
const buten = async (item) => { const buten = async (item) => {
getData(item.id, item.age); getData(item.id, item.age);
getDatas("溪口镇", item.age); getDatas(cfJd.value, item.age);
}; };
// //
const buten2 = async (item) => { const buten2 = async (item) => {
@ -1023,6 +1023,7 @@ const getDatas = async (e, i) => {
}); });
}); });
} }
if (cfJd.value != "") {
xkzCenter.map((item) => { xkzCenter.map((item) => {
// item.number = 0; // item.number = 0;
res.data.committeeSwrs.map((items) => { res.data.committeeSwrs.map((items) => {
@ -1040,6 +1041,7 @@ const getDatas = async (e, i) => {
} }
}); });
}); });
}
cs_name_arr.value.forEach((item, index) => { cs_name_arr.value.forEach((item, index) => {
map.removeOverlay(cs_name_arr.value[index]); map.removeOverlay(cs_name_arr.value[index]);
@ -1072,7 +1074,6 @@ const getDatas = async (e, i) => {
}); });
} }
} else { } else {
console.log("hhhhh", xkzCenter);
if (choose.value.person == "") { if (choose.value.person == "") {
addCs(); addCs();
} else { } else {
@ -1208,6 +1209,7 @@ const getDataBqs2 = async (jd, cs, bq, f = true) => {
} }
await http.get(`/api/ggfwyth/ysyzt/getTsbqByXzjdOrCsq`, data).then((res) => { await http.get(`/api/ggfwyth/ysyzt/getTsbqByXzjdOrCsq`, data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (cfJd.value != "") {
xkzCenter.map((item) => { xkzCenter.map((item) => {
item.numbers = 0; item.numbers = 0;
res.data.map((items) => { res.data.map((items) => {
@ -1216,6 +1218,8 @@ const getDataBqs2 = async (jd, cs, bq, f = true) => {
} }
}); });
}); });
}
if (f) { if (f) {
changeRs2(bq); changeRs2(bq);
} }
@ -1250,7 +1254,6 @@ const getDataBqs2 = async (jd, cs, bq, f = true) => {
}); });
} }
} else { } else {
// console.log("hhhhh", xkzCenter);
if (choose.value.person == "") { if (choose.value.person == "") {
addCs(); addCs();
} else { } else {
@ -1364,7 +1367,7 @@ const to_jd = (item_name) => {
} }
} }
} }
loadCs(); loadCs(item_name);
addPolygonCountyCs(); addPolygonCountyCs();
mapTownCount.map((item) => { mapTownCount.map((item) => {
if (item.name == item_name) { if (item.name == item_name) {
@ -1593,6 +1596,7 @@ const loadTown = () => {
}); });
} }
} else { } else {
console.log("长度超过60");
mapTownDataDK.push({ mapTownDataDK.push({
name: v.properties.name, name: v.properties.name,
point: v.geometry.coordinates[0], point: v.geometry.coordinates[0],
@ -1626,15 +1630,21 @@ const addPolygonCounty = () => {
// townName.value = item.name; // townName.value = item.name;
if (item.name == cfJd.value) { if (item.name == cfJd.value) {
} else { } else {
// cs_qk_arr.value.forEach((item, index) => {
// map.removeOverlay(cs_qk_arr.value[index]);
// });
// cs_qk_arr.value.length=0;
clear();
xkzDk.length = 0;
cfJd.value = item.name; cfJd.value = item.name;
let jdCenter = []; let jdCenter = [];
if (item.name == "溪口镇") { // if (item.name == "") {
console.log(444444444, choose.value.person);
BMAP(); BMAP();
loadCs(item.name);
addPolygonCountyCs();
getDataBq(cfJd.value, ""); getDataBq(cfJd.value, "");
if (choose.value.person == "") { if (choose.value.person == "") {
getDatas("溪口镇", ""); getDatas(cfJd.value, "");
} }
if ( if (
choose.value.person == "cjr" || choose.value.person == "cjr" ||
@ -1646,15 +1656,15 @@ const addPolygonCounty = () => {
choose.value.person == "kjer" choose.value.person == "kjer"
) { ) {
getDataBqs2(cfJd.value, cfCs.value, choose.value.person, false); getDataBqs2(cfJd.value, cfCs.value, choose.value.person, false);
getDatas("溪口镇", ""); getDatas(cfJd.value, "");
} else if (choose.value.person != "") { } else if (choose.value.person != "") {
if (choose.value.person == "9999") { if (choose.value.person == "9999") {
getDatas("溪口镇", ""); getDatas(cfJd.value, "");
} else { } else {
if (choose.value.person == 1) { if (choose.value.person == 1) {
getDatas("溪口镇", "0"); //0 getDatas(cfJd.value, "0"); //0
} else { } else {
getDatas("溪口镇", choose.value.person - 1); getDatas(cfJd.value, choose.value.person - 1);
} }
} }
} }
@ -1663,23 +1673,24 @@ const addPolygonCounty = () => {
title_jd.value = item.name; title_jd.value = item.name;
} }
loadCs(); mapTownCount.map((itemm) => {
addPolygonCountyCs(); if (itemm.name == item.name) {
mapTownCount.map((item) => { jdCenter = itemm.center;
if (item.name == "溪口镇") {
jdCenter = item.center;
} }
}); });
goMapCenter(jdCenter, 13); goMapCenter(jdCenter, 13);
} else { // }
map.removeEventListener("click", markera); // else {
if (currentMarker !== null) { // loadCs(item.name);
map.removeOverlay(currentMarker); // addPolygonCountyCs();
} // // map.removeEventListener("click", markera);
clear(); // // if (currentMarker !== null) {
getData(); // // map.removeOverlay(currentMarker);
getDataBq(); // // }
} // // clear();
// // getData();
// // getDataBq();
// }
} }
}); });
} }
@ -1828,26 +1839,41 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
//------------------------------ //------------------------------
//--------------------- //---------------------
// //
const loadCs = () => { const loadCs = (name) => {
for (let v of xkz.features) { xkzCenter.length = 0;
cssj.forEach((item, index) => {
if (item.name == name) {
csqk.value = item.sj;
}
});
for (let v of csqk.value.features) {
if (v.geometry.coordinates.length > 1) { if (v.geometry.coordinates.length > 1) {
for (let w in v.geometry.coordinates) { for (let w in v.geometry.coordinates) {
if (v.geometry.coordinates[w][0].length < 60) continue; if (v.geometry.coordinates[w][0].length < 60) continue;
xkzDk.push({ xkzDk.push({
name: v.properties.name, name: v.properties.name,
point: v.geometry.coordinates[w][0], point: v.geometry.coordinates[w],
}); });
} }
xkzCenter.push({
name: v.properties.name,
center: [119.2002156322304, 28.83866363229786],
});
} else { } else {
xkzDk.push({ xkzDk.push({
name: v.properties.name, name: v.properties.name,
point: v.geometry.coordinates[0], point: v.geometry.coordinates[0],
}); });
xkzCenter.push({
name: v.properties.name,
center: [119.2002156322304, 28.83866363229786],
});
} }
} }
}; };
// //
const addPolygonCountyCs = () => { const addPolygonCountyCs = () => {
console.log(11111111111111,xkzDk);
xkzDk.map((item, index) => { xkzDk.map((item, index) => {
let num = index % 9; let num = index % 9;
let fillColor = colorList[num].bg; let fillColor = colorList[num].bg;
@ -2336,7 +2362,7 @@ const reset_font = () => {
} }
}; };
onMounted(() => { onMounted(() => {
// tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d"); tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
reset_font(); reset_font();
initMap(); initMap();
getData(); getData();
@ -2409,7 +2435,7 @@ onMounted(() => {
justify-content: space-between; justify-content: space-between;
padding: 18px; padding: 18px;
padding-left: 24px; padding-left: 24px;
padding-right: 5px; // padding-right: 5px;
width: 48%; width: 48%;
position: relative; position: relative;
// height: 57px; // height: 57px;
@ -2419,15 +2445,15 @@ onMounted(() => {
margin-bottom: 12px; margin-bottom: 12px;
font-size: 18px; font-size: 18px;
} }
.content_item_bg { // .content_item_bg {
position: absolute; // position: absolute;
top: 0; // top: 0;
left: 0; // left: 0;
width: 40%; // width: 40%;
height: 100%; // height: 100%;
background: RGBA(53, 85, 114, 0.8); // background: RGBA(53, 85, 114, 0.8);
z-index: -1; // z-index: -1;
} // }
.content_item:first-child { .content_item:first-child {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
@ -2473,13 +2499,12 @@ onMounted(() => {
top: 7.5px; top: 7.5px;
left: -13px; left: -13px;
} }
.content_item_value {
display: flex;
.content_item_percent { .content_item_percent {
margin-right: 5px;
color: #6bfeff; color: #6bfeff;
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5); text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
} }
.content_item_value {
// display: flex;
} }
.choose { .choose {

View File

@ -15,8 +15,8 @@ export default defineConfig({
// 第一个代理 // 第一个代理
"/api": { "/api": {
// 匹配到啥来进行方向代理 // 匹配到啥来进行方向代理
target: "http://192.168.2.17:8095/", //刘进 // target: "http://192.168.2.17:8095/", //刘进
// target: "http://220.191.238.50:996/", //线上 target: "http://220.191.238.50:996/", //线上
changeOrigin: true, //是否支持跨域 changeOrigin: true, //是否支持跨域
//rewrite: (path) => path.replace(/^\/api/, '') // 如果不需要api 直接把路径上的api 替换成空,这个 //rewrite: (path) => path.replace(/^\/api/, '') // 如果不需要api 直接把路径上的api 替换成空,这个
}, },