diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 2afcdb8..ff5a0f8 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -32,6 +32,7 @@ }, // 远程监管 { + path: '/ycjg', component: Layout, redirect: '/ssjk/page', diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 2afcdb8..ff5a0f8 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -32,6 +32,7 @@ }, // 远程监管 { + path: '/ycjg', component: Layout, redirect: '/ssjk/page', diff --git a/src/views/map/map.vue b/src/views/map/map.vue index 1969afc..1b06bc3 100644 --- a/src/views/map/map.vue +++ b/src/views/map/map.vue @@ -36,7 +36,7 @@ const webRtcServer = ref(null) const amap = ref() // 组件 -function search() { +function search(init = true) { refreshMarker.value = false map.value.eachLayer((layer: any) => { if (layer !== baseLayer.value[0]) { @@ -87,13 +87,25 @@ }) refreshMarker.value = true // 定位 - console.log('----------------------------------定位---------------------------------------') - console.log(res.data.rows) - console.log(res.data.rows[0]) - if (res.data.length > 0) { - // map.value.setView({ lat: res.data[0].latitude, lng: res.data[0].longitude }) - // map.value.setView([res.data.rows[0].latitude, res.data.rows[0].longitude]) - map.value.setView({ lat: res.data.rows[0].latitude, lng: res.data.rows[0].longitude }) + // if (res.data.length > 0) { + // map.value.setView({ lat: res.data[0].latitude, lng: res.data[0].longitude }) + // } + if (init && res && res.data && res.data.rows && res.data.rows.length > 0) { + let lat = proxy.$position.lat + let lng = proxy.$position.lng + console.log('执行定位') + for (let i = 0; i < res.data.rows.length; i++) { + if (res.data.rows[i].latitude && res.data.rows[i].longitude) { + lat = res.data.rows[i].latitude + lng = res.data.rows[i].longitude + console.log('lat, lng', lat, lng) + map.value.setView([lat, lng]) + break + } + } + } + else { + map.value.setView([toParentsMap.value.lat, toParentsMap.value.lng]) } }) } @@ -113,10 +125,9 @@ attributionControl: false, crs: L.CRS.EPSG3857, }) - // z 缩放级别, x:新坐标, y: y坐标 const str = '/static/tiles/{z}/{x}/{y}.png' baseLayer.value.push(L.tileLayer(str).addTo(map.value)) - search() + search(false) }) onBeforeUnmount(() => { diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 2afcdb8..ff5a0f8 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -32,6 +32,7 @@ }, // 远程监管 { + path: '/ycjg', component: Layout, redirect: '/ssjk/page', diff --git a/src/views/map/map.vue b/src/views/map/map.vue index 1969afc..1b06bc3 100644 --- a/src/views/map/map.vue +++ b/src/views/map/map.vue @@ -36,7 +36,7 @@ const webRtcServer = ref(null) const amap = ref() // 组件 -function search() { +function search(init = true) { refreshMarker.value = false map.value.eachLayer((layer: any) => { if (layer !== baseLayer.value[0]) { @@ -87,13 +87,25 @@ }) refreshMarker.value = true // 定位 - console.log('----------------------------------定位---------------------------------------') - console.log(res.data.rows) - console.log(res.data.rows[0]) - if (res.data.length > 0) { - // map.value.setView({ lat: res.data[0].latitude, lng: res.data[0].longitude }) - // map.value.setView([res.data.rows[0].latitude, res.data.rows[0].longitude]) - map.value.setView({ lat: res.data.rows[0].latitude, lng: res.data.rows[0].longitude }) + // if (res.data.length > 0) { + // map.value.setView({ lat: res.data[0].latitude, lng: res.data[0].longitude }) + // } + if (init && res && res.data && res.data.rows && res.data.rows.length > 0) { + let lat = proxy.$position.lat + let lng = proxy.$position.lng + console.log('执行定位') + for (let i = 0; i < res.data.rows.length; i++) { + if (res.data.rows[i].latitude && res.data.rows[i].longitude) { + lat = res.data.rows[i].latitude + lng = res.data.rows[i].longitude + console.log('lat, lng', lat, lng) + map.value.setView([lat, lng]) + break + } + } + } + else { + map.value.setView([toParentsMap.value.lat, toParentsMap.value.lng]) } }) } @@ -113,10 +125,9 @@ attributionControl: false, crs: L.CRS.EPSG3857, }) - // z 缩放级别, x:新坐标, y: y坐标 const str = '/static/tiles/{z}/{x}/{y}.png' baseLayer.value.push(L.tileLayer(str).addTo(map.value)) - search() + search(false) }) onBeforeUnmount(() => { diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue index cce94d5..cc9dda3 100644 --- a/src/views/system/area/listArea.vue +++ b/src/views/system/area/listArea.vue @@ -8,6 +8,8 @@ import { toTreeList } from '@/utils/structure' import { delArea, getAreaByPid, getAreaListPage } from '@/api/system/area' import type { TableColumn } from '@/components/NormalTable/table_interface' +const router = useRouter() +const mainPage = useMainPage() enum Perm { ADD = '/sys/area/add', @@ -99,7 +101,10 @@ message: '删除成功', type: 'success', }) + // window.location.reload() // 强制刷新页面 + // router.go(0) // 重新加载当前页面路由 fetchData() + mainPage.reload() table.value.doLayout() } }) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 2afcdb8..ff5a0f8 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -32,6 +32,7 @@ }, // 远程监管 { + path: '/ycjg', component: Layout, redirect: '/ssjk/page', diff --git a/src/views/map/map.vue b/src/views/map/map.vue index 1969afc..1b06bc3 100644 --- a/src/views/map/map.vue +++ b/src/views/map/map.vue @@ -36,7 +36,7 @@ const webRtcServer = ref(null) const amap = ref() // 组件 -function search() { +function search(init = true) { refreshMarker.value = false map.value.eachLayer((layer: any) => { if (layer !== baseLayer.value[0]) { @@ -87,13 +87,25 @@ }) refreshMarker.value = true // 定位 - console.log('----------------------------------定位---------------------------------------') - console.log(res.data.rows) - console.log(res.data.rows[0]) - if (res.data.length > 0) { - // map.value.setView({ lat: res.data[0].latitude, lng: res.data[0].longitude }) - // map.value.setView([res.data.rows[0].latitude, res.data.rows[0].longitude]) - map.value.setView({ lat: res.data.rows[0].latitude, lng: res.data.rows[0].longitude }) + // if (res.data.length > 0) { + // map.value.setView({ lat: res.data[0].latitude, lng: res.data[0].longitude }) + // } + if (init && res && res.data && res.data.rows && res.data.rows.length > 0) { + let lat = proxy.$position.lat + let lng = proxy.$position.lng + console.log('执行定位') + for (let i = 0; i < res.data.rows.length; i++) { + if (res.data.rows[i].latitude && res.data.rows[i].longitude) { + lat = res.data.rows[i].latitude + lng = res.data.rows[i].longitude + console.log('lat, lng', lat, lng) + map.value.setView([lat, lng]) + break + } + } + } + else { + map.value.setView([toParentsMap.value.lat, toParentsMap.value.lng]) } }) } @@ -113,10 +125,9 @@ attributionControl: false, crs: L.CRS.EPSG3857, }) - // z 缩放级别, x:新坐标, y: y坐标 const str = '/static/tiles/{z}/{x}/{y}.png' baseLayer.value.push(L.tileLayer(str).addTo(map.value)) - search() + search(false) }) onBeforeUnmount(() => { diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue index cce94d5..cc9dda3 100644 --- a/src/views/system/area/listArea.vue +++ b/src/views/system/area/listArea.vue @@ -8,6 +8,8 @@ import { toTreeList } from '@/utils/structure' import { delArea, getAreaByPid, getAreaListPage } from '@/api/system/area' import type { TableColumn } from '@/components/NormalTable/table_interface' +const router = useRouter() +const mainPage = useMainPage() enum Perm { ADD = '/sys/area/add', @@ -99,7 +101,10 @@ message: '删除成功', type: 'success', }) + // window.location.reload() // 强制刷新页面 + // router.go(0) // 重新加载当前页面路由 fetchData() + mainPage.reload() table.value.doLayout() } }) diff --git a/src/views/ycjg/fzsq/list.vue b/src/views/ycjg/fzsq/list.vue index c5359a1..242ac7f 100644 --- a/src/views/ycjg/fzsq/list.vue +++ b/src/views/ycjg/fzsq/list.vue @@ -159,10 +159,10 @@