vue-openlayers-plugin 1.1.15 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +302 -170
- package/lib/{BasemapPanel-7664fc20.mjs → BasemapPanel-d6e4ea88.mjs} +1 -1
- package/lib/{CoordinateLocationDialog-f505c006.mjs → CoordinateLocationDialog-81d00abc.mjs} +1 -1
- package/lib/{MapPrintDialog-0cf04cae.mjs → FilterPanel-7358e3fb.mjs} +1 -1
- package/lib/{FilterPanel-4cfbbfeb.mjs → LayerPanel-9bf28955.mjs} +1 -1
- package/lib/{LayerPanel-354b6ac7.mjs → MapPrintDialog-64d46412.mjs} +1 -1
- package/lib/{MeasurementDialog-4fd11413.mjs → MeasurementDialog-4e084192.mjs} +1 -1
- package/lib/{MyMarkersDialog-f413337c.mjs → MyMarkersDialog-aa44e5bd.mjs} +1 -1
- package/lib/{QuadCompareDialog-176a8178.mjs → QuadCompareDialog-84a88cf9.mjs} +1 -1
- package/lib/{RegionNavigationDialog-1edd078f.mjs → RegionNavigationDialog-467ad6c0.mjs} +1 -1
- package/lib/{SplitCompareDialog-3fe419de.mjs → SplitCompareDialog-50410c0b.mjs} +1 -1
- package/lib/{SwipeCompareDialog-e2c28122.mjs → SwipeCompareDialog-c322e2f6.mjs} +1 -1
- package/lib/{ViewBookmarksDialog-9873fb3c.mjs → ViewBookmarksDialog-83cf5ec4.mjs} +1 -1
- package/lib/{index-923f7253.mjs → index-58704a25.mjs} +400 -152
- package/lib/{index-a30f4100.mjs → index-ee58f2f8.mjs} +1 -1
- package/lib/{index.es-b7728855.mjs → index.es-320e524d.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +386 -138
- package/lib/style.css +13 -4
- package/package.json +106 -106
- package/types/components/OlDialogs/LayerPanel.vue.d.ts +102 -0
- package/types/components/OlDialogs/LayerPanel.vue.d.ts.map +1 -1
- package/types/components/OlMap.vue.d.ts +204 -0
- package/types/components/OlMap.vue.d.ts.map +1 -1
- package/types/components/OlMapSearch.vue.d.ts +20 -1
- package/types/components/OlMapSearch.vue.d.ts.map +1 -1
- package/types/core/LayerManager.d.ts +5 -5
- package/types/core/LayerManager.d.ts.map +1 -1
- package/types/core/layers/GeoJSONLayerHandler.d.ts +3 -4
- package/types/core/layers/GeoJSONLayerHandler.d.ts.map +1 -1
- package/types/core/layers/interfaces.d.ts +1 -1
- package/types/core/layers/interfaces.d.ts.map +1 -1
- package/types/core/storage.d.ts.map +1 -1
- package/types/core/tiandituSearchApi.d.ts.map +1 -1
- package/types/lowcode-entry.d.ts +204 -0
- package/types/lowcode-entry.d.ts.map +1 -1
- package/types/plugins/index.d.ts +90 -0
- package/types/plugins/index.d.ts.map +1 -0
- package/types/services/searchService.d.ts +21 -1
- package/types/services/searchService.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
- package/types/types/map.d.ts +29 -1
- package/types/types/map.d.ts.map +1 -1
|
@@ -53198,33 +53198,10 @@ class MapStorage {
|
|
|
53198
53198
|
};
|
|
53199
53199
|
if (config.url)
|
|
53200
53200
|
optimizedConfig.url = config.url;
|
|
53201
|
-
if (config.method)
|
|
53202
|
-
optimizedConfig.method = config.method;
|
|
53203
|
-
if (config.params && Object.keys(config.params).length > 0) {
|
|
53204
|
-
optimizedConfig.params = config.params;
|
|
53205
|
-
}
|
|
53206
|
-
if (config.headers && Object.keys(config.headers).length > 0) {
|
|
53207
|
-
optimizedConfig.headers = config.headers;
|
|
53208
|
-
}
|
|
53209
|
-
if (config.body !== void 0)
|
|
53210
|
-
optimizedConfig.body = config.body;
|
|
53211
|
-
if (config.dataPath)
|
|
53212
|
-
optimizedConfig.dataPath = config.dataPath;
|
|
53213
53201
|
if (config.opacity !== void 0 && config.opacity !== 1)
|
|
53214
53202
|
optimizedConfig.opacity = config.opacity;
|
|
53215
53203
|
if (config.zIndex !== void 0 && config.zIndex !== 0)
|
|
53216
53204
|
optimizedConfig.zIndex = config.zIndex;
|
|
53217
|
-
if (config.geojsonConfig)
|
|
53218
|
-
optimizedConfig.geojsonConfig = config.geojsonConfig;
|
|
53219
|
-
if (config.config)
|
|
53220
|
-
optimizedConfig.config = config.config;
|
|
53221
|
-
if (config.projection)
|
|
53222
|
-
optimizedConfig.projection = config.projection;
|
|
53223
|
-
if (config.projectionDefinition) {
|
|
53224
|
-
optimizedConfig.projectionDefinition = config.projectionDefinition;
|
|
53225
|
-
}
|
|
53226
|
-
if (config.style)
|
|
53227
|
-
optimizedConfig.style = config.style;
|
|
53228
53205
|
if (config.legend)
|
|
53229
53206
|
optimizedConfig.legend = config.legend;
|
|
53230
53207
|
if (config.metadata && Object.keys(config.metadata).length > 0) {
|
|
@@ -67684,6 +67661,7 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67684
67661
|
__publicField(this, "vectorSource", null);
|
|
67685
67662
|
__publicField(this, "refreshTimer", null);
|
|
67686
67663
|
__publicField(this, "refreshDebounceTimer", null);
|
|
67664
|
+
__publicField(this, "initialRefreshTimer", null);
|
|
67687
67665
|
__publicField(this, "moveEndListener", null);
|
|
67688
67666
|
__publicField(this, "lastKnownZoom");
|
|
67689
67667
|
__publicField(this, "isRefreshing", false);
|
|
@@ -67705,9 +67683,6 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67705
67683
|
this.setupRefreshBehavior();
|
|
67706
67684
|
return vectorLayer;
|
|
67707
67685
|
}
|
|
67708
|
-
/**
|
|
67709
|
-
* 创建矢量数据源
|
|
67710
|
-
*/
|
|
67711
67686
|
createVectorSource() {
|
|
67712
67687
|
this.registerCustomProjection();
|
|
67713
67688
|
return new VectorSource$1();
|
|
@@ -67738,14 +67713,13 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67738
67713
|
const normalizedParams = {
|
|
67739
67714
|
...requestConfig.params || {}
|
|
67740
67715
|
};
|
|
67741
|
-
const layerConfig = this.config;
|
|
67742
67716
|
const landTypeParamName = requestConfig.landTypeParamName || "landType";
|
|
67743
|
-
const landTypeValue = requestConfig.landType ??
|
|
67717
|
+
const landTypeValue = requestConfig.landType ?? this.config.geojsonLandType ?? normalizedParams[landTypeParamName] ?? normalizedParams.landType;
|
|
67744
67718
|
if (landTypeValue !== void 0 && normalizedParams[landTypeParamName] === void 0) {
|
|
67745
67719
|
normalizedParams[landTypeParamName] = landTypeValue;
|
|
67746
67720
|
}
|
|
67747
67721
|
const managementUnitParamName = requestConfig.managementUnitParamName || "managementUnit";
|
|
67748
|
-
const managementUnitValue = requestConfig.managementUnit ??
|
|
67722
|
+
const managementUnitValue = requestConfig.managementUnit ?? this.config.managementUnit ?? ((_a2 = this.config.metadata) == null ? void 0 : _a2.managementUnit) ?? normalizedParams[managementUnitParamName] ?? normalizedParams.managementUnit;
|
|
67749
67723
|
if (managementUnitValue !== void 0 && normalizedParams[managementUnitParamName] === void 0) {
|
|
67750
67724
|
normalizedParams[managementUnitParamName] = managementUnitValue;
|
|
67751
67725
|
}
|
|
@@ -67764,20 +67738,30 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67764
67738
|
async initializeSource() {
|
|
67765
67739
|
var _a2;
|
|
67766
67740
|
const source = this.getVectorSource();
|
|
67767
|
-
if (!source)
|
|
67741
|
+
if (!source) {
|
|
67768
67742
|
return;
|
|
67743
|
+
}
|
|
67769
67744
|
const geojsonConfig = this.getGeoJSONConfig();
|
|
67770
67745
|
if (geojsonConfig.data) {
|
|
67771
67746
|
this.applyGeoJSONData(geojsonConfig.data);
|
|
67772
67747
|
return;
|
|
67773
67748
|
}
|
|
67774
67749
|
if (((_a2 = geojsonConfig.request) == null ? void 0 : _a2.url) || this.config.url) {
|
|
67775
|
-
|
|
67750
|
+
this.scheduleInitialRefresh();
|
|
67776
67751
|
return;
|
|
67777
67752
|
}
|
|
67778
67753
|
source.clear();
|
|
67779
67754
|
this.originalFeatures = [];
|
|
67780
67755
|
}
|
|
67756
|
+
scheduleInitialRefresh() {
|
|
67757
|
+
if (this.initialRefreshTimer) {
|
|
67758
|
+
clearTimeout(this.initialRefreshTimer);
|
|
67759
|
+
}
|
|
67760
|
+
this.initialRefreshTimer = setTimeout(() => {
|
|
67761
|
+
this.initialRefreshTimer = null;
|
|
67762
|
+
void this.refresh();
|
|
67763
|
+
}, 0);
|
|
67764
|
+
}
|
|
67781
67765
|
getVectorSource() {
|
|
67782
67766
|
if (this.vectorSource) {
|
|
67783
67767
|
return this.vectorSource;
|
|
@@ -67791,8 +67775,9 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67791
67775
|
}
|
|
67792
67776
|
applyGeoJSONData(data) {
|
|
67793
67777
|
const source = this.getVectorSource();
|
|
67794
|
-
if (!source)
|
|
67778
|
+
if (!source) {
|
|
67795
67779
|
return;
|
|
67780
|
+
}
|
|
67796
67781
|
const features2 = this.readFeaturesFromData(data);
|
|
67797
67782
|
source.clear();
|
|
67798
67783
|
source.addFeatures(features2);
|
|
@@ -67816,7 +67801,7 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67816
67801
|
}
|
|
67817
67802
|
try {
|
|
67818
67803
|
return this.normalizeGeoJSONData(JSON.parse(trimmed));
|
|
67819
|
-
} catch
|
|
67804
|
+
} catch {
|
|
67820
67805
|
throw new Error("GeoJSON 字符串解析失败");
|
|
67821
67806
|
}
|
|
67822
67807
|
}
|
|
@@ -67900,15 +67885,17 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67900
67885
|
};
|
|
67901
67886
|
}
|
|
67902
67887
|
createRequestUrl(url, params, method) {
|
|
67903
|
-
|
|
67888
|
+
var _a2;
|
|
67889
|
+
const baseOrigin = typeof window !== "undefined" && ((_a2 = window.location) == null ? void 0 : _a2.origin) ? window.location.origin : "http://localhost";
|
|
67890
|
+
const requestUrl = new URL(url, baseOrigin);
|
|
67904
67891
|
Object.entries(params).forEach(([key, value]) => {
|
|
67905
67892
|
if (value === void 0 || value === null || method !== "GET") {
|
|
67906
67893
|
return;
|
|
67907
67894
|
}
|
|
67908
67895
|
if (Array.isArray(value)) {
|
|
67909
|
-
value.forEach(
|
|
67910
|
-
|
|
67911
|
-
);
|
|
67896
|
+
value.forEach((item) => {
|
|
67897
|
+
requestUrl.searchParams.append(key, String(item));
|
|
67898
|
+
});
|
|
67912
67899
|
return;
|
|
67913
67900
|
}
|
|
67914
67901
|
requestUrl.searchParams.set(key, String(value));
|
|
@@ -67918,6 +67905,8 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67918
67905
|
async refresh(overrides) {
|
|
67919
67906
|
const geojsonConfig = this.getGeoJSONConfig();
|
|
67920
67907
|
const requestConfig = geojsonConfig.request;
|
|
67908
|
+
let requestUrl = "";
|
|
67909
|
+
let requestMethod = (requestConfig == null ? void 0 : requestConfig.method) || "GET";
|
|
67921
67910
|
if (!(requestConfig == null ? void 0 : requestConfig.url)) {
|
|
67922
67911
|
if (geojsonConfig.data) {
|
|
67923
67912
|
this.applyGeoJSONData(geojsonConfig.data);
|
|
@@ -67930,12 +67919,13 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67930
67919
|
this.isRefreshing = true;
|
|
67931
67920
|
try {
|
|
67932
67921
|
const refreshPayload = this.buildExtentPayload(geojsonConfig.refresh);
|
|
67922
|
+
const currentRequestBody = (overrides == null ? void 0 : overrides.body) ?? requestConfig.body;
|
|
67933
67923
|
const context = this.buildRequestContext({
|
|
67934
67924
|
params: {
|
|
67935
67925
|
...refreshPayload.params || {},
|
|
67936
67926
|
...(overrides == null ? void 0 : overrides.params) || {}
|
|
67937
67927
|
},
|
|
67938
|
-
body: typeof refreshPayload.body === "object" && !Array.isArray(refreshPayload.body) && typeof
|
|
67928
|
+
body: typeof refreshPayload.body === "object" && !Array.isArray(refreshPayload.body) && typeof currentRequestBody === "object" && !Array.isArray(currentRequestBody) ? {
|
|
67939
67929
|
...requestConfig.body,
|
|
67940
67930
|
...refreshPayload.body,
|
|
67941
67931
|
...overrides == null ? void 0 : overrides.body
|
|
@@ -67966,17 +67956,19 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
67966
67956
|
}
|
|
67967
67957
|
};
|
|
67968
67958
|
}
|
|
67969
|
-
|
|
67959
|
+
requestMethod = request.method;
|
|
67960
|
+
requestUrl = this.createRequestUrl(
|
|
67970
67961
|
request.url,
|
|
67971
67962
|
request.params,
|
|
67972
67963
|
request.method
|
|
67973
67964
|
);
|
|
67965
|
+
const requestHeaders = request.method === "GET" ? { ...request.headers } : {
|
|
67966
|
+
"Content-Type": "application/json;charset=UTF-8",
|
|
67967
|
+
...request.headers
|
|
67968
|
+
};
|
|
67974
67969
|
const response = await fetch(requestUrl, {
|
|
67975
67970
|
method: request.method,
|
|
67976
|
-
headers:
|
|
67977
|
-
"Content-Type": request.method === "GET" ? void 0 : "application/json;charset=UTF-8",
|
|
67978
|
-
...request.headers
|
|
67979
|
-
},
|
|
67971
|
+
headers: requestHeaders,
|
|
67980
67972
|
body: request.method === "GET" || request.body === void 0 ? void 0 : typeof request.body === "string" ? request.body : JSON.stringify(request.body)
|
|
67981
67973
|
});
|
|
67982
67974
|
if (!response.ok) {
|
|
@@ -68013,7 +68005,10 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
68013
68005
|
source == null ? void 0 : source.clear();
|
|
68014
68006
|
this.originalFeatures = [];
|
|
68015
68007
|
}
|
|
68016
|
-
|
|
68008
|
+
const errorMessage = error2 instanceof Error ? error2.message : String(error2);
|
|
68009
|
+
throw new Error(
|
|
68010
|
+
`GeoJSON 请求失败 [${this.config.id}] ${requestMethod} ${requestUrl || requestConfig.url}: ${errorMessage}`
|
|
68011
|
+
);
|
|
68017
68012
|
} finally {
|
|
68018
68013
|
this.isRefreshing = false;
|
|
68019
68014
|
}
|
|
@@ -68771,6 +68766,10 @@ class GeoJSONLayerHandler extends BaseLayer2 {
|
|
|
68771
68766
|
}
|
|
68772
68767
|
destroy() {
|
|
68773
68768
|
this.clearRefreshBehavior();
|
|
68769
|
+
if (this.initialRefreshTimer) {
|
|
68770
|
+
clearTimeout(this.initialRefreshTimer);
|
|
68771
|
+
this.initialRefreshTimer = null;
|
|
68772
|
+
}
|
|
68774
68773
|
this.vectorSource = null;
|
|
68775
68774
|
super.destroy();
|
|
68776
68775
|
}
|
|
@@ -333777,72 +333776,6 @@ class LayerManager {
|
|
|
333777
333776
|
getLayerHandler(layerId) {
|
|
333778
333777
|
return this.layerHandlers.get(layerId);
|
|
333779
333778
|
}
|
|
333780
|
-
async refreshLayer(layerId, options) {
|
|
333781
|
-
try {
|
|
333782
|
-
const config = this.getLayerConfig(layerId);
|
|
333783
|
-
if (!config) {
|
|
333784
|
-
return false;
|
|
333785
|
-
}
|
|
333786
|
-
if (!this.layerHandlers.has(layerId) && config.visible) {
|
|
333787
|
-
const loaded = await this.loadLayerOnDemand(layerId);
|
|
333788
|
-
if (!loaded) {
|
|
333789
|
-
return false;
|
|
333790
|
-
}
|
|
333791
|
-
}
|
|
333792
|
-
const handler = this.layerHandlers.get(layerId);
|
|
333793
|
-
if (!(handler == null ? void 0 : handler.refresh)) {
|
|
333794
|
-
return false;
|
|
333795
|
-
}
|
|
333796
|
-
await handler.refresh(options);
|
|
333797
|
-
return true;
|
|
333798
|
-
} catch (error2) {
|
|
333799
|
-
console.error("刷新图层失败:", error2);
|
|
333800
|
-
return false;
|
|
333801
|
-
}
|
|
333802
|
-
}
|
|
333803
|
-
updateLayerRequestParams(layerId, params) {
|
|
333804
|
-
var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m;
|
|
333805
|
-
try {
|
|
333806
|
-
const config = this.getLayerConfig(layerId);
|
|
333807
|
-
if (!config) {
|
|
333808
|
-
return false;
|
|
333809
|
-
}
|
|
333810
|
-
const nextConfig = {
|
|
333811
|
-
...config,
|
|
333812
|
-
params: {
|
|
333813
|
-
...config.params || {},
|
|
333814
|
-
...params
|
|
333815
|
-
},
|
|
333816
|
-
geojsonConfig: {
|
|
333817
|
-
...config.geojsonConfig || ((_b2 = (_a2 = config.config) == null ? void 0 : _a2.vector) == null ? void 0 : _b2.geojson) || ((_c2 = config.config) == null ? void 0 : _c2.geojson) || {},
|
|
333818
|
-
request: {
|
|
333819
|
-
...((_g = config.geojsonConfig || ((_e2 = (_d = config.config) == null ? void 0 : _d.vector) == null ? void 0 : _e2.geojson) || ((_f = config.config) == null ? void 0 : _f.geojson)) == null ? void 0 : _g.request) || {},
|
|
333820
|
-
params: {
|
|
333821
|
-
...((_l = (_k = config.geojsonConfig || ((_i2 = (_h = config.config) == null ? void 0 : _h.vector) == null ? void 0 : _i2.geojson) || ((_j = config.config) == null ? void 0 : _j.geojson)) == null ? void 0 : _k.request) == null ? void 0 : _l.params) || {},
|
|
333822
|
-
...params
|
|
333823
|
-
}
|
|
333824
|
-
}
|
|
333825
|
-
}
|
|
333826
|
-
};
|
|
333827
|
-
if (this.layerConfigs.has(layerId)) {
|
|
333828
|
-
this.layerConfigs.set(layerId, nextConfig);
|
|
333829
|
-
}
|
|
333830
|
-
if (this.pendingLayerConfigs.has(layerId)) {
|
|
333831
|
-
this.pendingLayerConfigs.set(layerId, nextConfig);
|
|
333832
|
-
}
|
|
333833
|
-
const handler = this.layerHandlers.get(layerId);
|
|
333834
|
-
(_m = handler == null ? void 0 : handler.updateRequestParams) == null ? void 0 : _m.call(handler, params);
|
|
333835
|
-
this.saveLayerConfigs();
|
|
333836
|
-
this.eventBus.emit("layer-config-updated", {
|
|
333837
|
-
layerId,
|
|
333838
|
-
config: nextConfig
|
|
333839
|
-
});
|
|
333840
|
-
return true;
|
|
333841
|
-
} catch (error2) {
|
|
333842
|
-
console.error("更新图层请求参数失败:", error2);
|
|
333843
|
-
return false;
|
|
333844
|
-
}
|
|
333845
|
-
}
|
|
333846
333779
|
/**
|
|
333847
333780
|
* 设置底图图层ID列表(用于底图互斥判断)
|
|
333848
333781
|
*/
|
|
@@ -334160,25 +334093,74 @@ class LayerManager {
|
|
|
334160
334093
|
}
|
|
334161
334094
|
return void 0;
|
|
334162
334095
|
}
|
|
334096
|
+
async refreshLayer(layerId, options) {
|
|
334097
|
+
try {
|
|
334098
|
+
const handler = this.layerHandlers.get(layerId);
|
|
334099
|
+
if (!handler || typeof handler.refresh !== "function") {
|
|
334100
|
+
return false;
|
|
334101
|
+
}
|
|
334102
|
+
await handler.refresh(options);
|
|
334103
|
+
return true;
|
|
334104
|
+
} catch (error2) {
|
|
334105
|
+
console.error("刷新图层失败:", error2);
|
|
334106
|
+
return false;
|
|
334107
|
+
}
|
|
334108
|
+
}
|
|
334109
|
+
updateLayerRequestParams(layerId, params) {
|
|
334110
|
+
var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s;
|
|
334111
|
+
try {
|
|
334112
|
+
const config = this.getLayerConfig(layerId);
|
|
334113
|
+
if (!config) {
|
|
334114
|
+
return false;
|
|
334115
|
+
}
|
|
334116
|
+
const nextConfig = {
|
|
334117
|
+
...config,
|
|
334118
|
+
params: {
|
|
334119
|
+
...config.params || {},
|
|
334120
|
+
...params
|
|
334121
|
+
},
|
|
334122
|
+
geojsonConfig: {
|
|
334123
|
+
...config.geojsonConfig || ((_b2 = (_a2 = config.config) == null ? void 0 : _a2.vector) == null ? void 0 : _b2.geojson) || ((_c2 = config.config) == null ? void 0 : _c2.geojson) || {},
|
|
334124
|
+
request: {
|
|
334125
|
+
...((_d = config.geojsonConfig) == null ? void 0 : _d.request) || ((_g = (_f = (_e2 = config.config) == null ? void 0 : _e2.vector) == null ? void 0 : _f.geojson) == null ? void 0 : _g.request) || ((_i2 = (_h = config.config) == null ? void 0 : _h.geojson) == null ? void 0 : _i2.request) || {},
|
|
334126
|
+
params: {
|
|
334127
|
+
...((_k = (_j = config.geojsonConfig) == null ? void 0 : _j.request) == null ? void 0 : _k.params) || ((_o2 = (_n2 = (_m = (_l = config.config) == null ? void 0 : _l.vector) == null ? void 0 : _m.geojson) == null ? void 0 : _n2.request) == null ? void 0 : _o2.params) || ((_r2 = (_q = (_p = config.config) == null ? void 0 : _p.geojson) == null ? void 0 : _q.request) == null ? void 0 : _r2.params) || {},
|
|
334128
|
+
...params
|
|
334129
|
+
}
|
|
334130
|
+
}
|
|
334131
|
+
}
|
|
334132
|
+
};
|
|
334133
|
+
if (this.layerConfigs.has(layerId)) {
|
|
334134
|
+
this.layerConfigs.set(layerId, nextConfig);
|
|
334135
|
+
}
|
|
334136
|
+
if (this.pendingLayerConfigs.has(layerId)) {
|
|
334137
|
+
this.pendingLayerConfigs.set(layerId, nextConfig);
|
|
334138
|
+
}
|
|
334139
|
+
const handler = this.layerHandlers.get(layerId);
|
|
334140
|
+
(_s = handler == null ? void 0 : handler.updateRequestParams) == null ? void 0 : _s.call(handler, params);
|
|
334141
|
+
this.saveLayerConfigs();
|
|
334142
|
+
this.eventBus.emit("layer-config-updated", {
|
|
334143
|
+
layerId,
|
|
334144
|
+
config: nextConfig
|
|
334145
|
+
});
|
|
334146
|
+
return true;
|
|
334147
|
+
} catch (error2) {
|
|
334148
|
+
console.error("更新图层请求参数失败:", error2);
|
|
334149
|
+
return false;
|
|
334150
|
+
}
|
|
334151
|
+
}
|
|
334163
334152
|
/**
|
|
334164
334153
|
* 更新图层配置
|
|
334165
334154
|
*/
|
|
334166
334155
|
updateLayerConfig(layerId, newConfig) {
|
|
334167
334156
|
try {
|
|
334168
334157
|
const handler = this.layerHandlers.get(layerId);
|
|
334169
|
-
const config = this.layerConfigs.get(layerId)
|
|
334170
|
-
if (config) {
|
|
334158
|
+
const config = this.layerConfigs.get(layerId);
|
|
334159
|
+
if (handler && config) {
|
|
334171
334160
|
const updatedConfig = { ...config, ...newConfig };
|
|
334172
|
-
|
|
334173
|
-
|
|
334174
|
-
|
|
334175
|
-
if (this.pendingLayerConfigs.has(layerId)) {
|
|
334176
|
-
this.pendingLayerConfigs.set(layerId, updatedConfig);
|
|
334177
|
-
}
|
|
334178
|
-
if (handler) {
|
|
334179
|
-
handler.updateConfig(newConfig);
|
|
334180
|
-
}
|
|
334181
|
-
if (handler && (newConfig.style || newConfig.customCss !== void 0)) {
|
|
334161
|
+
this.layerConfigs.set(layerId, updatedConfig);
|
|
334162
|
+
handler.updateConfig(newConfig);
|
|
334163
|
+
if (newConfig.style || newConfig.customCss !== void 0) {
|
|
334182
334164
|
if ("updateLayerStyles" in handler) {
|
|
334183
334165
|
handler.updateLayerStyles(
|
|
334184
334166
|
updatedConfig.style,
|
|
@@ -335007,7 +334989,7 @@ const _hoisted_15$3 = ["src", "alt"];
|
|
|
335007
334989
|
const _hoisted_16$3 = { key: 1 };
|
|
335008
334990
|
const _hoisted_17$3 = ["href"];
|
|
335009
334991
|
const _hoisted_18$3 = { key: 2 };
|
|
335010
|
-
const _hoisted_19$
|
|
334992
|
+
const _hoisted_19$3 = { key: 3 };
|
|
335011
334993
|
const _hoisted_20$2 = { key: 4 };
|
|
335012
334994
|
const _hoisted_21$2 = {
|
|
335013
334995
|
key: 6,
|
|
@@ -335297,7 +335279,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
335297
335279
|
target: "_blank",
|
|
335298
335280
|
class: "table-link"
|
|
335299
335281
|
}, toDisplayString(getFieldValue(item, field.key || field.name)), 9, _hoisted_17$3)
|
|
335300
|
-
])) : field.type === "date" ? (openBlock(), createElementBlock("span", _hoisted_18$3, toDisplayString(formatDate(getFieldValue(item, field.key || field.name))), 1)) : field.type === "number" ? (openBlock(), createElementBlock("span", _hoisted_19$
|
|
335282
|
+
])) : field.type === "date" ? (openBlock(), createElementBlock("span", _hoisted_18$3, toDisplayString(formatDate(getFieldValue(item, field.key || field.name))), 1)) : field.type === "number" ? (openBlock(), createElementBlock("span", _hoisted_19$3, toDisplayString(formatNumber2(getFieldValue(item, field.key || field.name))), 1)) : (openBlock(), createElementBlock("span", _hoisted_20$2, toDisplayString(getFieldValue(item, field.key || field.name)), 1))
|
|
335301
335283
|
]);
|
|
335302
335284
|
}), 128))
|
|
335303
335285
|
], 8, _hoisted_13$6);
|
|
@@ -337415,19 +337397,19 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
337415
337397
|
}
|
|
337416
337398
|
});
|
|
337417
337399
|
const defaultComponents = {
|
|
337418
|
-
measurement: () => import("./MeasurementDialog-
|
|
337419
|
-
basemap: () => import("./BasemapPanel-
|
|
337420
|
-
print: () => import("./MapPrintDialog-
|
|
337421
|
-
"layer-panel": () => import("./LayerPanel-
|
|
337422
|
-
coordinate: () => import("./CoordinateLocationDialog-
|
|
337423
|
-
"region-navigation": () => import("./RegionNavigationDialog-
|
|
337424
|
-
"my-markers": () => import("./MyMarkersDialog-
|
|
337425
|
-
"view-bookmarks": () => import("./ViewBookmarksDialog-
|
|
337426
|
-
"map-drawing": () => import("./index-
|
|
337427
|
-
"filter-panel": () => import("./FilterPanel-
|
|
337428
|
-
"swipe-compare": () => import("./SwipeCompareDialog-
|
|
337429
|
-
"split-compare": () => import("./SplitCompareDialog-
|
|
337430
|
-
"quad-compare": () => import("./QuadCompareDialog-
|
|
337400
|
+
measurement: () => import("./MeasurementDialog-4e084192.mjs"),
|
|
337401
|
+
basemap: () => import("./BasemapPanel-d6e4ea88.mjs"),
|
|
337402
|
+
print: () => import("./MapPrintDialog-64d46412.mjs"),
|
|
337403
|
+
"layer-panel": () => import("./LayerPanel-9bf28955.mjs"),
|
|
337404
|
+
coordinate: () => import("./CoordinateLocationDialog-81d00abc.mjs"),
|
|
337405
|
+
"region-navigation": () => import("./RegionNavigationDialog-467ad6c0.mjs"),
|
|
337406
|
+
"my-markers": () => import("./MyMarkersDialog-aa44e5bd.mjs"),
|
|
337407
|
+
"view-bookmarks": () => import("./ViewBookmarksDialog-83cf5ec4.mjs"),
|
|
337408
|
+
"map-drawing": () => import("./index-ee58f2f8.mjs"),
|
|
337409
|
+
"filter-panel": () => import("./FilterPanel-7358e3fb.mjs"),
|
|
337410
|
+
"swipe-compare": () => import("./SwipeCompareDialog-c322e2f6.mjs"),
|
|
337411
|
+
"split-compare": () => import("./SplitCompareDialog-50410c0b.mjs"),
|
|
337412
|
+
"quad-compare": () => import("./QuadCompareDialog-84a88cf9.mjs")
|
|
337431
337413
|
};
|
|
337432
337414
|
const _DialogRegistry = class _DialogRegistry {
|
|
337433
337415
|
constructor() {
|
|
@@ -337898,6 +337880,7 @@ class TiandituSearchApi {
|
|
|
337898
337880
|
* @param options 搜索选项
|
|
337899
337881
|
*/
|
|
337900
337882
|
async search(query, options = {}) {
|
|
337883
|
+
var _a2;
|
|
337901
337884
|
try {
|
|
337902
337885
|
const {
|
|
337903
337886
|
maxResults = 10,
|
|
@@ -337925,8 +337908,10 @@ class TiandituSearchApi {
|
|
|
337925
337908
|
throw new Error(`天地图API请求失败: ${response.status}`);
|
|
337926
337909
|
}
|
|
337927
337910
|
const data = await response.json();
|
|
337928
|
-
|
|
337929
|
-
|
|
337911
|
+
const isSuccess = data.status === "200" || data.status === "0" || typeof data.status === "object" && ((_a2 = data.status) == null ? void 0 : _a2.infocode) === 1e3;
|
|
337912
|
+
if (!isSuccess) {
|
|
337913
|
+
const errorMessage = typeof data.status === "object" ? `${data.status.cndesc || "未知错误"} (${data.status.infocode ?? "unknown"})` : data.status;
|
|
337914
|
+
throw new Error(`天地图API返回错误: ${errorMessage}`);
|
|
337930
337915
|
}
|
|
337931
337916
|
return this.transformResults(data, type);
|
|
337932
337917
|
} catch (error2) {
|
|
@@ -338093,6 +338078,20 @@ class TiandituSearchApi {
|
|
|
338093
338078
|
}
|
|
338094
338079
|
}
|
|
338095
338080
|
const tiandituSearchApi = new TiandituSearchApi();
|
|
338081
|
+
class MapSearchError extends Error {
|
|
338082
|
+
constructor(options) {
|
|
338083
|
+
super(options.message);
|
|
338084
|
+
__publicField(this, "code");
|
|
338085
|
+
__publicField(this, "userMessage");
|
|
338086
|
+
__publicField(this, "provider");
|
|
338087
|
+
__publicField(this, "cause");
|
|
338088
|
+
this.name = "MapSearchError";
|
|
338089
|
+
this.code = options.code;
|
|
338090
|
+
this.userMessage = options.userMessage;
|
|
338091
|
+
this.provider = options.provider;
|
|
338092
|
+
this.cause = options.cause;
|
|
338093
|
+
}
|
|
338094
|
+
}
|
|
338096
338095
|
class MapSearchService {
|
|
338097
338096
|
constructor(config, deps) {
|
|
338098
338097
|
__publicField(this, "config");
|
|
@@ -338146,7 +338145,7 @@ class MapSearchService {
|
|
|
338146
338145
|
return results;
|
|
338147
338146
|
} catch (error2) {
|
|
338148
338147
|
console.error("搜索失败:", error2);
|
|
338149
|
-
|
|
338148
|
+
throw this.createSearchError(query, error2);
|
|
338150
338149
|
}
|
|
338151
338150
|
}
|
|
338152
338151
|
/**
|
|
@@ -338261,7 +338260,7 @@ class MapSearchService {
|
|
|
338261
338260
|
async searchTianditu(query) {
|
|
338262
338261
|
try {
|
|
338263
338262
|
const results = await tiandituSearchApi.search(query, {
|
|
338264
|
-
...this.
|
|
338263
|
+
...this.getTiandituSearchOptions(),
|
|
338265
338264
|
maxResults: this.config.maxResults || 10,
|
|
338266
338265
|
type: this.config.type || "all"
|
|
338267
338266
|
});
|
|
@@ -338271,6 +338270,111 @@ class MapSearchService {
|
|
|
338271
338270
|
throw error2;
|
|
338272
338271
|
}
|
|
338273
338272
|
}
|
|
338273
|
+
getTiandituSearchOptions() {
|
|
338274
|
+
const {
|
|
338275
|
+
enabled: _enabled,
|
|
338276
|
+
position: _position,
|
|
338277
|
+
placeholder: _placeholder,
|
|
338278
|
+
provider: _provider,
|
|
338279
|
+
apiKey: _apiKey,
|
|
338280
|
+
customApi: _customApi,
|
|
338281
|
+
layerSearch: _layerSearch,
|
|
338282
|
+
maxResults: _maxResults,
|
|
338283
|
+
showHistory: _showHistory,
|
|
338284
|
+
enableStorage: _enableStorage,
|
|
338285
|
+
searchDelay: _searchDelay,
|
|
338286
|
+
minSearchLength: _minSearchLength,
|
|
338287
|
+
messages: _messages,
|
|
338288
|
+
resultStyle: _resultStyle,
|
|
338289
|
+
onSearch: _onSearch,
|
|
338290
|
+
onSelect: _onSelect,
|
|
338291
|
+
customSearchFn: _customSearchFn,
|
|
338292
|
+
...tiandituOptions
|
|
338293
|
+
} = this.config;
|
|
338294
|
+
return tiandituOptions;
|
|
338295
|
+
}
|
|
338296
|
+
createSearchError(query, error2) {
|
|
338297
|
+
var _a2;
|
|
338298
|
+
if (error2 instanceof MapSearchError) {
|
|
338299
|
+
return error2;
|
|
338300
|
+
}
|
|
338301
|
+
const provider = this.getResolvedProvider();
|
|
338302
|
+
const code = this.inferSearchErrorCode(error2);
|
|
338303
|
+
const technicalMessage = error2 instanceof Error ? error2.message : "搜索服务发生未知错误";
|
|
338304
|
+
const userMessage = this.resolveMessage((_a2 = this.config.messages) == null ? void 0 : _a2.searchFailed, {
|
|
338305
|
+
query,
|
|
338306
|
+
provider,
|
|
338307
|
+
error: error2,
|
|
338308
|
+
code
|
|
338309
|
+
}) || this.getDefaultSearchFailedMessage(provider, code);
|
|
338310
|
+
return new MapSearchError({
|
|
338311
|
+
code,
|
|
338312
|
+
message: technicalMessage,
|
|
338313
|
+
userMessage,
|
|
338314
|
+
provider,
|
|
338315
|
+
cause: error2
|
|
338316
|
+
});
|
|
338317
|
+
}
|
|
338318
|
+
inferSearchErrorCode(error2) {
|
|
338319
|
+
if (error2 instanceof MapSearchError) {
|
|
338320
|
+
return error2.code;
|
|
338321
|
+
}
|
|
338322
|
+
if (error2 instanceof TypeError) {
|
|
338323
|
+
return "network_error";
|
|
338324
|
+
}
|
|
338325
|
+
if (!(error2 instanceof Error)) {
|
|
338326
|
+
return "unknown_error";
|
|
338327
|
+
}
|
|
338328
|
+
const message = error2.message.toLowerCase();
|
|
338329
|
+
if (message.includes("未配置") || message.includes("not configured")) {
|
|
338330
|
+
return "config_error";
|
|
338331
|
+
}
|
|
338332
|
+
if (message.includes("failed to fetch") || message.includes("networkerror") || message.includes("网络")) {
|
|
338333
|
+
return "network_error";
|
|
338334
|
+
}
|
|
338335
|
+
if (message.includes("http error") || message.includes("请求失败") || /^http\s\d+/.test(message)) {
|
|
338336
|
+
return "http_error";
|
|
338337
|
+
}
|
|
338338
|
+
if (message.includes("api错误") || message.includes("返回错误") || message.includes("业务错误")) {
|
|
338339
|
+
return "api_error";
|
|
338340
|
+
}
|
|
338341
|
+
return "unknown_error";
|
|
338342
|
+
}
|
|
338343
|
+
getResolvedProvider() {
|
|
338344
|
+
return this.config.provider || "tianditu";
|
|
338345
|
+
}
|
|
338346
|
+
getDefaultSearchFailedMessage(provider, code) {
|
|
338347
|
+
const providerLabel = this.getProviderLabel(provider);
|
|
338348
|
+
switch (code) {
|
|
338349
|
+
case "config_error":
|
|
338350
|
+
return `${providerLabel}未完成配置,请联系管理员`;
|
|
338351
|
+
case "http_error":
|
|
338352
|
+
return `${providerLabel}服务连接失败,请稍后重试`;
|
|
338353
|
+
case "api_error":
|
|
338354
|
+
return `${providerLabel}返回业务错误,请调整关键词后重试`;
|
|
338355
|
+
case "network_error":
|
|
338356
|
+
return `网络连接异常,无法访问${providerLabel}`;
|
|
338357
|
+
default:
|
|
338358
|
+
return `${providerLabel}搜索暂不可用,请稍后重试`;
|
|
338359
|
+
}
|
|
338360
|
+
}
|
|
338361
|
+
getProviderLabel(provider) {
|
|
338362
|
+
const labelMap = {
|
|
338363
|
+
baidu: "百度地图搜索服务",
|
|
338364
|
+
amap: "高德地图搜索服务",
|
|
338365
|
+
google: "Google 地图搜索服务",
|
|
338366
|
+
tianditu: "天地图搜索服务",
|
|
338367
|
+
custom: "自定义搜索服务",
|
|
338368
|
+
layer: "图层搜索服务"
|
|
338369
|
+
};
|
|
338370
|
+
return labelMap[provider];
|
|
338371
|
+
}
|
|
338372
|
+
resolveMessage(resolver, context) {
|
|
338373
|
+
if (!resolver) {
|
|
338374
|
+
return void 0;
|
|
338375
|
+
}
|
|
338376
|
+
return typeof resolver === "function" ? resolver(context) : resolver;
|
|
338377
|
+
}
|
|
338274
338378
|
/**
|
|
338275
338379
|
* 自定义API搜索
|
|
338276
338380
|
*/
|
|
@@ -338615,6 +338719,11 @@ const defaultSearchConfig = {
|
|
|
338615
338719
|
showHistory: true,
|
|
338616
338720
|
searchDelay: 300,
|
|
338617
338721
|
minSearchLength: 2,
|
|
338722
|
+
messages: {
|
|
338723
|
+
historyTitle: "搜索历史",
|
|
338724
|
+
clearHistory: "清除",
|
|
338725
|
+
resultsTitle: "搜索结果"
|
|
338726
|
+
},
|
|
338618
338727
|
resultStyle: {
|
|
338619
338728
|
markerColor: "#409eff",
|
|
338620
338729
|
markerSize: 20,
|
|
@@ -338624,6 +338733,7 @@ const defaultSearchConfig = {
|
|
|
338624
338733
|
};
|
|
338625
338734
|
const searchService = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
338626
338735
|
__proto__: null,
|
|
338736
|
+
MapSearchError,
|
|
338627
338737
|
MapSearchService,
|
|
338628
338738
|
defaultSearchConfig
|
|
338629
338739
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -338660,6 +338770,10 @@ const _hoisted_17$2 = {
|
|
|
338660
338770
|
class: "item-confidence"
|
|
338661
338771
|
};
|
|
338662
338772
|
const _hoisted_18$2 = {
|
|
338773
|
+
key: 0,
|
|
338774
|
+
class: "search-error"
|
|
338775
|
+
};
|
|
338776
|
+
const _hoisted_19$2 = {
|
|
338663
338777
|
key: 0,
|
|
338664
338778
|
class: "no-results"
|
|
338665
338779
|
};
|
|
@@ -338676,10 +338790,15 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338676
338790
|
enableStorage: false,
|
|
338677
338791
|
// 默认禁用存储
|
|
338678
338792
|
searchDelay: 300,
|
|
338679
|
-
minSearchLength: 2
|
|
338793
|
+
minSearchLength: 2,
|
|
338794
|
+
messages: {
|
|
338795
|
+
historyTitle: "搜索历史",
|
|
338796
|
+
clearHistory: "清除",
|
|
338797
|
+
resultsTitle: "搜索结果"
|
|
338798
|
+
}
|
|
338680
338799
|
}) }
|
|
338681
338800
|
},
|
|
338682
|
-
emits: ["search", "select", "clear"],
|
|
338801
|
+
emits: ["search", "select", "clear", "search-error"],
|
|
338683
338802
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
338684
338803
|
const props = __props;
|
|
338685
338804
|
const emit = __emit;
|
|
@@ -338695,12 +338814,52 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338695
338814
|
const showResults = ref(false);
|
|
338696
338815
|
const selectedIndex = ref(-1);
|
|
338697
338816
|
const searchTimer = ref(null);
|
|
338817
|
+
const searchErrorMessage = ref("");
|
|
338818
|
+
const searchErrorCode = ref("");
|
|
338698
338819
|
const position2 = computed(() => props.config.position || "top-left");
|
|
338699
338820
|
const placeholder = computed(() => props.config.placeholder || "搜索地点...");
|
|
338700
338821
|
const maxResults = computed(() => props.config.maxResults || 10);
|
|
338701
338822
|
const showHistory = computed(() => props.config.showHistory !== false);
|
|
338702
338823
|
const searchDelay = computed(() => props.config.searchDelay || 300);
|
|
338703
338824
|
const minSearchLength = computed(() => props.config.minSearchLength || 2);
|
|
338825
|
+
const historyTitleText = computed(
|
|
338826
|
+
() => {
|
|
338827
|
+
var _a2;
|
|
338828
|
+
return resolveMessage((_a2 = props.config.messages) == null ? void 0 : _a2.historyTitle, {}, "搜索历史");
|
|
338829
|
+
}
|
|
338830
|
+
);
|
|
338831
|
+
const clearHistoryText = computed(
|
|
338832
|
+
() => {
|
|
338833
|
+
var _a2;
|
|
338834
|
+
return resolveMessage((_a2 = props.config.messages) == null ? void 0 : _a2.clearHistory, {}, "清除");
|
|
338835
|
+
}
|
|
338836
|
+
);
|
|
338837
|
+
const resultsTitleText = computed(
|
|
338838
|
+
() => {
|
|
338839
|
+
var _a2;
|
|
338840
|
+
return resolveMessage(
|
|
338841
|
+
(_a2 = props.config.messages) == null ? void 0 : _a2.resultsTitle,
|
|
338842
|
+
{
|
|
338843
|
+
query: searchQuery.value,
|
|
338844
|
+
count: searchResults.value.length
|
|
338845
|
+
},
|
|
338846
|
+
"搜索结果"
|
|
338847
|
+
);
|
|
338848
|
+
}
|
|
338849
|
+
);
|
|
338850
|
+
const noResultsText = computed(
|
|
338851
|
+
() => {
|
|
338852
|
+
var _a2;
|
|
338853
|
+
return resolveMessage(
|
|
338854
|
+
(_a2 = props.config.messages) == null ? void 0 : _a2.noResults,
|
|
338855
|
+
{
|
|
338856
|
+
query: searchQuery.value,
|
|
338857
|
+
provider: props.config.provider
|
|
338858
|
+
},
|
|
338859
|
+
getDefaultNoResultsMessage(props.config.provider || "tianditu")
|
|
338860
|
+
);
|
|
338861
|
+
}
|
|
338862
|
+
);
|
|
338704
338863
|
const displayResults = computed(() => {
|
|
338705
338864
|
return searchResults.value.slice(0, maxResults.value);
|
|
338706
338865
|
});
|
|
@@ -338714,15 +338873,65 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338714
338873
|
}
|
|
338715
338874
|
return count2;
|
|
338716
338875
|
});
|
|
338876
|
+
const resolveMessage = (resolver, context, fallback) => {
|
|
338877
|
+
if (!resolver) {
|
|
338878
|
+
return fallback;
|
|
338879
|
+
}
|
|
338880
|
+
return typeof resolver === "function" ? resolver(context) : resolver;
|
|
338881
|
+
};
|
|
338882
|
+
const getProviderLabel = (provider) => {
|
|
338883
|
+
const labelMap = {
|
|
338884
|
+
baidu: "百度地图",
|
|
338885
|
+
amap: "高德地图",
|
|
338886
|
+
google: "Google 地图",
|
|
338887
|
+
tianditu: "天地图",
|
|
338888
|
+
custom: "自定义搜索服务",
|
|
338889
|
+
layer: "图层搜索"
|
|
338890
|
+
};
|
|
338891
|
+
return labelMap[provider];
|
|
338892
|
+
};
|
|
338893
|
+
const getDefaultNoResultsMessage = (provider) => {
|
|
338894
|
+
switch (provider) {
|
|
338895
|
+
case "baidu":
|
|
338896
|
+
return "百度地图未找到相关地点,请尝试更换关键词";
|
|
338897
|
+
case "amap":
|
|
338898
|
+
return "高德地图未找到相关地点,请尝试更换关键词";
|
|
338899
|
+
case "google":
|
|
338900
|
+
return "Google 地图未找到相关地点,请尝试更换关键词";
|
|
338901
|
+
case "custom":
|
|
338902
|
+
return "自定义搜索服务未返回结果";
|
|
338903
|
+
case "layer":
|
|
338904
|
+
return "当前图层中未找到匹配结果";
|
|
338905
|
+
default:
|
|
338906
|
+
return "天地图未找到相关地点,请尝试补充行政区或 POI 名称";
|
|
338907
|
+
}
|
|
338908
|
+
};
|
|
338909
|
+
const normalizeSearchError = (error2) => {
|
|
338910
|
+
if (error2 instanceof MapSearchError) {
|
|
338911
|
+
return error2;
|
|
338912
|
+
}
|
|
338913
|
+
const provider = props.config.provider || "tianditu";
|
|
338914
|
+
return new MapSearchError({
|
|
338915
|
+
code: "unknown_error",
|
|
338916
|
+
message: error2 instanceof Error ? error2.message : "搜索服务发生未知错误",
|
|
338917
|
+
userMessage: `${getProviderLabel(provider)}搜索暂不可用,请稍后重试`,
|
|
338918
|
+
provider,
|
|
338919
|
+
cause: error2
|
|
338920
|
+
});
|
|
338921
|
+
};
|
|
338717
338922
|
const handleSearchInput = (value) => {
|
|
338718
338923
|
if (searchTimer.value) {
|
|
338719
338924
|
clearTimeout(searchTimer.value);
|
|
338720
338925
|
}
|
|
338721
338926
|
if (value.length >= minSearchLength.value) {
|
|
338927
|
+
searchErrorMessage.value = "";
|
|
338928
|
+
searchErrorCode.value = "";
|
|
338722
338929
|
searchTimer.value = setTimeout(() => {
|
|
338723
338930
|
performSearch(value);
|
|
338724
338931
|
}, searchDelay.value);
|
|
338725
338932
|
} else {
|
|
338933
|
+
searchErrorMessage.value = "";
|
|
338934
|
+
searchErrorCode.value = "";
|
|
338726
338935
|
searchResults.value = [];
|
|
338727
338936
|
showResults.value = value.length === 0 && showHistory.value;
|
|
338728
338937
|
}
|
|
@@ -338770,6 +338979,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338770
338979
|
selectedIndex.value = -1;
|
|
338771
338980
|
searchQuery.value = "";
|
|
338772
338981
|
searchResults.value = [];
|
|
338982
|
+
searchErrorMessage.value = "";
|
|
338983
|
+
searchErrorCode.value = "";
|
|
338773
338984
|
};
|
|
338774
338985
|
const getSelectableItems = () => {
|
|
338775
338986
|
const items = [];
|
|
@@ -338782,11 +338993,14 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338782
338993
|
return items;
|
|
338783
338994
|
};
|
|
338784
338995
|
const performSearch = async (query) => {
|
|
338996
|
+
var _a2;
|
|
338785
338997
|
if (!query || query.length < minSearchLength.value) {
|
|
338786
338998
|
return;
|
|
338787
338999
|
}
|
|
338788
339000
|
isLoading.value = true;
|
|
338789
339001
|
showResults.value = true;
|
|
339002
|
+
searchErrorMessage.value = "";
|
|
339003
|
+
searchErrorCode.value = "";
|
|
338790
339004
|
try {
|
|
338791
339005
|
const results = await searchService2.search(query);
|
|
338792
339006
|
searchResults.value = results;
|
|
@@ -338794,6 +339008,19 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338794
339008
|
} catch (error2) {
|
|
338795
339009
|
console.error("搜索失败:", error2);
|
|
338796
339010
|
searchResults.value = [];
|
|
339011
|
+
const normalizedError = normalizeSearchError(error2);
|
|
339012
|
+
searchErrorCode.value = normalizedError.code;
|
|
339013
|
+
searchErrorMessage.value = error2 instanceof MapSearchError ? normalizedError.userMessage : resolveMessage(
|
|
339014
|
+
(_a2 = props.config.messages) == null ? void 0 : _a2.searchFailed,
|
|
339015
|
+
{
|
|
339016
|
+
query,
|
|
339017
|
+
provider: normalizedError.provider,
|
|
339018
|
+
error: error2,
|
|
339019
|
+
code: normalizedError.code
|
|
339020
|
+
},
|
|
339021
|
+
normalizedError.userMessage
|
|
339022
|
+
);
|
|
339023
|
+
emit("search-error", normalizedError);
|
|
338797
339024
|
} finally {
|
|
338798
339025
|
isLoading.value = false;
|
|
338799
339026
|
}
|
|
@@ -338803,7 +339030,6 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338803
339030
|
showResults.value = false;
|
|
338804
339031
|
selectedIndex.value = -1;
|
|
338805
339032
|
addToHistory(result);
|
|
338806
|
-
debugger;
|
|
338807
339033
|
emit("select", result);
|
|
338808
339034
|
};
|
|
338809
339035
|
const selectHistoryItem = (item) => {
|
|
@@ -338866,12 +339092,16 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338866
339092
|
const updateResults = (results) => {
|
|
338867
339093
|
searchResults.value = results;
|
|
338868
339094
|
isLoading.value = false;
|
|
339095
|
+
searchErrorMessage.value = "";
|
|
339096
|
+
searchErrorCode.value = "";
|
|
338869
339097
|
};
|
|
338870
339098
|
const clearResults = () => {
|
|
338871
339099
|
searchResults.value = [];
|
|
338872
339100
|
searchQuery.value = "";
|
|
338873
339101
|
showResults.value = false;
|
|
338874
339102
|
selectedIndex.value = -1;
|
|
339103
|
+
searchErrorMessage.value = "";
|
|
339104
|
+
searchErrorCode.value = "";
|
|
338875
339105
|
emit("clear");
|
|
338876
339106
|
};
|
|
338877
339107
|
onMounted(() => {
|
|
@@ -338889,6 +339119,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338889
339119
|
(newConfig) => {
|
|
338890
339120
|
searchService2.updateConfig(newConfig);
|
|
338891
339121
|
searchResults.value = [];
|
|
339122
|
+
searchErrorMessage.value = "";
|
|
339123
|
+
searchErrorCode.value = "";
|
|
338892
339124
|
selectedIndex.value = -1;
|
|
338893
339125
|
console.log("MapSearch配置已更新:", newConfig);
|
|
338894
339126
|
},
|
|
@@ -338983,15 +339215,15 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338983
339215
|
showHistory.value && searchHistory.value.length > 0 && !searchQuery.value ? (openBlock(), createElementBlock("div", _hoisted_3$j, [
|
|
338984
339216
|
renderSlot(_ctx.$slots, "history-title", { clearHistory }, () => [
|
|
338985
339217
|
createElementVNode("div", _hoisted_4$h, [
|
|
338986
|
-
|
|
339218
|
+
createElementVNode("span", null, toDisplayString(historyTitleText.value), 1),
|
|
338987
339219
|
createVNode$1(unref(ElButton), {
|
|
338988
339220
|
link: "",
|
|
338989
339221
|
size: "small",
|
|
338990
339222
|
onClick: clearHistory
|
|
338991
339223
|
}, {
|
|
338992
|
-
default: withCtx(() => [
|
|
338993
|
-
createTextVNode(
|
|
338994
|
-
])
|
|
339224
|
+
default: withCtx(() => [
|
|
339225
|
+
createTextVNode(toDisplayString(clearHistoryText.value), 1)
|
|
339226
|
+
]),
|
|
338995
339227
|
_: 1
|
|
338996
339228
|
})
|
|
338997
339229
|
])
|
|
@@ -339028,7 +339260,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
339028
339260
|
resultsCount: searchResults.value.length
|
|
339029
339261
|
}, () => [
|
|
339030
339262
|
searchQuery.value ? (openBlock(), createElementBlock("div", _hoisted_10$9, [
|
|
339031
|
-
|
|
339263
|
+
createElementVNode("span", null, toDisplayString(resultsTitleText.value), 1),
|
|
339032
339264
|
createElementVNode("span", _hoisted_11$7, "(" + toDisplayString(searchResults.value.length) + ")", 1)
|
|
339033
339265
|
])) : createCommentVNode("", true)
|
|
339034
339266
|
]),
|
|
@@ -339070,19 +339302,35 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
339070
339302
|
]);
|
|
339071
339303
|
}), 128))
|
|
339072
339304
|
])) : createCommentVNode("", true),
|
|
339305
|
+
renderSlot(_ctx.$slots, "search-error", {
|
|
339306
|
+
searchQuery: searchQuery.value,
|
|
339307
|
+
errorMessage: searchErrorMessage.value,
|
|
339308
|
+
errorCode: searchErrorCode.value,
|
|
339309
|
+
isLoading: isLoading.value
|
|
339310
|
+
}, () => [
|
|
339311
|
+
searchErrorMessage.value && !isLoading.value ? (openBlock(), createElementBlock("div", _hoisted_18$2, [
|
|
339312
|
+
createVNode$1(unref(ElIcon), null, {
|
|
339313
|
+
default: withCtx(() => [
|
|
339314
|
+
createVNode$1(unref(InfoFilled))
|
|
339315
|
+
]),
|
|
339316
|
+
_: 1
|
|
339317
|
+
}),
|
|
339318
|
+
createElementVNode("span", null, toDisplayString(searchErrorMessage.value), 1)
|
|
339319
|
+
])) : createCommentVNode("", true)
|
|
339320
|
+
]),
|
|
339073
339321
|
renderSlot(_ctx.$slots, "no-results", {
|
|
339074
339322
|
searchQuery: searchQuery.value,
|
|
339075
339323
|
searchResults: searchResults.value,
|
|
339076
339324
|
isLoading: isLoading.value
|
|
339077
339325
|
}, () => [
|
|
339078
|
-
searchQuery.value && searchResults.value.length === 0 && !isLoading.value ? (openBlock(), createElementBlock("div",
|
|
339326
|
+
searchQuery.value && searchResults.value.length === 0 && !isLoading.value && !searchErrorMessage.value ? (openBlock(), createElementBlock("div", _hoisted_19$2, [
|
|
339079
339327
|
createVNode$1(unref(ElIcon), null, {
|
|
339080
339328
|
default: withCtx(() => [
|
|
339081
339329
|
createVNode$1(unref(InfoFilled))
|
|
339082
339330
|
]),
|
|
339083
339331
|
_: 1
|
|
339084
339332
|
}),
|
|
339085
|
-
|
|
339333
|
+
createElementVNode("span", null, toDisplayString(noResultsText.value), 1)
|
|
339086
339334
|
])) : createCommentVNode("", true)
|
|
339087
339335
|
])
|
|
339088
339336
|
])
|
|
@@ -352455,7 +352703,7 @@ function(t3) {
|
|
|
352455
352703
|
*/
|
|
352456
352704
|
function(t3) {
|
|
352457
352705
|
function e8() {
|
|
352458
|
-
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-
|
|
352706
|
+
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-320e524d.mjs")).catch(function(t4) {
|
|
352459
352707
|
return Promise.reject(new Error("Could not load canvg: " + t4));
|
|
352460
352708
|
}).then(function(t4) {
|
|
352461
352709
|
return t4.default ? t4.default : t4;
|