Compare commits
2 Commits
ed09b9148e
...
2084d27b08
| Author | SHA1 | Date |
|---|---|---|
|
|
2084d27b08 | |
|
|
ca4dca2a1f |
|
|
@ -1,7 +1,19 @@
|
|||
<template>
|
||||
<div class="map-container">
|
||||
<div :id="mapContainerName" class="map-box"></div>
|
||||
<a-input-search class="inputbox" v-model:value="address" enter-button placeholder="请输入地址" @search="searchAddress" />
|
||||
<div class="inputbox">
|
||||
<a-input-search v-model:value="address" enter-button placeholder="请输入地址" @search="searchAddress" />
|
||||
<div class="addressbox" v-if="optionsVisible">
|
||||
<div class="flex" v-for="item in optionsData" @click="handleflyto(item)">
|
||||
<div class="label">{{ item.formatted_address }}</div>
|
||||
<div class="mr-1">{{ item.city }}</div>
|
||||
<div>{{ item.district }}</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -43,30 +55,36 @@
|
|||
|
||||
const mapContainerName = ref<String>();
|
||||
mapContainerName.value = 'mapContainer-' + generateUUID();
|
||||
const props = defineProps(['geoms','location']);
|
||||
const props = defineProps(['geoms','location','isPoint']);
|
||||
const emit = defineEmits(['handlerDrawComplete'])
|
||||
|
||||
const address = ref()
|
||||
const optionsData = ref([])
|
||||
const optionsVisible = ref(false)
|
||||
const searchAddress = ()=>{
|
||||
axios({
|
||||
method: 'get',
|
||||
url: `https://restapi.amap.com/v3/geocode/geo?key=ed310f0b1f6cfd93edfba42f1a09d4d9&address=`+address.value,
|
||||
url: `https://restapi.amap.com/v3/geocode/geo?key=ed310f0b1f6cfd93edfba42f1a09d4d9&&city=临沂&address=`+address.value,
|
||||
}).then((res) => {
|
||||
if(res.data){
|
||||
let location = res.data.geocodes[0].location.split(',')
|
||||
map.flyTo({
|
||||
center: location,
|
||||
zoom: 13,
|
||||
bearing: 0,
|
||||
speed: 1, // 飞行速度
|
||||
curve: 2, // 飞行曲线
|
||||
essential: true,
|
||||
easing(t) {
|
||||
// 飞行动画函数
|
||||
return t;
|
||||
},
|
||||
});
|
||||
}
|
||||
console.log('aaa111', res.data)
|
||||
optionsData.value = res.data.geocodes
|
||||
optionsVisible.value = true
|
||||
});
|
||||
}
|
||||
const handleflyto = (e) =>{
|
||||
optionsVisible.value = false
|
||||
let location = e.location.split(',')
|
||||
map.flyTo({
|
||||
center: location,
|
||||
zoom: 13,
|
||||
bearing: 0,
|
||||
speed: 1, // 飞行速度
|
||||
curve: 2, // 飞行曲线
|
||||
essential: true,
|
||||
easing(t) {
|
||||
// 飞行动画函数
|
||||
return t;
|
||||
},
|
||||
});
|
||||
}
|
||||
// 定义地图容器
|
||||
|
|
@ -149,8 +167,8 @@
|
|||
drawTool = new MapboxDraw({
|
||||
displayControlsDefault: false,
|
||||
controls: {
|
||||
point: true,
|
||||
polygon: true, // 仅显示“绘制多边形”按钮
|
||||
point: props.isPoint? true: false,
|
||||
polygon: props.isPoint? false: true, // 仅显示“绘制多边形”按钮
|
||||
trash: true // 仅显示“删除”按钮
|
||||
},
|
||||
modes: {
|
||||
|
|
@ -635,6 +653,29 @@
|
|||
left: 20px;
|
||||
top: 10px;
|
||||
width: 300px;
|
||||
.addressbox{
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
overflow: auto;
|
||||
padding-top: 10px;
|
||||
background: #fff;
|
||||
border-radius: 0 0 3px 3px;
|
||||
.flex{
|
||||
cursor: pointer;
|
||||
line-height: 30px;
|
||||
.label{
|
||||
margin: 0 10px;
|
||||
max-width: 170px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.mr-1{
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
<a-modal v-model:visible="mapsVisible" title="位置选择" @cancel="handleCancel" @ok="handleOk" width="800px" height="500px" >
|
||||
<a-modal v-model:visible="mapsVisible" title="位置选择" @cancel="handleCancel" @ok="handleOk" width="1200px" height="850px" >
|
||||
<div class="modalbox">
|
||||
<MapboxMap @handlerDrawComplete="handlerDrawComplete" :location="location" :geoms="geomData"></MapboxMap>
|
||||
<MapboxMap @handlerDrawComplete="handlerDrawComplete" :location="location" :geoms="geomData" :isPoint="geoType"></MapboxMap>
|
||||
</div>
|
||||
|
||||
</a-modal>
|
||||
|
|
@ -29,16 +29,18 @@ import { ref, watch, defineAsyncComponent, onMounted } from 'vue';
|
|||
import MapboxMap from './components/map.vue';
|
||||
import axios from 'axios';
|
||||
import { useRuleFormItem } from '@/hooks/component/useFormItem';
|
||||
import { propTypes } from '@/utils/propTypes';
|
||||
|
||||
defineOptions({ name: 'AddressDetails' });
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
disabled: propTypes.bool,
|
||||
value: { type: String },
|
||||
geoType: {
|
||||
type: String,
|
||||
default: '3',
|
||||
},
|
||||
geoType: propTypes.bool,
|
||||
});
|
||||
onMounted(() => {
|
||||
|
||||
console.log('rrr112r', props)
|
||||
})
|
||||
const emitData = ref<any[]>([]);
|
||||
const [FormItemData] = useRuleFormItem(props);
|
||||
|
|
@ -104,7 +106,7 @@ watch(
|
|||
<style lang="less">
|
||||
.modalbox{
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
height: 600px;
|
||||
}
|
||||
.flex{
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export const MapboxDefaultStyle = {
|
|||
`https://t0.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
|
||||
],
|
||||
tileSize: 256,
|
||||
minzoom:18,
|
||||
minzoom:5,
|
||||
maxzoom:24,
|
||||
},
|
||||
'dianzi-biaozhu': {
|
||||
|
|
@ -23,6 +23,8 @@ export const MapboxDefaultStyle = {
|
|||
`https://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
|
||||
],
|
||||
tileSize: 256,
|
||||
minzoom:8,
|
||||
maxzoom:24,
|
||||
},
|
||||
'raster-tiles': {
|
||||
type: 'raster',
|
||||
|
|
@ -42,8 +44,10 @@ export const MapboxDefaultStyle = {
|
|||
layout: {
|
||||
visibility: 'visible',
|
||||
},
|
||||
minzoom: 5,
|
||||
maxzoom: 24,
|
||||
},{
|
||||
id: 'tdt-img-tiles',
|
||||
id: 'raster-tiles',
|
||||
type: 'raster',
|
||||
source: 'raster-tiles',
|
||||
minzoom: 0,
|
||||
|
|
@ -52,10 +56,10 @@ export const MapboxDefaultStyle = {
|
|||
id: 'dianzi',
|
||||
type: 'raster',
|
||||
source: 'dianzi',
|
||||
layout: {
|
||||
visibility: 'visible',
|
||||
},
|
||||
minzoom: 18,
|
||||
// layout: {
|
||||
// visibility: 'visible',
|
||||
// },
|
||||
minzoom: 5,
|
||||
maxzoom: 24,
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
const getOptions = computed(() => {
|
||||
const { labelField, valueField, numberToString } = props;
|
||||
|
||||
|
||||
let data = unref(optionsRef).reduce((prev, next: any) => {
|
||||
if (next) {
|
||||
const value = get(next, valueField);
|
||||
|
|
|
|||
|
|
@ -280,7 +280,11 @@
|
|||
let path = '';
|
||||
const { server } = props;
|
||||
fileList.value?.forEach((item, index) => {
|
||||
path += item.url?.replace(server + '/', '') + ',';
|
||||
if(index+1 == fileList.value.length){
|
||||
path += item.url?.replace(server + '/', '');
|
||||
}else{
|
||||
path += item.url?.replace(server + '/', '') + ',';
|
||||
}
|
||||
});
|
||||
return path;
|
||||
// const list = (fileList.value || [])
|
||||
|
|
@ -294,7 +298,7 @@
|
|||
const globalImagePreviewUrl = ref();
|
||||
|
||||
function handlerPreviewImage(item,index): void {
|
||||
console.log('aaaa', )
|
||||
|
||||
const { azimuth} = props;
|
||||
// if(azimuth){
|
||||
globalImagePreviewUrl.value = item.url
|
||||
|
|
|
|||
|
|
@ -233,8 +233,11 @@ import { fileUploadApi } from '@/api/sys/upload';
|
|||
const { server } = props;
|
||||
let saveData = "";
|
||||
fileList.value.forEach((item,index)=>{
|
||||
console.log("fileListItem",item);
|
||||
saveData+=item.url?.replace(server,"")+","
|
||||
if(index+1 == fileList.value.length){
|
||||
saveData += item.url?.replace(server + '/', '');
|
||||
}else{
|
||||
path += item.url?.replace(server + '/', '') + ',';
|
||||
}
|
||||
})
|
||||
return saveData;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,12 +100,6 @@
|
|||
<FormItem label="图标" v-if="['Button'].includes(formConfig.currentItem.component)">
|
||||
<IconPicker v-model:value="formConfig.currentItem.componentProps.icon" />
|
||||
</FormItem>
|
||||
<FormItem label="图斑类型" v-if="['AddressDetails'].includes(formConfig.currentItem.component)">
|
||||
<a-radio-group v-model:value="formConfig.currentItem.geoType">
|
||||
<a-radio value="1">点</a-radio>
|
||||
<a-radio value="2">面</a-radio>
|
||||
</a-radio-group>
|
||||
</FormItem>
|
||||
<FormItem label="脚本" v-if="['Button'].includes(formConfig.currentItem.component)">
|
||||
<a-button size="mini" @click="handleButtonClick"> 点击脚本 </a-button>
|
||||
</FormItem>
|
||||
|
|
@ -443,8 +437,7 @@
|
|||
let arr = allOptions.value.filter((item) => {
|
||||
return item.category == 'input';
|
||||
});
|
||||
console.log(arr);
|
||||
console.log(currentIndex.value);
|
||||
|
||||
arr.forEach((item) => {
|
||||
if (item.name == 'dataTable') {
|
||||
if (currentIndex.value == -1) {
|
||||
|
|
|
|||
|
|
@ -1267,6 +1267,25 @@ const componentAttrs: IBaseComponentProps = {
|
|||
component: 'Checkbox',
|
||||
},
|
||||
],
|
||||
AddressInput: [
|
||||
{
|
||||
name: 'geoType',
|
||||
label: '图斑类型',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '点',
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
label: '面',
|
||||
value: false,
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
function deleteProps(list: Omit<IBaseFormAttrs, 'tag'>[], key: string) {
|
||||
|
|
@ -1278,6 +1297,7 @@ function deleteProps(list: Omit<IBaseFormAttrs, 'tag'>[], key: string) {
|
|||
}
|
||||
|
||||
componentAttrs['StrengthMeter'] = componentAttrs['Input'];
|
||||
|
||||
componentAttrs['StrengthMeter'].push({
|
||||
name: 'visibilityToggle',
|
||||
label: '是否显示切换按钮',
|
||||
|
|
@ -1288,6 +1308,9 @@ deleteProps(componentAttrs['StrengthMeter'], 'type');
|
|||
deleteProps(componentAttrs['StrengthMeter'], 'prefix');
|
||||
deleteProps(componentAttrs['StrengthMeter'], 'defaultValue');
|
||||
deleteProps(componentAttrs['StrengthMeter'], 'suffix');
|
||||
|
||||
componentAttrs['AddressDetails'] = componentAttrs['AddressInput'];
|
||||
|
||||
//组件属性
|
||||
// name 控件的属性
|
||||
export const baseComponentAttrs: IBaseComponentProps = componentAttrs;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export interface IBaseFormAttrs {
|
|||
on?: IAnyObject;
|
||||
children?: IBaseFormAttrs[];
|
||||
category?: 'control' | 'input';
|
||||
geoType: string
|
||||
}
|
||||
|
||||
export interface IBaseFormItemControlAttrs extends IBaseFormAttrs {
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
'ImageUpload',
|
||||
'VideoUpload',
|
||||
'Tabs',
|
||||
'AddressDetails'
|
||||
];
|
||||
|
||||
const config_backups: any = {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@
|
|||
icon: [
|
||||
{
|
||||
component: 'IconPicker',
|
||||
required: true,
|
||||
required: false,
|
||||
message: '请选择图标',
|
||||
trigger: 'blur',
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue