清除图层
This commit is contained in:
parent
1d132e13bf
commit
e723d17969
|
@ -66,6 +66,7 @@ export const useVariableStore = defineStore(Names.TEST, {
|
||||||
size:null,
|
size:null,
|
||||||
pages:null,
|
pages:null,
|
||||||
},
|
},
|
||||||
|
wktdata:null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Session } from '/@/utils/storage';
|
||||||
|
|
||||||
// export const moduleName = 'zqq-biz-vordm';
|
// export const moduleName = 'zqq-biz-vordm';
|
||||||
export const moduleName = 'yyhouc-biz-vordm';
|
export const moduleName = 'yyhouc-biz-vordm';
|
||||||
|
// export const moduleName = 'glj-biz-vordm';
|
||||||
// 配置新建一个 axios 实例
|
// 配置新建一个 axios 实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
//baseURL: import.meta.env.VITE_API_URL,
|
//baseURL: import.meta.env.VITE_API_URL,
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
<el-container style="margin-top: -2%;margin-bottom: 2%;">
|
<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='1' @click="mapEvents('1')">Point</el-radio>
|
||||||
<el-radio v-model="state.radio" label='2' @click="mapEvents('2')">Area</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>
|
||||||
<el-container style="margin-top: 2%;margin-bottom: 2%;" v-if="state.radio==='1'?true:false">
|
<el-container style="margin-top: 2%;margin-bottom: 2%;" v-if="state.radio==='1'?true:false">
|
||||||
<span style="line-height: 35px;"> Latitude:</span>
|
<span style="line-height: 35px;"> Latitude:</span>
|
||||||
|
@ -172,7 +172,6 @@ const handleClick = (tab, event) => {
|
||||||
state.selectName = tab.props.name;
|
state.selectName = tab.props.name;
|
||||||
getTableData();
|
getTableData();
|
||||||
};
|
};
|
||||||
let controller=true
|
|
||||||
const MapPage = defineAsyncComponent({
|
const MapPage = defineAsyncComponent({
|
||||||
loader:() =>import('/@/components/Map.vue'),
|
loader:() =>import('/@/components/Map.vue'),
|
||||||
delay: 200,
|
delay: 200,
|
||||||
|
@ -247,16 +246,24 @@ const onOpenEditRole = (type, row) => {
|
||||||
},100);
|
},100);
|
||||||
};
|
};
|
||||||
const mapEvents = (ev)=>{
|
const mapEvents = (ev)=>{
|
||||||
if(ev == '1'){
|
if(ev == '1'){
|
||||||
mapRef.value.mapOperations.clearPolygon()
|
mapRef.value.mapOperations.clearPolygon()
|
||||||
mapRef.value.mapOperations.on("click", mapClick)
|
// mapRef.value.mapOperations.on("click", mapClick)
|
||||||
mapRef.value.mapOperations.on("mousemove", changelatlon)
|
mapRef.value.mapOperations.on("mousemove", changelatlon)
|
||||||
|
variableStore.polygoncontrol = "option1"
|
||||||
}else{
|
}else{
|
||||||
mapRef.value.mapOperations.off("click",mapClick);
|
mapRef.value.mapOperations.off("click",mapClick);
|
||||||
mapRef.value.mapOperations.drawPolygon()
|
// mapRef.value.mapOperations.drawPolygon()
|
||||||
mapRef.value.mapOperations.drawCreated()
|
// mapRef.value.mapOperations.drawCreated()
|
||||||
|
variableStore.polygoncontrol = "option2"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const ClearSubmit = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
mapRef.value.mapOperations.removeAll()
|
||||||
|
variableStore.wktdata = null
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
const mapClick=(res)=>{
|
const mapClick=(res)=>{
|
||||||
mapRef.value.mapOperations.removeLayer( state.wktPoint)
|
mapRef.value.mapOperations.removeLayer( state.wktPoint)
|
||||||
changelatlon(res);
|
changelatlon(res);
|
||||||
|
@ -290,12 +297,6 @@ const onHandleCurrentChange = (val) => {
|
||||||
state.tableData.param.pageNum = val;
|
state.tableData.param.pageNum = val;
|
||||||
getTableData();
|
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) => {
|
const changelatlon = (e) => {
|
||||||
//深拷贝e
|
//深拷贝e
|
||||||
state.dislat = e.latlng.lat.toFixed(3);
|
state.dislat = e.latlng.lat.toFixed(3);
|
||||||
|
|
Loading…
Reference in New Issue