forked from github/dataease
Merge branch 'dev' into pre@dev@api
This commit is contained in:
commit
fc9ca1e392
@ -41,6 +41,9 @@ public class PanelConstants {
|
||||
// 外部模板新建
|
||||
public static final String NEW_OUTER_TEMPLATE = "new_outer_template";
|
||||
|
||||
// 模板市场新建
|
||||
public static final String NEW_MARKET_TEMPLATE = "new_market_template";
|
||||
|
||||
}
|
||||
|
||||
//仪表板类型
|
||||
|
@ -111,7 +111,9 @@ public interface ParamConstants {
|
||||
FRONT_TIME_OUT("basic.frontTimeOut"),
|
||||
MSG_TIME_OUT("basic.msgTimeOut"),
|
||||
DEFAULT_LOGIN_TYPE("basic.loginType"),
|
||||
OPEN_HOME_PAGE("ui.openHomePage");
|
||||
OPEN_HOME_PAGE("ui.openHomePage"),
|
||||
TEMPLATE_MARKET_ULR("basic.templateMarketUlr"),
|
||||
TEMPLATE_ACCESS_KEY("basic.templateAccessKey");
|
||||
|
||||
private String value;
|
||||
|
||||
|
@ -64,7 +64,6 @@ public class HttpClientUtil {
|
||||
throw new RuntimeException("HttpClient构建失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get http请求
|
||||
*
|
||||
|
@ -27,6 +27,8 @@ public class PanelGroupRequest extends PanelGroupDTO {
|
||||
private String templateId;
|
||||
@ApiModelProperty("静态文件")
|
||||
private String staticResource;
|
||||
@ApiModelProperty("模板链接")
|
||||
private String templateUrl;
|
||||
|
||||
public PanelGroupRequest() {
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package io.dataease.controller.request.templateMarket;
|
||||
|
||||
import io.dataease.dto.templateMarket.TemplateMarketDTO;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/15
|
||||
* Description:
|
||||
*/
|
||||
public class TemplateMarketSearchRequest extends TemplateMarketDTO {
|
||||
|
||||
}
|
@ -6,6 +6,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.auth.annotation.DeLog;
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.commons.constants.SysLogConstants;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.controller.sys.request.UserGridRequest;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.SysRole;
|
||||
@ -58,7 +60,7 @@ public class SysUserController {
|
||||
@ApiImplicitParam(name = "request", value = "查询条件", required = true)
|
||||
})
|
||||
public Pager<List<SysUserGridResponse>> userGrid(@PathVariable int goPage, @PathVariable int pageSize,
|
||||
@RequestBody BaseGridRequest request) {
|
||||
@RequestBody UserGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, sysUserService.query(request));
|
||||
}
|
||||
@ -66,7 +68,8 @@ public class SysUserController {
|
||||
@ApiIgnore
|
||||
@PostMapping("/userLists")
|
||||
public List<SysUserGridResponse> userLists(@RequestBody BaseGridRequest request) {
|
||||
return sysUserService.query(request);
|
||||
UserGridRequest userGridRequest = BeanUtils.copyBean(new UserGridRequest(), request);
|
||||
return sysUserService.query(userGridRequest);
|
||||
}
|
||||
|
||||
@ApiOperation("创建用户")
|
||||
|
@ -1,18 +1,13 @@
|
||||
package io.dataease.controller.sys.request;
|
||||
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class UserGridRequest implements Serializable {
|
||||
@ApiModelProperty("快速检索")
|
||||
private String quick;
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
@ApiModelProperty("组织")
|
||||
private String deptId;
|
||||
@ApiModelProperty("状态")
|
||||
private String enabled;
|
||||
public class UserGridRequest extends BaseGridRequest implements Serializable {
|
||||
@ApiModelProperty("关键字")
|
||||
private String keyWord;
|
||||
}
|
||||
|
@ -16,5 +16,9 @@ public class BasicInfo implements Serializable {
|
||||
private String openHomePage;
|
||||
@ApiModelProperty("默认登录方式")
|
||||
private Integer loginType = 0;
|
||||
@ApiModelProperty("模板市场链接")
|
||||
private String templateMarketUlr;
|
||||
@ApiModelProperty("模板市场AccessKey")
|
||||
private String templateAccessKey;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package io.dataease.controller.templateMarket;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.controller.request.templateMarket.TemplateMarketSearchRequest;
|
||||
import io.dataease.dto.templateMarket.MarketBaseResponse;
|
||||
import io.dataease.dto.templateMarket.TemplateMarketDTO;
|
||||
import io.dataease.service.templateMarket.TemplateMarketService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/15
|
||||
* Description:
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "系统:模板市场")
|
||||
@ApiSupport(order = 220)
|
||||
@RequestMapping("/template/market")
|
||||
public class TemplateMarketController {
|
||||
|
||||
@Resource
|
||||
private TemplateMarketService marketService;
|
||||
|
||||
|
||||
@ApiOperation("查询模板")
|
||||
@PostMapping("/search")
|
||||
private MarketBaseResponse searchTemplate(@RequestBody TemplateMarketSearchRequest request){
|
||||
return marketService.searchTemplate(request);
|
||||
}
|
||||
|
||||
@ApiOperation("查询分类")
|
||||
@GetMapping("/categories")
|
||||
private List<String> categories(){
|
||||
return marketService.getCategories();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package io.dataease.dto.panel;
|
||||
|
||||
import io.dataease.plugins.common.base.domain.PanelTemplateWithBLOBs;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/14
|
||||
* Description:
|
||||
*/
|
||||
@Data
|
||||
public class PanelTemplateFileDTO extends PanelTemplateWithBLOBs {
|
||||
|
||||
private String panelStyle;
|
||||
|
||||
private String panelData;
|
||||
|
||||
private String staticResource;
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package io.dataease.dto.templateMarket;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/15
|
||||
* Description:
|
||||
*/
|
||||
@Data
|
||||
public class MarketBaseResponse {
|
||||
private String baseUrl;
|
||||
|
||||
private List<TemplateMarketDTO> contents;
|
||||
|
||||
public MarketBaseResponse() {
|
||||
}
|
||||
|
||||
public MarketBaseResponse(String baseUrl, List<TemplateMarketDTO> contents) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.contents = contents;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package io.dataease.dto.templateMarket;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/15
|
||||
* Description:
|
||||
*/
|
||||
@Data
|
||||
public class MarketCategory {
|
||||
private String id;
|
||||
private String name;
|
||||
private String slug;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package io.dataease.dto.templateMarket;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/15
|
||||
* Description:
|
||||
*/
|
||||
@Data
|
||||
public class MarketMetas {
|
||||
private String theme_repo;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package io.dataease.dto.templateMarket;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/18
|
||||
* Description:
|
||||
*/
|
||||
@Data
|
||||
public class TemplateCategory {
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String slug;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package io.dataease.dto.templateMarket;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/15
|
||||
* Description:
|
||||
*/
|
||||
@Data
|
||||
public class TemplateMarketDTO {
|
||||
private String id;
|
||||
private String title;
|
||||
private String status;
|
||||
private String slug;
|
||||
private String editorType;
|
||||
private String summary;
|
||||
private String thumbnail;
|
||||
private Boolean showFlag = true;
|
||||
private List<MarketCategory> categories;
|
||||
private MarketMetas metas;
|
||||
}
|
@ -40,7 +40,15 @@
|
||||
d.pid,
|
||||
d.NAME AS dept_name
|
||||
FROM
|
||||
sys_user u
|
||||
(
|
||||
select * from sys_user
|
||||
<if test="extendCondition != null">
|
||||
where
|
||||
nick_name like concat('%', #{extendCondition} , '%')
|
||||
or
|
||||
email like concat('%', #{extendCondition} , '%')
|
||||
</if>
|
||||
) u
|
||||
LEFT JOIN sys_dept d ON d.dept_id = u.dept_id
|
||||
LEFT JOIN sys_users_roles sur ON sur.user_id = u.user_id
|
||||
LEFT JOIN sys_role r ON r.role_id = sur.role_id
|
||||
|
@ -0,0 +1,51 @@
|
||||
package io.dataease.listener;
|
||||
|
||||
import io.dataease.plugins.common.base.domain.SysStartupJob;
|
||||
import io.dataease.plugins.common.base.mapper.SysStartupJobMapper;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.loader.ClassloaderResponsity;
|
||||
import io.dataease.plugins.xpack.auth.service.RowPermissionTreeService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2022/07/10 10:01 上午
|
||||
*/
|
||||
@Component
|
||||
public class RowPermissionMergeListener implements ApplicationListener<ApplicationReadyEvent> {
|
||||
private final Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
|
||||
public static final String JOB_ID = "rowPermissionsMerge";
|
||||
@Resource
|
||||
private SysStartupJobMapper sysStartupJobMapper;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||
Map<String, RowPermissionTreeService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((RowPermissionTreeService.class));
|
||||
if (beansOfType.keySet().size() > 0) {
|
||||
System.out.println("====row permissions merge [start]====");
|
||||
logger.info("====row permissions merge [start]====");
|
||||
|
||||
SysStartupJob sysStartupJob = sysStartupJobMapper.selectByPrimaryKey(JOB_ID);
|
||||
if (ObjectUtils.isNotEmpty(sysStartupJob) && StringUtils.equalsIgnoreCase(sysStartupJob.getStatus(), "ready")) {
|
||||
System.out.println("====row permissions merge [doing]====");
|
||||
logger.info("====row permissions merge [doing]====");
|
||||
|
||||
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);
|
||||
rowPermissionTreeService.mergeOldPermissions();
|
||||
sysStartupJob.setStatus("done");
|
||||
sysStartupJobMapper.updateByPrimaryKey(sysStartupJob);
|
||||
}
|
||||
System.out.println("====row permissions merge [end]====");
|
||||
logger.info("====row permissions merge [end]====");
|
||||
}
|
||||
}
|
||||
}
|
@ -10,21 +10,13 @@ import java.util.List;
|
||||
@RequestMapping("/api/map")
|
||||
public interface MapApi {
|
||||
|
||||
@GetMapping("/resourceFull/{areaCode}")
|
||||
String resourceFull(@PathVariable String areaCode);
|
||||
|
||||
@GetMapping("/asyncGeometry")
|
||||
String asyncGeometry();
|
||||
|
||||
@GetMapping("/areaEntitys/{pcode}")
|
||||
List<AreaEntity> areaEntitys(@PathVariable String pcode);
|
||||
|
||||
|
||||
/**
|
||||
* 由于api有限流机制
|
||||
* 请求失败后 调用重试方法
|
||||
* @param areaCode
|
||||
*/
|
||||
@GetMapping("/retry/{areaCode}")
|
||||
void retry(@PathVariable String areaCode);
|
||||
@GetMapping("/globalEntitys/{pcode}")
|
||||
List<AreaEntity> globalEntitys(@PathVariable String pcode);
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,9 @@ package io.dataease.map.dto.entity;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String COUNTRY_CODE = "国gb";
|
||||
public static final String COUNTRY_NAME = "国name";
|
||||
|
||||
public static final String PROVINCE_CODE = "省gb";
|
||||
public static final String PROVINCE_NAME = "省name";
|
||||
|
||||
|
@ -15,28 +15,9 @@ import java.util.List;
|
||||
@RestController
|
||||
public class MapServer implements MapApi {
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private MapService mapService;
|
||||
|
||||
@Override
|
||||
public String resourceFull(@PathVariable String areaCode) {
|
||||
return mapService.geometry(areaCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String asyncGeometry() {
|
||||
try {
|
||||
List<AreaEntity> areaEntities = mapService.areaEntities();
|
||||
MapUtils.recursionWriteFull(areaEntities);
|
||||
}catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
return e.getMessage();
|
||||
}
|
||||
return "async success";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaEntity> areaEntitys(@PathVariable String pcode) {
|
||||
List<AreaEntity> areaEntities = mapService.areaEntities();
|
||||
@ -47,11 +28,11 @@ public class MapServer implements MapApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retry(@PathVariable String areaCode) {
|
||||
List<AreaEntity> areaEntities = mapService.areaEntities();
|
||||
AreaEntity areaEntity = MapUtils.nodeByCode(areaEntities, areaCode);
|
||||
List<AreaEntity> targets = new ArrayList<>();
|
||||
targets.add(areaEntity);
|
||||
MapUtils.recursionWriteFull(targets);
|
||||
public List<AreaEntity> globalEntitys(String pcode) {
|
||||
List<AreaEntity> areaEntities = mapService.globalEntities();
|
||||
if (StringUtils.equals(pcode, "0")) {
|
||||
return areaEntities;
|
||||
}
|
||||
return mapService.entitysByPid(areaEntities, pcode);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.dataease.map.service;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.io.file.FileReader;
|
||||
import io.dataease.map.dto.entity.AreaEntity;
|
||||
@ -14,22 +13,20 @@ import java.util.List;
|
||||
@Service
|
||||
public class MapService {
|
||||
|
||||
|
||||
private static final String dirPath = "/opt/dataease/data/feature/";
|
||||
|
||||
// 要不要加缓存呢?
|
||||
public String geometry(String areaCode) {
|
||||
String path = dirPath + "full/" + areaCode + "_full.json";
|
||||
FileReader fileReader = new FileReader(path);
|
||||
return fileReader.readString();
|
||||
}
|
||||
|
||||
@Cacheable("sys_map_areas")
|
||||
public List<AreaEntity> areaEntities() {
|
||||
List<AreaEntity> areaEntities = MapUtils.readAreaEntity();
|
||||
return areaEntities;
|
||||
}
|
||||
|
||||
@Cacheable("sys_map_areas")
|
||||
public List<AreaEntity> globalEntities() {
|
||||
List<AreaEntity> areaEntities = MapUtils.readGlobalAreaEntity();
|
||||
return areaEntities;
|
||||
}
|
||||
|
||||
public List<AreaEntity> entitysByPid(List<AreaEntity> entities, String pid) {
|
||||
for (int i = 0; i < entities.size(); i++) {
|
||||
AreaEntity areaEntity = entities.get(i);
|
||||
@ -39,7 +36,7 @@ public class MapService {
|
||||
|
||||
if (CollectionUtil.isNotEmpty(areaEntity.getChildren())) {
|
||||
List<AreaEntity> areaEntities = entitysByPid(areaEntity.getChildren(), pid);
|
||||
if (null != areaEntities){
|
||||
if (null != areaEntities) {
|
||||
return areaEntities;
|
||||
}
|
||||
}
|
||||
@ -48,6 +45,4 @@ public class MapService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
package io.dataease.map.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.io.file.FileWriter;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.dataease.map.dto.entity.AreaEntity;
|
||||
import io.dataease.map.dto.entity.Constants;
|
||||
import io.dataease.plugins.common.base.domain.AreaMapping;
|
||||
import io.dataease.plugins.common.base.domain.AreaMappingExample;
|
||||
import io.dataease.plugins.common.base.domain.AreaMappingGlobal;
|
||||
import io.dataease.plugins.common.base.domain.AreaMappingGlobalExample;
|
||||
import io.dataease.plugins.common.base.mapper.AreaMappingGlobalMapper;
|
||||
import io.dataease.plugins.common.base.mapper.AreaMappingMapper;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.map.dto.entity.*;
|
||||
import io.dataease.map.dto.entity.Properties;
|
||||
import io.dataease.map.dto.response.MapResponse;
|
||||
import io.dataease.map.dto.response.MapResultDto;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.*;
|
||||
@ -21,24 +20,33 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class MapUtils {
|
||||
|
||||
|
||||
private static AreaMappingMapper areaMappingMapper;
|
||||
|
||||
private static AreaMappingGlobalMapper areaMappingGlobalMapper;
|
||||
|
||||
@Autowired
|
||||
public void setAreaMappingMapper(AreaMappingMapper areaMappingMapper) {
|
||||
MapUtils.areaMappingMapper = areaMappingMapper;
|
||||
}
|
||||
|
||||
private static final String path = "/opt/dataease/data/行政区划列表2020-03.xlsx";
|
||||
private static final String featureDir = "/opt/dataease/data/feature/";
|
||||
@Autowired
|
||||
public void setAreaMappingGlobalMapper(AreaMappingGlobalMapper areaMappingGlobalMapper) {
|
||||
MapUtils.areaMappingGlobalMapper = areaMappingGlobalMapper;
|
||||
}
|
||||
|
||||
private static final String featureDir = "/opt/dataease/data/feature/";
|
||||
|
||||
public static String formatCode(String code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static List<AreaMappingGlobal> readGlobalCodes() {
|
||||
AreaMappingGlobalExample example = new AreaMappingGlobalExample();
|
||||
List<AreaMappingGlobal> mappingGlobals = areaMappingGlobalMapper.selectByExample(example);
|
||||
return mappingGlobals;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> readCodeList( ) {
|
||||
public static List<Map<String, Object>> readCodeList() {
|
||||
AreaMappingExample example = new AreaMappingExample();
|
||||
List<AreaMapping> areaMappings = areaMappingMapper.selectByExample(example);
|
||||
return areaMappings.stream().map(mapping -> {
|
||||
@ -54,6 +62,74 @@ public class MapUtils {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<AreaEntity> readGlobalAreaEntity() {
|
||||
List<AreaMappingGlobal> maps = readGlobalCodes();
|
||||
Map<String, AreaEntity> countryMap = new ConcurrentHashMap<>();
|
||||
Map<String, AreaEntity> provinceMap = new ConcurrentHashMap<>();
|
||||
Map<String, AreaEntity> cityMap = new ConcurrentHashMap<>();
|
||||
Map<String, AreaEntity> countyMap = new ConcurrentHashMap<>();
|
||||
AreaEntity globalRoot = globalRoot();
|
||||
maps.stream().forEach(map -> {
|
||||
String country_code = map.getCountryCode();
|
||||
String province_code = map.getProvinceCode();
|
||||
String city_code = map.getCityCode();
|
||||
String county_code = map.getCountyCode();
|
||||
// 是否是跨级直辖
|
||||
Boolean isCrossLevel = StrUtil.equals(province_code, city_code)
|
||||
&& !StrUtil.equals(province_code, "156710000");
|
||||
|
||||
if (!countryMap.containsKey(country_code)) {
|
||||
String country_name = map.getCountryName();
|
||||
AreaEntity child = AreaEntity.builder().code(country_code).name(country_name)
|
||||
.pcode(globalRoot.getCode()).build();
|
||||
|
||||
countryMap.put(country_code, child);
|
||||
globalRoot.addChild(child);
|
||||
}
|
||||
|
||||
AreaEntity currentCountry = countryMap.get(country_code);
|
||||
|
||||
String province_name = map.getProvinceName();
|
||||
if (!provinceMap.containsKey(province_code)) {
|
||||
AreaEntity child = AreaEntity.builder().code(province_code).name(province_name)
|
||||
.pcode(currentCountry.getCode()).build();
|
||||
provinceMap.put(province_code, child);
|
||||
currentCountry.addChild(child);
|
||||
}
|
||||
|
||||
// 当前省
|
||||
AreaEntity currentProvince = provinceMap.get(province_code);
|
||||
|
||||
String city_name = map.getCityName();
|
||||
if (isCrossLevel) {
|
||||
city_code = county_code;
|
||||
city_name = map.getCountyName();
|
||||
}
|
||||
if (StringUtils.isNotBlank(city_code) && !cityMap.containsKey(city_code)) {
|
||||
AreaEntity child = AreaEntity.builder().code(city_code).name(city_name).pcode(currentProvince.getCode())
|
||||
.build();
|
||||
cityMap.put(city_code, child);
|
||||
currentProvince.addChild(child);
|
||||
}
|
||||
if (StringUtils.isNotBlank(county_code) && !isCrossLevel) {
|
||||
// 当前市
|
||||
AreaEntity currentCity = cityMap.get(city_code);
|
||||
if (!countyMap.containsKey(county_code)) {
|
||||
String county_name = map.getCountyName();
|
||||
AreaEntity child = AreaEntity.builder().code(county_code).name(county_name)
|
||||
.pcode(currentCity.getCode())
|
||||
.build();
|
||||
countyMap.put(county_code, child);
|
||||
currentCity.addChild(child);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
List<AreaEntity> result = new ArrayList<>();
|
||||
result.add(globalRoot);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<AreaEntity> readAreaEntity() {
|
||||
List<Map<String, Object>> maps = readCodeList();
|
||||
|
||||
@ -75,15 +151,15 @@ public class MapUtils {
|
||||
// 是否是跨级直辖
|
||||
Boolean isCrossLevel = StrUtil.equals(province_code, city_code) && !StrUtil.equals(province_code, "710000");
|
||||
|
||||
|
||||
if (!provinceMap.containsKey(province_code)) {
|
||||
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();
|
||||
provinceMap.put(province_code, child);
|
||||
china.addChild(child);
|
||||
}
|
||||
|
||||
//当前省
|
||||
// 当前省
|
||||
AreaEntity currentProvince = provinceMap.get(province_code);
|
||||
|
||||
String city_name = map.get(Constants.CITY_NAME).toString();
|
||||
@ -92,16 +168,19 @@ public class MapUtils {
|
||||
city_name = map.get(Constants.COUNTY_NAME).toString();
|
||||
}
|
||||
if (!cityMap.containsKey(city_code)) {
|
||||
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);
|
||||
currentProvince.addChild(child);
|
||||
}
|
||||
if (!isCrossLevel) {
|
||||
//当前市
|
||||
// 当前市
|
||||
AreaEntity currentCity = cityMap.get(city_code);
|
||||
if (!countyMap.containsKey(county_code)) {
|
||||
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);
|
||||
currentCity.addChild(child);
|
||||
}
|
||||
@ -116,148 +195,8 @@ public class MapUtils {
|
||||
return AreaEntity.builder().code("100000").name("中华人民共和国").build();
|
||||
}
|
||||
|
||||
public static void recursionWrite(List<AreaEntity> areaEntityList) {
|
||||
areaEntityList.forEach(areaEntity -> {
|
||||
String code = areaEntity.getCode();
|
||||
MapResponse mapResponse = HttpUtils.get(code);
|
||||
if (StrUtil.equals("1", mapResponse.getStatus()) && StrUtil.equalsAnyIgnoreCase("ok", mapResponse.getInfo()) && StrUtil.equalsAnyIgnoreCase("10000", mapResponse.getInfocode())) {
|
||||
List<District> districts = mapResponse.getDistricts();
|
||||
if (CollectionUtil.isNotEmpty(districts)) {
|
||||
List<Feature> kidFeatures = districts.stream().map(district -> buildFeature(district, areaEntity)).collect(Collectors.toList());
|
||||
MapResultDto mapResultDto = buildGeometry(kidFeatures);
|
||||
writeFeatureFile(mapResultDto, areaEntity.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(areaEntity.getChildren())) {
|
||||
recursionWrite(areaEntity.getChildren());
|
||||
}
|
||||
});
|
||||
|
||||
private static AreaEntity globalRoot() {
|
||||
return AreaEntity.builder().code("000000000").name("地球村").build();
|
||||
}
|
||||
|
||||
public static void recursionWriteFull(List<AreaEntity> areaEntityList) {
|
||||
areaEntityList.forEach(areaEntity -> {
|
||||
|
||||
List<AreaEntity> childrens = areaEntity.getChildren();
|
||||
if (CollectionUtil.isEmpty(childrens)) {
|
||||
childrens = new ArrayList<>();
|
||||
childrens.add(areaEntity);
|
||||
}
|
||||
|
||||
List<Feature> features = new ArrayList<>();
|
||||
|
||||
childrens.stream().forEach(child -> {
|
||||
MapResponse mapResponse = HttpUtils.get(child.getCode());
|
||||
if (StrUtil.equals("1", mapResponse.getStatus()) && StrUtil.equalsAnyIgnoreCase("ok", mapResponse.getInfo()) && StrUtil.equalsAnyIgnoreCase("10000", mapResponse.getInfocode())) {
|
||||
List<District> districts = mapResponse.getDistricts();
|
||||
if (CollectionUtil.isNotEmpty(districts)) {
|
||||
List<Feature> kidFeatures = districts.stream().map(district -> buildFeature(district, child)).collect(Collectors.toList());
|
||||
features.addAll(kidFeatures);
|
||||
}
|
||||
}else {
|
||||
LogUtil.error("请求节点错误 请手动补偿: " + areaEntity.getName() +" -> "+child.getName());
|
||||
}
|
||||
});
|
||||
|
||||
if (CollectionUtil.isNotEmpty(features)) {
|
||||
MapResultDto mapResultDto = buildGeometry(features);
|
||||
writeFeatureFileFull(mapResultDto, areaEntity.getCode() + "_full");
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(areaEntity.getChildren())) {
|
||||
recursionWriteFull(areaEntity.getChildren());
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static Feature buildFeature(District district, AreaEntity areaEntity) {
|
||||
String type = "Feature";
|
||||
Properties properties = new Properties();
|
||||
properties.setAdcode(district.getAdcode());
|
||||
properties.setName(district.getName());
|
||||
properties.setCenter(Arrays.stream(district.getCenter().split(",")).map(Double::parseDouble).collect(Collectors.toList()));
|
||||
properties.setCentroid(properties.getCenter());
|
||||
properties.setChildrenNum(CollectionUtil.isNotEmpty(areaEntity.getChildren()) ? areaEntity.getChildren().size() : 0);
|
||||
properties.setLevel(district.getLevel());
|
||||
Parent parent = new Parent();
|
||||
parent.setAdcode(areaEntity.getPcode());
|
||||
properties.setParent(parent);
|
||||
|
||||
String polylineStr = district.getPolyline();
|
||||
String[] polylines = polylineStr.split("[|]");
|
||||
List<List<List<List<Double>>>> multiPolygon = Arrays.stream(polylines).map(polyline -> {
|
||||
String[] strings = polyline.split(";");
|
||||
List<List<Double>> line = Arrays.stream(strings).map(str -> {
|
||||
String[] pointstr = str.split(",");
|
||||
List<String> strPoint = Arrays.asList(pointstr);
|
||||
List<Double> point = strPoint.stream().map(Double::parseDouble).collect(Collectors.toList());
|
||||
return point;
|
||||
}).collect(Collectors.toList());
|
||||
List<Double> firstPoint = line.get(0);
|
||||
List<Double> lastPoint = line.get(line.size() - 1);
|
||||
// 线的起始点和终点没有重合 说明没有闭合 需要手动闭合
|
||||
if (firstPoint.get(0) != lastPoint.get(0) || firstPoint.get(1) != lastPoint.get(1)) {
|
||||
line.add(firstPoint);
|
||||
}
|
||||
List<List<List<Double>>> polygon = new ArrayList<>();
|
||||
polygon.add(line);
|
||||
return polygon;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
Geometry geometry = new Geometry();
|
||||
geometry.setType("MultiPolygon");
|
||||
geometry.setCoordinates(multiPolygon);
|
||||
|
||||
Feature feature = new Feature();
|
||||
feature.setType(type);
|
||||
feature.setProperties(properties);
|
||||
feature.setGeometry(geometry);
|
||||
return feature;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static MapResultDto buildGeometry(List<Feature> features) {
|
||||
MapResultDto mapResultDto = new MapResultDto();
|
||||
mapResultDto.setType("FeatureCollection");
|
||||
mapResultDto.setFeatures(features);
|
||||
return mapResultDto;
|
||||
}
|
||||
|
||||
public static void writeFeatureFile(MapResultDto mapResultDto, String fileName) {
|
||||
String path = featureDir + fileName + ".json";
|
||||
FileWriter fileWriter = new FileWriter(path);
|
||||
String content = JSONUtil.toJsonStr(mapResultDto);
|
||||
fileWriter.write(content);
|
||||
}
|
||||
|
||||
public static void writeFeatureFileFull(MapResultDto mapResultDto, String fileName) {
|
||||
String path = featureDir + "full/" + fileName + ".json";
|
||||
FileWriter fileWriter = new FileWriter(path);
|
||||
String content = JSONUtil.toJsonStr(mapResultDto);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,19 @@
|
||||
package io.dataease.plugins.server;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.auth.annotation.DePermission;
|
||||
import io.dataease.commons.constants.DePermissionType;
|
||||
import io.dataease.commons.constants.ResourceAuthLevel;
|
||||
import io.dataease.commons.utils.PageUtils;
|
||||
import io.dataease.commons.utils.Pager;
|
||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeRequest;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.auth.service.RowPermissionTreeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -56,8 +58,19 @@ public class RowPermissionsTreeController {
|
||||
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
|
||||
@ApiOperation("根据数据集查找行权限")
|
||||
@PostMapping("getByDs")
|
||||
public List<DataSetRowPermissionsTreeDTO> getByDs(@RequestBody DataSetRowPermissionsTreeDTO request) {
|
||||
public List<DataSetRowPermissionsTreeDTO> getByDs(@RequestBody DatasetRowPermissionsTreeRequest request) {
|
||||
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);
|
||||
return rowPermissionTreeService.list(request);
|
||||
}
|
||||
|
||||
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
|
||||
@ApiOperation("根据数据集分页查找行权限")
|
||||
@PostMapping("getByDsPage/{goPage}/{pageSize}")
|
||||
public Pager<List<DataSetRowPermissionsTreeDTO>> getByDs(@RequestBody DatasetRowPermissionsTreeRequest request, @PathVariable int goPage, @PathVariable int pageSize) {
|
||||
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
List<DataSetRowPermissionsTreeDTO> list = rowPermissionTreeService.list(request);
|
||||
Pager<List<DataSetRowPermissionsTreeDTO>> setPageInfo = PageUtils.setPageInfo(page, list);
|
||||
return setPageInfo;
|
||||
}
|
||||
}
|
||||
|
@ -153,22 +153,24 @@ public class XDeptServer {
|
||||
public Pager<List<DeptUserItemDTO>> userGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody XpackDeptUserRequest request) {
|
||||
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
List<DeptUserItemDTO> userItems = deptService.queryBinded(request);
|
||||
List<DeptUserItemDTO> userItems = deptService.queryBinded(request, true);
|
||||
Pager<List<DeptUserItemDTO>> setPageInfo = PageUtils.setPageInfo(page, userItems);
|
||||
return setPageInfo;
|
||||
}
|
||||
|
||||
@RequiresPermissions({"dept:edit", "user:edit"})
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@PostMapping("/bindUser")
|
||||
public void bindUser(@RequestBody XpackDeptBindRequest request) {
|
||||
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
|
||||
request.getUserIds().forEach(userId -> {
|
||||
CacheUtils.remove( AuthConstants.USER_CACHE_NAME, "user" + userId);
|
||||
});
|
||||
deptService.bindUser(request);
|
||||
}
|
||||
|
||||
@RequiresPermissions({"dept:edit", "user:edit"})
|
||||
@PostMapping("/unBindUser")
|
||||
public void unBindUser(@RequestBody XpackDeptUnBindRequest request) {
|
||||
public void unBindUser(@RequestBody XpackDeptBindRequest request) {
|
||||
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
|
||||
if (CollectionUtil.isEmpty(request.getUserIds())) {
|
||||
DEException.throwException("userIds can not be empty");
|
||||
|
@ -12,7 +12,6 @@ import io.dataease.commons.utils.Pager;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import io.dataease.plugins.common.entity.XpackGridRequest;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.role.dto.request.RoleUserMappingDelRequest;
|
||||
import io.dataease.plugins.xpack.role.dto.request.RoleUserMappingRequest;
|
||||
import io.dataease.plugins.xpack.role.dto.request.RoleUserRequest;
|
||||
import io.dataease.plugins.xpack.role.dto.response.RoleUserItem;
|
||||
@ -120,17 +119,21 @@ public class XRoleServer {
|
||||
|
||||
@RequiresPermissions({"role:edit", "user:edit"})
|
||||
@ApiOperation("绑定用户")
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@PostMapping("/bindUser")
|
||||
public void bindUser(@RequestBody RoleUserMappingRequest request) {
|
||||
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
|
||||
if (CollectionUtils.isNotEmpty(request.getUserIds())) {
|
||||
request.getUserIds().forEach(userId -> {
|
||||
CacheUtils.remove( AuthConstants.USER_CACHE_NAME, "user" + userId);
|
||||
});
|
||||
}
|
||||
roleXpackService.addUser(request);
|
||||
}
|
||||
|
||||
@RequiresPermissions({"role:edit", "user:edit"})
|
||||
@ApiOperation("解绑用户")
|
||||
@PostMapping("/unBindUsers")
|
||||
public void unBindUsers(@RequestBody RoleUserMappingDelRequest request) {
|
||||
public void unBindUsers(@RequestBody RoleUserMappingRequest request) {
|
||||
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
|
||||
if (CollectionUtils.isNotEmpty(request.getUserIds())) {
|
||||
request.getUserIds().forEach(userId -> {
|
||||
|
@ -154,8 +154,11 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(sortFields)) {
|
||||
@ -316,6 +319,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -323,6 +328,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -393,12 +399,15 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -505,6 +514,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -512,6 +523,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -616,6 +628,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -623,6 +637,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -702,12 +717,15 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
@ -1206,7 +1224,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String cast = String.format(DorisConstants.CAST, originField, y.getDeType() == 2 ? DorisConstants.DEFAULT_INT_FORMAT : DorisConstants.DEFAULT_FLOAT_FORMAT);
|
||||
String agg = String.format(DorisConstants.AGG_FIELD, y.getSummary(), cast);
|
||||
String cast1 = String.format(DorisConstants.CAST, agg, DorisConstants.DEFAULT_FLOAT_FORMAT);
|
||||
fieldName = String.format(DorisConstants.ROUND, cast1, "2");
|
||||
fieldName = String.format(DorisConstants.ROUND, cast1, "8");
|
||||
} else {
|
||||
String cast = String.format(DorisConstants.CAST, originField, y.getDeType() == 2 ? DorisConstants.DEFAULT_INT_FORMAT : DorisConstants.DEFAULT_FLOAT_FORMAT);
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
|
@ -155,8 +155,10 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(sortFields)) {
|
||||
@ -317,6 +319,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -324,6 +328,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -394,12 +399,15 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -506,6 +514,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -513,6 +523,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -617,6 +628,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -624,6 +637,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -703,12 +717,15 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
@ -1212,7 +1229,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String cast = String.format(MysqlConstants.CAST, originField, y.getDeType() == 2 ? MysqlConstants.DEFAULT_INT_FORMAT : MysqlConstants.DEFAULT_FLOAT_FORMAT);
|
||||
String agg = String.format(MysqlConstants.AGG_FIELD, y.getSummary(), cast);
|
||||
String cast1 = String.format(MysqlConstants.CAST, agg, MysqlConstants.DEFAULT_FLOAT_FORMAT);
|
||||
fieldName = String.format(MysqlConstants.ROUND, cast1, "2");
|
||||
fieldName = String.format(MysqlConstants.ROUND, cast1, "8");
|
||||
} else {
|
||||
String cast = String.format(MysqlConstants.CAST, originField, y.getDeType() == 2 ? MysqlConstants.DEFAULT_INT_FORMAT : MysqlConstants.DEFAULT_FLOAT_FORMAT);
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
|
@ -183,8 +183,11 @@ public class CKQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
@ -348,6 +351,8 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -355,6 +360,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -425,12 +431,15 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -538,6 +547,8 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -545,6 +556,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -649,6 +661,8 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -656,6 +670,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -735,12 +750,15 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -158,8 +158,11 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
@ -328,6 +331,8 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -335,6 +340,7 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -407,12 +413,15 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -521,6 +530,8 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -528,6 +539,7 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -633,6 +645,8 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -640,6 +654,7 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -720,12 +735,15 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -183,8 +183,11 @@ public class EsQueryProvider extends QueryProvider {
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
|
||||
@ -353,6 +356,8 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -360,6 +365,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -435,12 +441,15 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -550,6 +559,8 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -557,6 +568,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -669,6 +681,8 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -676,6 +690,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -759,12 +774,15 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
@ -1213,7 +1231,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
|
||||
String cast = String.format(EsSqlLConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? "bigint" : "double");
|
||||
String agg = String.format(EsSqlLConstants.AGG_FIELD, y.getSummary(), cast);
|
||||
fieldName = String.format(EsSqlLConstants.ROUND, agg, "2");
|
||||
fieldName = String.format(EsSqlLConstants.ROUND, agg, "8");
|
||||
} else {
|
||||
String cast = String.format(EsSqlLConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? "bigint" : "double");
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
|
@ -143,8 +143,11 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
@ -304,6 +307,8 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -311,6 +316,7 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -381,12 +387,15 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -494,6 +503,8 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -501,6 +512,7 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -605,6 +617,8 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -612,6 +626,7 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -691,12 +706,15 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -140,8 +140,11 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
@ -301,6 +304,8 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -308,6 +313,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -378,12 +384,15 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -491,6 +500,8 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -498,6 +509,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -602,6 +614,8 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -609,6 +623,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -688,12 +703,15 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -130,8 +130,11 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
@ -264,6 +267,8 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -271,6 +276,7 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -346,12 +352,15 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -461,6 +470,8 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -468,6 +479,7 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -577,6 +589,8 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -584,6 +598,7 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -669,12 +684,15 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -117,8 +117,11 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
@ -360,6 +363,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -367,6 +372,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -437,12 +443,15 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -549,6 +558,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -556,6 +567,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -660,6 +672,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -667,6 +681,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -747,12 +762,15 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
orders.addAll(yOrders);
|
||||
|
@ -171,8 +171,11 @@ public class PgQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
@ -331,6 +334,8 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -338,6 +343,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -408,12 +414,15 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -521,6 +530,8 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -528,6 +539,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -632,6 +644,8 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -639,6 +653,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -719,12 +734,15 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -180,8 +180,11 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
|
||||
@ -341,6 +344,8 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -348,6 +353,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -463,6 +469,8 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -470,6 +478,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -574,6 +583,8 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -581,6 +592,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -661,12 +673,15 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -170,8 +170,11 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(sortFields)) {
|
||||
@ -323,6 +326,8 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -330,6 +335,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -404,12 +410,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -540,6 +549,8 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -547,6 +558,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -655,6 +667,8 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(xFields);
|
||||
@ -662,6 +676,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
groups.addAll(xFields);
|
||||
// 外层再次套sql
|
||||
@ -746,12 +761,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// 处理仪表板字段过滤
|
||||
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
// 构建sql所有参数
|
||||
List<SQLObj> fields = new ArrayList<>();
|
||||
fields.addAll(yFields);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (extWheres != null) wheres.add(extWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
List<SQLObj> groups = new ArrayList<>();
|
||||
// 外层再次套sql
|
||||
List<SQLObj> orders = new ArrayList<>();
|
||||
|
@ -997,9 +997,9 @@ public class ChartViewService {
|
||||
item[dataIndex] = null;
|
||||
} else {
|
||||
item[dataIndex] = new BigDecimal(cValue)
|
||||
.divide(new BigDecimal(lastValue), 2, RoundingMode.HALF_UP)
|
||||
.divide(new BigDecimal(lastValue), 8, RoundingMode.HALF_UP)
|
||||
.subtract(new BigDecimal(1))
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.setScale(8, RoundingMode.HALF_UP)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ public class ChartDataBuild {
|
||||
if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1 || chartViewFieldDTO.getDeType() == 5) {
|
||||
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? "" : ele[i]);
|
||||
} else if (chartViewFieldDTO.getDeType() == 2 || chartViewFieldDTO.getDeType() == 3) {
|
||||
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? null : new BigDecimal(ele[i]).setScale(2, RoundingMode.HALF_UP));
|
||||
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? null : new BigDecimal(ele[i]).setScale(8, RoundingMode.HALF_UP));
|
||||
}
|
||||
}
|
||||
tableRow.add(d);
|
||||
|
@ -11,6 +11,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeObj;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeRequest;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.auth.service.RowPermissionTreeService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -18,7 +19,10 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@ -60,7 +64,7 @@ public class PermissionsTreeService {
|
||||
List<CurrentRoleDto> currentRoleDtos = authUserService.roleInfos(userId);
|
||||
roleIds = currentRoleDtos.stream().map(CurrentRoleDto::getId).collect(Collectors.toList());
|
||||
|
||||
DataSetRowPermissionsTreeDTO dataSetRowPermissionsDTO = new DataSetRowPermissionsTreeDTO();
|
||||
DatasetRowPermissionsTreeRequest dataSetRowPermissionsDTO = new DatasetRowPermissionsTreeRequest();
|
||||
dataSetRowPermissionsDTO.setDatasetId(datasetId);
|
||||
dataSetRowPermissionsDTO.setEnable(true);
|
||||
|
||||
|
@ -3,14 +3,12 @@ package io.dataease.service.panel;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.auth.annotation.DeCleaner;
|
||||
import io.dataease.commons.constants.*;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.DeLogUtils;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.commons.utils.TreeUtils;
|
||||
import io.dataease.commons.utils.*;
|
||||
import io.dataease.controller.request.authModel.VAuthModelRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
import io.dataease.controller.request.panel.PanelGroupBaseInfoRequest;
|
||||
import io.dataease.controller.request.panel.PanelGroupRequest;
|
||||
import io.dataease.controller.request.panel.PanelTemplateRequest;
|
||||
import io.dataease.controller.request.panel.PanelViewDetailsRequest;
|
||||
import io.dataease.dto.PanelGroupExtendDataDTO;
|
||||
import io.dataease.dto.SysLogDTO;
|
||||
@ -18,6 +16,7 @@ import io.dataease.dto.authModel.VAuthModelDTO;
|
||||
import io.dataease.dto.chart.ChartViewDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||
import io.dataease.dto.panel.PanelGroupDTO;
|
||||
import io.dataease.dto.panel.PanelTemplateFileDTO;
|
||||
import io.dataease.dto.panel.po.PanelViewInsertDTO;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import io.dataease.ext.*;
|
||||
@ -389,6 +388,16 @@ public class PanelGroupService {
|
||||
dynamicData = request.getDynamicData();
|
||||
staticResource = request.getStaticResource();
|
||||
mobileLayout = panelViewService.havaMobileLayout(templateData);
|
||||
} else if (PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(newFrom)){
|
||||
PanelTemplateFileDTO templateFileInfo = getTemplateFromMarket(request.getTemplateUrl());
|
||||
if(templateFileInfo == null){
|
||||
DataEaseException.throwException("Can't find the template's info from market,please check");
|
||||
}
|
||||
templateStyle = templateFileInfo.getPanelStyle();
|
||||
templateData = templateFileInfo.getPanelData();
|
||||
dynamicData = templateFileInfo.getDynamicData();
|
||||
staticResource = templateFileInfo.getStaticResource();
|
||||
mobileLayout = panelViewService.havaMobileLayout(templateData);
|
||||
}
|
||||
Map<String, String> dynamicDataMap = gson.fromJson(dynamicData, Map.class);
|
||||
List<PanelViewInsertDTO> panelViews = new ArrayList<>();
|
||||
@ -583,4 +592,15 @@ public class PanelGroupService {
|
||||
panelGroup.setStatus(request.getStatus());
|
||||
panelGroupMapper.updateByPrimaryKeySelective(panelGroup);
|
||||
}
|
||||
|
||||
|
||||
public PanelTemplateFileDTO getTemplateFromMarket(String templateUrl){
|
||||
if(StringUtils.isNotEmpty(templateUrl)){
|
||||
Gson gson = new Gson();
|
||||
String templateInfo = HttpClientUtil.get(templateUrl,null);
|
||||
return gson.fromJson(templateInfo, PanelTemplateFileDTO.class);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package io.dataease.service.sys;
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.auth.service.ExtAuthService;
|
||||
import io.dataease.controller.sys.base.ConditionEntity;
|
||||
import io.dataease.controller.sys.request.*;
|
||||
import io.dataease.ext.ExtSysUserAssistMapper;
|
||||
import io.dataease.ext.ExtSysUserMapper;
|
||||
import io.dataease.ext.query.GridExample;
|
||||
@ -10,10 +12,6 @@ import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.CodingUtil;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.request.LdapAddRequest;
|
||||
import io.dataease.controller.sys.request.SysUserCreateRequest;
|
||||
import io.dataease.controller.sys.request.SysUserPwdRequest;
|
||||
import io.dataease.controller.sys.request.SysUserStateRequest;
|
||||
import io.dataease.controller.sys.response.SysUserGridResponse;
|
||||
import io.dataease.controller.sys.response.SysUserRole;
|
||||
import io.dataease.i18n.Translator;
|
||||
@ -60,12 +58,12 @@ public class SysUserService {
|
||||
private ExtSysUserAssistMapper extSysUserAssistMapper;
|
||||
|
||||
|
||||
public List<SysUserGridResponse> query(BaseGridRequest request) {
|
||||
|
||||
public List<SysUserGridResponse> query(UserGridRequest request) {
|
||||
String keyWord = request.getKeyWord();
|
||||
GridExample gridExample = request.convertExample();
|
||||
gridExample.setExtendCondition(keyWord);
|
||||
List<SysUserGridResponse> lists = extSysUserMapper.query(gridExample);
|
||||
lists.forEach(item -> {
|
||||
|
||||
List<SysUserRole> roles = item.getRoles();
|
||||
List<Long> roleIds = roles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
item.setRoleIds(roleIds);
|
||||
|
@ -6,6 +6,7 @@ import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.EncryptUtils;
|
||||
import io.dataease.controller.sys.response.BasicInfo;
|
||||
import io.dataease.dto.SystemParameterDTO;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import io.dataease.plugins.common.base.domain.FileMetadata;
|
||||
import io.dataease.plugins.common.base.domain.SystemParameter;
|
||||
import io.dataease.plugins.common.base.domain.SystemParameterExample;
|
||||
@ -69,6 +70,13 @@ public class SystemParameterService {
|
||||
boolean open = StringUtils.equals("true", param.getParamValue());
|
||||
result.setOpenHomePage(open ? "true" : "false");
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_MARKET_ULR.getValue())) {
|
||||
result.setTemplateMarketUlr(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_ACCESS_KEY.getValue())) {
|
||||
result.setTemplateAccessKey(param.getParamValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -270,5 +278,23 @@ public class SystemParameterService {
|
||||
}
|
||||
|
||||
}
|
||||
public BasicInfo templateMarketInfo(){
|
||||
BasicInfo basicInfo = new BasicInfo();
|
||||
List<SystemParameter> result = this.getParamList("basic.template");
|
||||
if(CollectionUtils.isNotEmpty(result)){
|
||||
result.stream().forEach(param -> {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_MARKET_ULR.getValue())) {
|
||||
basicInfo.setTemplateMarketUlr(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_ACCESS_KEY.getValue())) {
|
||||
basicInfo.setTemplateAccessKey(param.getParamValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
if(StringUtils.isEmpty(basicInfo.getTemplateMarketUlr())|| StringUtils.isEmpty(basicInfo.getTemplateAccessKey())){
|
||||
DataEaseException.throwException("Please check market setting info");
|
||||
}
|
||||
return basicInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
package io.dataease.service.templateMarket;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.utils.HttpClientConfig;
|
||||
import io.dataease.commons.utils.HttpClientUtil;
|
||||
import io.dataease.controller.request.templateMarket.TemplateMarketSearchRequest;
|
||||
import io.dataease.controller.sys.response.BasicInfo;
|
||||
import io.dataease.dto.panel.PanelTemplateFileDTO;
|
||||
import io.dataease.dto.templateMarket.MarketBaseResponse;
|
||||
import io.dataease.dto.templateMarket.TemplateCategory;
|
||||
import io.dataease.dto.templateMarket.TemplateMarketDTO;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import io.dataease.service.system.SystemParameterService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/7/14
|
||||
* Description: ${userName}
|
||||
*/
|
||||
@Service
|
||||
public class TemplateMarketService {
|
||||
|
||||
private final static String POSTS_API="/api/content/posts?page=0&size=2000";
|
||||
private final static String CATEGORIES_API="/api/content/categories";
|
||||
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
|
||||
/**
|
||||
* @Description Get template file from template market
|
||||
* @param templateUrl template url
|
||||
*/
|
||||
public PanelTemplateFileDTO getTemplateFromMarket(String templateUrl){
|
||||
if(StringUtils.isNotEmpty(templateUrl)){
|
||||
String sufUrl = systemParameterService.templateMarketInfo().getTemplateMarketUlr();
|
||||
Gson gson = new Gson();
|
||||
String templateInfo = HttpClientUtil.get(sufUrl+templateUrl,null);
|
||||
return gson.fromJson(templateInfo, PanelTemplateFileDTO.class);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description Get info from template market content api
|
||||
* @param url content api url
|
||||
*/
|
||||
public String marketGet(String url,String accessKey){
|
||||
HttpClientConfig config = new HttpClientConfig();
|
||||
config.addHeader("API-Authorization",accessKey);
|
||||
return HttpClientUtil.get(url,config);
|
||||
}
|
||||
|
||||
public MarketBaseResponse searchTemplate(TemplateMarketSearchRequest request){
|
||||
try{
|
||||
BasicInfo basicInfo = systemParameterService.templateMarketInfo();
|
||||
String result = marketGet(basicInfo.getTemplateMarketUlr()+POSTS_API,basicInfo.getTemplateAccessKey());
|
||||
List<TemplateMarketDTO> postsResult = JSONObject.parseObject(result).getJSONObject("data").getJSONArray("content").toJavaList(TemplateMarketDTO.class);
|
||||
return new MarketBaseResponse(basicInfo.getTemplateMarketUlr(),postsResult);
|
||||
}catch (Exception e){
|
||||
DataEaseException.throwException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getCategories(){
|
||||
BasicInfo basicInfo = systemParameterService.templateMarketInfo();
|
||||
String resultStr = marketGet(basicInfo.getTemplateMarketUlr()+CATEGORIES_API,basicInfo.getTemplateAccessKey());
|
||||
List<TemplateCategory> categories = JSONObject.parseObject(resultStr).getJSONArray("data").toJavaList(TemplateCategory.class);
|
||||
if(CollectionUtils.isNotEmpty(categories)){
|
||||
return categories.stream().map(TemplateCategory :: getName).collect(Collectors.toList());
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -36,4 +36,8 @@ ADD COLUMN `phone_prefix` varchar(255) NULL COMMENT '手机号前缀' AFTER `sub
|
||||
INSERT INTO `my_plugin` (`name`, `store`, `free`, `cost`, `category`, `descript`, `version`, `creator`, `load_mybatis`,
|
||||
`install_time`, `module_name`, `ds_type`)
|
||||
VALUES ('Mongo 数据源插件', 'default', '0', '0', 'datasource', 'Mongo 数据源插件', '1.0-SNAPSHOT', 'DATAEASE', '0',
|
||||
'1650765903630', 'mongo-backend', 'mongobi');
|
||||
'1650765903630', 'mongo-backend', 'mongobi');
|
||||
|
||||
|
||||
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateAccessKey', 'dataease', 'text', NULL);
|
||||
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateMarketUlr', 'https://dataease.io/templates', 'text', 4);
|
||||
|
@ -8,6 +8,14 @@ export const areaMapping = () => {
|
||||
})
|
||||
}
|
||||
|
||||
export const globalMapping = () => {
|
||||
return request({
|
||||
url: '/api/map/globalEntitys/0',
|
||||
method: 'get',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export function geoJson(areaCode) {
|
||||
return request({
|
||||
url: '/geo/' + areaCode + '_full.json',
|
||||
|
20
frontend/src/api/templateMarket/index.js
Normal file
20
frontend/src/api/templateMarket/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function searchMarket(data) {
|
||||
return request({
|
||||
url: '/template/market/search',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
hideMsg: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getCategories() {
|
||||
return request({
|
||||
url: '/template/market/categories',
|
||||
method: 'get',
|
||||
hideMsg: true,
|
||||
loading: false
|
||||
})
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
|
||||
<div v-show="!editControlButton" class="toolbar">
|
||||
<div class="panel-info-area">
|
||||
<!--back to panelList-->
|
||||
<svg-icon
|
||||
icon-class="icon_left_outlined"
|
||||
class="toolbar-icon-active icon20 margin-left20"
|
||||
|
5
frontend/src/icons/svg/none_select.svg
Normal file
5
frontend/src/icons/svg/none_select.svg
Normal file
@ -0,0 +1,5 @@
|
||||
<svg width="125" height="125" viewBox="0 0 125 125" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="125" height="125" rx="62.5" fill="#EFF0F1"/>
|
||||
<path d="M68.6525 91.3927C67.7195 93.8379 64.2695 93.8652 63.2978 91.4358L47.0339 50.7747C46.0952 48.4287 48.424 46.0985 50.7714 47.0372L91.4296 63.3011C93.8547 64.2714 93.8346 67.7113 91.398 68.6529L74.8998 75.0253L68.6525 91.3942V91.3927ZM65.904 82.4702L69.9836 71.7809C70.1273 71.4047 70.3485 71.0629 70.6328 70.7776C70.9171 70.4923 71.2581 70.27 71.6338 70.1249L82.5042 65.926L54.864 54.8702L65.904 82.4702Z" fill="#BBBFC4"/>
|
||||
<path d="M48.125 32.3125C56.7026 32.3125 63.6859 39.1421 63.9303 47.6607L57.7534 45.1896C57.2462 43.5293 56.3182 42.0284 55.0594 40.8329C53.8006 39.6373 52.2538 38.7878 50.5696 38.3669C48.8853 37.9459 47.1208 37.9679 45.4476 38.4307C43.7743 38.8934 42.2493 39.7812 41.0206 41.0077C39.792 42.2343 38.9016 43.7578 38.436 45.4302C37.9703 47.1027 37.9453 48.8672 38.3634 50.5521C38.7814 52.2371 39.6283 53.7853 40.8217 55.0461C42.0151 56.307 43.5143 57.2376 45.1738 57.7476L47.6463 63.9303C39.1334 63.6773 32.3125 56.6982 32.3125 48.125C32.3125 39.3922 39.3922 32.3125 48.125 32.3125Z" fill="#BBBFC4"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
@ -1121,7 +1121,15 @@ export default {
|
||||
open: 'Open',
|
||||
row: 'Row',
|
||||
interval: 'Interval',
|
||||
max_more_than_mix: 'Max must more than Min'
|
||||
max_more_than_mix: 'Max must more than Min',
|
||||
field: 'Field',
|
||||
textColor: 'Text Color',
|
||||
backgroundColor: 'Background Color',
|
||||
field_can_not_empty: 'Field can not empty',
|
||||
conditions_can_not_empty: 'Conditions can not be empty,if unnecessary,please delete the field',
|
||||
remark: 'Remark',
|
||||
remark_edit: 'Edit Remark',
|
||||
remark_bg_color: 'Background Fill'
|
||||
},
|
||||
dataset: {
|
||||
field_rename: 'Rename Field',
|
||||
@ -1491,6 +1499,11 @@ export default {
|
||||
sure_bt: 'Confirm'
|
||||
},
|
||||
panel: {
|
||||
market_network_tips: 'View template Market template requires server and template Market( https://dataease.io/templates ), please check the network... ',
|
||||
enter_name_tips: 'Please enter the name of the panel',
|
||||
name: 'Name',
|
||||
apply_template: 'Apply Template',
|
||||
enter_template_name_tips: 'Please enter the template name...',
|
||||
pic_adaptation: 'Adaptation',
|
||||
pic_equiratio: 'Equiratio',
|
||||
pic_original: 'Original',
|
||||
|
@ -1121,7 +1121,15 @@ export default {
|
||||
open: '開啟',
|
||||
row: '行數',
|
||||
interval: '間隔',
|
||||
max_more_than_mix: '最大值必須大於最小值'
|
||||
max_more_than_mix: '最大值必須大於最小值',
|
||||
field: '字段',
|
||||
textColor: '文字顏色',
|
||||
backgroundColor: '背景顏色',
|
||||
field_can_not_empty: '字段不能為空',
|
||||
conditions_can_not_empty: '字段的條件不能為空,若無條件,請直接刪除該字段',
|
||||
remark: '備註',
|
||||
remark_edit: '編輯備註',
|
||||
remark_bg_color: '背景填充'
|
||||
},
|
||||
dataset: {
|
||||
field_rename: '字段重命名',
|
||||
@ -1492,6 +1500,11 @@ export default {
|
||||
sure_bt: '確定'
|
||||
},
|
||||
panel: {
|
||||
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)联通,请检查网络...',
|
||||
enter_name_tips: '请输入仪表板名称',
|
||||
name: '名称',
|
||||
apply_template: '应用模板',
|
||||
enter_template_name_tips: '请输入模板名称...',
|
||||
pic_adaptation: '适应组件',
|
||||
pic_equiratio: '等比适应',
|
||||
pic_original: '原始尺寸',
|
||||
|
@ -1123,7 +1123,15 @@ export default {
|
||||
open: '开启',
|
||||
row: '行数',
|
||||
interval: '间隔',
|
||||
max_more_than_mix: '最大值必须大于最小值'
|
||||
max_more_than_mix: '最大值必须大于最小值',
|
||||
field: '字段',
|
||||
textColor: '文字颜色',
|
||||
backgroundColor: '背景颜色',
|
||||
field_can_not_empty: '字段不能为空',
|
||||
conditions_can_not_empty: '字段的条件不能为空,若无条件,请直接删除该字段',
|
||||
remark: '备注',
|
||||
remark_edit: '编辑备注',
|
||||
remark_bg_color: '背景填充'
|
||||
},
|
||||
dataset: {
|
||||
field_rename: '字段重命名',
|
||||
@ -1500,6 +1508,11 @@ export default {
|
||||
sure_bt: '确定'
|
||||
},
|
||||
panel: {
|
||||
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)联通,请检查网络...',
|
||||
enter_name_tips: '请输入仪表板名称',
|
||||
name: '名称',
|
||||
apply_template: '应用模板',
|
||||
enter_template_name_tips: '请输入模板名称...',
|
||||
pic_adaptation: '适应组件',
|
||||
pic_equiratio: '等比适应',
|
||||
pic_original: '原始尺寸',
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
<div class="right-menu" style="color: var(--TopTextColor)">
|
||||
<template>
|
||||
|
||||
<span class="hover-effect right-menu-item template-market-item" @click="changeTemplateMarketShow(true)">模板市场</span>
|
||||
<notification class="right-menu-item hover-effect" />
|
||||
<lang-select class="right-menu-item hover-effect" />
|
||||
<div style="height: 100%;padding: 0 8px;" class="right-menu-item hover-effect">
|
||||
@ -43,7 +43,6 @@
|
||||
trigger="click"
|
||||
>
|
||||
<div class="el-dropdown-link" style="display: flex;color: var(--TopTextColor);font-size: 14px; width:100%;">
|
||||
|
||||
<span style="max-width:80px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">{{ name }}</span>
|
||||
<span><i class="el-icon-arrow-down el-icon--right" /></span>
|
||||
</div>
|
||||
@ -70,6 +69,16 @@
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
||||
<!--模板市场全屏显示框-->
|
||||
<el-dialog
|
||||
:visible="templateMarketShow"
|
||||
:show-close="false"
|
||||
class="dialog-css"
|
||||
:fullscreen="true"
|
||||
append-to-body="true"
|
||||
>
|
||||
<template-market v-if="templateMarketShow" style="text-align: center" @closeDialog="changeTemplateMarketShow(false)" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@ -95,9 +104,11 @@ import {
|
||||
import {
|
||||
initTheme
|
||||
} from '@/utils/ThemeUtil'
|
||||
import TemplateMarket from '@/views/panel/templateMarket'
|
||||
export default {
|
||||
name: 'Topbar',
|
||||
components: {
|
||||
TemplateMarket,
|
||||
AppLink,
|
||||
Notification,
|
||||
LangSelect
|
||||
@ -114,7 +125,8 @@ export default {
|
||||
uiInfo: null,
|
||||
logoUrl: null,
|
||||
axiosFinished: false,
|
||||
isPluginLoaded: false
|
||||
isPluginLoaded: false,
|
||||
templateMarketShow: false
|
||||
}
|
||||
},
|
||||
|
||||
@ -357,6 +369,9 @@ export default {
|
||||
},
|
||||
setTopTextActiveInfo(val) {
|
||||
this.loadUiInfo()
|
||||
},
|
||||
changeTemplateMarketShow(isShow) {
|
||||
this.templateMarketShow = isShow
|
||||
}
|
||||
|
||||
}
|
||||
@ -387,5 +402,15 @@ export default {
|
||||
background-color: var(--MainBG);
|
||||
|
||||
}
|
||||
.template-market-item{
|
||||
display: flex;
|
||||
color: var(--MenuActiveBG, #409EFF);
|
||||
font-size: 14px!important;
|
||||
line-height: 38px!important;
|
||||
}
|
||||
|
||||
.dialog-css ::v-deep .el-dialog__header{
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -144,7 +144,10 @@ export const DEFAULT_TITLE_STYLE = {
|
||||
hPosition: 'left',
|
||||
vPosition: 'top',
|
||||
isItalic: false,
|
||||
isBolder: true
|
||||
isBolder: true,
|
||||
remarkShow: false,
|
||||
remark: '',
|
||||
remarkBackgroundColor: '#ffffffff'
|
||||
}
|
||||
|
||||
export const DEFAULT_TITLE_STYLE_DARK = {
|
||||
@ -337,7 +340,8 @@ export const DEFAULT_FUNCTION_CFG = {
|
||||
}
|
||||
export const DEFAULT_THRESHOLD = {
|
||||
gaugeThreshold: '',
|
||||
labelThreshold: []
|
||||
labelThreshold: [],
|
||||
tableThreshold: []
|
||||
}
|
||||
export const DEFAULT_SCROLL = {
|
||||
open: false,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { TableSheet, S2Event, PivotSheet } from '@antv/s2'
|
||||
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
|
||||
import { DEFAULT_TOTAL } from '@/views/chart/chart/chart'
|
||||
import { DEFAULT_COLOR_CASE, DEFAULT_TOTAL } from '@/views/chart/chart/chart'
|
||||
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
|
||||
import { hexColorToRGBA } from '@/views/chart/chart/util'
|
||||
|
||||
export function baseTableInfo(s2, container, chart, action, tableData) {
|
||||
const containerDom = document.getElementById(container)
|
||||
@ -59,6 +60,9 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
|
||||
if (!f) {
|
||||
return value
|
||||
}
|
||||
if (value === null || value === undefined) {
|
||||
return value
|
||||
}
|
||||
if (f.groupType === 'd') {
|
||||
return value
|
||||
} else {
|
||||
@ -86,6 +90,9 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
|
||||
if (!f) {
|
||||
return value
|
||||
}
|
||||
if (value === null || value === undefined) {
|
||||
return value
|
||||
}
|
||||
if (f.groupType === 'd') {
|
||||
return value
|
||||
} else {
|
||||
@ -116,7 +123,8 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
|
||||
width: containerDom.offsetWidth,
|
||||
height: containerDom.offsetHeight,
|
||||
// showSeriesNumber: true
|
||||
style: getSize(chart)
|
||||
style: getSize(chart),
|
||||
conditions: getConditions(chart)
|
||||
}
|
||||
|
||||
// 开始渲染
|
||||
@ -190,6 +198,9 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
|
||||
if (!f) {
|
||||
return value
|
||||
}
|
||||
if (value === null || value === undefined) {
|
||||
return value
|
||||
}
|
||||
if (f.formatterCfg) {
|
||||
return valueFormatter(value, f.formatterCfg)
|
||||
} else {
|
||||
@ -211,6 +222,9 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
|
||||
if (!f) {
|
||||
return value
|
||||
}
|
||||
if (value === null || value === undefined) {
|
||||
return value
|
||||
}
|
||||
if (f.formatterCfg) {
|
||||
return valueFormatter(value, f.formatterCfg)
|
||||
} else {
|
||||
@ -235,7 +249,8 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
|
||||
width: containerDom.offsetWidth,
|
||||
height: containerDom.offsetHeight,
|
||||
// showSeriesNumber: true
|
||||
style: getSize(chart)
|
||||
style: getSize(chart),
|
||||
conditions: getConditions(chart)
|
||||
}
|
||||
|
||||
// 开始渲染
|
||||
@ -319,6 +334,9 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
|
||||
if (!f) {
|
||||
return value
|
||||
}
|
||||
if (value === null || value === undefined) {
|
||||
return value
|
||||
}
|
||||
if (f.formatterCfg) {
|
||||
return valueFormatter(value, f.formatterCfg)
|
||||
} else {
|
||||
@ -340,6 +358,9 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
|
||||
if (!f) {
|
||||
return value
|
||||
}
|
||||
if (value === null || value === undefined) {
|
||||
return value
|
||||
}
|
||||
if (f.formatterCfg) {
|
||||
return valueFormatter(value, f.formatterCfg)
|
||||
} else {
|
||||
@ -385,7 +406,8 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
|
||||
width: containerDom.offsetWidth,
|
||||
height: containerDom.offsetHeight,
|
||||
style: getSize(chart),
|
||||
totals: totalCfg
|
||||
totals: totalCfg,
|
||||
conditions: getConditions(chart)
|
||||
}
|
||||
|
||||
// 开始渲染
|
||||
@ -424,3 +446,190 @@ function getCurrentField(valueFieldList, field) {
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
function getConditions(chart) {
|
||||
const res = {
|
||||
text: [],
|
||||
background: []
|
||||
}
|
||||
let conditions
|
||||
try {
|
||||
const senior = JSON.parse(chart.senior)
|
||||
conditions = senior.threshold ? senior.threshold.tableThreshold : null
|
||||
} catch (err) {
|
||||
const senior = JSON.parse(JSON.stringify(chart.senior))
|
||||
conditions = senior.threshold ? senior.threshold.tableThreshold : null
|
||||
}
|
||||
|
||||
if (conditions && conditions.length > 0) {
|
||||
// table item color
|
||||
let valueColor = DEFAULT_COLOR_CASE.tableFontColor
|
||||
let valueBgColor = DEFAULT_COLOR_CASE.tableItemBgColor
|
||||
if (chart.customAttr) {
|
||||
const customAttr = JSON.parse(chart.customAttr)
|
||||
// color
|
||||
if (customAttr.color) {
|
||||
const c = JSON.parse(JSON.stringify(customAttr.color))
|
||||
valueColor = c.tableFontColor
|
||||
valueBgColor = hexColorToRGBA(c.tableItemBgColor, c.alpha)
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < conditions.length; i++) {
|
||||
const field = conditions[i]
|
||||
res.text.push({
|
||||
field: field.field.dataeaseName,
|
||||
mapping(value) {
|
||||
return {
|
||||
fill: mappingColor(value, valueColor, field, 'color')
|
||||
}
|
||||
}
|
||||
})
|
||||
res.background.push({
|
||||
field: field.field.dataeaseName,
|
||||
mapping(value) {
|
||||
return {
|
||||
fill: mappingColor(value, valueBgColor, field, 'backgroundColor')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
function mappingColor(value, defaultColor, field, type) {
|
||||
let color
|
||||
for (let i = 0; i < field.conditions.length; i++) {
|
||||
let flag = false
|
||||
const t = field.conditions[i]
|
||||
if (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) {
|
||||
const tv = parseFloat(t.value)
|
||||
if (t.term === 'eq') {
|
||||
if (value === tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_eq') {
|
||||
if (value !== tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'lt') {
|
||||
if (value < tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'gt') {
|
||||
if (value > tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'le') {
|
||||
if (value <= tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'ge') {
|
||||
if (value >= tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
break
|
||||
} else if (i === field.conditions.length - 1) {
|
||||
color = defaultColor
|
||||
}
|
||||
} else if (field.field.deType === 0) {
|
||||
const tv = t.value
|
||||
if (t.term === 'eq') {
|
||||
if (value === tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_eq') {
|
||||
if (value !== tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'like') {
|
||||
if (value.includes(tv)) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not like') {
|
||||
if (!value.includes(tv)) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'null') {
|
||||
if (value === null || value === undefined) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_null') {
|
||||
if (value !== null && value !== undefined) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'empty') {
|
||||
if (value === '') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_empty') {
|
||||
if (value !== '') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
break
|
||||
} else if (i === field.conditions.length - 1) {
|
||||
color = defaultColor
|
||||
}
|
||||
} else {
|
||||
// time
|
||||
const tv = new Date(t.value + ' GMT+8').getTime()
|
||||
const v = new Date(value + ' GMT+8').getTime()
|
||||
if (t.term === 'eq') {
|
||||
if (v === tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_eq') {
|
||||
if (v !== tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'lt') {
|
||||
if (v < tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'gt') {
|
||||
if (v > tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'le') {
|
||||
if (v <= tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'ge') {
|
||||
if (v >= tv) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
break
|
||||
} else if (i === field.conditions.length - 1) {
|
||||
color = defaultColor
|
||||
}
|
||||
}
|
||||
}
|
||||
return color
|
||||
}
|
||||
|
@ -44,14 +44,67 @@
|
||||
<span :title="item.value">{{ item.value }}</span>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span :style="{width:'14px', height:'14px', backgroundColor: item.color}" />
|
||||
<span :style="{width:'14px', height:'14px', backgroundColor: item.color, border: 'solid 1px #e1e4e8'}" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-col>
|
||||
|
||||
<!--编辑阈值-->
|
||||
<!--表格-->
|
||||
<el-col v-if="chart.type && (chart.render === 'antv' && chart.type.includes('table'))">
|
||||
<el-col>
|
||||
<el-button
|
||||
:title="$t('chart.edit')"
|
||||
icon="el-icon-edit"
|
||||
type="text"
|
||||
size="small"
|
||||
style="width: 24px;margin-left: 4px;"
|
||||
@click="editTableThreshold"
|
||||
/>
|
||||
<el-col style="padding: 0 18px;max-height: 500px;overflow-y: auto;">
|
||||
<el-row v-for="(fieldItem,fieldIndex) in thresholdForm.tableThreshold" :key="fieldIndex">
|
||||
<el-row class="field-style">
|
||||
<span>
|
||||
<svg-icon v-if="fieldItem.field.deType === 0" icon-class="field_text" class="field-icon-text" />
|
||||
<svg-icon v-if="fieldItem.field.deType === 1" icon-class="field_time" class="field-icon-time" />
|
||||
<svg-icon v-if="fieldItem.field.deType === 2 || fieldItem.field.value === 3" icon-class="field_value" class="field-icon-value" />
|
||||
<svg-icon v-if="fieldItem.field.deType === 5" icon-class="field_location" class="field-icon-location" />
|
||||
</span>
|
||||
<span :title="fieldItem.field.name" class="field-text">{{ fieldItem.field.name }}</span>
|
||||
</el-row>
|
||||
<el-row v-for="(item,index) in fieldItem.conditions" :key="index" class="line-style">
|
||||
<el-col :span="6">
|
||||
<span v-if="item.term === 'eq'" :title="$t('chart.filter_eq')">{{ $t('chart.filter_eq') }}</span>
|
||||
<span v-else-if="item.term === 'not_eq'" :title="$t('chart.filter_not_eq')">{{ $t('chart.filter_not_eq') }}</span>
|
||||
<span v-else-if="item.term === 'lt'" :title="$t('chart.filter_lt')">{{ $t('chart.filter_lt') }}</span>
|
||||
<span v-else-if="item.term === 'gt'" :title="$t('chart.filter_gt')">{{ $t('chart.filter_gt') }}</span>
|
||||
<span v-else-if="item.term === 'le'" :title="$t('chart.filter_le')">{{ $t('chart.filter_le') }}</span>
|
||||
<span v-else-if="item.term === 'ge'" :title="$t('chart.filter_ge')">{{ $t('chart.filter_ge') }}</span>
|
||||
<span v-else-if="item.term === 'like'" :title="$t('chart.filter_like')">{{ $t('chart.filter_like') }}</span>
|
||||
<span v-else-if="item.term === 'not like'" :title="$t('chart.filter_not_like')">{{ $t('chart.filter_not_like') }}</span>
|
||||
<span v-else-if="item.term === 'null'" :title="$t('chart.filter_null')">{{ $t('chart.filter_null') }}</span>
|
||||
<span v-else-if="item.term === 'not_null'" :title="$t('chart.filter_not_null')">{{ $t('chart.filter_not_null') }}</span>
|
||||
<span v-else-if="item.term === 'empty'" :title="$t('chart.filter_empty')">{{ $t('chart.filter_empty') }}</span>
|
||||
<span v-else-if="item.term === 'not_empty'" :title="$t('chart.filter_not_empty')">{{ $t('chart.filter_not_empty') }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span v-if="!item.term.includes('null') && !item.term.includes('empty')" :title="item.value">{{ item.value }}</span>
|
||||
<span v-else> </span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span :title="$t('chart.textColor')" :style="{width:'14px', height:'14px', backgroundColor: item.color, border: 'solid 1px #e1e4e8'}" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span :title="$t('chart.backgroundColor')" :style="{width:'14px', height:'14px', backgroundColor: item.backgroundColor, border: 'solid 1px #e1e4e8'}" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-col>
|
||||
|
||||
<!--编辑指标卡阈值-->
|
||||
<el-dialog
|
||||
v-if="editLabelThresholdDialog"
|
||||
v-dialogDrag
|
||||
@ -60,6 +113,7 @@
|
||||
:show-close="false"
|
||||
width="50%"
|
||||
class="dialog-css"
|
||||
append-to-body
|
||||
>
|
||||
<text-threshold-edit :threshold="thresholdForm.labelThreshold" @onLabelThresholdChange="thresholdChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@ -67,16 +121,36 @@
|
||||
<el-button type="primary" size="mini" @click="changeLabelThreshold">{{ $t('chart.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--编辑表格阈值-->
|
||||
<el-dialog
|
||||
v-if="editTableThresholdDialog"
|
||||
v-dialogDrag
|
||||
:title="$t('chart.threshold')"
|
||||
:visible="editTableThresholdDialog"
|
||||
:show-close="false"
|
||||
width="50%"
|
||||
class="dialog-css"
|
||||
append-to-body
|
||||
>
|
||||
<table-threshold-edit :threshold="thresholdForm.tableThreshold" :chart="chart" @onTableThresholdChange="tableThresholdChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeTableThreshold">{{ $t('chart.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" @click="changeTableThreshold">{{ $t('chart.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
|
||||
import TextThresholdEdit from '@/views/chart/components/senior/dialog/TextThresholdEdit'
|
||||
import TableThresholdEdit from '@/views/chart/components/senior/dialog/TableThresholdEdit'
|
||||
|
||||
export default {
|
||||
name: 'Threshold',
|
||||
components: { TextThresholdEdit },
|
||||
components: { TableThresholdEdit, TextThresholdEdit },
|
||||
props: {
|
||||
chart: {
|
||||
type: Object,
|
||||
@ -87,7 +161,9 @@ export default {
|
||||
return {
|
||||
thresholdForm: JSON.parse(JSON.stringify(DEFAULT_THRESHOLD)),
|
||||
editLabelThresholdDialog: false,
|
||||
thresholdArr: []
|
||||
thresholdArr: [],
|
||||
editTableThresholdDialog: false,
|
||||
tableThresholdArr: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -115,9 +191,14 @@ export default {
|
||||
if (!this.thresholdForm.labelThreshold) {
|
||||
this.thresholdForm.labelThreshold = []
|
||||
}
|
||||
if (!this.thresholdForm.tableThreshold) {
|
||||
this.thresholdForm.tableThreshold = []
|
||||
}
|
||||
} else {
|
||||
this.thresholdForm = JSON.parse(JSON.stringify(DEFAULT_THRESHOLD))
|
||||
}
|
||||
this.thresholdArr = JSON.parse(JSON.stringify(this.thresholdForm.labelThreshold))
|
||||
this.tableThresholdArr = JSON.parse(JSON.stringify(this.thresholdForm.tableThreshold))
|
||||
}
|
||||
},
|
||||
changeThreshold() {
|
||||
@ -192,6 +273,68 @@ export default {
|
||||
},
|
||||
thresholdChange(val) {
|
||||
this.thresholdArr = val
|
||||
},
|
||||
tableThresholdChange(val) {
|
||||
this.tableThresholdArr = val
|
||||
},
|
||||
|
||||
editTableThreshold() {
|
||||
this.editTableThresholdDialog = true
|
||||
},
|
||||
closeTableThreshold() {
|
||||
this.editTableThresholdDialog = false
|
||||
},
|
||||
changeTableThreshold() {
|
||||
// check line config
|
||||
for (let i = 0; i < this.tableThresholdArr.length; i++) {
|
||||
const field = this.tableThresholdArr[i]
|
||||
if (!field.fieldId) {
|
||||
this.$message({
|
||||
message: this.$t('chart.field_can_not_empty'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!field.conditions || field.conditions.length === 0) {
|
||||
this.$message({
|
||||
message: this.$t('chart.conditions_can_not_empty'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
for (let j = 0; j < field.conditions.length; j++) {
|
||||
const ele = field.conditions[j]
|
||||
if (!ele.term || ele.term === '') {
|
||||
this.$message({
|
||||
message: this.$t('chart.exp_can_not_empty'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!ele.term.includes('null') && !ele.term.includes('empty') && !ele.value) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_can_not_empty'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
if ((field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && parseFloat(ele.value).toString() === 'NaN') {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_error'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
this.thresholdForm.tableThreshold = JSON.parse(JSON.stringify(this.tableThresholdArr))
|
||||
this.changeThreshold()
|
||||
this.closeTableThreshold()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,4 +396,18 @@ span{
|
||||
.dialog-css >>> .el-dialog__body {
|
||||
padding: 10px 20px 20px;
|
||||
}
|
||||
|
||||
.field-style{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
}
|
||||
|
||||
.field-text{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #8492a6;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
@ -0,0 +1,397 @@
|
||||
<template>
|
||||
<el-col>
|
||||
<el-button icon="el-icon-plus" circle size="mini" style="margin-bottom: 10px;" @click="addThreshold" />
|
||||
<div style="max-height: 50vh;overflow-y: auto;">
|
||||
<div v-for="(fieldItem,fieldIndex) in thresholdArr" :key="fieldIndex" class="field-item">
|
||||
<el-row style="margin-top: 6px;">
|
||||
<span class="color-title">{{ $t('chart.field') }}</span>
|
||||
<el-select v-model="fieldItem.fieldId" size="mini" @change="addField(fieldItem)">
|
||||
<el-option
|
||||
v-for="fieldOption in fields"
|
||||
:key="fieldOption.id"
|
||||
:label="fieldOption.name"
|
||||
:value="fieldOption.id"
|
||||
>
|
||||
<span style="float: left">
|
||||
<svg-icon v-if="fieldOption.deType === 0" icon-class="field_text" class="field-icon-text" />
|
||||
<svg-icon v-if="fieldOption.deType === 1" icon-class="field_time" class="field-icon-time" />
|
||||
<svg-icon
|
||||
v-if="fieldOption.deType === 2 || fieldOption.value === 3"
|
||||
icon-class="field_value"
|
||||
class="field-icon-value"
|
||||
/>
|
||||
<svg-icon v-if="fieldOption.deType === 5" icon-class="field_location" class="field-icon-location" />
|
||||
</span>
|
||||
<span style="float: left; color: #8492a6; font-size: 12px">{{ fieldOption.name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
circle
|
||||
size="mini"
|
||||
style="margin-bottom: 10px;margin-left: 10px;"
|
||||
@click="addConditions(fieldItem)"
|
||||
/>
|
||||
<el-button
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
size="mini"
|
||||
style="margin-bottom: 10px;float: right;"
|
||||
@click="removeThreshold(fieldIndex)"
|
||||
/>
|
||||
</el-row>
|
||||
<el-row v-for="(item,index) in fieldItem.conditions" :key="index" class="line-item">
|
||||
<el-col :span="4">
|
||||
<el-select v-model="item.term" size="mini" @change="changeThreshold">
|
||||
<el-option-group
|
||||
v-for="(group,idx) in fieldItem.options"
|
||||
:key="idx"
|
||||
:label="group.label"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in group.options"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="8" style="text-align: center;">
|
||||
<el-input
|
||||
v-show="!item.term.includes('null') && !item.term.includes('empty')"
|
||||
v-model="item.value"
|
||||
class="value-item"
|
||||
:placeholder="$t('chart.drag_block_label_value')"
|
||||
size="mini"
|
||||
clearable
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4" style="display: flex;align-items: center;justify-content: center;">
|
||||
<span class="color-title">{{ $t('chart.textColor') }}</span>
|
||||
<el-color-picker
|
||||
v-model="item.color"
|
||||
show-alpha
|
||||
class="color-picker-style"
|
||||
:predefine="predefineColors"
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4" style="display: flex;align-items: center;justify-content: center;">
|
||||
<span class="color-title">{{ $t('chart.backgroundColor') }}</span>
|
||||
<el-color-picker
|
||||
v-model="item.backgroundColor"
|
||||
show-alpha
|
||||
class="color-picker-style"
|
||||
:predefine="predefineColors"
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
style="float: right"
|
||||
@click="removeCondition(fieldItem,index)"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tip">提示:请勿重复选择字段,若同一字段重复配置,则只有最后的字段配置生效</div>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { COLOR_PANEL } from '@/views/chart/chart/chart'
|
||||
|
||||
export default {
|
||||
name: 'TableThresholdEdit',
|
||||
props: {
|
||||
threshold: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
chart: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
thresholdArr: [],
|
||||
fields: [],
|
||||
thresholdObj: {
|
||||
fieldId: '',
|
||||
field: {},
|
||||
conditions: []
|
||||
},
|
||||
thresholdCondition: {
|
||||
term: 'eq',
|
||||
field: '0',
|
||||
value: '',
|
||||
color: '#ff0000ff',
|
||||
backgroundColor: '#ffffffff'
|
||||
},
|
||||
textOptions: [
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'eq',
|
||||
label: this.$t('chart.filter_eq')
|
||||
}, {
|
||||
value: 'not_eq',
|
||||
label: this.$t('chart.filter_not_eq')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'like',
|
||||
label: this.$t('chart.filter_like')
|
||||
}, {
|
||||
value: 'not like',
|
||||
label: this.$t('chart.filter_not_like')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'null',
|
||||
label: this.$t('chart.filter_null')
|
||||
}, {
|
||||
value: 'not_null',
|
||||
label: this.$t('chart.filter_not_null')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'empty',
|
||||
label: this.$t('chart.filter_empty')
|
||||
}, {
|
||||
value: 'not_empty',
|
||||
label: this.$t('chart.filter_not_empty')
|
||||
}]
|
||||
}
|
||||
],
|
||||
dateOptions: [
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'eq',
|
||||
label: this.$t('chart.filter_eq')
|
||||
}, {
|
||||
value: 'not_eq',
|
||||
label: this.$t('chart.filter_not_eq')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'lt',
|
||||
label: this.$t('chart.filter_lt')
|
||||
}, {
|
||||
value: 'gt',
|
||||
label: this.$t('chart.filter_gt')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'le',
|
||||
label: this.$t('chart.filter_le')
|
||||
}, {
|
||||
value: 'ge',
|
||||
label: this.$t('chart.filter_ge')
|
||||
}]
|
||||
}
|
||||
],
|
||||
valueOptions: [
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'eq',
|
||||
label: this.$t('chart.filter_eq')
|
||||
}, {
|
||||
value: 'not_eq',
|
||||
label: this.$t('chart.filter_not_eq')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'lt',
|
||||
label: this.$t('chart.filter_lt')
|
||||
}, {
|
||||
value: 'gt',
|
||||
label: this.$t('chart.filter_gt')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'le',
|
||||
label: this.$t('chart.filter_le')
|
||||
}, {
|
||||
value: 'ge',
|
||||
label: this.$t('chart.filter_ge')
|
||||
}]
|
||||
}
|
||||
],
|
||||
predefineColors: COLOR_PANEL
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.thresholdArr = JSON.parse(JSON.stringify(this.threshold))
|
||||
this.initFields()
|
||||
},
|
||||
initOptions(item) {
|
||||
if (item.field) {
|
||||
if (item.field.deType === 0 || item.field.deType === 5) {
|
||||
item.options = JSON.parse(JSON.stringify(this.textOptions))
|
||||
} else if (item.field.deType === 1) {
|
||||
item.options = JSON.parse(JSON.stringify(this.dateOptions))
|
||||
} else {
|
||||
item.options = JSON.parse(JSON.stringify(this.valueOptions))
|
||||
}
|
||||
item.conditions && item.conditions.forEach(ele => {
|
||||
ele.term = ''
|
||||
})
|
||||
}
|
||||
},
|
||||
initFields() {
|
||||
// 暂时支持指标
|
||||
if (this.chart.type === 'table-info') {
|
||||
if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') {
|
||||
this.fields = JSON.parse(JSON.stringify(this.chart.xaxis))
|
||||
} else {
|
||||
this.fields = JSON.parse(this.chart.xaxis)
|
||||
}
|
||||
} else if (this.chart.type === 'table-pivot') {
|
||||
if (Object.prototype.toString.call(this.chart.yaxis) === '[object Array]') {
|
||||
this.fields = JSON.parse(JSON.stringify(this.chart.yaxis))
|
||||
} else {
|
||||
this.fields = JSON.parse(this.chart.yaxis)
|
||||
}
|
||||
} else {
|
||||
if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') {
|
||||
this.fields = this.fields.concat(JSON.parse(JSON.stringify(this.chart.xaxis)))
|
||||
} else {
|
||||
this.fields = this.fields.concat(JSON.parse(this.chart.xaxis))
|
||||
}
|
||||
if (Object.prototype.toString.call(this.chart.yaxis) === '[object Array]') {
|
||||
this.fields = this.fields.concat(JSON.parse(JSON.stringify(this.chart.yaxis)))
|
||||
} else {
|
||||
this.fields = this.fields.concat(JSON.parse(this.chart.yaxis))
|
||||
}
|
||||
}
|
||||
// 暂不支持时间
|
||||
// this.fields = this.fields.filter(ele => ele.deType !== 1)
|
||||
},
|
||||
addThreshold() {
|
||||
this.thresholdArr.push(JSON.parse(JSON.stringify(this.thresholdObj)))
|
||||
this.changeThreshold()
|
||||
},
|
||||
removeThreshold(index) {
|
||||
this.thresholdArr.splice(index, 1)
|
||||
this.changeThreshold()
|
||||
},
|
||||
|
||||
changeThreshold() {
|
||||
this.$emit('onTableThresholdChange', this.thresholdArr)
|
||||
},
|
||||
|
||||
addConditions(item) {
|
||||
item.conditions.push(JSON.parse(JSON.stringify(this.thresholdCondition)))
|
||||
this.changeThreshold()
|
||||
},
|
||||
removeCondition(item, index) {
|
||||
item.conditions.splice(index, 1)
|
||||
this.changeThreshold()
|
||||
},
|
||||
addField(item) {
|
||||
// get field
|
||||
if (this.fields && this.fields.length > 0) {
|
||||
this.fields.forEach(ele => {
|
||||
if (item.fieldId === ele.id) {
|
||||
item.field = JSON.parse(JSON.stringify(ele))
|
||||
this.initOptions(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.changeThreshold()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.field-item {
|
||||
width: 100%;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #DCDFE6;
|
||||
padding: 4px 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.line-item {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.form-item >>> .el-form-item__label {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.value-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.select-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
.el-select-dropdown__item {
|
||||
padding: 0 20px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.color-picker-style {
|
||||
cursor: pointer;
|
||||
z-index: 1003;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.color-picker-style >>> .el-color-picker__trigger {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.color-title {
|
||||
margin-right: 6px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.tip {
|
||||
color: #F56C6C;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
@ -207,7 +207,7 @@
|
||||
class="render-select"
|
||||
style="width: 100px"
|
||||
size="mini"
|
||||
@change="changeChartType()"
|
||||
@change="changeChartRender()"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in pluginRenderOptions"
|
||||
@ -697,12 +697,12 @@
|
||||
<el-tab-pane name="senior" :label="$t('chart.senior')" class="padding-tab" style="width: 350px;">
|
||||
<el-row class="view-panel">
|
||||
<div
|
||||
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge')) || view.type === 'text' || view.type === 'table-normal' || view.type === 'table-info'"
|
||||
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge') || view.type === 'text' || view.type.includes('table'))"
|
||||
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;"
|
||||
class="attr-style theme-border-class"
|
||||
>
|
||||
<el-row
|
||||
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('table'))"
|
||||
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type === 'table-normal' || view.type === 'table-info')"
|
||||
>
|
||||
<span class="padding-lr">{{ $t('chart.senior_cfg') }}</span>
|
||||
<el-collapse v-model="attrActiveNames" class="style-collapse">
|
||||
@ -714,7 +714,7 @@
|
||||
@onFunctionCfgChange="onFunctionCfgChange"
|
||||
/>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item v-if="view.type && (view.type.includes('table'))" name="scroll" :title="$t('chart.scroll_cfg')">
|
||||
<el-collapse-item v-if="view.type && (view.type === 'table-normal' || view.type === 'table-info')" name="scroll" :title="$t('chart.scroll_cfg')">
|
||||
<scroll-cfg
|
||||
:param="param"
|
||||
class="attr-selector"
|
||||
@ -725,7 +725,7 @@
|
||||
</el-collapse>
|
||||
</el-row>
|
||||
<el-row
|
||||
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge') || view.type === 'text')"
|
||||
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge') || view.type === 'text' || (view.render === 'antv' && view.type.includes('table')))"
|
||||
>
|
||||
<span class="padding-lr">{{ $t('chart.analyse_cfg') }}</span>
|
||||
<el-collapse v-model="styleActiveNames" class="style-collapse">
|
||||
@ -742,7 +742,7 @@
|
||||
/>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item
|
||||
v-if="view.type && (view.type.includes('gauge') || view.type === 'text')"
|
||||
v-if="view.type && (view.type.includes('gauge') || view.type === 'text' || (view.render === 'antv' && view.type.includes('table')))"
|
||||
name="threshold"
|
||||
:title="$t('chart.threshold')"
|
||||
>
|
||||
@ -1469,7 +1469,7 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
buildParam(getData, trigger, needRefreshGroup = false, switchType = false) {
|
||||
buildParam(getData, trigger, needRefreshGroup = false, switchType = false, switchRender = false) {
|
||||
if (!this.view.resultCount ||
|
||||
this.view.resultCount === '' ||
|
||||
isNaN(Number(this.view.resultCount)) ||
|
||||
@ -1477,6 +1477,9 @@ export default {
|
||||
parseInt(this.view.resultCount) < 1) {
|
||||
this.view.resultCount = '1000'
|
||||
}
|
||||
if (switchType) {
|
||||
this.view.senior.threshold.tableThreshold = []
|
||||
}
|
||||
if (switchType && (this.view.type === 'table-info' || this.chart.type === 'table-info') && this.view.xaxis.length > 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@ -1663,9 +1666,9 @@ export default {
|
||||
delete view.data
|
||||
return view
|
||||
},
|
||||
calcData(getData, trigger, needRefreshGroup = false, switchType = false) {
|
||||
calcData(getData, trigger, needRefreshGroup = false, switchType = false, switchRender = false) {
|
||||
this.changeEditStatus(true)
|
||||
const view = this.buildParam(true, 'chart', false, switchType)
|
||||
const view = this.buildParam(true, 'chart', false, switchType, switchRender)
|
||||
if (!view) return
|
||||
viewEditSave(this.panelInfo.id, view).then(() => {
|
||||
// this.getData(this.param.id)
|
||||
@ -2490,6 +2493,10 @@ export default {
|
||||
this.hasEdit = status
|
||||
this.$store.commit('recordViewEdit', { viewId: this.param.id, hasEdit: status })
|
||||
},
|
||||
changeChartRender() {
|
||||
this.setChartDefaultOptions()
|
||||
this.calcData(true, 'chart', true, false, true)
|
||||
},
|
||||
changeChartType() {
|
||||
this.setChartDefaultOptions()
|
||||
this.calcData(true, 'chart', true, true)
|
||||
|
@ -354,7 +354,7 @@ export default {
|
||||
watch: {
|
||||
// 切换展示页面后 重新点击一下当前节点
|
||||
'$store.state.panel.mainActiveName': function(newVal, oldVal) {
|
||||
if (newVal === 'PanelMain' && this.lastActiveNode && this.lastActiveNodeData) {
|
||||
if (newVal === 'PanelMain' && this.lastActiveNodeData) {
|
||||
this.activeNodeAndClickOnly(this.lastActiveNodeData)
|
||||
}
|
||||
},
|
||||
@ -369,14 +369,25 @@ export default {
|
||||
this.$refs.panel_list_tree.filter(this.filterText)
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
bus.$off('newPanelFromMarket', this.newPanelFromMarket)
|
||||
},
|
||||
mounted() {
|
||||
this.$store.commit('setComponentData', [])
|
||||
this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE_STRING)
|
||||
this.defaultTree(true)
|
||||
this.tree(true)
|
||||
this.initCache()
|
||||
bus.$on('newPanelFromMarket', this.newPanelFromMarket)
|
||||
},
|
||||
methods: {
|
||||
newPanelFromMarket(panelInfo) {
|
||||
if (panelInfo) {
|
||||
this.defaultTree()
|
||||
this.tree()
|
||||
this.edit(panelInfo, null)
|
||||
}
|
||||
},
|
||||
initCache() {
|
||||
// 初始化时提前加载视图和数据集的缓存
|
||||
this.initLocalStorage.forEach(item => {
|
||||
|
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div class="testcase-template">
|
||||
<el-row class="template-img" :style="classBackground" />
|
||||
<el-row class="bottom-area">
|
||||
<el-row>
|
||||
<span class="demonstration">{{ template.title }}</span>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<el-row class="template-button">
|
||||
<el-button size="mini" type="primary" icon="el-icon-view" @click="templatePreview">预览</el-button>
|
||||
<el-button size="mini" type="success" icon="el-icon-files" @click="apply">应用</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'TemplateMarketItem',
|
||||
props: {
|
||||
template: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
baseUrl: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
classBackground() {
|
||||
return {
|
||||
background: `url(${this.thumbnailUrl}) no-repeat`,
|
||||
'background-size': `100% 100%`
|
||||
}
|
||||
},
|
||||
thumbnailUrl() {
|
||||
if (this.template.thumbnail.indexOf('http') > -1) {
|
||||
return this.template.thumbnail
|
||||
} else {
|
||||
return this.baseUrl + this.template.thumbnail
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleDelete() {
|
||||
|
||||
},
|
||||
apply() {
|
||||
this.$emit('templateApply', this.template)
|
||||
},
|
||||
templatePreview() {
|
||||
this.$emit('templatePreview', this.thumbnailUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.testcase-template {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin: 10px 30px;
|
||||
box-shadow: 0 0 2px 0 rgba(31,31,31,0.15), 0 1px 2px 0 rgba(31,31,31,0.15);
|
||||
border: solid 2px #fff;
|
||||
box-sizing: border-box;
|
||||
border-radius: 3px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
.demonstration {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
color: gray;
|
||||
text-align: center;
|
||||
margin: 10px auto;
|
||||
white-space:nowrap;
|
||||
overflow:hidden;
|
||||
text-overflow:ellipsis;
|
||||
}
|
||||
|
||||
.template-img {
|
||||
background-size: 100% 100%;
|
||||
height: 170px;
|
||||
width: 300px;
|
||||
margin: 0 auto;
|
||||
border: solid 2px #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.template-img:hover {
|
||||
border: solid 1px #4b8fdf;
|
||||
border-radius: 3px;
|
||||
color: deepskyblue;
|
||||
cursor: pointer;
|
||||
}
|
||||
.testcase-template:hover ::v-deep .template-button{
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.template-button {
|
||||
display: none;
|
||||
text-align: center;
|
||||
position:absolute;
|
||||
bottom: 5px;
|
||||
left: 0px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
</style>
|
260
frontend/src/views/panel/templateMarket/index.vue
Normal file
260
frontend/src/views/panel/templateMarket/index.vue
Normal file
@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-row>
|
||||
<el-col span="4" style="text-align: left">
|
||||
<svg-icon
|
||||
icon-class="icon_left_outlined"
|
||||
class="topbar-icon-active"
|
||||
@click="closeDialog"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col v-if="networkStatus" span="18">
|
||||
<el-row>
|
||||
<el-col span="20">
|
||||
<el-input v-model="searchText" :placeholder="$t('panel.enter_template_name_tips')" clearable="true" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col span="20" style="margin-top: 15px">
|
||||
<el-tabs v-model="marketActiveTab" @tab-click="handleClick">
|
||||
<el-tab-pane v-for="tabItem in marketTabs" :key="tabItem" :label="tabItem" :name="tabItem" />
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="networkStatus">
|
||||
<el-row v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="text-align: center;">
|
||||
<template-market-item
|
||||
v-for="(templateItem) in currentMarketTemplateShowList"
|
||||
v-show="templateItem.showFlag"
|
||||
:key="templateItem.id"
|
||||
:template="templateItem"
|
||||
:base-url="baseUrl"
|
||||
@templateApply="templateApply"
|
||||
@templatePreview="templatePreview"
|
||||
/>
|
||||
<el-dialog
|
||||
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
|
||||
:title="$t('panel.apply_template')"
|
||||
:visible.sync="folderSelectShow"
|
||||
width="500px"
|
||||
class="dialog-css"
|
||||
append-to-body="true"
|
||||
:destroy-on-close="true"
|
||||
>
|
||||
<el-form ref="panelForm" :model="panelForm" label-width="80px">
|
||||
<el-form-item :label="$t('panel.name')">
|
||||
<el-input v-model="panelForm.name" :placeholder="$t('panel.enter_name_tips')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.folder')">
|
||||
<treeselect
|
||||
v-model="panelForm.pid"
|
||||
:clearable="false"
|
||||
:options="panelGroupList"
|
||||
:normalizer="normalizer"
|
||||
:placeholder="$t('chart.select_group')"
|
||||
:no-children-text="$t('commons.treeselect.no_children_text')"
|
||||
:no-options-text="$t('commons.treeselect.no_options_text')"
|
||||
:no-results-text="$t('commons.treeselect.no_results_text')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer dialog-footer-self">
|
||||
<el-button size="mini" @click="folderSelectShow=false">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button size="mini" type="primary" :disabled="!panelForm.name || !panelForm.pid" @click="apply">{{ $t('commons.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--预览-->
|
||||
<el-dialog top="5vh" width="80%" append-to-body="true" :visible.sync="previewVisible">
|
||||
<img width="100%" :src="templatePreviewUrl" alt="">
|
||||
</el-dialog>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<el-row v-else class="custom-position">
|
||||
{{ $t('panel.market_network_tips') }}
|
||||
</el-row>
|
||||
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { searchMarket, getCategories } from '@/api/templateMarket'
|
||||
import TemplateMarketItem from '@/views/panel/templateMarket/component/TemplateMarketItem'
|
||||
import { groupTree, panelSave } from '@/api/panel/panel'
|
||||
import bus from '@/utils/bus'
|
||||
import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
|
||||
|
||||
export default {
|
||||
name: 'TemplateMarket',
|
||||
components: { TemplateMarketItem },
|
||||
data() {
|
||||
return {
|
||||
previewVisible: false,
|
||||
templatePreviewUrl: null,
|
||||
marketTabs: null,
|
||||
marketActiveTab: null,
|
||||
searchText: null,
|
||||
panelForm: {
|
||||
name: null,
|
||||
pid: null,
|
||||
nodeType: 'panel',
|
||||
templateUrl: null,
|
||||
newFrom: 'new_market_template',
|
||||
panelType: 'self',
|
||||
panelStyle: JSON.stringify(DEFAULT_COMMON_CANVAS_STYLE_STRING),
|
||||
panelData: '[]'
|
||||
},
|
||||
panelGroupList: [],
|
||||
curApplyTemplate: null,
|
||||
folderSelectShow: false,
|
||||
baseUrl: 'https://dataease.io/templates',
|
||||
currentMarketTemplateShowList: [],
|
||||
networkStatus: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
watch: {
|
||||
marketActiveTab() {
|
||||
this.initTemplateShow()
|
||||
},
|
||||
searchText() {
|
||||
this.initTemplateShow()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initMarketTemplate()
|
||||
this.getGroupTree()
|
||||
},
|
||||
methods: {
|
||||
initMarketTemplate() {
|
||||
searchMarket({}).then(rsp => {
|
||||
this.baseUrl = rsp.data.baseUrl
|
||||
this.currentMarketTemplateShowList = rsp.data.contents
|
||||
}).catch(() => {
|
||||
this.networkStatus = false
|
||||
})
|
||||
getCategories().then(rsp => {
|
||||
this.marketTabs = rsp.data
|
||||
this.marketActiveTab = this.marketTabs[0]
|
||||
}).catch(() => {
|
||||
this.networkStatus = false
|
||||
})
|
||||
},
|
||||
getGroupTree() {
|
||||
groupTree({ nodeType: 'folder' }).then(res => {
|
||||
this.panelGroupList = res.data
|
||||
})
|
||||
},
|
||||
normalizer(node) {
|
||||
// 去掉children=null的属性
|
||||
if (node.children === null || node.children === 'null') {
|
||||
delete node.children
|
||||
}
|
||||
},
|
||||
templateApply(template) {
|
||||
this.curApplyTemplate = template
|
||||
this.panelForm.name = template.title
|
||||
this.panelForm.templateUrl = this.baseUrl + template.metas.theme_repo
|
||||
this.folderSelectShow = true
|
||||
},
|
||||
apply() {
|
||||
if (this.panelForm.name.length > 50) {
|
||||
this.$warning(this.$t('commons.char_can_not_more_50'))
|
||||
return false
|
||||
}
|
||||
|
||||
if (!this.panelForm.templateUrl) {
|
||||
this.$warning('未获取模板下载链接请联系模板市场官方')
|
||||
return false
|
||||
}
|
||||
panelSave(this.panelForm).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
this.folderSelectShow = false
|
||||
bus.$emit('newPanelFromMarket', response.data)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
closeDialog() {
|
||||
this.$emit('closeDialog')
|
||||
},
|
||||
handleClick(item) {
|
||||
|
||||
},
|
||||
initTemplateShow() {
|
||||
this.currentMarketTemplateShowList.forEach(template => {
|
||||
template.showFlag = this.templateShow(template)
|
||||
})
|
||||
},
|
||||
templateShow(templateItem) {
|
||||
let categoryMarch = false
|
||||
let searchMarch = false
|
||||
templateItem.categories.forEach(category => {
|
||||
if (category.name === this.marketActiveTab) {
|
||||
categoryMarch = true
|
||||
}
|
||||
})
|
||||
if (!this.searchText || templateItem.title.indexOf(this.searchText) > -1) {
|
||||
searchMarch = true
|
||||
}
|
||||
return categoryMarch && searchMarch
|
||||
},
|
||||
templatePreview(url) {
|
||||
this.templatePreviewUrl = url
|
||||
this.previewVisible = true
|
||||
},
|
||||
newPanel() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialog-footer-self{
|
||||
text-align: center;
|
||||
}
|
||||
.search-button-self{
|
||||
text-align: left;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.topbar-icon-active {
|
||||
cursor: pointer;
|
||||
transition: .1s;
|
||||
border-radius: 3px;
|
||||
font-size: 22px;
|
||||
background-color: rgb(245, 245, 245);
|
||||
|
||||
&:active {
|
||||
color: #000;
|
||||
border-color: #3a8ee6;
|
||||
background-color: red;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(31, 35, 41, 0.1);
|
||||
color: #3a8ee6;
|
||||
}
|
||||
}
|
||||
.custom-position {
|
||||
height: 80vh;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
flex-flow: row nowrap;
|
||||
color: #9ea6b2;
|
||||
}
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user