diff --git a/src/components/Map.vue b/src/components/Map.vue index 3c6c5d8..6c4740c 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -2,27 +2,25 @@
- - - \ No newline at end of file + diff --git a/src/stores/index.ts b/src/stores/index.ts index c99ca11..3d0fa72 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -56,6 +56,7 @@ export const useVariableStore = defineStore(Names.TEST, { // Data_upload_agency:"" // } ], + // 存储wkt格式数据 layerGroupPoint:null, layerGroupPoly:null, polygoncontrol:null, diff --git a/src/utils/request.js b/src/utils/request.js index 1e18ec7..23898cb 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -5,7 +5,7 @@ import { Session } from '/@/utils/storage'; // export const moduleName = 'zqq-biz-vordm'; export const moduleName = 'biz-vordm'; -export const crawlModule = "vordm-crawl"; +export const crawlModule = 'vordm-crawl'; // 配置新建一个 axios 实例 const service = axios.create({ //baseURL: import.meta.env.VITE_API_URL, diff --git a/src/views/responseManagement/userResponse/index.vue b/src/views/responseManagement/userResponse/index.vue index 9539538..95e00a9 100644 --- a/src/views/responseManagement/userResponse/index.vue +++ b/src/views/responseManagement/userResponse/index.vue @@ -86,12 +86,12 @@ @@ -126,7 +126,7 @@ show-overflow-tooltip> + --> @@ -135,6 +135,9 @@ {{ dateFormat(scope.row.disasterTime) }} + + + + + @@ -166,8 +180,7 @@ + width="30%"> Area + Edit Clear + v-if="state.radio==='1'?true:false"> Latitude: - + v-model="state.dislat" + readonly="readonly"> Longitude: - + + + + + - <<<<<<< HEAD - - - ======= - - >>>>>>> zqq - - - - - - + + @@ -231,17 +243,23 @@ import { reactive, onMounted, ref, nextTick, watchEffect, defineAsyncComponent } import { ElMessageBox, ElMessage } from 'element-plus'; import { getList, review } from '/@/api/disasterInfo/index'; import { getDictionary } from '/@/api/system/dictbiz'; +import { useVariableStore } from '/@/stores/index.ts' //引入地图 +import Map from '/@/components/Map.vue'; import { useDateFormat } from '@vueuse/shared'; +import selectUser from './component/selectUser.vue'; import L from "leaflet"; import '@geoman-io/leaflet-geoman-free'; import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css'; import "leaflet/dist/leaflet.css"; import 'leaflet-draw/dist/leaflet.draw' import 'leaflet-draw/dist/leaflet.draw.css' -const map = ref(); +import { map } from 'lodash'; +import * as turf from '@turf/turf' +const variableStore = useVariableStore(); +const mapRef = ref(); const activeName = ref('first'); - +const select = ref(); const handleClick = (tab, event) => { state.selectName = tab.props.name; getTableData(); @@ -276,7 +294,8 @@ const state = reactive({ edit: {}, radio: null, dislat: '', - dislon: '' + dislon: '', + wktPoint_Poly: undefined }); // 初始化表格数据 const getTableData = () => { @@ -287,7 +306,6 @@ const getTableData = () => { } else { state.tableData.param.respondStatus = 2; } - console.log(activeName.value); getList(state.tableData.param).then((res) => { state.tableData.data = res.records; state.tableData.total = res.total; @@ -302,23 +320,18 @@ const onOpenEditRole = (type, row) => { //深拷贝 state.edit = JSON.parse(JSON.stringify(row)); - nextTick(() => { - //赋值地图范围,并且可以修改点或者区域 - //TODO - map.mapOperations.wktParseToMap(row.geometry) - }); state.dialogVisible = true; setTimeout(() => { state.radio = "1" // mapRef.value.mapOperations.removeAll() //赋值地图范围,并且可以修改点或者区域 - if (state.wktPoint) { - mapRef.value.mapOperations.removeLayer(state.wktPoint) + if (state.wktPoint_Poly) { + mapRef.value.mapOperations.removeLayer(state.wktPoint_Poly) } - state.wktPoint = mapRef.value.mapOperations.wktParseToMap(row.geometry) + state.wktPoint_Poly = mapRef.value.mapOperations.wktParseToMap(row.geometry) // mapRef.value.mapOperations.on("click", (res)=>{ // mapRef.value.mapOperations.clearPolygon() - // mapRef.value.mapOperations.removeLayer( state.wktPoint) + // mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly) // mapRef.value.mapOperations.addInteractMarker(res.latlng.lat, res.latlng.lng) // }) mapEvents('1') @@ -326,40 +339,51 @@ const onOpenEditRole = (type, row) => { }; const mapEvents = (ev) => { if (ev == '1') { - mapRef.value.mapOperations.clearPolygon() - // mapRef.value.mapOperations.on("click", mapClick) + // mapRef.value.mapOperations.clearPolygon() + mapRef.value.mapOperations.on("click", mapClick) mapRef.value.mapOperations.on("mousemove", changelatlon) - variableStore.polygoncontrol = "option1" - } else { + mapRef.value.mapOperations.clearPolygon() + + } else if (ev == '2') { mapRef.value.mapOperations.off("click", mapClick); + mapRef.value.mapOperations.drawPolygon() // mapRef.value.mapOperations.drawPolygon() // mapRef.value.mapOperations.drawCreated() - variableStore.polygoncontrol = "option2" + + } + else { + mapRef.value.mapOperations.Edit() } }; const ClearSubmit = () => { setTimeout(() => { mapRef.value.mapOperations.removeAll() variableStore.wktdata = null + variableStore.layerGroupPoint = null; + layerGroupPoly = null; }, 100) } const mapClick = (res) => { - mapRef.value.mapOperations.removeLayer(state.wktPoint) + // mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly ) changelatlon(res); mapRef.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3), res.latlng.lng.toFixed(3)) + // console.log(state.wktPoint_Poly) } - const reviews = (index) => { //将修改后的地图位置赋值到state.edit.geometry //TODO 修改地图赋值 //state.edit.geometry = map.mapOperations.getWkt(); //判断index的值来判断是审核通过还是不通过 + + + if (index === 1) { state.edit.respondStatus = 1; } else { state.edit.respondStatus = 2; } + state.edit.geometry = variableStore.layerGroupPoint === null ? variableStore.layerGroupPoly : variableStore.layerGroupPoint; //时间格式化 state.edit.disasterTime = useDateFormat(state.edit.disasterTime, 'YYYY-MM-DD').value + " 00:00:00"; review(state.edit).then((res) => { @@ -370,20 +394,13 @@ const reviews = (index) => { } // 分页改变 const onHandleCurrentChange = (val) => { - console.log(val); state.tableData.param.pageNum = val; getTableData(); }; -const onMapClick = (e) => { - state.lat = e.latlng.lat.toFixed(3); - state.lon = e.latlng.lng.toFixed(3); - map.value.mapOperations.addInteractMarker(state.lat, state.lon) -} const changelatlon = (e) => { - + //深拷贝e state.dislat = e.latlng.lat.toFixed(3); state.dislon = e.latlng.lng.toFixed(3); - // state.lon = state.lon % 360; // if (state.lon < 0) { // state.lon = state.lon + 360; // } @@ -429,20 +446,7 @@ onMounted(() => { getDictionary({ code: 'disaster' }).then((res) => { state.disasterTypeList = res; }); - watchEffect(() => { - if (state.radio == "1") { - // map.value.mapOperations.on("click", onMapClick) - // map.value.mapOperations.clearPolygon() - // map.value.mapOperations.on("mousemove", changelatlon) - // variableStore.polygoncontrol = "option1" - } - else { - // map.value.mapOperations.off("click", onMapClick) - // map.value.mapOperations.drawPolygon() - // map.value.mapOperations.drawCreated() - // variableStore.polygoncontrol = "option2" - } - }) + }); const getValue = (key) => { //返回state.disasterTypeLis 对应的value