Compare commits

...

3 Commits

Author SHA1 Message Date
姚宇浩 e34071d948 gx 2024-08-20 15:54:19 +08:00
姚宇浩 901611527e Merge branch 'main' of https://git.cityme.com.cn/xiangshan/ggfwjsc 2024-08-20 14:33:02 +08:00
姚宇浩 aa24dc255a gx 2024-08-20 14:32:52 +08:00
1 changed files with 78 additions and 35 deletions

View File

@ -154,9 +154,9 @@
</div>
</div>
</div>
<div class="btns">
<div class="btns" v-if="showEdit">
<div class="btnopen" @click="openEdit">编辑</div>
<div class="btnsave">保存</div>
<div class="btnsave" @click="saveEdit">保存</div>
<div class="btnclose" @click="closeEdit">取消</div>
</div>
@ -230,7 +230,7 @@ import http from "@/utils/request.js";
import mapTown from "@/assets/json/ly.json";
import { VideoCamera } from "@element-plus/icons-vue";
// import xkz from "@/assets/json/xkz.json";
import cssj from "@/assets/json/cssj.json";
// import cssj from "@/assets/json/cssj.json";
import j0 from "@/assets/images/map/j0.png";
import j1 from "@/assets/images/map/j1.png";
import j2 from "@/assets/images/map/j2.png";
@ -281,7 +281,11 @@ const cs_un_choose_arr = ref([]); //单点社区其他区块(灰色)
const cs_dd_arr = ref([]); //
//
const csqk = ref({});
// var cssj
var cssj;
//id
const changeCsqkId = ref("");
//
const showEdit = ref(false);
//
const title_choose = ref("");
const title_jd = ref("");
@ -804,8 +808,8 @@ const initMap = () => {
//
addJd();
};
const getCssj = () => {
http
const getCssj = async () => {
await http
.get("/api/ggfwyth/regionalDivision/getCsRegionalDivision")
.then((res) => {
if (res.code == 200) {
@ -813,42 +817,84 @@ const getCssj = () => {
}
});
};
//
var arrJWD = [[[]]];
var arr1;
var iii;
//bd09bd09
const bd09 = async (x, y, index) => {
iii=index;
const bd09 = (x, y) => {
var ggPoint = new BMapGL.Point(x, y);
var pointArr = [];
pointArr.push(ggPoint);
var convertor = new BMapGL.Convertor();
convertor.translate(pointArr, COORDINATES_BD09_MC, COORDINATES_BD09, (e) => {
arr1 = [];
let arr1 = [];
arr1.push(e.points[0].lng);
arr1.push(e.points[0].lat);
console.log("arr1", arr1);
arr1.push(iii);
arrJWD[0][0].push(arr1);
});
};
//
const openEdit = () => {
arrJWD = [[[]]];
cs_choose_arr.value[0].enableEditing();
console.log(cs_choose_arr.value[0]);
};
//
const closeEdit = () => {
//
const saveEdit = async () => {
cs_choose_arr.value[0].disableEditing();
console.log(cs_choose_arr.value[0]);
cs_choose_arr.value[0].points.forEach((item, index) => {
bd09(item.lng, item.lat, index);
});
for (const item of cs_choose_arr.value[0].points) {
if (item?.latLng) {
let arr1 = [];
arr1.push(item?.latLng.lng);
arr1.push(item?.latLng.lat);
arrJWD[0][0].push(arr1);
} else {
bd09(item.lng, item.lat);
//0.1convertor.translate
await new Promise((resolve) => setTimeout(resolve, 100));
}
}
console.log("arrJWD", arrJWD);
saveDK();
};
//
const closeEdit = async () => {
cs_choose_arr.value[0].disableEditing();
cs_choose_arr.value.forEach((item, index) => {
map.removeOverlay(cs_choose_arr.value[index]);
});
addCsChoose();
showEdit.value = false;
};
//
const saveDK = async () => {
await http
.post(
`/api/ggfwyth/regionalDivision/addCsManagerRegionalDivision?id=${
changeCsqkId.value
}&data=${JSON.stringify(arrJWD)}`
)
.then((res) => {
if (res.code == 200) {
ElMessage.success("编辑成功");
}
});
await getCssj();
await loadCs(cfJd.value);
cs_choose_arr.value.forEach((item, index) => {
map.removeOverlay(cs_choose_arr.value[index]);
});
chooseCsList.value.length = 0;
xkzDk.forEach((itemm, indexx) => {
if (itemm.name == cfCs.value) {
chooseCsList.value.push(itemm);
addCsChoose();
}
});
};
//
const csh = () => {
clear();
@ -2521,7 +2567,7 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
//------------------------------
//---------------------
//
const loadCs = (name) => {
const loadCs = async (name) => {
xkzCenter.length = 0;
xkzDk.length = 0;
cssj.forEach((item, index) => {
@ -2534,20 +2580,24 @@ const loadCs = (name) => {
for (let w in v.geometry.coordinates) {
if (v.geometry.coordinates[w][0].length < 60) continue;
xkzDk.push({
id: v.id,
name: v.properties.name,
point: v.geometry.coordinates[w],
});
}
xkzCenter.push({
id: v.id,
name: v.properties.name,
center: v.properties.center,
});
} else {
xkzDk.push({
id: v.id,
name: v.properties.name,
point: v.geometry.coordinates[0],
});
xkzCenter.push({
id: v.id,
name: v.properties.name,
center: v.properties.center,
});
@ -2649,18 +2699,6 @@ const addCsChoose = () => {
zIndex: 99,
});
map.addOverlay(cs_choose_arr.value[index]);
cs_choose_arr.value[index].addEventListener("click", (e) => {
console.log(4444444444, e);
// e.overlay
if (e.overlay && e.overlay.type === "Polygon") {
var vertices = e.overlay.getPath(); //
var coordinates = vertices.map(function (point) {
return { lng: point.lng, lat: point.lat };
});
console.log(coordinates); //
}
});
}
});
};
@ -2936,6 +2974,11 @@ const DGcreateCs = (polygon, indexx) => {
},
});
map.addOverlay(cs_dd_arr.value[indexx]);
cs_dd_arr.value[indexx].addEventListener("click", () => {
console.log(polygon.id);
changeCsqkId.value = polygon.id;
showEdit.value = !showEdit.value;
});
};
//(+)
const DGcreateCs2 = (polygon, indexx) => {
@ -3056,7 +3099,7 @@ onMounted(async () => {
getData();
BMAP();
getFwq();
// getCssj();
getCssj();
await getDataBq();
loadingss.value = false;
});
@ -3628,8 +3671,8 @@ onMounted(async () => {
z-index: 999;
position: absolute;
color: #ffffff;
top: 120px;
left: 600px;
top: 15%;
right: 30%;
display: flex;
cursor: pointer;
.btnopen {