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

@ -406,6 +406,9 @@ const mapOperations = {
}, },
deleteRectangle: () => { deleteRectangle: () => {
homeMap.removeLayer(layerRectangle) homeMap.removeLayer(layerRectangle)
},
removeEdit: () => {
homeMap.pm.toggleGlobalRemovalMode();
} }
} }
//omnivore.wkt.parse('POINT(-80 0)').addTo(homeMap); //omnivore.wkt.parse('POINT(-80 0)').addTo(homeMap);

View File

@ -309,17 +309,28 @@
</el-container> </el-container>
<el-container style="margin-top: 2%;margin-bottom: 2%;" <el-container style="margin-top: 2%;margin-bottom: 2%;"
v-if="state.radio === '3' ? true : false"> v-if="state.radio === '3' ? true : false">
<el-row>
<el-col :span="3">
<span style="line-height: 35px;"> Latitude</span> <span style="line-height: 35px;"> Latitude</span>
</el-col>
<el-col :span="7">
<el-input placeholder="wait……" <el-input placeholder="wait……"
style="height:35px;margin-right: 1%;" style="height:35px;margin-right: 1%;"
v-model="state.dislat" v-model="state.dislat"
:onchange="manualCoordinate"> :onchange="manualLat">
</el-input> </el-input>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="3">
<span style="line-height: 35px;">Longitude</span> <span style="line-height: 35px;">Longitude</span>
</el-col>
<el-col :span="7">
<el-input placeholder="wait……" <el-input placeholder="wait……"
style="height:35px;" style="height:35px;"
v-model="state.dislon" v-model="state.dislon"
:onchange="manualCoordinate"></el-input> :onchange="manualLon"></el-input>
</el-col>
</el-row>
</el-container> </el-container>
<MapPage style="height:350px ; width:100% ;margin-bottom: 10px;" <MapPage style="height:350px ; width:100% ;margin-bottom: 10px;"
ref="mapRef"> ref="mapRef">
@ -376,7 +387,7 @@
<script setup name="userResponse"> <script setup name="userResponse">
import en from 'element-plus/dist/locale/en.mjs' 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 { ElMessageBox, ElMessage } from 'element-plus';
import { getList, review, responseEndedDisasterInfo } from '/@/api/disasterInfo/index'; import { getList, review, responseEndedDisasterInfo } from '/@/api/disasterInfo/index';
import { getDictionary, getList as getListNew } from '/@/api/system/dictbiz'; import { getDictionary, getList as getListNew } from '/@/api/system/dictbiz';
@ -457,7 +468,9 @@ const state = reactive({
dislon: '', dislon: '',
popupLat: null, popupLat: null,
popupLon: null, popupLon: null,
wktPoint_Poly: undefined wktPoint_Poly: undefined,
passLat: false,
passLon: false,
}); });
// //
const getTableData = () => { 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 manualCoordinate = () => {
// const disLatLen = state.dislat.length // const disLatLen = state.dislat.length
// const disLonLen = state.dislon.length // const disLonLen = state.dislon.length
@ -536,11 +604,13 @@ const mapEvents = (ev) => {
mapRef.value.mapOperations.off("click", mapClick); mapRef.value.mapOperations.off("click", mapClick);
mapRef.value.mapOperations.off("mousemove", showLatLon) mapRef.value.mapOperations.off("mousemove", showLatLon)
mapRef.value.mapOperations.clearPolygon() mapRef.value.mapOperations.clearPolygon()
mapRef.value.mapOperations.removeEdit()
ev == '' ev == ''
} }
else if (ev == '2') { else if (ev == '2') {
mapRef.value.mapOperations.off("click", mapClick); mapRef.value.mapOperations.off("click", mapClick);
mapRef.value.mapOperations.off("mousemove", showLatLon) mapRef.value.mapOperations.off("mousemove", showLatLon)
mapRef.value.mapOperations.removeEdit()
// mapRef.value.mapOperations.drawPolygon() // mapRef.value.mapOperations.drawPolygon()
// mapRef.value.mapOperations.drawCreated() // mapRef.value.mapOperations.drawCreated()
ev == '' ev == ''
@ -550,7 +620,6 @@ const mapEvents = (ev) => {
mapRef.value.mapOperations.on("mousemove", showLatLon) mapRef.value.mapOperations.on("mousemove", showLatLon)
mapRef.value.mapOperations.Edit() mapRef.value.mapOperations.Edit()
ev == '' ev == ''
} }
}; };
const ClearSubmit = () => { const ClearSubmit = () => {