zqq:call-for-help添加校验

This commit is contained in:
qqGroup0 2023-05-06 21:56:25 +08:00
parent 6c12bfc9ab
commit 563293b90a
2 changed files with 92 additions and 20 deletions

View File

@ -59,8 +59,8 @@ onMounted(() => {
const mapOperations = {
wktParseToMap: (res) => {
let layer = omnivore.wkt.parse(res)
if(featureLayerG_area.getLayers().length != 0||featureLayerG_point.getLayers().length != 0){
if (featureLayerG_area.getLayers().length != 0 || featureLayerG_point.getLayers().length != 0) {
return;
}
layer.addTo(featureLayerG_point)
@ -70,12 +70,12 @@ const mapOperations = {
// flyTo
if (attr[0].feature.geometry.type.indexOf('Polygon') == -1) {
homeMap.flyTo([attr[0].feature.geometry.coordinates[1], attr[0].feature.geometry.coordinates[0]], 3)
variableStore.layerGroupPoint=res;
return {'layer':layer,'location':[attr[0].feature.geometry.coordinates[1],attr[0].feature.geometry.coordinates[0]]}
variableStore.layerGroupPoint = res;
return { 'layer': layer, 'location': [attr[0].feature.geometry.coordinates[1], attr[0].feature.geometry.coordinates[0]] }
}
// fly
else {
variableStore.layerGroupPoly=res;
variableStore.layerGroupPoly = res;
let polygons = [];
for (let i = 0; i < attr[0].feature.geometry.coordinates.length; i++) {
console.log(attr[0].feature.geometry.coordinates[i])
@ -90,7 +90,7 @@ const mapOperations = {
let final_center = turf.center(turf.featureCollection(features))
// console.log(final_center)
homeMap.flyTo([final_center.geometry.coordinates[1], final_center.geometry.coordinates[0]], 3)
return {'layer':layer,'location':null}
return { 'layer': layer, 'location': null }
}
// return layer
@ -406,6 +406,9 @@ const mapOperations = {
},
deleteRectangle: () => {
homeMap.removeLayer(layerRectangle)
},
removeEdit: () => {
homeMap.pm.toggleGlobalRemovalMode();
}
}
//omnivore.wkt.parse('POINT(-80 0)').addTo(homeMap);

View File

@ -309,17 +309,28 @@
</el-container>
<el-container style="margin-top: 2%;margin-bottom: 2%;"
v-if="state.radio === '3' ? true : false">
<span style="line-height: 35px;"> Latitude</span>
<el-input placeholder="wait……"
style="height:35px;margin-right: 1%;"
v-model="state.dislat"
:onchange="manualCoordinate">
</el-input>
<span style="line-height: 35px;">Longitude</span>
<el-input placeholder="wait……"
style="height:35px;"
v-model="state.dislon"
:onchange="manualCoordinate"></el-input>
<el-row>
<el-col :span="3">
<span style="line-height: 35px;"> Latitude</span>
</el-col>
<el-col :span="7">
<el-input placeholder="wait……"
style="height:35px;margin-right: 1%;"
v-model="state.dislat"
:onchange="manualLat">
</el-input>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="3">
<span style="line-height: 35px;">Longitude</span>
</el-col>
<el-col :span="7">
<el-input placeholder="wait……"
style="height:35px;"
v-model="state.dislon"
:onchange="manualLon"></el-input>
</el-col>
</el-row>
</el-container>
<MapPage style="height:350px ; width:100% ;margin-bottom: 10px;"
ref="mapRef">
@ -376,7 +387,7 @@
<script setup name="userResponse">
import en from 'element-plus/dist/locale/en.mjs'
import { reactive, onMounted, ref, nextTick, watchEffect, defineAsyncComponent } from 'vue';
import { reactive, onMounted, ref, nextTick, watchEffect, defineAsyncComponent, h } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { getList, review, responseEndedDisasterInfo } from '/@/api/disasterInfo/index';
import { getDictionary, getList as getListNew } from '/@/api/system/dictbiz';
@ -457,7 +468,9 @@ const state = reactive({
dislon: '',
popupLat: null,
popupLon: null,
wktPoint_Poly: undefined
wktPoint_Poly: undefined,
passLat: false,
passLon: false,
});
//
const getTableData = () => {
@ -513,6 +526,61 @@ const onOpenEditRole = (type, row) => {
}
};
//
const manualLat = () => {
const latReg = /^(\-|\+)?([0-8]?\d{1}\.\d{0,6}|90\.0{0,6}|[0-8]?\d{1}|90)$/;
if (!latReg.test(state.dislat)) {
state.passLat = false
ElMessage({
message: h('p', null, [
h('span', null, 'Please enter the correct '),
h('span', { style: 'font-size: 15px;font-weight: bold;' }, 'latitude'),
]),
})
}
else {
state.passLat = true
}
if (state.passLat && state.passLon) {
mapRef.value.mapOperations.addInteractMarker(state.dislat, state.dislon)
const positionParam = {
x: state.dislon,
y: state.dislat,
zoom: 3
}
mapRef.value.mapOperations.goPosition(positionParam)
}
}
//
const manualLon = () => {
const lonReg = /^(\-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,6})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,6}|180)$/;
if (!lonReg.test(state.dislon)) {
state.passLon = false
ElMessage({
message: h('p', null, [
h('span', null, 'Please enter the correct '),
h('span', { style: 'font-size: 15px;font-weight: bold;' }, 'longitude'),
]),
})
}
else {
state.passLon = true
}
if (state.passLat && state.passLon) {
mapRef.value.mapOperations.addInteractMarker(state.dislat, state.dislon)
const positionParam = {
x: state.dislon,
y: state.dislat,
zoom: 3
}
mapRef.value.mapOperations.goPosition(positionParam)
}
}
const manualCoordinate = () => {
// const disLatLen = state.dislat.length
// const disLonLen = state.dislon.length
@ -536,11 +604,13 @@ const mapEvents = (ev) => {
mapRef.value.mapOperations.off("click", mapClick);
mapRef.value.mapOperations.off("mousemove", showLatLon)
mapRef.value.mapOperations.clearPolygon()
mapRef.value.mapOperations.removeEdit()
ev == ''
}
else if (ev == '2') {
mapRef.value.mapOperations.off("click", mapClick);
mapRef.value.mapOperations.off("mousemove", showLatLon)
mapRef.value.mapOperations.removeEdit()
// mapRef.value.mapOperations.drawPolygon()
// mapRef.value.mapOperations.drawCreated()
ev == ''
@ -550,7 +620,6 @@ const mapEvents = (ev) => {
mapRef.value.mapOperations.on("mousemove", showLatLon)
mapRef.value.mapOperations.Edit()
ev == ''
}
};
const ClearSubmit = () => {