forked from github/dataease
Merge pull request #245 from dataease/pr@dev@fix_过滤器弹框组件样式优化
fix: 过滤组件弹框样式错位
This commit is contained in:
commit
33af016eaa
@ -18,4 +18,13 @@ public interface MapApi {
|
|||||||
|
|
||||||
@GetMapping("/areaEntitys/{pcode}")
|
@GetMapping("/areaEntitys/{pcode}")
|
||||||
List<AreaEntity> areaEntitys(@PathVariable String pcode);
|
List<AreaEntity> areaEntitys(@PathVariable String pcode);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 由于api有限流机制
|
||||||
|
* 请求失败后 调用重试方法
|
||||||
|
* @param areaCode
|
||||||
|
*/
|
||||||
|
@GetMapping("/retry/{areaCode}")
|
||||||
|
void retry(@PathVariable String areaCode);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import io.dataease.map.utils.MapUtils;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -41,10 +42,14 @@ public class MapServer implements MapApi {
|
|||||||
List<AreaEntity> areaEntities = mapService.areaEntities();
|
List<AreaEntity> areaEntities = mapService.areaEntities();
|
||||||
|
|
||||||
return mapService.entitysByPid(areaEntities, pcode);
|
return mapService.entitysByPid(areaEntities, pcode);
|
||||||
|
}
|
||||||
|
|
||||||
/*return areaEntities.stream().filter(item -> StringUtils.equals(item.getPcode(), pcode)).map(item -> {
|
@Override
|
||||||
item.setChildren(null);
|
public void retry(@PathVariable String areaCode) {
|
||||||
return item;
|
List<AreaEntity> areaEntities = mapService.areaEntities();
|
||||||
}).collect(Collectors.toList());*/
|
AreaEntity areaEntity = MapUtils.nodeByCode(areaEntities, areaCode);
|
||||||
|
List<AreaEntity> targets = new ArrayList<>();
|
||||||
|
targets.add(areaEntity);
|
||||||
|
MapUtils.recursionWriteFull(targets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,4 +48,6 @@ public class MapService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import io.dataease.base.domain.AreaMapping;
|
import io.dataease.base.domain.AreaMapping;
|
||||||
import io.dataease.base.domain.AreaMappingExample;
|
import io.dataease.base.domain.AreaMappingExample;
|
||||||
import io.dataease.base.mapper.AreaMappingMapper;
|
import io.dataease.base.mapper.AreaMappingMapper;
|
||||||
|
import io.dataease.commons.utils.LogUtil;
|
||||||
import io.dataease.map.dto.entity.*;
|
import io.dataease.map.dto.entity.*;
|
||||||
import io.dataease.map.dto.entity.Properties;
|
import io.dataease.map.dto.entity.Properties;
|
||||||
import io.dataease.map.dto.response.MapResponse;
|
import io.dataease.map.dto.response.MapResponse;
|
||||||
@ -68,7 +69,7 @@ public class MapUtils {
|
|||||||
AreaEntity china = root();
|
AreaEntity china = root();
|
||||||
|
|
||||||
maps.parallelStream().forEach(map -> {
|
maps.parallelStream().forEach(map -> {
|
||||||
// maps.stream().forEach(map -> {
|
// maps.stream().forEach(map -> {
|
||||||
String province_code = map.get(Constants.PROVINCE_CODE).toString();
|
String province_code = map.get(Constants.PROVINCE_CODE).toString();
|
||||||
String city_code = map.get(Constants.CITY_CODE).toString();
|
String city_code = map.get(Constants.CITY_CODE).toString();
|
||||||
String county_code = map.get(Constants.COUNTY_CODE).toString();
|
String county_code = map.get(Constants.COUNTY_CODE).toString();
|
||||||
@ -77,6 +78,10 @@ public class MapUtils {
|
|||||||
city_code = formatCode(city_code);
|
city_code = formatCode(city_code);
|
||||||
county_code = formatCode(county_code);
|
county_code = formatCode(county_code);
|
||||||
|
|
||||||
|
// 是否是跨级直辖
|
||||||
|
Boolean isCrossLevel = StrUtil.equals(province_code, city_code) && !StrUtil.equals(province_code, "710000");
|
||||||
|
|
||||||
|
|
||||||
if (!provinceMap.containsKey(province_code)) {
|
if (!provinceMap.containsKey(province_code)) {
|
||||||
String province_name = map.get(Constants.PROVINCE_NAME).toString();
|
String province_name = map.get(Constants.PROVINCE_NAME).toString();
|
||||||
AreaEntity child = AreaEntity.builder().code(province_code).name(province_name).pcode(china.getCode()).build();
|
AreaEntity child = AreaEntity.builder().code(province_code).name(province_name).pcode(china.getCode()).build();
|
||||||
@ -86,20 +91,26 @@ public class MapUtils {
|
|||||||
|
|
||||||
//当前省
|
//当前省
|
||||||
AreaEntity currentProvince = provinceMap.get(province_code);
|
AreaEntity currentProvince = provinceMap.get(province_code);
|
||||||
|
|
||||||
|
String city_name = map.get(Constants.CITY_NAME).toString();
|
||||||
|
if (isCrossLevel) {
|
||||||
|
city_code = county_code;
|
||||||
|
city_name = map.get(Constants.COUNTY_NAME).toString();
|
||||||
|
}
|
||||||
if (!cityMap.containsKey(city_code)) {
|
if (!cityMap.containsKey(city_code)) {
|
||||||
String city_name = map.get(Constants.CITY_NAME).toString();
|
|
||||||
AreaEntity child = AreaEntity.builder().code(city_code).name(city_name).pcode(currentProvince.getCode()).build();
|
AreaEntity child = AreaEntity.builder().code(city_code).name(city_name).pcode(currentProvince.getCode()).build();
|
||||||
cityMap.put(city_code, child);
|
cityMap.put(city_code, child);
|
||||||
currentProvince.addChild(child);
|
currentProvince.addChild(child);
|
||||||
}
|
}
|
||||||
|
if (!isCrossLevel) {
|
||||||
//当前市
|
//当前市
|
||||||
AreaEntity currentCity = cityMap.get(city_code);
|
AreaEntity currentCity = cityMap.get(city_code);
|
||||||
if (!countyMap.containsKey(county_code)) {
|
if (!countyMap.containsKey(county_code)) {
|
||||||
String county_name = map.get(Constants.COUNTY_NAME).toString();
|
String county_name = map.get(Constants.COUNTY_NAME).toString();
|
||||||
AreaEntity child = AreaEntity.builder().code(county_code).name(county_name).pcode(currentCity.getCode()).build();
|
AreaEntity child = AreaEntity.builder().code(county_code).name(county_name).pcode(currentCity.getCode()).build();
|
||||||
countyMap.put(county_code, child);
|
countyMap.put(county_code, child);
|
||||||
currentCity.addChild(child);
|
currentCity.addChild(child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// List<AreaEntity> treeNodes = provinceMap.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
|
// List<AreaEntity> treeNodes = provinceMap.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
|
||||||
@ -156,8 +167,11 @@ public class MapUtils {
|
|||||||
List<Feature> kidFeatures = districts.stream().map(district -> buildFeature(district, child)).collect(Collectors.toList());
|
List<Feature> kidFeatures = districts.stream().map(district -> buildFeature(district, child)).collect(Collectors.toList());
|
||||||
features.addAll(kidFeatures);
|
features.addAll(kidFeatures);
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
LogUtil.error("请求节点错误 请手动补偿: " + areaEntity.getName() +" -> "+child.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(features)) {
|
if (CollectionUtil.isNotEmpty(features)) {
|
||||||
MapResultDto mapResultDto = buildGeometry(features);
|
MapResultDto mapResultDto = buildGeometry(features);
|
||||||
writeFeatureFileFull(mapResultDto, areaEntity.getCode() + "_full");
|
writeFeatureFileFull(mapResultDto, areaEntity.getCode() + "_full");
|
||||||
@ -249,4 +263,20 @@ public class MapUtils {
|
|||||||
String content = JSONUtil.toJsonStr(mapResultDto);
|
String content = JSONUtil.toJsonStr(mapResultDto);
|
||||||
fileWriter.write(content);
|
fileWriter.write(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AreaEntity nodeByCode(List<AreaEntity> areaEntities, String code) {
|
||||||
|
for (int i = 0; i < areaEntities.size(); i++) {
|
||||||
|
AreaEntity areaEntity = areaEntities.get(i);
|
||||||
|
if (StrUtil.equals(areaEntity.getCode(), code)) {
|
||||||
|
return areaEntity;
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(areaEntity.getChildren())) {
|
||||||
|
AreaEntity temp = nodeByCode(areaEntity.getChildren(), code);
|
||||||
|
if (null != temp){
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="16"><div class="filter-options-right">
|
<el-col :span="16"><div class="filter-options-right">
|
||||||
<el-col :span="8">
|
<span style="padding-right: 10px;">
|
||||||
<el-checkbox v-model="componentInfo.options.attrs.showTitle" @change="showTitleChange">显示标题</el-checkbox>
|
<el-checkbox v-model="componentInfo.options.attrs.showTitle" @change="showTitleChange">显示标题</el-checkbox>
|
||||||
<el-popover
|
<el-popover
|
||||||
v-model="titlePopovervisible"
|
v-model="titlePopovervisible"
|
||||||
@ -196,8 +196,8 @@
|
|||||||
|
|
||||||
<i slot="reference" :class="{'i-filter-active': componentInfo.options.attrs.showTitle, 'i-filter-inactive': !componentInfo.options.attrs.showTitle}" class="el-icon-setting i-filter" />
|
<i slot="reference" :class="{'i-filter-active': componentInfo.options.attrs.showTitle, 'i-filter-inactive': !componentInfo.options.attrs.showTitle}" class="el-icon-setting i-filter" />
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</el-col>
|
</span>
|
||||||
<el-col :span="8">
|
<span style="padding-left: 10px;">
|
||||||
<el-checkbox v-model="componentInfo.options.attrs.enableRange" @change="enableRangeChange"><span> {{ $t('panel.custom_scope') }} </span> </el-checkbox>
|
<el-checkbox v-model="componentInfo.options.attrs.enableRange" @change="enableRangeChange"><span> {{ $t('panel.custom_scope') }} </span> </el-checkbox>
|
||||||
|
|
||||||
<el-popover
|
<el-popover
|
||||||
@ -219,7 +219,7 @@
|
|||||||
|
|
||||||
<i slot="reference" :class="{'i-filter-active': componentInfo.options.attrs.enableRange, 'i-filter-inactive': !componentInfo.options.attrs.enableRange}" class="el-icon-setting i-filter" />
|
<i slot="reference" :class="{'i-filter-active': componentInfo.options.attrs.enableRange, 'i-filter-inactive': !componentInfo.options.attrs.enableRange}" class="el-icon-setting i-filter" />
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</el-col>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
|
Loading…
Reference in New Issue
Block a user