This commit is contained in:
姚宇浩 2024-08-26 16:51:57 +08:00
parent 2051d49d98
commit 4bcc4eaf5d
2 changed files with 56 additions and 13 deletions

View File

@ -54,7 +54,6 @@
controls controls
playsinline playsinline
autoplay="autoplay" autoplay="autoplay"
style="width: 100%; height: auto;"
> >
<source :src="attachmentLink" type="application/x-mpegURL" /> <source :src="attachmentLink" type="application/x-mpegURL" />
</video> </video>

View File

@ -958,26 +958,33 @@ const setActiveStyle = (overlay) => {
overlay.setOptions(activeStyle); overlay.setOptions(activeStyle);
}; };
const clickHandler = (e) => { const clickHandler = (e) => {
console.log(5555, e); console.log(5555);
let target = polyLayer.pickOverlays(e.target); let target = polyLayer.pickOverlays(e.target);
if (target && target[0]) { if (target && target[0]) {
selectedOverlay = target[0]; selectedOverlay = target[0];
setActiveStyle(selectedOverlay); console.log("5-1", selectedOverlay);
movepoy.open(selectedOverlay); // nextTick(() => {
setActiveStyle(selectedOverlay);
movepoy.open(selectedOverlay);
// });
} else { } else {
console.log(888); console.log("5-2");
polyLayer.resetStyle(); polyLayer.resetStyle();
} }
}; };
//
const moveEdit = () => { const moveEdit = () => {
console.log(11111, cs_choose_arr.value[0]); console.log(11111, cs_choose_arr.value[0]);
map.removeEventListener("click", markera); map.removeEventListener("click", markera);
if (currentMarker !== null) { if (currentMarker !== null) {
map.removeOverlay(currentMarker); map.removeOverlay(currentMarker);
} }
// selectedOverlay = null;
// map.value = map; sceneMove = null;
movepoy = null;
select = null;
map.addGeoJSONLayer(polyLayer); map.addGeoJSONLayer(polyLayer);
polyLayer.addOverlay(cs_choose_arr.value[0]); polyLayer.addOverlay(cs_choose_arr.value[0]);
sceneMove = new DrawScene(map); sceneMove = new DrawScene(map);
@ -988,20 +995,24 @@ const moveEdit = () => {
type: DrawingType.DRAWING_POINT, type: DrawingType.DRAWING_POINT,
}); });
select.open(); select.open();
polyLayer.resetStyle();
sceneMove.addEventListener(OperateEventType.CLICK, clickHandler); sceneMove.addEventListener(OperateEventType.CLICK, clickHandler);
}; };
// //
const moveCancel = () => { const moveCancel = () => {
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
polyLayer.resetStyle();
cs_choose_arr.value.forEach((item, index) => { cs_choose_arr.value.forEach((item, index) => {
map.removeOverlay(cs_choose_arr.value[index]); map.removeOverlay(cs_choose_arr.value[index]);
}); });
addCsChoose(); addCsChoose();
polyLayer.resetStyle();
}; };
// //
const moveSave = () => { const moveSave = () => {
console.log(22222, cs_choose_arr.value[0]); console.log(22222, cs_choose_arr.value[0]);
// select.close(); // select.close();
// movepoy.close(selectedOverlay);
polyLayer.resetStyle();
arrJWD = [[[]]]; arrJWD = [[[]]];
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler); sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
cs_choose_arr.value[0].points.forEach((item, index) => { cs_choose_arr.value[0].points.forEach((item, index) => {
@ -1011,17 +1022,50 @@ const moveSave = () => {
arrJWD[0][0].push(arr1); arrJWD[0][0].push(arr1);
}); });
console.log("arrJWD", arrJWD); console.log("arrJWD", arrJWD);
saveDK();
moveDK();
}; };
// //退
const moveBack = () => { const moveBack = () => {
// select.close();
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
polyLayer.resetStyle(); polyLayer.resetStyle();
// cs_choose_arr.value.forEach((item, index) => {
// map.removeOverlay(cs_choose_arr.value[index]);
// });
// addCsChoose();
move_mode.value = false;
drawing.value = false;
};
//
const moveDK = async () => {
loadingss.value = true;
await http
.post(
`/api/ggfwyth/regionalDivision/edit?id=${
changeCsqkId.value
}&data=${JSON.stringify(arrJWD)}`
)
.then((res) => {
if (res.code == 200) {
ElMessage.success({
message: "保存成功",
});
}
});
await getCssj();
await loadCs(cfJd.value);
cs_choose_arr.value.forEach((item, index) => { cs_choose_arr.value.forEach((item, index) => {
map.removeOverlay(cs_choose_arr.value[index]); map.removeOverlay(cs_choose_arr.value[index]);
}); });
addCsChoose(); chooseCsList.value.length = 0;
move_mode.value = false; xkzDk.forEach((itemm, indexx) => {
drawing.value = false; if (itemm.name == cfCs.value) {
chooseCsList.value.push(itemm);
addCsChoose();
}
});
loadingss.value = false;
}; };
// //
const editmode = () => { const editmode = () => {