修正了map的相关配置
This commit is contained in:
parent
8a72d844e7
commit
3131181e60
|
|
@ -85,14 +85,6 @@ export default function Map(props) {
|
|||
若配置多个地图服务,系统会默认使用第一个。高德地图目前支持多个key循环使用
|
||||
</Card>
|
||||
</Row>
|
||||
<AMaps maps={amaps} setValue={(path, value) => setValue(`amaps.${path}`, value)} removeItem={(path, index) => {
|
||||
if (index === 0) {
|
||||
cleanKey('', 'amaps');
|
||||
}
|
||||
else {
|
||||
removeItem(`amaps`, index);
|
||||
}
|
||||
}} addItem={(path, index) => setValue(`amaps.${index}`, {})}/>
|
||||
<MapWorld mapWorld={mapWorld} setValue={(path, value) => {
|
||||
if (value) {
|
||||
setValue(`mapWorld.${path}`, value);
|
||||
|
|
@ -101,5 +93,13 @@ export default function Map(props) {
|
|||
cleanKey('', 'mapWorld');
|
||||
}
|
||||
}}/>
|
||||
<AMaps maps={amaps} setValue={(path, value) => setValue(`amaps.${path}`, value)} removeItem={(path, index) => {
|
||||
if (index === 0) {
|
||||
cleanKey('', 'amaps');
|
||||
}
|
||||
else {
|
||||
removeItem(`amaps`, index);
|
||||
}
|
||||
}} addItem={(path, index) => setValue(`amaps.${index}`, {})}/>
|
||||
</Space>);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { rewriteOperation, rewriteSelection } from '../utils/selectionRewriter';
|
||||
import { registerGetMapService } from 'oak-common-aspect';
|
||||
import AMap from 'oak-common-aspect/lib/map/amap';
|
||||
import MapWorld from 'oak-common-aspect/lib/map/mapWorld';
|
||||
let mapService;
|
||||
const startRoutines = [
|
||||
{
|
||||
|
|
@ -20,12 +21,11 @@ const startRoutines = [
|
|||
}
|
||||
const application = context.getApplication();
|
||||
const { config } = application.system;
|
||||
if (config.Map?.amaps) {
|
||||
mapService = new AMap(config.Map.amaps);
|
||||
return mapService;
|
||||
}
|
||||
if (config.Map?.mapWorld) {
|
||||
// todo 天地图的class实现
|
||||
mapService = new MapWorld(config.Map.mapWorld.webApiKey);
|
||||
}
|
||||
else if (config.Map?.amaps) {
|
||||
mapService = new AMap(config.Map.amaps);
|
||||
}
|
||||
return mapService;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
|
|||
const selectionRewriter_1 = require("../utils/selectionRewriter");
|
||||
const oak_common_aspect_1 = require("oak-common-aspect");
|
||||
const amap_1 = tslib_1.__importDefault(require("oak-common-aspect/lib/map/amap"));
|
||||
const mapWorld_1 = tslib_1.__importDefault(require("oak-common-aspect/lib/map/mapWorld"));
|
||||
let mapService;
|
||||
const startRoutines = [
|
||||
{
|
||||
|
|
@ -23,12 +24,11 @@ const startRoutines = [
|
|||
}
|
||||
const application = context.getApplication();
|
||||
const { config } = application.system;
|
||||
if (config.Map?.amaps) {
|
||||
mapService = new amap_1.default(config.Map.amaps);
|
||||
return mapService;
|
||||
}
|
||||
if (config.Map?.mapWorld) {
|
||||
// todo 天地图的class实现
|
||||
mapService = new mapWorld_1.default(config.Map.mapWorld.webApiKey);
|
||||
}
|
||||
else if (config.Map?.amaps) {
|
||||
mapService = new amap_1.default(config.Map.amaps);
|
||||
}
|
||||
return mapService;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -189,6 +189,17 @@ export default function Map(props: {
|
|||
若配置多个地图服务,系统会默认使用第一个。高德地图目前支持多个key循环使用
|
||||
</Card>
|
||||
</Row>
|
||||
<MapWorld
|
||||
mapWorld={mapWorld}
|
||||
setValue={(path, value) => {
|
||||
if (value) {
|
||||
setValue(`mapWorld.${path}`, value);
|
||||
}
|
||||
else {
|
||||
cleanKey('', 'mapWorld');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<AMaps
|
||||
maps={amaps}
|
||||
setValue={(path, value) => setValue(`amaps.${path}`, value)}
|
||||
|
|
@ -202,17 +213,6 @@ export default function Map(props: {
|
|||
}}
|
||||
addItem={(path, index) => setValue(`amaps.${index}`, {})}
|
||||
/>
|
||||
<MapWorld
|
||||
mapWorld={mapWorld}
|
||||
setValue={(path, value) => {
|
||||
if (value) {
|
||||
setValue(`mapWorld.${path}`, value);
|
||||
}
|
||||
else {
|
||||
cleanKey('', 'mapWorld');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import { rewriteOperation, rewriteSelection } from '../utils/selectionRewriter';
|
|||
|
||||
import { registerGetMapService } from 'oak-common-aspect';
|
||||
import AMap from 'oak-common-aspect/lib/map/amap';
|
||||
import MapWorld from 'oak-common-aspect/lib/map/mapWorld';
|
||||
import { MapService } from 'oak-common-aspect/es/types/Map';
|
||||
|
||||
let mapService: MapService;
|
||||
|
|
@ -30,13 +31,12 @@ const startRoutines: Array<Routine<EntityDict & BaseEntityDict, keyof EntityDict
|
|||
}
|
||||
const application = (<BackendRuntimeContext<EntityDict & BaseEntityDict>>context).getApplication();
|
||||
const { config } = application!.system!;
|
||||
|
||||
if (config.Map?.amaps) {
|
||||
mapService = new AMap(config.Map.amaps!);
|
||||
return mapService;
|
||||
}
|
||||
|
||||
if (config.Map?.mapWorld) {
|
||||
// todo 天地图的class实现
|
||||
mapService = new MapWorld(config.Map.mapWorld.webApiKey);
|
||||
}
|
||||
else if (config.Map?.amaps) {
|
||||
mapService = new AMap(config.Map.amaps!);
|
||||
}
|
||||
|
||||
return mapService;
|
||||
|
|
|
|||
Loading…
Reference in New Issue