1、调整凭证
2、调整运单
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="地图选择地址"
|
||||
width="920px"
|
||||
append-to-body
|
||||
@opened="initMap"
|
||||
>
|
||||
<el-dialog v-model="visible" title="地图选择地址" width="920px" append-to-body @opened="initMap">
|
||||
<div class="address-map-picker__toolbar">
|
||||
<el-input
|
||||
v-model="keyword"
|
||||
@@ -15,7 +9,14 @@
|
||||
/>
|
||||
<el-button type="primary" :loading="searching" @click="searchKeyword">搜索</el-button>
|
||||
</div>
|
||||
<div ref="map" class="address-map-picker__map"></div>
|
||||
<div class="address-map-picker__content">
|
||||
<map-search-results
|
||||
v-if="searchResults.length"
|
||||
:results="searchResults"
|
||||
@select="selectSearchResult"
|
||||
/>
|
||||
<div ref="map" class="address-map-picker__map"></div>
|
||||
</div>
|
||||
<div class="address-map-picker__info">{{ status }}</div>
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
@@ -54,6 +55,8 @@ export default {
|
||||
amap: null,
|
||||
marker: null,
|
||||
geocoder: null,
|
||||
searchResults: [],
|
||||
mapInitializing: null,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -65,6 +68,7 @@ export default {
|
||||
this.keyword = this.address || '';
|
||||
this.selected = {};
|
||||
this.status = '可搜索地址或点击地图选点';
|
||||
this.searchResults = [];
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -96,25 +100,39 @@ export default {
|
||||
return amapLoader;
|
||||
},
|
||||
initMap() {
|
||||
this.loadAmap()
|
||||
if (this.mapInitializing) return this.mapInitializing;
|
||||
|
||||
this.mapInitializing = this.loadAmap()
|
||||
.then(() => {
|
||||
this.$nextTick(() => {
|
||||
if (!this.amap) {
|
||||
this.amap = new window.AMap.Map(this.$refs.map, {
|
||||
center: [116.40769, 39.89945],
|
||||
zoom: 11,
|
||||
});
|
||||
this.amap.on('click', event => this.pickPoint(event.lnglat));
|
||||
} else {
|
||||
this.amap.resize();
|
||||
this.clearMarker();
|
||||
}
|
||||
if (!window.AMap?.Map) {
|
||||
throw new Error('高德地图组件未就绪');
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
this.$nextTick(() => {
|
||||
if (!this.$refs.map) return resolve(null);
|
||||
if (!this.amap) {
|
||||
this.amap = new window.AMap.Map(this.$refs.map, {
|
||||
center: [116.40769, 39.89945],
|
||||
zoom: 11,
|
||||
});
|
||||
this.amap.on('click', event => this.pickPoint(event.lnglat));
|
||||
} else {
|
||||
this.amap.resize();
|
||||
this.clearMarker();
|
||||
}
|
||||
resolve(this.amap);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('高德地图组件加载失败,请稍后重试');
|
||||
this.visible = false;
|
||||
return null;
|
||||
})
|
||||
.finally(() => {
|
||||
this.mapInitializing = null;
|
||||
});
|
||||
return this.mapInitializing;
|
||||
},
|
||||
ensureGeocoder() {
|
||||
if (this.geocoder) return Promise.resolve(this.geocoder);
|
||||
@@ -154,15 +172,28 @@ export default {
|
||||
this.$message.warning('请输入地址关键词');
|
||||
return;
|
||||
}
|
||||
if (this.searching) return;
|
||||
this.searchResults = [];
|
||||
this.searching = true;
|
||||
this.loadAmap()
|
||||
.then(() => this.runGeocode('location', keyword))
|
||||
this.initMap()
|
||||
.then(map => (map ? this.runGeocode('location', keyword) : null))
|
||||
.then(result => {
|
||||
const point = result.geocodes?.[0]?.location || result.location;
|
||||
if (!result) return;
|
||||
const geocodes = result.geocodes || (result.location ? [result] : []);
|
||||
this.searchResults = geocodes.map((item, index) => ({
|
||||
id: item.id || index,
|
||||
name: item.formattedAddress || item.address || keyword,
|
||||
address: item.formattedAddress || item.address || keyword,
|
||||
location: item.location,
|
||||
}));
|
||||
const point = geocodes[0]?.location || result.location;
|
||||
if (!point) {
|
||||
throw new Error('未找到匹配地址');
|
||||
}
|
||||
this.pickPoint(point, keyword);
|
||||
return this.$nextTick().then(() => {
|
||||
this.amap?.resize();
|
||||
this.pickPoint(point, geocodes[0]?.formattedAddress || keyword);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.status = '未找到匹配地址';
|
||||
@@ -172,6 +203,11 @@ export default {
|
||||
this.searching = false;
|
||||
});
|
||||
},
|
||||
selectSearchResult(item) {
|
||||
if (item && item.location) {
|
||||
this.pickPoint(item.location, item.address || item.name || '');
|
||||
}
|
||||
},
|
||||
pickPoint(point, fallbackAddress = '') {
|
||||
const longitude = typeof point.getLng === 'function' ? point.getLng() : point.lng;
|
||||
const latitude = typeof point.getLat === 'function' ? point.getLat() : point.lat;
|
||||
@@ -181,7 +217,11 @@ export default {
|
||||
}
|
||||
const lnglat = new window.AMap.LngLat(Number(longitude), Number(latitude));
|
||||
this.renderMarker(lnglat);
|
||||
this.selected = { longitude: Number(longitude), latitude: Number(latitude), address: fallbackAddress };
|
||||
this.selected = {
|
||||
longitude: Number(longitude),
|
||||
latitude: Number(latitude),
|
||||
address: fallbackAddress,
|
||||
};
|
||||
this.status = '正在解析地址...';
|
||||
this.resolving = true;
|
||||
this.runGeocode('address', lnglat)
|
||||
@@ -238,11 +278,19 @@ export default {
|
||||
}
|
||||
|
||||
&__map {
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
height: 420px;
|
||||
border: 1px solid #eff1f7;
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__info {
|
||||
margin-top: 10px;
|
||||
color: #606266;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div v-if="results.length" class="map-search-results">
|
||||
<div class="map-search-results__title">搜索结果</div>
|
||||
<el-empty v-if="!results.length" description="暂无搜索结果" :image-size="60" />
|
||||
<div
|
||||
v-for="(item, index) in results"
|
||||
:key="item.id || index"
|
||||
class="map-search-results__item"
|
||||
@click="$emit('select', item)"
|
||||
>
|
||||
<div class="map-search-results__name">{{ item.name || item.address || '未命名地址' }}</div>
|
||||
<div class="map-search-results__address">{{ item.address || item.name || '-' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
results: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
emits: ['select'],
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.map-search-results {
|
||||
width: 260px;
|
||||
height: 420px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #eff1f7;
|
||||
background: #fff;
|
||||
flex: 0 0 260px;
|
||||
|
||||
&__title {
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid #eff1f7;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__item {
|
||||
padding: 10px 12px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
&__item:hover {
|
||||
background: #f5f9ff;
|
||||
}
|
||||
|
||||
&__name {
|
||||
color: #303133;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
&__address {
|
||||
margin-top: 4px;
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -75,8 +75,8 @@ import pdfWorkerSrc from 'pdfjs-dist/build/pdf.worker.mjs?url';
|
||||
import { baseUrl } from '@/config/env';
|
||||
import { getUploadHeaders } from '@/utils/upload';
|
||||
|
||||
const UNIFIED_ATTACHMENT_TIP =
|
||||
'支持pdf、bmp、jpeg、png、jpg、doc、docx、ppt、pptx、xlsx、xls、eml、msg、zip的文件格式,单个文件不超过500M';
|
||||
const UNIFIED_ATTACHMENT_TIP_PREFIX =
|
||||
'支持pdf、bmp、jpeg、png、jpg、doc、docx、ppt、pptx、xlsx、xls、eml、msg、zip的文件格式,单个文件不超过';
|
||||
|
||||
const MIME_MAP = {
|
||||
jpg: 'image/jpeg',
|
||||
@@ -215,7 +215,7 @@ export default {
|
||||
return this.acceptedList.join(',');
|
||||
},
|
||||
tipText() {
|
||||
return this.tip || UNIFIED_ATTACHMENT_TIP;
|
||||
return this.tip || `${UNIFIED_ATTACHMENT_TIP_PREFIX}${this.maxSize}M`;
|
||||
},
|
||||
uploadingCount() {
|
||||
return this.fileList.filter(file => ['ready', 'uploading'].includes(file.status)).length;
|
||||
|
||||
Reference in New Issue
Block a user