提交 45e70da5 作者: 宇宙超人

地图瓦片数据修改

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