提交 7821c141 编写于 作者: KK's avatar KK

地图加载逻辑调整 --fix1

上级 2d8dbce9
...@@ -324,27 +324,13 @@ import { Http } from "@/ibiz-core/utils"; ...@@ -324,27 +324,13 @@ import { Http } from "@/ibiz-core/utils";
let latitude = element[mapItemModel.latitude]; let latitude = element[mapItemModel.latitude];
let longitude = element[mapItemModel.longitude]; let longitude = element[mapItemModel.longitude];
if(longitude && latitude){ if(longitude && latitude){
let cityName = await this.getCityName(`${r'${longitude}'},${r'${latitude}'}`);
res.push({ res.push({
name: cityName,
value: [longitude,latitude].concat(mapItemData.filter((temp:any)=>{return temp[mapItemModel.latitude] == latitude && temp[mapItemModel.longitude]==longitude }).length,mapItemModel.code) value: [longitude,latitude].concat(mapItemData.filter((temp:any)=>{return temp[mapItemModel.latitude] == latitude && temp[mapItemModel.longitude]==longitude }).length,mapItemModel.code)
}); });
} }
} }
return res; return res;
} }
/**
* 获取城市坐标
*/
public async getCityName(location:string) {
let cityInfo = await Http.getInstance().get("map/v3/geocode/regeo",{key:"f24180cec13fe7e72472dcb9fcd26c0e",location:location})
if (cityInfo && cityInfo.status === 200 && cityInfo.data) {
if(cityInfo.data.infocode == 10000 && cityInfo.data.regeocode && cityInfo.data.regeocode.addressComponent){
return cityInfo.data.regeocode.addressComponent.city.length != 0?cityInfo.data.regeocode.addressComponent.city:cityInfo.data.regeocode.addressComponent.province;
}
}
}
<#ibizinclude> <#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl ../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude> </#ibizinclude>
......
...@@ -2,6 +2,83 @@ ...@@ -2,6 +2,83 @@
../@MACRO/MODEL/MODEL_HEADER.ts.ftl ../@MACRO/MODEL/MODEL_HEADER.ts.ftl
</#ibizinclude> </#ibizinclude>
/**
* 日历项类型
*
* @returns {any[]}
* @memberof ${srfclassname('${ctrl.getCodeName()}')}${srfclassname('${ctrl.name}')}Mode
*/
public itemType: string = "";
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof ${srfclassname('${ctrl.getCodeName()}')}${srfclassname('${ctrl.name}')}Mode
*/
public getDataItems(): any[] {
let dataItems: any = [
<#-- 关联主实体的主键 -->
<#if ctrl.getPSAppDataEntity()??>
<#assign appDataEntity = ctrl.getPSAppDataEntity() />
<#if appDataEntity.isMajor() == false && appDataEntity.getMinorPSAppDERSs()??>
<#list appDataEntity.getMinorPSAppDERSs() as minorAppDERSs>
<#if minorAppDERSs.getMajorPSAppDataEntity()??>
<#assign majorAppDataEntity = minorAppDERSs.getMajorPSAppDataEntity() />
{
name: '${majorAppDataEntity.getCodeName()?lower_case}',
prop: '${majorAppDataEntity.getKeyPSAppDEField().getCodeName()?lower_case}'
},
</#if>
</#list>
</#if>
</#if>
{
name: 'itemType',
},
];
switch (this.itemType) {
<#-- 地图项实体映射 -->
<#if ctrl.getPSSysMapItems()??>
<#list ctrl.getPSSysMapItems() as mapItem>
<#if mapItem.getPSAppDataEntity()??>
case "${mapItem.getItemType()?lower_case}":
dataItems =
[
...dataItems,
{
name: 'longitude',
prop: '${mapItem.getLongitudePSAppDEField().getCodeName()?lower_case}'
},
{
name: 'latitude',
prop: '${mapItem.getLatitudePSAppDEField().getCodeName()?lower_case}'
},
{
name: 'color',
prop: '${mapItem.getColorPSAppDEField().getCodeName()?lower_case}'
},
{
name: 'content',
prop: '${mapItem.getContentPSDEField().getCodeName()?lower_case}'
},
{
name: 'group',
prop: '${mapItem.getGroupPSAppDEField().getCodeName()?lower_case}'
},
{
name: 'icon',
prop: '${mapItem.getIconPSAppDEField().getCodeName()?lower_case}'
},
];
break;
</#if>
</#list>
</#if>
}
return dataItems;
}
<#ibizinclude> <#ibizinclude>
../@MACRO/MODEL/MODEL_BOTTOM.ts.ftl ../@MACRO/MODEL/MODEL_BOTTOM.ts.ftl
</#ibizinclude> </#ibizinclude>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册