|
|
|
@ -8,6 +8,8 @@ import {isArray} from "@/utils/validate.js";
|
|
|
|
|
import {ElMessage} from "element-plus";
|
|
|
|
|
import {areaConversion} from "@/utils/ruoyi.js";
|
|
|
|
|
import * as turf from "@turf/turf";
|
|
|
|
|
import {lazyAMapApiLoaderInstance} from "@vuemap/vue-amap";
|
|
|
|
|
|
|
|
|
|
let {proxy} = getCurrentInstance();
|
|
|
|
|
const uploadJsonData = ref([])
|
|
|
|
|
const props = defineProps({})
|
|
|
|
@ -109,13 +111,21 @@ const uploadJson = (file) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const formRef = ref(null)
|
|
|
|
|
// 已有地块列表
|
|
|
|
|
const polygonList = ref([])
|
|
|
|
|
const saveMassif = () => {
|
|
|
|
|
proxy.$refs["formRef"].validate(valid => {
|
|
|
|
|
if (valid){
|
|
|
|
|
lazyAMapApiLoaderInstance.then(() => {
|
|
|
|
|
let newFormData = deepClone(formData.value)
|
|
|
|
|
for (let item of newFormData.coordinateList) {
|
|
|
|
|
if (!item.longitude || !item.latitude){
|
|
|
|
|
ElMessage.error('请确认坐标是否完整')
|
|
|
|
|
if (!item.longitude || !item.latitude || !newFormData.massifName) {
|
|
|
|
|
ElMessage.error('地块保存失败,请确认地块名称和坐标点均已填写。')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let polygonTemp = newFormData.coordinateList.map(item =>[item.longitude, item.latitude])
|
|
|
|
|
for (let item of polygonList.value) {
|
|
|
|
|
if (AMap.GeometryUtil.doesRingRingIntersect(polygonTemp.value, item.path) || AMap.GeometryUtil.isRingInRing(polygonTemp.value, item.path) || AMap.GeometryUtil.isRingInRing(item.path, polygonTemp.value)) {
|
|
|
|
|
ElMessage.error('当前地块与已有地块边界重合,请修改后再确认')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -129,7 +139,6 @@ const saveMassif = () => {
|
|
|
|
|
emit('submitSuccess', formData.value)
|
|
|
|
|
showDrawer.value = false
|
|
|
|
|
}, 2000)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|