清除图层

This commit is contained in:
刘旋 2023-04-21 10:51:12 +08:00
parent 1d132e13bf
commit e723d17969
3 changed files with 15 additions and 13 deletions

View File

@ -66,6 +66,7 @@ export const useVariableStore = defineStore(Names.TEST, {
size:null,
pages:null,
},
wktdata:null,
}
},

View File

@ -5,7 +5,7 @@ import { Session } from '/@/utils/storage';
// export const moduleName = 'zqq-biz-vordm';
export const moduleName = 'yyhouc-biz-vordm';
// export const moduleName = 'glj-biz-vordm';
// 配置新建一个 axios 实例
const service = axios.create({
//baseURL: import.meta.env.VITE_API_URL,

View File

@ -115,7 +115,7 @@
<el-container style="margin-top: -2%;margin-bottom: 2%;">
<el-radio v-model="state.radio" label='1' @click="mapEvents('1')">Point</el-radio>
<el-radio v-model="state.radio" label='2' @click="mapEvents('2')">Area</el-radio>
<el-button type="primary" style="margin-left: 5%;">Clear</el-button>
<el-button type="primary" style="margin-left: 5%;" @click="ClearSubmit">Clear</el-button>
</el-container>
<el-container style="margin-top: 2%;margin-bottom: 2%;" v-if="state.radio==='1'?true:false">
<span style="line-height: 35px;"> Latitude</span>
@ -172,7 +172,6 @@ const handleClick = (tab, event) => {
state.selectName = tab.props.name;
getTableData();
};
let controller=true
const MapPage = defineAsyncComponent({
loader:() =>import('/@/components/Map.vue'),
delay: 200,
@ -247,16 +246,24 @@ const onOpenEditRole = (type, row) => {
},100);
};
const mapEvents = (ev)=>{
if(ev == '1'){
if(ev == '1'){
mapRef.value.mapOperations.clearPolygon()
mapRef.value.mapOperations.on("click", mapClick)
// mapRef.value.mapOperations.on("click", mapClick)
mapRef.value.mapOperations.on("mousemove", changelatlon)
variableStore.polygoncontrol = "option1"
}else{
mapRef.value.mapOperations.off("click",mapClick);
mapRef.value.mapOperations.drawPolygon()
mapRef.value.mapOperations.drawCreated()
// mapRef.value.mapOperations.drawPolygon()
// mapRef.value.mapOperations.drawCreated()
variableStore.polygoncontrol = "option2"
}
};
const ClearSubmit = () => {
setTimeout(() => {
mapRef.value.mapOperations.removeAll()
variableStore.wktdata = null
}, 100)
}
const mapClick=(res)=>{
mapRef.value.mapOperations.removeLayer( state.wktPoint)
changelatlon(res);
@ -290,12 +297,6 @@ const onHandleCurrentChange = (val) => {
state.tableData.param.pageNum = val;
getTableData();
};
const onMapClick = (e) => {
state.lat = e.latlng.lat.toFixed(3);
state.lon = e.latlng.lng.toFixed(3);
mapRef.value.mapOperations.addInteractMarker(state.lat, state.lon)
}
const changelatlon = (e) => {
//e
state.dislat = e.latlng.lat.toFixed(3);