提交 45e70da5 作者: 宇宙超人

地图瓦片数据修改

上级 73529170
......@@ -16,7 +16,8 @@ export const tk = 'aa0ccd36f2dbb86dbb16cbf63f0034a6'
const host = 'https://foxgis.app.yiring.com'
// 构建天地图图层地址
export function buildTdtTileUrl(id: string, tk: string) {
export function buildTdtTileUrl(id: string,layer:string) {
return `http://t0.tianditu.gov.cn/${id}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${layer}&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tk}`
return `${host}/api/tdt/cache/${id}/{z}/{y}/{x}/${tk}?v=2022`
}
......@@ -28,7 +29,6 @@ export const DEFAULT_MAP_CENTER: [number, number] = [113.01798803033034, 28.0987
* 地图默认缩放级别
*/
export const DEFAULT_MAP_ZOOM = 11.5
/**
* 地图样式
*/
......@@ -39,15 +39,27 @@ export const defaultStyle: mapboxgl.Style = {
sprite: `${host}/api/sprites/drainage/sprite`,
glyphs: `${host}/api/fonts/{fontstack}/{range}.pbf`,
sources: {
'wms-cia_w-source': {
'wms-vec_w-source': {
type: 'raster',
tiles: [buildTdtTileUrl('vec_w','vec')],
tileSize: 256,
maxzoom: 18,
},
'wms-cva_w-source': {
type: 'raster',
tiles: [buildTdtTileUrl('cia', tk)],
tiles: [buildTdtTileUrl('cva_w','cva')],
tileSize: 256,
maxzoom: 18,
},
// 'wms-cia_w-source': {
// type: 'raster',
// tiles: [buildTdtTileUrl('cia', tk)],
// tileSize: 256,
// maxzoom: 18,
// },
'wms-img_w-source': {
type: 'raster',
tiles: [buildTdtTileUrl('cia', tk)],
tiles: [buildTdtTileUrl('img_w','img')],
tileSize: 256,
maxzoom: 18,
},
......@@ -62,18 +74,24 @@ export const defaultStyle: mapboxgl.Style = {
},
// 默认图层 - 标注底图
{
id: 'wms-cia_w-layer',
id: 'wms-vec_w-layer',
type: 'raster',
source: 'wms-cia_w-source',
source: 'wms-vec_w-source',
layout: { visibility: 'visible' },
},
// 默认图层 - 影像底图
{
id: 'wms-img_w-layer',
id: 'wms-cva_w-layer',
type: 'raster',
source: 'wms-img_w-source',
source: 'wms-cva_w-source',
layout: { visibility: 'visible' },
},
// // 默认图层 - 影像底图
// {
// id: 'wms-img_w-layer',
// type: 'raster',
// source: 'wms-img_w-source',
// layout: { visibility: 'visible' },
// },
// 天空图层
{
id: 'sky',
......
......@@ -112,16 +112,24 @@ export default {
if (this.map && this.map.remove) {
this.map.remove()
}
console.log(123123, merge(defaultStyle, options?.style))
let style = merge(defaultStyle, options?.style);
//是否卫星图显示
if (options?.style.isImg) {
style.layers.push({
id: 'wms-img_w-layer',
type: 'raster',
source: 'wms-img_w-source',
layout: { visibility: 'visible' },
})
}
// [107.570282, 19.474339],
// [115.629717, 34.466859],
// 加载地图
const mapboxgl = window.mapboxgl
const map = new mapboxgl.Map({
// accessToken,
container: options.container,
style: merge(defaultStyle, options?.style),
style: style,
...merge(
{
minZoom: 5,
......
......@@ -595,7 +595,8 @@
"navigationStyle": "custom",
"backgroundColorTop": "#5DB66F",
"backgroundColorBottom": "#F2F2F2",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"bounce":false
}
},
// === AI 聊天助手 ===
......
......@@ -7,11 +7,16 @@
interface Props {
show: boolean
editData?: any
farmId:any,
farmBaseId:any,
}
const props = withDefaults(defineProps<Props>(), {
show: false,
editData: null,
farmId:0,
farmBaseId:0,
})
// 定义Emits
......@@ -154,6 +159,8 @@ return
// 准备提交数据
const submitData = {
...formData,
farmId: props.farmId,
farmBaseId: props.farmBaseId,
}
// 根据 editData 判断是新增还是修改
......@@ -174,6 +181,7 @@ return
uni.showToast({ title: '操作成功', icon: 'success' })
emit('update:show', false)
emit('submitSuccess')
emit('close')
} catch (error) {
console.log('提交失败:', error)
uni.showToast({
......
......@@ -3,6 +3,7 @@
import * as turf from '@turf/turf'
import type { Page } from './config'
import PlayWidget from './components/PlayWidget.vue'
import SaveDialog from '../../device/components/save-dialog.vue'
import Navigate from '@/utils/page/navigate'
import {
addDefaultGeoJSONSource,
......@@ -23,6 +24,7 @@ const page = reactive<Page>({
latest: null,
query: {},
})
const showDialog = ref(false)
onShow(() => {
getFarmbaseInfoList()
})
......@@ -91,7 +93,7 @@ async function getDeviceTypeCount() {
// 地图组件
const [registerMap, map] = useMapbox({
style: { zoom: 15 },
style: { zoom: 15, isImg: true },
onLoaded: async (data) => {
console.log('✨✨✨ Map Loaded', data)
......@@ -242,7 +244,7 @@ const [registerToolBoxWidget] = useToolBoxWidget({
show: true,
expand: true,
showExpandButton: false,
top: -90,
top: 50,
tools: [
{
key: 'action',
......@@ -368,7 +370,7 @@ onNavigationBarButtonTap((e) => {
<!-- 地图组件 -->
<!-- <view class="h-730 overflow-hidden map-box"> -->
<view class="h-730 overflow-hidden map-box">
<view class="h-830 overflow-hidden map-box">
<!-- 地图组件 -->
<Mapbox @register="registerMap" />
</view>
......@@ -391,8 +393,8 @@ onNavigationBarButtonTap((e) => {
</view>
</view>
<view class="card !top-730">
<view class="w-full absolute top--70rpx">
<view class="card !top-950">
<view class="w-full absolute">
<view style="background: #e6f5e8">
<view class="box-1">
<view class="relative w-full flex flex-row">
......@@ -483,9 +485,7 @@ onNavigationBarButtonTap((e) => {
<view class="box-4">
<view class="box-4-title">
<view class="box-4-title-text1"><text>基地设备</text></view>
<navigator url="/pages/device/device" class="box-4-title-text2"
><text>+ 添加设备</text></navigator
>
<view class="box-4-title-text2" @click="showDialog=true"><text>+ 添加设备</text></view>
</view>
<view class="box-4-device">
<view
......@@ -494,7 +494,7 @@ onNavigationBarButtonTap((e) => {
:key="index"
>
<view class="box-4-item-icon">
<image class="box-4-item-icon-image" src="/static/images/nongchang/jiankong.png" />
<image class="box-4-item-icon-image" :src="`/static/images/nongchang/device${device.deviceType}.png`" />
</view>
<view class="box-4-item-content">
<text class="box-4-item-text1">{{ device.deviceName }}</text>
......@@ -506,6 +506,7 @@ onNavigationBarButtonTap((e) => {
</view>
</view>
</view>
<SaveDialog :show="showDialog" :farmId="model.id" :farmBaseId="model.farmbaseInfo?.id" @submitSuccess="getDeviceTypeCount" @close="showDialog=false"/>
</view>
</template>
......@@ -878,7 +879,7 @@ page {
.box-4-device {
width: 100%;
height: calc(100% - 50rpx);
//height: calc(100% - 50rpx);
margin-top: 10rpx;
display: flex;
flex-wrap: wrap;
......@@ -886,7 +887,8 @@ page {
.box-4-device-item {
width: 49%;
height: 48%;
// height: 48%;
height: 136rpx;
display: flex;
flex-direction: row;
border-radius: 24rpx;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论