Merge branch 'dev' into pr@dev_memory_component

This commit is contained in:
dataeaseShu 2022-11-18 15:51:21 +08:00
commit 039c936b22
122 changed files with 7416 additions and 1278 deletions

View File

@ -1,26 +1,99 @@
package io.dataease.auth.filter;
import org.apache.shiro.web.filter.authc.AnonymousFilter;
import cn.hutool.core.util.ArrayUtil;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.LogUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.web.filter.AccessControlFilter;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import static io.dataease.commons.license.F2CLicenseResponse.Status;
public class F2CDocFilter extends AccessControlFilter {
private static final String RESULT_URI_KEY = "result_uri_key";
private static final String NOLIC_PAGE = "nolic.html";
private static final String NO_LOGIN_PAGE = "/nologin.html";
private static final String DEFAULT_FAILED_PAGE = "/";
public class F2CDocFilter extends AnonymousFilter {
@Override
protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) {
HttpServletRequest req = (HttpServletRequest) request;
String path = "/deApi";
protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object o) throws Exception {
HttpServletRequest request = (HttpServletRequest) servletRequest;
try {
req.getRequestDispatcher(path).forward(req, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
DefaultLicenseService defaultLicenseService = CommonBeanFactory.getBean(DefaultLicenseService.class);
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense();
Status status = f2CLicenseResponse.getStatus();
if (status != Status.valid) {
request.setAttribute(RESULT_URI_KEY, NOLIC_PAGE);
return false;
}
} catch (Exception e) {
request.setAttribute(RESULT_URI_KEY, NOLIC_PAGE);
LogUtil.error(e.getMessage(), e);
return false;
}
try {
Boolean isLogin = validateLogin(request);
if (!isLogin) {
request.setAttribute(RESULT_URI_KEY, NO_LOGIN_PAGE);
return false;
}
} catch (Exception e) {
request.setAttribute(RESULT_URI_KEY, NO_LOGIN_PAGE);
LogUtil.error(e.getMessage(), e);
return false;
}
return true;
}
private Boolean validateLogin(HttpServletRequest request) throws Exception{
String authorization = request.getHeader("Authorization");
if (StringUtils.isBlank(authorization)) {
Cookie[] cookies = request.getCookies();
if (ArrayUtil.isNotEmpty(cookies)) {
Cookie cookie = Arrays.stream(cookies).filter(item -> StringUtils.equals(item.getName(), "Authorization")).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(cookie) && StringUtils.isNotBlank(cookie.getValue())) {
authorization = cookie.getValue();
}
}
}
if (StringUtils.isBlank(authorization)) {
return false;
}
TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(authorization);
AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class);
SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId());
if (user == null) {
return false;
}
String password = user.getPassword();
boolean verify = JWTUtils.verify(authorization, tokenInfo, password);
return verify;
}
@Override
protected boolean onAccessDenied(ServletRequest req, ServletResponse res) throws Exception {
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
Object attribute = request.getAttribute(RESULT_URI_KEY);
String path = ObjectUtils.isNotEmpty(attribute) ? attribute.toString() : DEFAULT_FAILED_PAGE;
request.getRequestDispatcher(path).forward(request, response);
return false;
}
}

View File

@ -1,5 +1,6 @@
package io.dataease.auth.filter;
import cn.hutool.core.util.URLUtil;
import com.auth0.jwt.algorithms.Algorithm;
import io.dataease.auth.entity.ASKToken;
import io.dataease.auth.entity.JWTToken;
@ -23,8 +24,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.nio.charset.Charset;
public class JWTFilter extends BasicHttpAuthenticationFilter {
@ -158,4 +161,18 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
httpServletResponse.setHeader("authentication-status", "login_expire");
}
@Override
protected boolean onAccessDenied(ServletRequest req, ServletResponse res, Object mappedValue) throws Exception {
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
String requestURI = request.getRequestURI();
String msg = requestURI + " has been denied";
String encode = URLUtil.encode(msg, Charset.forName("UTF-8"));
Cookie cookie_error = new Cookie("onAccessDeniedMsg", encode);
cookie_error.setPath("/");
response.addCookie(cookie_error);
response.sendRedirect("/");
return false;
}
}

View File

@ -168,13 +168,14 @@ public class AuthServer implements AuthApi {
String token = ServletUtils.getToken();
Long userId = JWTUtils.tokenInfoByToken(token).getUserId();
SysUserEntity user = authUserService.getUserById(userId);
CurrentUserDto currentUserDto = BeanUtils.copyBean(new CurrentUserDto(), user);
CurrentUserDto currentUserDto = BeanUtils.copyBean(new CurrentUserDto(), user, "password");
List<CurrentRoleDto> currentRoleDtos = authUserService.roleInfos(user.getUserId());
List<String> permissions = authUserService.permissions(user.getUserId());
currentUserDto.setRoles(currentRoleDtos);
currentUserDto.setPermissions(permissions);
return currentUserDto;
}
userDto.setPassword(null);
return userDto;
}

View File

@ -11,6 +11,7 @@ import java.util.Map;
public class ShiroServiceImpl implements ShiroService {
private final static String ANON = "anon";
private final static String DOC = "doc";
@Override
public Map<String, String> loadFilterChainDefinitionMap() {
@ -20,15 +21,18 @@ public class ShiroServiceImpl implements ShiroService {
// ----------------------------------------------------------
// 放行Swagger2页面需要放行这些
filterChainDefinitionMap.put("/doc.html**", "doc");
filterChainDefinitionMap.put("/deApi**", ANON);
filterChainDefinitionMap.put("/doc.html**", DOC);
filterChainDefinitionMap.put("/deApi**", DOC);
filterChainDefinitionMap.put("/swagger-ui.html", ANON);
filterChainDefinitionMap.put("/swagger-ui/**", ANON);
filterChainDefinitionMap.put("/swagger/**", ANON);
filterChainDefinitionMap.put("/webjars/**", ANON);
filterChainDefinitionMap.put("/swagger-resources/**", ANON);
filterChainDefinitionMap.put("/v2/**", ANON);
filterChainDefinitionMap.put("/v3/**", ANON);
filterChainDefinitionMap.put("/swagger-resources/**", DOC);
filterChainDefinitionMap.put("/v2/**", DOC);
filterChainDefinitionMap.put("/v3/**", DOC);
filterChainDefinitionMap.put("/**.gif", ANON);
filterChainDefinitionMap.put("/**.png", ANON);
filterChainDefinitionMap.put("/static/**", ANON);
filterChainDefinitionMap.put("/css/**", ANON);
@ -108,6 +112,8 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/plugin/larksuite/getQrParam", ANON);
filterChainDefinitionMap.put("/cas/reset/**", ANON);
filterChainDefinitionMap.put("/cas/loginPage", ANON);
filterChainDefinitionMap.put("/pdf-template/queryAll", ANON);
filterChainDefinitionMap.put("/unauth", ANON);
filterChainDefinitionMap.put("/display/**", ANON);
@ -122,6 +128,7 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/panel/group/exportDetails", ANON);
filterChainDefinitionMap.put("/dataset/field/linkMultFieldValues", "link");
filterChainDefinitionMap.put("/dataset/field/linkMappingFieldValues", "link");
filterChainDefinitionMap.put("/systemInfo/proxyUserLoginInfo/**", ANON);
filterChainDefinitionMap.put("/**", "authc");

View File

@ -21,6 +21,7 @@ public class CronUtils {
/**
* 解析表达式获取CronTrigger
*
* @param cron
* @return
*/
@ -33,6 +34,7 @@ public class CronUtils {
/**
* 获取以指定时间为开始时间的下一次执行时间
*
* @param cron
* @param start
* @return
@ -40,7 +42,7 @@ public class CronUtils {
public static Date getNextTriggerTime(String cron, Date start) {
if (start == null) {
return getNextTriggerTime(cron);
}else{
} else {
CronTrigger trigger = getCronTrigger(cron);
return trigger.getFireTimeAfter(start);
}
@ -48,19 +50,20 @@ public class CronUtils {
/**
* 获取以当前日期为准的下一次执行时间
*
* @param cron
* @return
*/
public static Date getNextTriggerTime(String cron) {
Date date = null;
try{
try {
CronTrigger trigger = getCronTrigger(cron);
Date startDate = trigger.getStartTime();
date = trigger.getFireTimeAfter(startDate);
}catch (Exception e){
} catch (Exception e) {
}
return date;
return date;
}
public static String cron(GlobalTaskEntity taskEntity) {
@ -98,6 +101,15 @@ public class CronUtils {
return null;
}
public static String cron() {
Calendar instance = Calendar.getInstance();
instance.add(Calendar.SECOND, 5);
return instance.get(Calendar.SECOND) + " " +
instance.get(Calendar.MINUTE) + " " +
instance.get(Calendar.HOUR_OF_DAY) + " * * ?";
}
private static String getDayOfWeek(Calendar instance) {
int index = instance.get(Calendar.DAY_OF_WEEK);
index = (index % 7) + 1;

View File

@ -2,17 +2,16 @@ package io.dataease.controller;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.service.panel.PanelLinkService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@ -42,13 +41,7 @@ public class IndexController {
@GetMapping("/deApi")
public String deApi() {
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense();
switch (f2CLicenseResponse.getStatus()) {
case valid:
return "doc.html";
default:
return "nolic.html";
}
return "doc.html";
}
@GetMapping("/link/{index}")
@ -64,8 +57,8 @@ public class IndexController {
// TODO 增加仪表板外部参数
HttpServletRequest request = ServletUtils.request();
String attachParams = request.getParameter("attachParams");
if(StringUtils.isNotEmpty(attachParams)){
url = url+"&attachParams="+attachParams;
if (StringUtils.isNotEmpty(attachParams)) {
url = url + "&attachParams=" + attachParams;
}
response.sendRedirect(url);
} catch (IOException e) {

View File

@ -16,10 +16,16 @@ import io.dataease.controller.response.DatasetTableField4Type;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.DatasetTable;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.datasource.entity.Dateformat;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.provider.ProviderFactory;
import io.dataease.service.dataset.DataSetFieldService;
import io.dataease.service.dataset.DataSetTableFieldsService;
import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.dataset.PermissionService;
import io.dataease.service.datasource.DatasourceService;
import io.dataease.service.engine.EngineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
@ -46,14 +52,16 @@ import java.util.stream.Collectors;
public class DataSetTableFieldController {
@Resource
private DataSetTableFieldsService dataSetTableFieldsService;
@Autowired
private DataSetFieldService dataSetFieldService;
@Resource
private DataSetTableService dataSetTableService;
@Resource
private PermissionService permissionService;
@Resource
private EngineService engineService;
@Resource
private DatasourceService datasourceService;
@DePermission(type = DePermissionType.DATASET)
@ApiOperation("查询表下属字段")
@ -208,4 +216,14 @@ public class DataSetTableFieldController {
ArrayList::new));
return list;
}
@DePermission(type = DePermissionType.DATASET)
@ApiOperation("时间格式")
@PostMapping("dateformats/{tableId}")
public List<Dateformat> dateformats(@PathVariable String tableId) throws Exception{
DatasetTable datasetTable = dataSetTableService.get(tableId);
Datasource ds = datasetTable.getMode() == 0 ? datasourceService.get(datasetTable.getDataSourceId()) : engineService.getDeEngine();
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
return qp.dateformat();
}
}

View File

@ -5,11 +5,11 @@ import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissionProxy;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.auth.service.impl.ExtAuthServiceImpl;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.controller.request.panel.*;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.panel.*;
import io.dataease.dto.PermissionProxy;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.panel.PanelExport2App;
@ -17,10 +17,11 @@ import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.service.panel.PanelGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.pentaho.di.core.util.UUIDUtil;
import springfox.documentation.annotations.ApiIgnore;
import org.apache.shiro.authz.annotation.Logical;
import org.pentaho.di.core.util.UUIDUtil;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -62,12 +63,12 @@ public class PanelGroupController {
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANEL_LEVEL_MANAGE)
}, logical = Logical.AND)
@I18n
public PanelGroupDTO save(@RequestBody PanelGroupRequest request) throws Exception{
public PanelGroupDTO save(@RequestBody PanelGroupRequest request) throws Exception {
String panelId = panelGroupService.save(request);
PanelGroupDTO result = findOne(panelId);
// 如果新建来源来自模板市场在返回数据中加入父级ID便于跳转展开仪表板树
if(PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(request.getNewFrom())){
result.setParents(authService.parentResource(panelId,"panel"));
if (PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(request.getNewFrom())) {
result.setParents(authService.parentResource(panelId, "panel"));
result.setRequestId(UUIDUtil.getUUIDAsString());
}
return result;
@ -150,31 +151,33 @@ public class PanelGroupController {
public void updatePanelStatus(@PathVariable String panelId, @RequestBody PanelGroupBaseInfoRequest request) {
panelGroupService.updatePanelStatus(panelId, request);
}
@ApiOperation("自动缓存")
@PostMapping("/autoCache")
@DePermissions(value = {
@DePermission(type = DePermissionType.PANEL, value = "id"),
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANEL_LEVEL_MANAGE)
}, logical = Logical.AND)
public void autoCache(@RequestBody PanelGroupRequest request){
public void autoCache(@RequestBody PanelGroupRequest request) {
panelGroupService.autoCache(request);
}
@ApiOperation("查找缓存")
@GetMapping("/findUserCache/{panelId}")
public PanelGroupDTO findUserCache(@PathVariable String panelId){
public PanelGroupDTO findUserCache(@PathVariable String panelId) {
return panelGroupService.findUserPanelCache(panelId);
}
@ApiOperation("检查缓存")
@GetMapping("/checkUserCache/{panelId}")
public Boolean checkUserCache(@PathVariable String panelId){
public Boolean checkUserCache(@PathVariable String panelId) {
return panelGroupService.checkUserCache(panelId);
}
@ApiOperation("删除缓存")
@DeleteMapping("/removePanelCache/{panelId}")
public void removePanelCache(@PathVariable String panelId){
public void removePanelCache(@PathVariable String panelId) {
panelGroupService.removePanelCache(panelId);
}
@ -183,39 +186,46 @@ public class PanelGroupController {
public void viewLog(@RequestBody PanelViewLogRequest request) {
panelGroupService.viewLog(request);
}
@ApiOperation("获取仪表板中视图Element信息")
@GetMapping("/findPanelElementInfo/{viewId}")
@I18n
public Object findPanelElementInfo(@PathVariable String viewId){
return panelGroupService.findPanelElementInfo(viewId);
public Object findPanelElementInfo(@PathVariable String viewId) {
return panelGroupService.findPanelElementInfo(viewId);
}
@GetMapping("/export2AppCheck/{panelId}")
@I18n
public PanelExport2App export2AppCheck(@PathVariable String panelId){
return panelGroupService.panelExport2AppCheck(panelId);
public PanelExport2App export2AppCheck(@PathVariable String panelId) {
return panelGroupService.panelExport2AppCheck(panelId);
}
@PostMapping("/appApply")
public PanelGroupDTO appApply(@RequestBody PanelAppTemplateApplyRequest request) throws Exception{
public PanelGroupDTO appApply(@RequestBody PanelAppTemplateApplyRequest request) throws Exception {
String panelId = panelGroupService.appApply(request);
PanelGroupDTO result = findOne(panelId);
result.setParents(authService.parentResource(panelId,"panel"));
result.setParents(authService.parentResource(panelId, "panel"));
result.setRequestId(UUIDUtil.getUUIDAsString());
result.setResponseSource("appApply");
return result;
}
@PostMapping("/appEdit")
public void appEdit(@RequestBody PanelAppTemplateApplyRequest request) throws Exception{
public void appEdit(@RequestBody PanelAppTemplateApplyRequest request) throws Exception {
panelGroupService.appEdit(request);
}
@GetMapping("/findOneWithParent/{panelId}")
public PanelGroupDTO findOneWithParent(@PathVariable String panelId) throws Exception{
public PanelGroupDTO findOneWithParent(@PathVariable String panelId) throws Exception {
PanelGroupDTO result = findOne(panelId);
result.setParents(authService.parentResource(panelId,"panel"));
result.setParents(authService.parentResource(panelId, "panel"));
result.setRequestId(UUIDUtil.getUUIDAsString());
result.setResponseSource("appApply");
return result;
}
@PostMapping("/toTop/{panelId}")
public void toTop(@PathVariable String panelId) throws Exception {
panelGroupService.toTop(panelId);
}
}

View File

@ -44,4 +44,8 @@ public class ChartExtRequest {
@ApiModelProperty(hidden = true)
private PermissionProxy proxy;
private Long goPage;
private Long pageSize;
}

View File

@ -0,0 +1,30 @@
package io.dataease.controller.sys;
import io.dataease.dto.UserLoginInfoDTO;
import io.dataease.service.SystemInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.io.IOException;
@ApiIgnore
@RestController
@RequestMapping("systemInfo")
public class SystemInfoController {
@Resource
private SystemInfoService systemInfoService;
@GetMapping("userLoginInfo")
public UserLoginInfoDTO userLoginInfo() throws IOException {
return systemInfoService.getUserLoginInfo(null);
}
@GetMapping("proxyUserLoginInfo/{userId}")
public UserLoginInfoDTO proxyUserLoginInfo(@PathVariable String userId) throws IOException {
return systemInfoService.getUserLoginInfo(userId);
}
}

View File

@ -58,7 +58,7 @@ public class SystemParameterController {
@GetMapping("/requestTimeOut")
public Integer RequestTimeOut() {
BasicInfo basicInfo = systemParameterService.basicInfo();
return StringUtils.isNotBlank(basicInfo.getFrontTimeOut()) ? Integer.parseInt(basicInfo.getFrontTimeOut()) : 10;
return StringUtils.isNotBlank(basicInfo.getFrontTimeOut()) ? Integer.parseInt(basicInfo.getFrontTimeOut()) : 100;
}
@RequiresPermissions("sysparam:read")

View File

@ -0,0 +1,25 @@
package io.dataease.dto;
import io.dataease.auth.api.dto.CurrentUserDto;
import lombok.Data;
/**
* Author: wangjiahao
* Date: 2022/11/10
* Description:
*/
@Data
public class UserLoginInfoDTO {
private CurrentUserDto userInfo;
private String ip;
public UserLoginInfoDTO() {
}
public UserLoginInfoDTO(CurrentUserDto userInfo, String ip) {
this.userInfo = userInfo;
this.ip = ip;
}
}

View File

@ -18,12 +18,13 @@ public class VAuthModelDTO extends VAuthModelWithBLOBs implements ITreeBase<VAut
private List<VAuthModelDTO> children;
private long allLeafs = 0l;
private long allLeafs = 0L;
private String innerId;
private Boolean isPlugin = false;
@Override
public String toString(){
return this.getName();
}

View File

@ -41,4 +41,8 @@ public class ChartViewDTO extends ChartViewWithBLOBs {
private String yAxis;
@SerializedName("yaxisExt")
private String yAxisExt;
private long totalPage;
private long totalItems;
private int datasetMode;
}

View File

@ -2,9 +2,11 @@ package io.dataease.dto.panel;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.plugins.common.base.domain.PanelGroupWithBLOBs;
import io.dataease.plugins.common.base.domain.PanelWatermark;
import io.dataease.plugins.common.model.ITreeBase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@ -43,4 +45,7 @@ public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase<Pane
private String requestId;
@ApiModelProperty("数据返回来源")
private String responseSource;
@ApiModelProperty("水印信息")
private PanelWatermark watermarkInfo;
}

View File

@ -16,16 +16,19 @@
<select id="findOneWithPrivileges" resultMap="BaseResultMapDTO">
select panel_group.*,
panel_group.name as label,
panel_group.name as label,
(select nick_name from sys_user where username = panel_group.create_by) as creator_name,
(select nick_name from sys_user where username = panel_group.update_by) as update_name,
get_auths(panel_group.id, 'panel', #{userId}) as `privileges`
get_auths(panel_group.id, 'panel', #{userId}) as `privileges`
from panel_group
where id = #{panelId}
</select>
<select id="panelGroupInit" resultMap="BaseResultMapDTO">
select id, name,panel_data from panel_group where node_type = 'panel' and panel_type ='self'
select id, name, panel_data
from panel_group
where node_type = 'panel'
and panel_type = 'self'
</select>
<select id="panelGroupListDefault" resultMap="BaseResultMapDTO">
@ -49,34 +52,34 @@
LEFT JOIN panel_group sourcePanelGroup
on sourcePanelGroup.id=panel_group.source
left join (
SELECT
auth_source,
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
FROM
(
`sys_auth`
LEFT JOIN `sys_auth_detail` ON ((
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
)))
WHERE
sys_auth_detail.privilege_value = 1
AND sys_auth.auth_source_type = 'panel'
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = #{userId}
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
)
)
GROUP BY
`sys_auth`.`auth_source`
SELECT
auth_source,
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
FROM
(
`sys_auth`
LEFT JOIN `sys_auth_detail` ON ((
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
)))
WHERE
sys_auth_detail.privilege_value = 1
AND sys_auth.auth_source_type = 'panel'
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = #{userId}
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
)
)
GROUP BY
`sys_auth`.`auth_source`
) authInfo
on panel_group.id = authInfo.auth_source
<where>
@ -100,7 +103,7 @@
and panel_group.level = #{level}
</if>
</where>
ORDER BY CONVERT(panel_group.name using gbk)
ORDER BY panel_group.panel_sort desc, CONVERT(panel_group.name using gbk)
</select>
<select id="panelGroupList" resultMap="BaseResultMapDTO">
@ -125,34 +128,34 @@
LEFT JOIN panel_group defaultPanelGroup
on defaultPanelGroup.source=panel_group.id and defaultPanelGroup.source is not null
left join (
SELECT
auth_source,
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
FROM
(
`sys_auth`
LEFT JOIN `sys_auth_detail` ON ((
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
)))
WHERE
sys_auth_detail.privilege_value = 1
AND sys_auth.auth_source_type = 'panel'
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = #{userId}
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
)
)
GROUP BY
`sys_auth`.`auth_source`
SELECT
auth_source,
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
FROM
(
`sys_auth`
LEFT JOIN `sys_auth_detail` ON ((
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
)))
WHERE
sys_auth_detail.privilege_value = 1
AND sys_auth.auth_source_type = 'panel'
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = #{userId}
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
)
)
GROUP BY
`sys_auth`.`auth_source`
) authInfo
on panel_group.id = authInfo.auth_source
<where>
@ -176,42 +179,47 @@
and panel_group.level = #{level}
</if>
</where>
ORDER BY panel_group.node_type desc, CONVERT(panel_group.name using gbk)
ORDER BY panel_group.node_type desc, CONVERT(panel_group.name using gbk)
</select>
<delete id="deleteCircle">
delete from panel_group where FIND_IN_SET(panel_group.id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid})) or FIND_IN_SET(panel_group.source,GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
delete
from panel_group
where FIND_IN_SET(panel_group.id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
or FIND_IN_SET(panel_group.source, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
</delete>
<delete id="deleteCircleView">
delete from chart_view where FIND_IN_SET(chart_view.scene_id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
delete
from chart_view
where FIND_IN_SET(chart_view.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
</delete>
<delete id="deleteCircleViewCache">
delete from chart_view_cache where FIND_IN_SET(chart_view_cache.scene_id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
delete
from chart_view_cache
where FIND_IN_SET(chart_view_cache.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
</delete>
<insert id="copyPanelView">
INSERT INTO panel_view ( id, panel_id, chart_view_id ) SELECT
uuid(),
#{panelId},
chart_view_id
FROM
panel_view
WHERE
panel_id = #{panelId}
INSERT INTO panel_view (id, panel_id, chart_view_id)
SELECT uuid(),
#{panelId},
chart_view_id
FROM panel_view
WHERE panel_id = #{panelId}
</insert>
<delete id="removeUselessViews">
DELETE
FROM
chart_view
chart_view
WHERE
chart_view.chart_type = 'private'
AND chart_view.scene_id = #{panelId}
chart_view.chart_type = 'private'
AND chart_view.scene_id = #{panelId}
<if test="viewIds != null and viewIds.size>0">
AND id NOT IN
<foreach collection="viewIds" item="viewId" open="(" separator="," close=")" >
<foreach collection="viewIds" item="viewId" open="(" separator="," close=")">
#{viewId}
</foreach>
</if>

View File

@ -1,6 +1,8 @@
package io.dataease.job.sechedule;
import com.fit2cloud.quartz.anno.QuartzScheduled;
import io.dataease.commons.utils.LogUtil;
import io.dataease.service.CleaningRebotService;
import io.dataease.service.datasource.DatasourceService;
import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.kettle.KettleService;
@ -17,6 +19,9 @@ public class Schedular {
@Resource
private KettleService kettleService;
@Resource
private CleaningRebotService cleaningRebotService;
@QuartzScheduled(cron = "0 0/3 * * * ?")
public void updateDatasetTableStatus() {
dataSetTableService.updateDatasetTableStatus();
@ -32,4 +37,10 @@ public class Schedular {
kettleService.updateKettleStatus();
}
@QuartzScheduled(cron = "0 0 0 ? * *")
public void cheanDisusedData() {
LogUtil.info("start execute clean task...");
cleaningRebotService.execute();
}
}

View File

@ -12,6 +12,8 @@ import java.util.Date;
public abstract class TaskHandler implements InitializingBean {
protected static final String IS_TEMP_TASK = "isTempTask";
public void addTask(ScheduleManager scheduleManager, GlobalTaskEntity taskEntity) throws Exception {
// 1首先看看是否过期
Long endTime = taskEntity.getEndTime();
@ -24,21 +26,31 @@ public abstract class TaskHandler implements InitializingBean {
Date start = new Date(taskEntity.getStartTime());
Date end = null;
if (ObjectUtils.isNotEmpty(taskEntity.getEndTime())) {
new Date(taskEntity.getEndTime());
end = new Date(taskEntity.getEndTime());
}
Class<? extends TaskHandler> executor = this.getClass();
String cron = CronUtils.cron(taskEntity);
scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, executor, cron, start, end, jobDataMap(taskEntity));
}
public void addTempTask(ScheduleManager scheduleManager, GlobalTaskEntity taskEntity) throws Exception {
removeTask(scheduleManager, taskEntity);
JobKey jobKey = new JobKey(taskEntity.getTaskId().toString());
TriggerKey triggerKey = new TriggerKey(taskEntity.getTaskId().toString());
Date start = new Date(taskEntity.getStartTime());
Class<? extends TaskHandler> executor = this.getClass();
String cron = CronUtils.cron();
JobDataMap jobDataMap = jobDataMap(taskEntity);
jobDataMap.put(IS_TEMP_TASK, true);
scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, executor, cron, start, null, jobDataMap);
}
protected abstract JobDataMap jobDataMap(GlobalTaskEntity taskEntity);
public abstract void resetRunningInstance(Long taskId);
public void removeTask(ScheduleManager scheduleManager, GlobalTaskEntity taskEntity) {
JobKey jobKey = new JobKey(taskEntity.getTaskId().toString());
TriggerKey triggerKey = new TriggerKey(taskEntity.getTaskId().toString());
@ -51,7 +63,6 @@ public abstract class TaskHandler implements InitializingBean {
}
protected abstract Boolean taskIsRunning(Long taskId);
@Override

View File

@ -92,13 +92,14 @@ public class EmailTaskHandler extends TaskHandler implements Job {
return;
JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
Boolean isTempTask = (Boolean) jobDataMap.getOrDefault(IS_TEMP_TASK, false);
GlobalTaskEntity taskEntity = (GlobalTaskEntity) jobDataMap.get("taskEntity");
ScheduleManager scheduleManager = SpringContextUtil.getBean(ScheduleManager.class);
if (CronUtils.taskExpire(taskEntity.getEndTime())) {
if (!isTempTask && CronUtils.taskExpire(taskEntity.getEndTime())) {
removeTask(scheduleManager, taskEntity);
return;
}
if (taskIsRunning(taskEntity.getTaskId())) {
if (!isTempTask && taskIsRunning(taskEntity.getTaskId())) {
LogUtil.info("Skip synchronization task: {} ,due to task status is {}",
taskEntity.getTaskId(), "running");
return;
@ -111,7 +112,10 @@ public class EmailTaskHandler extends TaskHandler implements Job {
XpackEmailTemplateDTO emailTemplate = (XpackEmailTemplateDTO) jobDataMap.get("emailTemplate");
SysUserEntity creator = (SysUserEntity) jobDataMap.get("creator");
LogUtil.info("start execute send panel report task...");
proxy(taskEntity.getTaskType()).sendReport(taskInstance, emailTemplate, creator);
proxy(taskEntity.getTaskType()).sendReport(taskInstance, emailTemplate, creator, isTempTask);
if (isTempTask) {
removeTask(scheduleManager, taskEntity);
}
}
@ -156,7 +160,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
}
@Async("priorityExecutor")
public void sendReport(GlobalTaskInstance taskInstance, XpackEmailTemplateDTO emailTemplateDTO, SysUserEntity user) {
public void sendReport(GlobalTaskInstance taskInstance, XpackEmailTemplateDTO emailTemplateDTO, SysUserEntity user, Boolean isTempTask) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
AuthUserServiceImpl userService = SpringContextUtil.getBean(AuthUserServiceImpl.class);
@ -164,7 +168,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
List<File> files = null;
try {
XpackEmailTaskRequest taskForm = emailXpackService.taskForm(taskInstance.getTaskId());
if (ObjectUtils.isEmpty(taskForm) || CronUtils.taskExpire(taskForm.getEndTime())) {
if (ObjectUtils.isEmpty(taskForm) || (!isTempTask && CronUtils.taskExpire(taskForm.getEndTime()))) {
removeInstance(taskInstance);
return;
}

View File

@ -16,9 +16,8 @@ import javax.annotation.Resource;
public class EmailTaskViewHandler extends EmailTaskHandler {
@Async("priorityExecutor")
public void sendReport(GlobalTaskInstance taskInstance, XpackEmailTemplateDTO emailTemplateDTO, SysUserEntity user) {
super.sendReport(taskInstance, emailTemplateDTO, user);
public void sendReport(GlobalTaskInstance taskInstance, XpackEmailTemplateDTO emailTemplateDTO, SysUserEntity user, Boolean isTempTask) {
super.sendReport(taskInstance, emailTemplateDTO, user, isTempTask);
}
}

View File

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.IOException;
@ -40,20 +41,20 @@ public class PluginCommonServer {
BufferedInputStream bis = null;
InputStream inputStream = null;
OutputStream os = null; //输出流
try{
try {
inputStream = service.vueResource(jsName);
byte[] buffer = new byte[1024];
os = response.getOutputStream();
bis = new BufferedInputStream(inputStream);
int i = bis.read(buffer);
while(i != -1){
while (i != -1) {
os.write(buffer, 0, i);
i = bis.read(buffer);
}
os.flush();
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}finally {
} finally {
try {
bis.close();
inputStream.close();
@ -69,28 +70,28 @@ public class PluginCommonServer {
@GetMapping("/component/{componentName}")
public void componentInfo(@PathVariable String componentName) {
Map<String, PluginComponentService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(PluginComponentService.class);
beansOfType.values().stream().forEach(service -> {
Map<String, PluginComponentService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(PluginComponentService.class);
beansOfType.values().stream().forEach(service -> {
List<String> components = service.components();
if (components.contains(componentName)) {
HttpServletResponse response = ServletUtils.response();
BufferedInputStream bis = null;
InputStream inputStream = null;
OutputStream os = null; //输出流
try{
try {
inputStream = service.vueResource(componentName);
byte[] buffer = new byte[1024];
os = response.getOutputStream();
bis = new BufferedInputStream(inputStream);
int i = bis.read(buffer);
while(i != -1){
while (i != -1) {
os.write(buffer, 0, i);
i = bis.read(buffer);
}
os.flush();
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}finally {
} finally {
try {
bis.close();
inputStream.close();
@ -101,7 +102,7 @@ public class PluginCommonServer {
}
return;
}
});
});
}
@GetMapping("/staticInfo/{name}/{suffix}")
@ -115,22 +116,24 @@ public class PluginCommonServer {
BufferedInputStream bis = null;
InputStream inputStream = null;
OutputStream os = null; //输出流
try{
try {
inputStream = service.vueResource(name, suffix);
byte[] buffer = new byte[1024];
os = response.getOutputStream();
bis = new BufferedInputStream(inputStream);
int i = bis.read(buffer);
while(i != -1){
while (i != -1) {
os.write(buffer, 0, i);
i = bis.read(buffer);
}
if (suffix.indexOf("svg") != -1)
response.setContentType("image/svg+xml");
if (suffix.indexOf("png") != -1)
response.setContentType("image/png");
os.flush();
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}finally {
} finally {
try {
bis.close();
inputStream.close();

View File

@ -56,7 +56,7 @@ public class XEmailTaskServer {
@RequiresPermissions("task-email:read")
@PostMapping("/queryTasks/{goPage}/{pageSize}")
public Pager<List<XpackTaskGridDTO>> queryTask(@PathVariable int goPage, @PathVariable int pageSize,
@RequestBody XpackGridRequest request) {
@RequestBody XpackGridRequest request) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
CurrentUserDto user = AuthUtils.getUser();
@ -76,17 +76,17 @@ public class XEmailTaskServer {
tasks.forEach(item -> {
if (CronUtils.taskExpire(item.getEndTime())) {
item.setNextExecTime(null);
}else {
} else {
GlobalTaskEntity globalTaskEntity = new GlobalTaskEntity();
globalTaskEntity.setRateType(item.getRateType());
globalTaskEntity.setRateVal(item.getRateVal());
try{
try {
String cron = CronUtils.cron(globalTaskEntity);
if (StringUtils.isNotBlank(cron)) {
Long nextTime = CronUtils.getNextTriggerTime(cron).getTime();
item.setNextExecTime(nextTime);
}
}catch (Exception e) {
} catch (Exception e) {
item.setNextExecTime(null);
}
}
@ -98,6 +98,20 @@ public class XEmailTaskServer {
return listPager;
}
@RequiresPermissions("task-email:edit")
@PostMapping("/fireNow/{taskId}")
public void fireNow(@PathVariable("taskId") Long taskId) throws Exception {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
XpackEmailTaskRequest request = emailXpackService.taskForm(taskId);
GlobalTaskEntity globalTaskEntity = BeanUtils.copyBean(new GlobalTaskEntity(), request);
if (CronUtils.taskExpire(globalTaskEntity.getEndTime())) {
globalTaskEntity.setEndTime(null);
scheduleService.addTempSchedule(globalTaskEntity);
return;
}
scheduleService.fireNow(globalTaskEntity);
}
@RequiresPermissions("task-email:add")
@PostMapping("/save")
public void save(@RequestBody XpackEmailCreate param) throws Exception {
@ -210,7 +224,7 @@ public class XEmailTaskServer {
@PostMapping("/queryInstancies/{goPage}/{pageSize}")
public Pager<List<XpackTaskInstanceDTO>> instancesGrid(@PathVariable int goPage, @PathVariable int pageSize,
@RequestBody XpackGridRequest request) {
@RequestBody XpackGridRequest request) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
List<XpackTaskInstanceDTO> instances = emailXpackService.taskInstanceGrid(request);
@ -227,7 +241,7 @@ public class XEmailTaskServer {
@RequiresPermissions("task-email:read")
@PostMapping("/export")
public void export(@RequestBody XpackGridRequest request) throws Exception{
public void export(@RequestBody XpackGridRequest request) throws Exception {
Pager<List<XpackTaskInstanceDTO>> listPager = instancesGrid(0, 0, request);
List<XpackTaskInstanceDTO> instanceDTOS = listPager.getListObject();
ExcelSheetModel excelSheetModel = excelSheetModel(instanceDTOS);
@ -257,7 +271,7 @@ public class XEmailTaskServer {
inputStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}finally {
} finally {
if (file.exists())
FileUtil.del(file);
}
@ -267,7 +281,7 @@ public class XEmailTaskServer {
private ExcelSheetModel excelSheetModel(List<XpackTaskInstanceDTO> instanceDTOS) {
ExcelSheetModel excelSheetModel = new ExcelSheetModel();
excelSheetModel.setSheetName(Translator.get("I18N_XPACKTASK_FILE_NAME"));
String[] headArr = new String[] {Translator.get("I18N_XPACKTASK_NAME"), Translator.get("I18N_XPACKTASK_EXEC_TIME"), Translator.get("I18N_XPACKTASK_STATUS")};
String[] headArr = new String[]{Translator.get("I18N_XPACKTASK_NAME"), Translator.get("I18N_XPACKTASK_EXEC_TIME"), Translator.get("I18N_XPACKTASK_STATUS")};
List<String> head = Arrays.asList(headArr);
excelSheetModel.setHeads(head);
List<List<String>> data = instanceDTOS.stream().map(this::formatExcelData).collect(Collectors.toList());

View File

@ -0,0 +1,33 @@
package io.dataease.plugins.server;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.watermark.WatermarkService;
import io.dataease.plugins.xpack.watermark.dto.PanelWatermarkDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
/**
* Author: wangjiahao
* Date: 2022/11/11
* Description:
*/
@ApiIgnore
@RequestMapping("/plugin/watermark")
@RestController
public class XWatermarkServer {
@ApiOperation("查询水印配置")
@GetMapping("/find")
public PanelWatermarkDTO find() {
WatermarkService userXpackService = SpringContextUtil.getBean(WatermarkService.class);
return userXpackService.getWatermarkInfo();
}
@ApiOperation("保存水印配置")
@PostMapping("/save")
public void save(@RequestBody PanelWatermarkDTO panelWatermark) {
WatermarkService userXpackService = SpringContextUtil.getBean(WatermarkService.class);
userXpackService.saveWatermarkInfo(panelWatermark);
}
}

View File

@ -1,5 +1,6 @@
package io.dataease.provider.engine.doris;
import com.alibaba.fastjson.JSONArray;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
@ -16,6 +17,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.Dateformat;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -1311,4 +1313,15 @@ public class DorisQueryProvider extends QueryProvider {
return sql;
}
}
public List<Dateformat> dateformat() {
return JSONArray.parseArray("[\n" +
"{\"dateformat\": \"%Y-%m-%d\"},\n" +
"{\"dateformat\": \"%Y/%m/%d\"},\n" +
"{\"dateformat\": \"%Y%m%d\"},\n" +
"{\"dateformat\": \"%Y-%m-%d %H:%i:%S\"},\n" +
"{\"dateformat\": \"%Y/%m/%d %H:%i:%S\"},\n" +
"{\"dateformat\": \"%Y%m%d %H:%i:%S\"}\n" +
"]", Dateformat.class);
}
}

View File

@ -1,5 +1,6 @@
package io.dataease.provider.engine.mysql;
import com.alibaba.fastjson.JSONArray;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
@ -16,6 +17,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.Dateformat;
import io.dataease.plugins.datasource.query.QueryProvider;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@ -1312,4 +1314,15 @@ public class MysqlQueryProvider extends QueryProvider {
return sql;
}
}
public List<Dateformat> dateformat() {
return JSONArray.parseArray("[\n" +
"{\"dateformat\": \"%Y-%m-%d\"},\n" +
"{\"dateformat\": \"%Y/%m/%d\"},\n" +
"{\"dateformat\": \"%Y%m%d\"},\n" +
"{\"dateformat\": \"%Y-%m-%d %H:%i:%S\"},\n" +
"{\"dateformat\": \"%Y/%m/%d %H:%i:%S\"},\n" +
"{\"dateformat\": \"%Y%m%d %H:%i:%S\"}\n" +
"]", Dateformat.class);
}
}

View File

@ -17,6 +17,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -393,8 +394,22 @@ public class CKQueryProvider extends QueryProvider {
return sqlLimit(st.render(), view);
}
@Override
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(CKConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
@ -466,7 +481,7 @@ public class CKQueryProvider extends QueryProvider {
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return sqlLimit(st.render(), view);
return st.render();
}
@Override
@ -1072,10 +1087,14 @@ public class CKQueryProvider extends QueryProvider {
if (ObjectUtils.isNotEmpty(datasetTableField) && datasetTableField.getDeType() == DeTypeConstants.DE_TIME && StringUtils.equalsIgnoreCase(request.getOperator(), "between")) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
request.setOperator("ge");
request.setValue(new ArrayList<String>(){{add(String.format(toDateTime64, "'" + simpleDateFormat.format(new Date(Long.parseLong(requestValue.get(0)))) + "'"));}});
request.setValue(new ArrayList<String>() {{
add(String.format(toDateTime64, "'" + simpleDateFormat.format(new Date(Long.parseLong(requestValue.get(0)))) + "'"));
}});
ChartExtFilterRequest requestCopy = BeanUtils.copyBean(new ChartExtFilterRequest(), request);
requestCopy.setOperator("le");
requestCopy.setValue(new ArrayList<String>(){{add(String.format(toDateTime64, "'" + simpleDateFormat.format(new Date(Long.parseLong(requestValue.get(1)))) + "'"));}});
requestCopy.setValue(new ArrayList<String>() {{
add(String.format(toDateTime64, "'" + simpleDateFormat.format(new Date(Long.parseLong(requestValue.get(1)))) + "'"));
}});
atomicReference.set(requestCopy);
}
});

View File

@ -19,6 +19,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -376,8 +377,7 @@ public class Db2QueryProvider extends QueryProvider {
return sqlLimit(st.render(), view);
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(Db2Constants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
@ -451,7 +451,22 @@ public class Db2QueryProvider extends QueryProvider {
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return sqlLimit(st.render(), view);
return st.render();
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
@Override
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}
@Override

View File

@ -16,6 +16,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -346,7 +347,15 @@ public class HiveQueryProvider extends QueryProvider {
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + " , " + pageInfo.getPageSize(): "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(HiveConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
@ -418,7 +427,11 @@ public class HiveQueryProvider extends QueryProvider {
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return sqlLimit(st.render(), view);
return st.render();
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
@Override

View File

@ -16,6 +16,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -343,7 +344,16 @@ public class ImpalaQueryProvider extends QueryProvider {
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + pageInfo.getPageSize() + " offset " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(ImpalaConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
@ -415,7 +425,11 @@ public class ImpalaQueryProvider extends QueryProvider {
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return sqlLimit(st.render(), view);
return st.render();
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
@Override

View File

@ -16,6 +16,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -311,7 +312,16 @@ public class MongoQueryProvider extends QueryProvider {
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + " , " + pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MongoConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
@ -385,7 +395,12 @@ public class MongoQueryProvider extends QueryProvider {
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return sqlLimit(st.render(), view);
return st.render();
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
@Override

View File

@ -1,5 +1,6 @@
package io.dataease.provider.query.mysql;
import com.alibaba.fastjson.JSONArray;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
@ -17,6 +18,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.Dateformat;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -1318,4 +1320,15 @@ public class MysqlQueryProvider extends QueryProvider {
public String sqlForPreview(String table, Datasource ds) {
return "SELECT * FROM " + String.format(MySQLConstants.KEYWORD_TABLE, table);
}
public List<Dateformat> dateformat() {
return JSONArray.parseArray("[\n" +
"{\"dateformat\": \"%Y-%m-%d\"},\n" +
"{\"dateformat\": \"%Y/%m/%d\"},\n" +
"{\"dateformat\": \"%Y%m%d\"},\n" +
"{\"dateformat\": \"%Y-%m-%d %H:%i:%S\"},\n" +
"{\"dateformat\": \"%Y/%m/%d %H:%i:%S\"},\n" +
"{\"dateformat\": \"%Y%m%d %H:%i:%S\"}\n" +
"]", Dateformat.class);
}
}

View File

@ -19,6 +19,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -402,7 +403,42 @@ public class OracleQueryProvider extends QueryProvider {
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> orgXAxis, List<ChartFieldCustomFilterDTO> OrgFeldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
List<ChartViewFieldDTO> xAxis = new ArrayList<>();
orgXAxis.forEach(chartViewFieldDTO -> {
xAxis.add(chartViewFieldDTO);
});
ChartViewFieldDTO chartViewFieldDTO = new ChartViewFieldDTO();
chartViewFieldDTO.setOriginName("ROWNUM");
xAxis.add(chartViewFieldDTO);
List<ChartFieldCustomFilterDTO> fieldCustomFilter = new ArrayList<>();
for (ChartFieldCustomFilterDTO chartFieldCustomFilterDTO : OrgFeldCustomFilter) {
fieldCustomFilter.add(chartFieldCustomFilterDTO);
}
ChartFieldCustomFilterDTO chartFieldCustomFilterDTO = new ChartFieldCustomFilterDTO();
DatasetTableField datasetTableField = new DatasetTableField();
datasetTableField.setOriginName("ROWNUM");
datasetTableField.setDeType(0);
chartFieldCustomFilterDTO.setField(datasetTableField);
List<ChartCustomFilterItemDTO> filterItemDTOS = new ArrayList<>();
ChartCustomFilterItemDTO itemDTO = new ChartCustomFilterItemDTO();
itemDTO.setTerm("le");
itemDTO.setValue(String.valueOf(pageInfo.getGoPage() * pageInfo.getPageSize()));
filterItemDTOS.add(itemDTO);
chartFieldCustomFilterDTO.setFilter(filterItemDTOS);
fieldCustomFilter.add(chartFieldCustomFilterDTO);
if (isTable) {
return "SELECT * FROM (" + sqlFix(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view)) + ") DE_RESULT_TMP " + " WHERE DE_ROWNUM >= " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize();
} else {
return "SELECT * FROM (" + sqlFix(originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view)) + ") DE_RESULT_TMP " + " WHERE DE_ROWNUM >= " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize();
}
}
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(OracleConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(OracleConstants.ALIAS_FIX, String.format(TABLE_ALIAS_PREFIX, 0)))
@ -413,6 +449,13 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xAxis)) {
for (int i = 0; i < xAxis.size(); i++) {
ChartViewFieldDTO x = xAxis.get(i);
if (x.getOriginName().equalsIgnoreCase("ROWNUM")) {
xFields.add(SQLObj.builder()
.fieldName(x.getOriginName())
.fieldAlias("DE_ROWNUM")
.build());
continue;
}
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
@ -474,7 +517,12 @@ public class OracleQueryProvider extends QueryProvider {
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return sqlLimit(st.render(), view);
return st.render();
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
@Override
@ -974,6 +1022,8 @@ public class OracleQueryProvider extends QueryProvider {
originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} else if (field.getOriginName().equalsIgnoreCase("ROWNUM")) {
originName = field.getOriginName();
} else {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
}

View File

@ -19,6 +19,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -144,7 +145,7 @@ public class PgQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -218,7 +219,7 @@ public class PgQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -373,7 +374,16 @@ public class PgQueryProvider extends QueryProvider {
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + pageInfo.getPageSize() + " offset " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
@ -448,6 +458,11 @@ public class PgQueryProvider extends QueryProvider {
return sqlLimit(st.render(), view);
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
@Override
public String getSQLAsTmpTableInfo(String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return getSQLTableInfo("(" + sqlFix(sql) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view);
@ -823,7 +838,7 @@ public class PgQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
@ -1281,7 +1296,7 @@ public class PgQueryProvider extends QueryProvider {
}
@Override
public String sqlForPreview(String table, Datasource ds){
public String sqlForPreview(String table, Datasource ds) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
schema = String.format(PgConstants.KEYWORD_TABLE, schema);
return "SELECT * FROM " + schema + "." + String.format(PgConstants.KEYWORD_TABLE, table);

View File

@ -17,6 +17,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
import org.apache.commons.collections4.CollectionUtils;
@ -150,7 +151,7 @@ public class RedshiftQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -225,7 +226,7 @@ public class RedshiftQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -385,14 +386,99 @@ public class RedshiftQueryProvider extends QueryProvider {
return getSQL("(" + sqlFix(sql) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, null, view);
}
@Override
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + pageInfo.getPageSize() + " offset " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}
@Override
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return null;
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
}
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(RedshiftConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build();
List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>();
if (CollectionUtils.isNotEmpty(xAxis)) {
for (int i = 0; i < xAxis.size(); i++) {
ChartViewFieldDTO x = xAxis.get(i);
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format(RedshiftConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else {
if (x.getDeType() == 2 || x.getDeType() == 3) {
originField = String.format(RedshiftConstants.CAST, String.format(RedshiftConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()), RedshiftConstants.DEFAULT_FLOAT_FORMAT);
} else {
originField = String.format(RedshiftConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
}
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && Utils.joinSort(x.getSort())) {
xOrders.add(SQLObj.builder()
.orderField(originField)
.orderAlias(fieldAlias)
.orderDirection(x.getSort())
.build());
}
}
}
// 处理视图中字段过滤
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
List<SQLObj> orders = new ArrayList<>();
orders.addAll(xOrders);
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
ST st_sql = stg.getInstanceOf("previewSql");
st_sql.add("isGroup", false);
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String sql = st_sql.render();
ST st = stg.getInstanceOf("previewSql");
st.add("isGroup", false);
SQLObj tableSQL = SQLObj.builder()
.tableName(String.format(RedshiftConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build();
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return st.render();
}
@Override
public String getSQLAsTmpTableInfo(String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return null;
return getSQLTableInfo("(" + sqlFix(sql) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, null, view);
}
@Override
@ -759,7 +845,7 @@ public class RedshiftQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");
@ -1195,7 +1281,7 @@ public class RedshiftQueryProvider extends QueryProvider {
}
@Override
public String sqlForPreview(String table, Datasource ds){
public String sqlForPreview(String table, Datasource ds) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
schema = String.format(PgConstants.KEYWORD_TABLE, schema);
return "SELECT * FROM " + schema + "." + String.format(PgConstants.KEYWORD_TABLE, table);

View File

@ -1,5 +1,7 @@
package io.dataease.provider.query.sqlserver;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -17,6 +19,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.datasource.entity.Dateformat;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.datasource.query.Utils;
@ -1331,4 +1334,13 @@ public class SqlserverQueryProvider extends QueryProvider {
schema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema);
return "SELECT * FROM " + schema + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table);
}
public List<Dateformat> dateformat() {
return JSONArray.parseArray("[\n" +
"{\"dateformat\": \"102\", \"desc\": \"yyyy.mm.dd\"},\n" +
"{\"dateformat\": \"23\", \"desc\": \"yyyy-mm-dd\"},\n" +
"{\"dateformat\": \"111\", \"desc\": \"yyyy/mm/dd\"},\n" +
"{\"dateformat\": \"120\", \"desc\": \"yyyy-mm-dd hh:mi:ss\"}\n" +
"]", Dateformat.class);
}
}

View File

@ -1,6 +1,7 @@
package io.dataease.service;
import io.dataease.ext.CleaningRebotMapper;
import io.dataease.service.message.SysMsgService;
import io.dataease.service.sys.log.LogService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -20,6 +21,9 @@ public class CleaningRebotService {
@Resource
private LogService logService;
@Resource
private SysMsgService sysMsgService;
public void execute() {
int floatDept = 0;
do {
@ -38,5 +42,6 @@ public class CleaningRebotService {
cleaningRebotMapper.delFloatingCreatorLinkMapping();
}
logService.cleanDisusedLog();
sysMsgService.cleanDisusedMsg();
}
}

View File

@ -68,6 +68,11 @@ public class ScheduleService {
taskHandler.addTask(scheduleManager, task);
}
public void addTempSchedule(GlobalTaskEntity task) throws Exception {
TaskHandler taskHandler = TaskStrategyFactory.getInvokeStrategy(task.getTaskType());
taskHandler.addTempTask(scheduleManager, task);
}
public void deleteSchedule(GlobalTaskEntity task) {
TaskHandler taskHandler = TaskStrategyFactory.getInvokeStrategy(task.getTaskType());
taskHandler.removeTask(scheduleManager, task);

View File

@ -0,0 +1,31 @@
package io.dataease.service;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.IPUtils;
import io.dataease.dto.UserLoginInfoDTO;
import io.dataease.plugins.common.base.domain.SysUser;
import io.dataease.plugins.common.base.mapper.SysUserMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class SystemInfoService {
@Resource
private SysUserMapper sysUserMapper;
public UserLoginInfoDTO getUserLoginInfo(String userId) {
if (StringUtils.isNotEmpty(userId)) {
SysUser userInfo = sysUserMapper.selectByPrimaryKey(Long.parseLong(userId));
CurrentUserDto userDto = new CurrentUserDto();
BeanUtils.copyBean(userDto, userInfo);
return new UserLoginInfoDTO(userDto, IPUtils.get());
}
return new UserLoginInfoDTO(AuthUtils.getUser(), IPUtils.get());
}
}

View File

@ -45,13 +45,10 @@ public class VAuthModelService {
return result;
}
if (request.getPrivileges() != null) {
result = result.stream().filter(vAuthModelDTO -> {
if (vAuthModelDTO.getNodeType().equalsIgnoreCase("spine") || (vAuthModelDTO.getNodeType().equalsIgnoreCase("leaf") && vAuthModelDTO.getPrivileges() != null && vAuthModelDTO.getPrivileges().contains(request.getPrivileges()))) {
return true;
} else {
return false;
}
}).collect(Collectors.toList());
result = result.stream().filter(vAuthModelDTO -> "spine".equalsIgnoreCase(vAuthModelDTO.getNodeType())
|| ("leaf".equalsIgnoreCase(vAuthModelDTO.getNodeType())
&& vAuthModelDTO.getPrivileges() != null
&& vAuthModelDTO.getPrivileges().contains(request.getPrivileges()))).collect(Collectors.toList());
}
return result;
}
@ -60,10 +57,10 @@ public class VAuthModelService {
if (CollectionUtils.isEmpty(result)) {
return;
}
Iterator iterator = result.listIterator();
Iterator<VAuthModelDTO> iterator = result.listIterator();
while (iterator.hasNext()) {
VAuthModelDTO tmp = (VAuthModelDTO) iterator.next();
if (tmp.getNodeType().equalsIgnoreCase("spine") && tmp.getAllLeafs() == 0) {
VAuthModelDTO tmp = iterator.next();
if ("spine".equalsIgnoreCase(tmp.getNodeType()) && tmp.getAllLeafs() == 0) {
iterator.remove();
} else {
removeEmptyDir(tmp.getChildren());
@ -77,9 +74,9 @@ public class VAuthModelService {
vAuthModelDTO.setAllLeafs(0);
continue;
}
long leafs = 0l;
long leafs = 0L;
for (VAuthModelDTO child : vAuthModelDTO.getChildren()) {
if (child.getNodeType().equalsIgnoreCase("leaf")) {
if ("leaf".equalsIgnoreCase(child.getNodeType())) {
leafs = leafs + 1;
} else {
leafs = +leafs + getLeafs(child);
@ -90,13 +87,13 @@ public class VAuthModelService {
}
private long getLeafs(VAuthModelDTO child) {
long leafs = 0l;
long leafs = 0L;
if (CollectionUtils.isEmpty(child.getChildren())) {
child.setAllLeafs(0);
return leafs;
}
for (VAuthModelDTO childChild : child.getChildren()) {
if (childChild.getNodeType().equalsIgnoreCase("leaf")) {
if ("leaf".equalsIgnoreCase(childChild.getNodeType())) {
leafs = leafs + 1;
} else {
leafs = +leafs + getLeafs(childChild);

View File

@ -42,6 +42,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.plugins.datasource.provider.Provider;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.view.entity.*;
@ -297,6 +298,10 @@ public class ChartViewService {
public ChartViewDTO getData(String id, ChartExtRequest request) throws Exception {
try {
ChartViewDTO view = this.getOne(id, request.getQueryFrom());
DatasetTable datasetTable = dataSetTableService.get(view.getTableId());
if (ObjectUtils.isNotEmpty(datasetTable)) {
view.setDatasetMode(datasetTable.getMode());
}
// 如果是从仪表板获取视图数据则仪表板的查询模式查询结果的数量覆盖视图对应的属性
if (CommonConstants.VIEW_RESULT_MODE.CUSTOM.equals(request.getResultMode())) {
view.setResultMode(request.getResultMode());
@ -548,7 +553,8 @@ public class ChartViewService {
return data;
}
public ChartViewDTO calcData(ChartViewDTO view, ChartExtRequest requestList, boolean cache) throws Exception {
public ChartViewDTO calcData(ChartViewDTO view, ChartExtRequest chartExtRequest, boolean cache) throws Exception {
ChartViewDTO chartViewDTO = new ChartViewDTO();
if (ObjectUtils.isEmpty(view)) {
throw new RuntimeException(Translator.get("i18n_chart_delete"));
}
@ -568,11 +574,12 @@ public class ChartViewService {
});
}
List<ChartViewFieldDTO> xAxisBase = gson.fromJson(view.getXAxis(), tokenType);
List<ChartViewFieldDTO> xAxis = gson.fromJson(view.getXAxis(), tokenType);
List<ChartViewFieldDTO> xAxisExt = gson.fromJson(view.getXAxisExt(), tokenType);
if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot") || StringUtils.containsIgnoreCase(view.getType(), "group")) {
if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot")
|| StringUtils.containsIgnoreCase(view.getType(), "group")
|| ("antv".equalsIgnoreCase(view.getRender()) && "line".equalsIgnoreCase(view.getType()))) {
xAxis.addAll(xAxisExt);
}
List<ChartViewFieldDTO> yAxis = gson.fromJson(view.getYAxis(), tokenType);
@ -580,7 +587,7 @@ public class ChartViewService {
List<ChartViewFieldDTO> yAxisExt = gson.fromJson(view.getYAxisExt(), tokenType);
yAxis.addAll(yAxisExt);
}
if (StringUtils.equalsIgnoreCase(view.getRender(), "antv") && StringUtils.equalsAnyIgnoreCase(view.getType(), "gauge","liquid")) {
if (StringUtils.equalsIgnoreCase(view.getRender(), "antv") && StringUtils.equalsAnyIgnoreCase(view.getType(), "gauge", "liquid")) {
List<ChartViewFieldDTO> sizeField = getSizeField(view);
yAxis.addAll(sizeField);
}
@ -589,27 +596,32 @@ public class ChartViewService {
List<ChartFieldCustomFilterDTO> fieldCustomFilter = gson.fromJson(view.getCustomFilter(), filterTokenType);
List<ChartViewFieldDTO> drill = gson.fromJson(view.getDrillFields(), tokenType);
// 视图计算字段用dataeaseName作为唯一标识
ChartViewField chartViewField = new ChartViewField();
chartViewField.setChartId(view.getId());
List<ChartViewField> chartViewFields = chartViewFieldService.list(chartViewField);
List<String> chartViewFieldNameList = chartViewFields.stream().map(ChartViewField::getDataeaseName).collect(Collectors.toList());
DatasetTableField datasetTableFieldObj = DatasetTableField.builder().tableId(view.getTableId()).checked(Boolean.TRUE).build();
List<DatasetTableField> fields = dataSetTableFieldsService.list(datasetTableFieldObj);
// 获取数据集,需校验权限
DataSetTableDTO table = dataSetTableService.getWithPermission(view.getTableId(), requestList.getUser());
checkPermission("use", table, requestList.getUser());
DataSetTableDTO table = dataSetTableService.getWithPermission(view.getTableId(), chartExtRequest.getUser());
checkPermission("use", table, chartExtRequest.getUser());
List<String> desensitizationList = new ArrayList<>();
//列权限
List<DatasetTableField> columnPermissionFields = permissionService.filterColumnPermissions(fields, desensitizationList, table.getId(), requestList.getUser());
List<DatasetTableField> columnPermissionFields = permissionService.filterColumnPermissions(fields, desensitizationList, table.getId(), chartExtRequest.getUser());
//将没有权限的列删掉
List<String> dataeaseNames = columnPermissionFields.stream().map(DatasetTableField::getDataeaseName).collect(Collectors.toList());
dataeaseNames.add("*");
fieldCustomFilter = fieldCustomFilter.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
extStack = extStack.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
extBubble = extBubble.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
drill = drill.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
fieldCustomFilter = fieldCustomFilter.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
extStack = extStack.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
extBubble = extBubble.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
drill = drill.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
//行权限
List<DataSetRowPermissionsTreeDTO> rowPermissionsTree = permissionsTreeService.getRowPermissionsTree(fields, table, requestList.getUser());
List<DataSetRowPermissionsTreeDTO> rowPermissionsTree = permissionsTreeService.getRowPermissionsTree(fields, table, chartExtRequest.getUser());
for (ChartFieldCustomFilterDTO ele : fieldCustomFilter) {
ele.setField(dataSetTableFieldsService.get(ele.getId()));
@ -619,9 +631,25 @@ public class ChartViewService {
return emptyChartViewDTO(view);
}
// 直连明细表分页
Map<String, Object> mapAttr = gson.fromJson(view.getCustomAttr(), Map.class);
Map<String, Object> mapSize = (Map<String, Object>) mapAttr.get("size");
if (StringUtils.equalsIgnoreCase(view.getType(), "table-info") && table.getMode() == 0 && StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) {
if (chartExtRequest.getGoPage() == null) {
chartExtRequest.setGoPage(1L);
}
if (chartExtRequest.getPageSize() == null) {
String pageSize = (String) mapSize.get("tablePageSize");
chartExtRequest.setPageSize(Long.parseLong(pageSize));
}
} else {
chartExtRequest.setGoPage(null);
chartExtRequest.setPageSize(null);
}
switch (view.getType()) {
case "label":
xAxis = xAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
xAxis = xAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
yAxis = new ArrayList<>();
if (CollectionUtils.isEmpty(xAxis)) {
return emptyChartViewDTO(view);
@ -631,39 +659,39 @@ public class ChartViewService {
case "gauge":
case "liquid":
xAxis = new ArrayList<>();
yAxis = yAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
if (CollectionUtils.isEmpty(yAxis)) {
return emptyChartViewDTO(view);
}
break;
case "table-info":
yAxis = new ArrayList<>();
xAxis = xAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || dataeaseNames.contains(item.getDataeaseName())).collect(Collectors.toList());
xAxis = xAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || dataeaseNames.contains(item.getDataeaseName())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(xAxis)) {
return emptyChartViewDTO(view);
}
break;
case "table-normal":
xAxis = xAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || dataeaseNames.contains(item.getDataeaseName())).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || dataeaseNames.contains(item.getDataeaseName())).collect(Collectors.toList());
xAxis = xAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || dataeaseNames.contains(item.getDataeaseName())).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || dataeaseNames.contains(item.getDataeaseName())).collect(Collectors.toList());
break;
case "bar-group":
case "bar-group-stack":
xAxis = xAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
xAxisBase = xAxisBase.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
xAxisExt = xAxisExt.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
xAxis = xAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
xAxisBase = xAxisBase.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
xAxisExt = xAxisExt.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
break;
default:
xAxis = xAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> StringUtils.isNotEmpty(item.getChartId()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
xAxis = xAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
}
// 过滤来自仪表板的条件
List<ChartExtFilterRequest> extFilterList = new ArrayList<>();
//组件过滤条件
if (ObjectUtils.isNotEmpty(requestList.getFilter())) {
for (ChartExtFilterRequest request : requestList.getFilter()) {
if (ObjectUtils.isNotEmpty(chartExtRequest.getFilter())) {
for (ChartExtFilterRequest request : chartExtRequest.getFilter()) {
// 解析多个fieldId,fieldId是一个逗号分隔的字符串
String fieldId = request.getFieldId();
if (request.getIsTree() == null) {
@ -677,7 +705,13 @@ public class ChartViewService {
if (sqlVariables.stream().map(SqlVariableDetails::getVariableName).collect(Collectors.toList()).contains(parameter)) {
hasParameters = true;
}
if (parameter.contains("|DE|") && table.getId().equals(parameter.split("\\|DE\\|")[0]) && sqlVariables.stream().map(SqlVariableDetails::getVariableName).collect(Collectors.toList()).contains(parameter.split("\\|DE\\|")[1])) {
if (parameter.contains("|DE|")
&& table.getId().equals(parameter.split("\\|DE\\|")[0])
&& sqlVariables
.stream()
.map(SqlVariableDetails::getVariableName)
.collect(Collectors.toList())
.contains(parameter.split("\\|DE\\|")[1])) {
hasParameters = true;
}
}
@ -742,13 +776,13 @@ public class ChartViewService {
List<ChartExtFilterRequest> filters = new ArrayList<>();
// 联动条件
if (ObjectUtils.isNotEmpty(requestList.getLinkageFilters())) {
filters.addAll(requestList.getLinkageFilters());
if (ObjectUtils.isNotEmpty(chartExtRequest.getLinkageFilters())) {
filters.addAll(chartExtRequest.getLinkageFilters());
}
// 外部参数条件
if (ObjectUtils.isNotEmpty(requestList.getOuterParamsFilters())) {
filters.addAll(requestList.getOuterParamsFilters());
if (ObjectUtils.isNotEmpty(chartExtRequest.getOuterParamsFilters())) {
filters.addAll(chartExtRequest.getOuterParamsFilters());
}
//联动过滤条件和外部参数过滤条件全部加上
@ -773,7 +807,7 @@ public class ChartViewService {
// 下钻
List<ChartExtFilterRequest> drillFilters = new ArrayList<>();
boolean isDrill = false;
List<ChartDrillRequest> drillRequest = requestList.getDrill();
List<ChartDrillRequest> drillRequest = chartExtRequest.getDrill();
if (CollectionUtils.isNotEmpty(drillRequest) && (drill.size() > drillRequest.size())) {
for (int i = 0; i < drillRequest.size(); i++) {
ChartDrillRequest request = drillRequest.get(i);
@ -856,76 +890,95 @@ public class ChartViewService {
// 如果是插件到此结束
}
String querySql = null;
long totalPage = 0l;
long totalItems = 0l;
String totalPageSql = null;
PageInfo pageInfo = new PageInfo();
pageInfo.setGoPage(chartExtRequest.getGoPage());
pageInfo.setPageSize(chartExtRequest.getPageSize());
//如果不是插件视图 走原生逻辑
if (table.getMode() == 0) {// 直连
if (ObjectUtils.isEmpty(ds)) {
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
}
if (StringUtils.isNotEmpty(ds.getStatus()) && ds.getStatus().equalsIgnoreCase("Error")) {
if (StringUtils.isNotEmpty(ds.getStatus()) && "Error".equalsIgnoreCase(ds.getStatus())) {
throw new Exception(Translator.get("i18n_invalid_ds"));
}
pageInfo.setDsVersion(datasourceProvider.dsVersion(ds));
datasourceRequest.setDatasource(ds);
DataTableInfoDTO dataTableInfoDTO = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.DB.name())) {
datasourceRequest.setTable(dataTableInfoDTO.getTable());
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
datasourceRequest.setQuery(qp.getSQLSummary(dataTableInfoDTO.getTable(), yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view, ds));
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
querySql = qp.getSQLSummary(dataTableInfoDTO.getTable(), yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view, ds);
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
datasourceRequest.setQuery(qp.getSQLStack(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view));
querySql = qp.getSQLStack(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view);
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
datasourceRequest.setQuery(qp.getSQLScatter(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, ds, view));
querySql = qp.getSQLScatter(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, ds, view);
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
datasourceRequest.setQuery(qp.getSQLTableInfo(dataTableInfoDTO.getTable(), xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
querySql = qp.getSQLWithPage(true, dataTableInfoDTO.getTable(), xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
totalPageSql = qp.getResultCount(true, dataTableInfoDTO.getTable(), xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
} else {
datasourceRequest.setQuery(qp.getSQL(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
querySql = qp.getSQL(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
}
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.SQL.name())) {
String sql = dataTableInfoDTO.isBase64Encryption() ? new String(java.util.Base64.getDecoder().decode(dataTableInfoDTO.getSql())) : dataTableInfoDTO.getSql();
sql = handleVariable(sql, requestList, qp, table, ds);
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
datasourceRequest.setQuery(qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
sql = handleVariable(sql, chartExtRequest, qp, table, ds);
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
querySql = qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
querySql = qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view);
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view));
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view);
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
datasourceRequest.setQuery(qp.getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
querySql = qp.getSQLWithPage(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
} else {
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
querySql = qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
}
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.CUSTOM.name())) {
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId());
String sql = dataSetTableService.getCustomSQLDatasource(dt, list, ds);
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
datasourceRequest.setQuery(qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
querySql = qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
querySql = qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view);
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view));
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view);
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
datasourceRequest.setQuery(qp.getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
querySql = qp.getSQLWithPage(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
} else {
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
querySql = qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
}
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.UNION.name())) {
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
Map<String, Object> sqlMap = dataSetTableService.getUnionSQLDatasource(dt, ds);
String sql = (String) sqlMap.get("sql");
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
datasourceRequest.setQuery(qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
querySql = qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
querySql = qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view);
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view));
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view);
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
datasourceRequest.setQuery(qp.getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
querySql = qp.getSQLWithPage(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
} else {
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
querySql = qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
}
}
if (StringUtils.isNotEmpty(totalPageSql) && StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) {
datasourceRequest.setQuery(totalPageSql);
totalItems = Long.valueOf(datasourceProvider.getData(datasourceRequest).get(0)[0]);
totalPage = (totalItems / pageInfo.getPageSize()) + (totalItems % pageInfo.getPageSize() > 0 ? 1 : 0);
}
datasourceRequest.setQuery(querySql);
data = datasourceProvider.getData(datasourceRequest);
if (CollectionUtils.isNotEmpty(assistFields)) {
datasourceAssistRequest.setQuery(assistSQL(datasourceRequest.getQuery(), assistFields));
@ -938,7 +991,7 @@ public class ChartViewService {
String tableName = "ds_" + table.getId().replaceAll("-", "_");
datasourceRequest.setTable(tableName);
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
datasourceRequest.setQuery(qp.getSQLSummary(tableName, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view, ds));
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
datasourceRequest.setQuery(qp.getSQLStack(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view));
@ -955,10 +1008,12 @@ public class ChartViewService {
assistData = datasourceProvider.getData(datasourceAssistRequest);
}
// 仪表板有参数不使用缓存
if (!cache || CollectionUtils.isNotEmpty(requestList.getFilter())
|| CollectionUtils.isNotEmpty(requestList.getLinkageFilters())
|| CollectionUtils.isNotEmpty(requestList.getOuterParamsFilters())
|| CollectionUtils.isNotEmpty(requestList.getDrill()) || CollectionUtils.isNotEmpty(rowPermissionsTree) || fields.size() != columnPermissionFields.size()) {
if (!cache || CollectionUtils.isNotEmpty(chartExtRequest.getFilter())
|| CollectionUtils.isNotEmpty(chartExtRequest.getLinkageFilters())
|| CollectionUtils.isNotEmpty(chartExtRequest.getOuterParamsFilters())
|| CollectionUtils.isNotEmpty(chartExtRequest.getDrill())
|| CollectionUtils.isNotEmpty(rowPermissionsTree)
|| fields.size() != columnPermissionFields.size()) {
data = datasourceProvider.getData(datasourceRequest);
} else {
try {
@ -1110,9 +1165,9 @@ public class ChartViewService {
mapChart = ChartDataBuild.transChartData(xAxis, yAxis, view, data, isDrill);
}
} else if (StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
if (StringUtils.equalsIgnoreCase(view.getType(), "bar-group")) {
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "bar-group", "line")) {
mapChart = ChartDataBuild.transBaseGroupDataAntV(xAxisBase, xAxis, xAxisExt, yAxis, view, data, isDrill);
} else if (StringUtils.equalsIgnoreCase(view.getType(),"bar-group-stack")) {
} else if (StringUtils.equalsIgnoreCase(view.getType(), "bar-group-stack")) {
mapChart = ChartDataBuild.transGroupStackDataAntV(xAxisBase, xAxis, xAxisExt, yAxis, extStack, data, view, isDrill);
} else if (StringUtils.containsIgnoreCase(view.getType(), "bar-stack")) {
mapChart = ChartDataBuild.transStackChartDataAntV(xAxis, yAxis, view, data, extStack, isDrill);
@ -1136,7 +1191,10 @@ public class ChartViewService {
}
// table组件明细表也用于导出数据
Map<String, Object> mapTableNormal = ChartDataBuild.transTableNormal(xAxis, yAxis, view, data, extStack, desensitizationList);
return uniteViewResult(datasourceRequest.getQuery(), mapChart, mapTableNormal, view, isDrill, drillFilters, dynamicAssistFields, assistData);
chartViewDTO = uniteViewResult(datasourceRequest.getQuery(), mapChart, mapTableNormal, view, isDrill, drillFilters, dynamicAssistFields, assistData);
chartViewDTO.setTotalPage(totalPage);
chartViewDTO.setTotalItems(totalItems);
return chartViewDTO;
}
// 对结果排序

View File

@ -158,7 +158,11 @@ public class ChartDataBuild {
} catch (Exception e) {
axisChartDataDTO.setValue(new BigDecimal(0));
}
axisChartDataDTO.setCategory(b.toString());
if ("line".equals(view.getType()) && CollectionUtils.isEmpty(xAxisExt)) {
axisChartDataDTO.setCategory(yAxis.get(j).getName());
} else {
axisChartDataDTO.setCategory(b.toString());
}
dataList.add(axisChartDataDTO);
}
}

View File

@ -149,7 +149,7 @@ public class DataSetTableService {
@Value("${upload.file.path}")
private String path;
private static Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
private static final Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
@DeCleaner(value = DePermissionType.DATASET, key = "sceneId")
public List<DatasetTable> batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
@ -185,7 +185,7 @@ public class DataSetTableService {
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@DeCleaner(value = DePermissionType.DATASET, key = "sceneId")
public List<DatasetTable> saveExcel(DataSetTableRequest datasetTable) throws Exception {
public List<DatasetTable> saveExcel(DataSetTableRequest datasetTable) {
List<String> datasetIdList = new ArrayList<>();
if (StringUtils.isEmpty(datasetTable.getId())) {
@ -234,10 +234,9 @@ public class DataSetTableService {
list.add(sheetTable);
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.CREATE, SysLogConstants.SOURCE_TYPE.DATASET, datasetTable.getId(), datasetTable.getSceneId(), null, null);
}
datasetIdList.forEach(datasetId -> {
commonThreadPool.addTask(() -> extractDataService.extractExcelData(datasetId, "all_scope", "初始导入",
null, datasetIdList));
});
datasetIdList.forEach(datasetId -> commonThreadPool.addTask(() ->
extractDataService.extractExcelData(datasetId, "all_scope", "初始导入",
null, datasetIdList)));
} else {
for (ExcelSheetData sheet : datasetTable.getSheets()) {
String[] fieldArray = sheet.getFields().stream().map(TableField::getFieldName)
@ -269,10 +268,9 @@ public class DataSetTableService {
list.add(sheetTable);
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFY, SysLogConstants.SOURCE_TYPE.DATASET, datasetTable.getId(), datasetTable.getSceneId(), null, null);
}
datasetIdList.forEach(datasetId -> {
commonThreadPool.addTask(() -> extractDataService.extractExcelData(datasetId, "all_scope", "初始导入",
null, datasetIdList));
});
datasetIdList.forEach(datasetId -> commonThreadPool.addTask(() ->
extractDataService.extractExcelData(datasetId, "all_scope", "初始导入",
null, datasetIdList)));
}
return list;
@ -303,15 +301,15 @@ public class DataSetTableService {
DataTableInfoDTO info = new DataTableInfoDTO();
info.setExcelSheetDataList(excelSheetDataList);
datasetTable.setInfo(new Gson().toJson(info));
int update = datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
// 替換時先不刪除旧字段同步成功后再删除
if (datasetTable.getEditType() == 0) {
commonThreadPool.addTask(() -> extractDataService.extractExcelData(datasetTable.getId(), "all_scope", "替换",
saveExcelTableField(datasetTable.getId(), datasetTable.getSheets().get(0).getFields(), false),
Arrays.asList(datasetTable.getId())));
Collections.singletonList(datasetTable.getId())));
} else if (datasetTable.getEditType() == 1) {
commonThreadPool.addTask(() -> extractDataService.extractExcelData(datasetTable.getId(), "add_scope", "追加",
null, Arrays.asList(datasetTable.getId())));
null, Collections.singletonList(datasetTable.getId())));
}
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFY, SysLogConstants.SOURCE_TYPE.DATASET, datasetTable.getId(), datasetTable.getSceneId(), null, null);
return Collections.singletonList(datasetTable);
@ -362,12 +360,12 @@ public class DataSetTableService {
return datasetTable;
}
public void alter(DataSetTableRequest request) throws Exception {
public void alter(DataSetTableRequest request) {
checkName(request);
datasetTableMapper.updateByPrimaryKeySelective(request);
}
public void delete(String id) throws Exception {
public void delete(String id) {
DatasetTable table = datasetTableMapper.selectByPrimaryKey(id);
SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, SysLogConstants.SOURCE_TYPE.DATASET, table.getId(), table.getSceneId(), null, null);
datasetTableMapper.deleteByPrimaryKey(id);
@ -489,9 +487,8 @@ public class DataSetTableService {
List<DataSetTableDTO> res = new ArrayList<>();
Map<String, DataSetTableDTO> map = new TreeMap<>();
group.forEach(ele -> map.put(ele.getId(), ele));
Iterator<Map.Entry<String, DataSetTableDTO>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
res.add(iterator.next().getValue());
for (Map.Entry<String, DataSetTableDTO> stringDataSetTableDTOEntry : map.entrySet()) {
res.add(stringDataSetTableDTOEntry.getValue());
}
res.sort(Comparator.comparing(DatasetTable::getName));
res.addAll(ds);
@ -521,8 +518,7 @@ public class DataSetTableService {
return datasourceProvider.getTableFields(datasourceRequest);
}
public Map<String, List<DatasetTableField>> getFieldsFromDE(DataSetTableRequest dataSetTableRequest)
throws Exception {
public Map<String, List<DatasetTableField>> getFieldsFromDE(DataSetTableRequest dataSetTableRequest) {
DatasetTableField datasetTableField = DatasetTableField.builder().build();
datasetTableField.setTableId(dataSetTableRequest.getId());
datasetTableField.setChecked(Boolean.TRUE);
@ -1015,15 +1011,11 @@ public class DataSetTableService {
break;
case "TEXT":
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("TEXT")).collect(Collectors.toList());
sqlVariableDetails.forEach(item -> {
item.setAlias(item.getVariableName());
});
sqlVariableDetails.forEach(item -> item.setAlias(item.getVariableName()));
break;
case "NUM":
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("LONG") || item.getType().get(0).contains("DOUBLE")).collect(Collectors.toList());
sqlVariableDetails.forEach(item -> {
item.setAlias(item.getVariableName());
});
sqlVariableDetails.forEach(item -> item.setAlias(item.getVariableName()));
break;
}
return sqlVariableDetails;
@ -1087,15 +1079,15 @@ public class DataSetTableService {
if (select.getSelectBody() instanceof PlainSelect) {
return handlePlainSelect((PlainSelect) select.getSelectBody(), select, dsType);
} else {
String result = "";
StringBuilder result = new StringBuilder();
SetOperationList setOperationList = (SetOperationList) select.getSelectBody();
for (int i = 0; i < setOperationList.getSelects().size(); i++) {
result = result + handlePlainSelect((PlainSelect) setOperationList.getSelects().get(i), null, dsType);
result.append(handlePlainSelect((PlainSelect) setOperationList.getSelects().get(i), null, dsType));
if (i < setOperationList.getSelects().size() - 1) {
result = result + " " + setOperationList.getOperations().get(i).toString() + " ";
result.append(" ").append(setOperationList.getOperations().get(i).toString()).append(" ");
}
}
return result;
return result.toString();
}
}
@ -1140,14 +1132,14 @@ public class DataSetTableService {
builder.append(" ");
for (Iterator<WithItem> iter = select.getWithItemsList().iterator(); iter.hasNext(); ) {
WithItem withItem = iter.next();
builder.append(withItem.getName() + " AS ( " + removeVariables(withItem.getSubSelect().toString(), dsType) + " ) ");
builder.append(withItem.getName()).append(" AS ( ").append(removeVariables(withItem.getSubSelect().toString(), dsType)).append(" ) ");
if (iter.hasNext()) {
builder.append(",");
}
}
}
builder.append(" " + plainSelect);
builder.append(" ").append(plainSelect);
return builder.toString();
}
@ -1230,7 +1222,7 @@ public class DataSetTableService {
String sqlAsTable = qp.createSQLPreview(sql, null);
datasourceRequest.setQuery(sqlAsTable);
Map<String, List> result = new HashMap<>();
Map<String, List> result;
try {
datasetSqlLog.setStartTime(System.currentTimeMillis());
result = datasourceProvider.fetchResultAndField(datasourceRequest);
@ -1275,7 +1267,7 @@ public class DataSetTableService {
public Map<String, Object> getUnionPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class);
Map<String, Object> sqlMap = new HashMap<>();
Map<String, Object> sqlMap;
DatasourceRequest datasourceRequest = new DatasourceRequest();
Datasource ds;
if (dataSetTableRequest.getMode() == 0) {
@ -1289,7 +1281,6 @@ public class DataSetTableService {
}
String sql = (String) sqlMap.get("sql");
List<DatasetTableField> fieldList = (List<DatasetTableField>) sqlMap.get("field");
List<UnionParamDTO> join = (List<UnionParamDTO>) sqlMap.get("join");
Map<String, Object> res = new HashMap<>();
// 处理结果
@ -1423,9 +1414,7 @@ public class DataSetTableService {
DataTableInfoCustomUnion first = dataTableInfoDTO.getList().get(0);
if (CollectionUtils.isNotEmpty(list)) {
StringBuilder field = new StringBuilder();
Iterator<Map.Entry<String, String[]>> iterator = customInfo.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String[]> next = iterator.next();
for (Map.Entry<String, String[]> next : customInfo.entrySet()) {
field.append(StringUtils.join(next.getValue(), ",")).append(",");
}
String f = field.substring(0, field.length() - 1);
@ -1493,9 +1482,7 @@ public class DataSetTableService {
String tableName = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class).getTable();
if (CollectionUtils.isNotEmpty(list)) {
StringBuilder field = new StringBuilder();
Iterator<Map.Entry<String, String[]>> iterator = customInfo.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String[]> next = iterator.next();
for (Map.Entry<String, String[]> next : customInfo.entrySet()) {
field.append(StringUtils.join(next.getValue(), ",")).append(",");
}
String f = field.substring(0, field.length() - 1);
@ -1601,9 +1588,7 @@ public class DataSetTableService {
if (CollectionUtils.isNotEmpty(unionList)) {
// field
StringBuilder field = new StringBuilder();
Iterator<Map.Entry<String, String[]>> iterator = checkedInfo.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String[]> next = iterator.next();
for (Map.Entry<String, String[]> next : checkedInfo.entrySet()) {
field.append(StringUtils.join(next.getValue(), ",")).append(",");
}
String f = subPrefixSuffixChar(field.toString());
@ -1664,8 +1649,7 @@ public class DataSetTableService {
// 递归计算出所有子级的checkedFields和unionParam
private void getUnionSQLDorisJoin(List<UnionDTO> childrenDs, Map<String, String[]> checkedInfo,
List<UnionParamDTO> unionList, List<DatasetTableField> checkedFields) {
for (int i = 0; i < childrenDs.size(); i++) {
UnionDTO unionDTO = childrenDs.get(i);
for (UnionDTO unionDTO : childrenDs) {
String tableId = unionDTO.getCurrentDs().getId();
String table = TableUtils.tableName(tableId);
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(tableId);
@ -1752,9 +1736,7 @@ public class DataSetTableService {
if (CollectionUtils.isNotEmpty(unionList)) {
// field
StringBuilder field = new StringBuilder();
Iterator<Map.Entry<String, String[]>> iterator = checkedInfo.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String[]> next = iterator.next();
for (Map.Entry<String, String[]> next : checkedInfo.entrySet()) {
field.append(StringUtils.join(next.getValue(), ",")).append(",");
}
String f = subPrefixSuffixChar(field.toString());
@ -1825,9 +1807,7 @@ public class DataSetTableService {
// 递归计算出所有子级的checkedFields和unionParam
private void getUnionSQLDatasourceJoin(List<UnionDTO> childrenDs, Map<String, String[]> checkedInfo,
List<UnionParamDTO> unionList, String keyword, List<DatasetTableField> checkedFields) {
for (int i = 0; i < childrenDs.size(); i++) {
UnionDTO unionDTO = childrenDs.get(i);
for (UnionDTO unionDTO : childrenDs) {
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(unionDTO.getCurrentDs().getId());
String tableId = unionDTO.getCurrentDs().getId();
if (ObjectUtils.isEmpty(datasetTable)) {
@ -1976,7 +1956,7 @@ public class DataSetTableService {
Map<String, Object> sqlMap = getUnionSQLDoris(dataTableInfoDTO);
String sql = (String) sqlMap.get("sql");
List<DatasetTableField> fieldList = (List<DatasetTableField>) sqlMap.get("field");
List<UnionParamDTO> join = (List<UnionParamDTO>) sqlMap.get("join");
// custom 创建doris视图
createDorisView(TableUtils.tableName(datasetTable.getId()), sql);
@ -2003,7 +1983,7 @@ public class DataSetTableService {
Map<String, Object> sqlMap = getUnionSQLDatasource(dt, ds);
String sql = (String) sqlMap.get("sql");
List<DatasetTableField> fieldList = (List<DatasetTableField>) sqlMap.get("field");
List<UnionParamDTO> join = (List<UnionParamDTO>) sqlMap.get("join");
datasourceRequest.setQuery(sql);
fields = datasourceProvider.fetchResultField(datasourceRequest);
@ -2157,16 +2137,15 @@ public class DataSetTableService {
private void checkColumes(DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception {
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(datasetTableIncrementalConfig.getTableId());
List<DatasetTableField> datasetTableFields = dataSetTableFieldsService.getFieldsByTableId(datasetTable.getId())
.stream().filter(datasetTableField -> datasetTableField.getExtField() == 0).collect(Collectors.toList());
datasetTableFields.sort((o1, o2) -> {
if (o1.getColumnIndex() == null) {
return -1;
}
if (o2.getColumnIndex() == null) {
return 1;
}
return o1.getColumnIndex().compareTo(o2.getColumnIndex());
});
.stream().filter(datasetTableField -> datasetTableField.getExtField() == 0).sorted((o1, o2) -> {
if (o1.getColumnIndex() == null) {
return -1;
}
if (o2.getColumnIndex() == null) {
return 1;
}
return o1.getColumnIndex().compareTo(o2.getColumnIndex());
}).collect(Collectors.toList());
List<String> originNameFields = datasetTableFields.stream().map(DatasetTableField::getOriginName)
.collect(Collectors.toList());
@ -2184,9 +2163,7 @@ public class DataSetTableService {
List<String> sqlFields = new ArrayList<>();
try {
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableField::getFieldName)
.forEach(field -> {
sqlFields.add(field);
});
.forEach(sqlFields::add);
} catch (Exception e) {
DataEaseException.throwException(Translator.get("i18n_check_sql_error") + e.getMessage());
}
@ -2204,7 +2181,7 @@ public class DataSetTableService {
List<String> sqlFields = new ArrayList<>();
try {
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableField::getFieldName)
.forEach(field -> sqlFields.add(field));
.forEach(sqlFields::add);
} catch (Exception e) {
DataEaseException.throwException(Translator.get("i18n_check_sql_error") + e.getMessage());
}
@ -2228,7 +2205,7 @@ public class DataSetTableService {
criteria.andNameEqualTo(datasetTable.getName());
}
List<DatasetTable> list = datasetTableMapper.selectByExample(datasetTableExample);
if (list.size() > 0) {
if (!list.isEmpty()) {
throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
}
}
@ -2253,7 +2230,7 @@ public class DataSetTableService {
criteria.andNameIn(new ArrayList<>(nameSet));
}
List<DatasetTable> list = datasetTableMapper.selectByExample(datasetTableExample);
if (list.size() > 0) {
if (!list.isEmpty()) {
throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
}
}
@ -2265,6 +2242,13 @@ public class DataSetTableService {
if (ObjectUtils.isNotEmpty(table)) {
Datasource datasource = datasourceMapper.selectByPrimaryKey(table.getDataSourceId());
Optional.ofNullable(datasource).orElse(new Datasource()).setConfiguration(null);
Collection<DataSourceType> types = datasourceService.types();
for (DataSourceType type : types) {
if (ObjectUtils.isNotEmpty(datasource) && StringUtils.equalsIgnoreCase(datasource.getType(), type.getType())) {
datasource.setType(type.getName());
break;
}
}
dataSetDetail.setDatasource(datasource);
}
return dataSetDetail;
@ -2278,8 +2262,7 @@ public class DataSetTableService {
if (StringUtils.isNotEmpty(tableId)) {
List<DatasetTableField> fields = dataSetTableFieldsService.getFieldsByTableId(tableId);
List<DatasetTableField> datasetTableFields = fields.stream().filter(datasetTableField -> datasetTableField.getExtField() == 0).collect(Collectors.toList());
datasetTableFields.sort((o1, o2) -> {
List<DatasetTableField> datasetTableFields = fields.stream().filter(datasetTableField -> datasetTableField.getExtField() == 0).sorted((o1, o2) -> {
if (o1.getColumnIndex() == null) {
return -1;
}
@ -2287,7 +2270,7 @@ public class DataSetTableService {
return 1;
}
return o1.getColumnIndex().compareTo(o2.getColumnIndex());
});
}).collect(Collectors.toList());
List<String> oldFields = datasetTableFields.stream().map(DatasetTableField::getOriginName).collect(Collectors.toList());
@ -2299,7 +2282,7 @@ public class DataSetTableService {
returnSheetDataList.add(excelSheetData);
}
}
if (returnSheetDataList.size() == 0) {
if (returnSheetDataList.isEmpty()) {
DataEaseException.throwException(Translator.get("i18n_excel_column_change"));
}
} else {
@ -2321,22 +2304,19 @@ public class DataSetTableService {
for (ExcelSheetData excelSheetData : excelSheetDataList) {
List<TableField> tableFields = excelSheetData.getFields();
List<String> newFields = tableFields.stream().map(TableField::getRemarks).collect(Collectors.toList());
if (oldFields.equals(newFields)) {
excelSheetData.setChangeFiled(false);
} else {
excelSheetData.setChangeFiled(true);
}
excelSheetData.setChangeFiled(!oldFields.equals(newFields));
boolean effectExtField = false;
for (String extFieldsRefName : extFieldsRefNames) {
if (!newFields.contains(extFieldsRefName)) {
effectExtField = true;
break;
}
}
excelSheetData.setEffectExtField(effectExtField);
returnSheetDataList.add(excelSheetData);
}
if (returnSheetDataList.size() == 0) {
if (returnSheetDataList.isEmpty()) {
DataEaseException.throwException(Translator.get("i18n_excel_column_change"));
}
}
@ -2403,7 +2383,7 @@ public class DataSetTableService {
}
List<List<String>> data = new ArrayList<>();
int num = 1;
String line = null;
String line;
while ((line = reader.readLine()) != null) {
if (num > 100) {
break;
@ -2450,7 +2430,7 @@ public class DataSetTableService {
try {
double d = cell.getNumericCellValue();
try {
Double value = new Double(d);
Double value = d;
double eps = 1e-10;
if (value - Math.floor(value) < eps) {
if (cellType) {
@ -2469,7 +2449,7 @@ public class DataSetTableService {
return nf.format(value);
}
} catch (Exception e) {
BigDecimal b = new BigDecimal(d);
BigDecimal b = BigDecimal.valueOf(d);
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "";
}
} catch (IllegalStateException e) {
@ -2502,7 +2482,7 @@ public class DataSetTableService {
} else {
double d = cell.getNumericCellValue();
try {
Double value = new Double(d);
Double value = d;
double eps = 1e-10;
if (value - Math.floor(value) < eps) {
if (cellType) {
@ -2521,7 +2501,7 @@ public class DataSetTableService {
return nf.format(value);
}
} catch (Exception e) {
BigDecimal b = new BigDecimal(d);
BigDecimal b = BigDecimal.valueOf(d);
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "";
}
}
@ -2655,18 +2635,14 @@ public class DataSetTableService {
* 判断数组中是否有重复的值
*/
public static boolean checkIsRepeat(String[] array) {
HashSet<String> hashSet = new HashSet<String>();
for (int i = 0; i < array.length; i++) {
if (StringUtils.isEmpty(array[i])) {
HashSet<String> hashSet = new HashSet<>();
for (String s : array) {
if (StringUtils.isEmpty(s)) {
throw new RuntimeException(Translator.get("i18n_excel_empty_column"));
}
hashSet.add(array[i]);
}
if (hashSet.size() == array.length) {
return false;
} else {
return true;
hashSet.add(s);
}
return hashSet.size() != array.length;
}
public DatasetTable syncDatasetTableField(String id) throws Exception {
@ -2857,7 +2833,7 @@ public class DataSetTableService {
return expressionDeParser;
}
static private boolean hasVariable(String sql) {
private static boolean hasVariable(String sql) {
return sql.contains(SubstitutedParams);
}
@ -2936,7 +2912,7 @@ public class DataSetTableService {
//设置列的宽度
detailsSheet.setColumnWidth(j, 255 * 20);
} else {
if ((fields.get(j).getDeType() == DeTypeConstants.DE_INT || fields.get(j).getDeType() == DeTypeConstants.DE_FLOAT) && StringUtils.isNotEmpty(rowData.get(j))) {
if ((fields.get(j).getDeType().equals(DeTypeConstants.DE_INT) || fields.get(j).getDeType() == DeTypeConstants.DE_FLOAT) && StringUtils.isNotEmpty(rowData.get(j))) {
try {
cell.setCellValue(Double.valueOf(rowData.get(j)));
} catch (Exception e) {

View File

@ -55,6 +55,13 @@ public class SysMsgService {
@Autowired
private SystemParameterService systemParameterService;
public void cleanDisusedMsg() {
Long overTime = overTime();
SysMsgExample example = new SysMsgExample();
example.createCriteria().andCreateTimeLessThan(overTime);
sysMsgMapper.deleteByExample(example);
}
public List<MsgGridDto> queryGrid(Long userId, MsgRequest msgRequest, List<Long> typeIds, Long startTime) {
String orderClause = " create_time desc";
SysMsgExample example = new SysMsgExample();

View File

@ -29,6 +29,7 @@ import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.*;
import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.service.SystemInfoService;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.DataSetTableService;
@ -131,6 +132,10 @@ public class PanelGroupService {
private DataSetGroupService dataSetGroupService;
@Resource
private DatasetGroupMapper datasetGroupMapper;
@Resource
private PanelWatermarkMapper panelWatermarkMapper;
@Resource
private SystemInfoService systemInfoService;
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
@ -304,6 +309,7 @@ public class PanelGroupService {
panelGroup.setPanelStyle(sourcePanel.getPanelStyle());
panelGroup.setSourcePanelName(sourcePanel.getName());
}
panelGroup.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
return panelGroup;
}
@ -750,7 +756,9 @@ public class PanelGroupService {
if (cache == null) {
return null;
} else {
return (PanelGroupRequest) cache;
PanelGroupDTO result = (PanelGroupRequest) cache;
result.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
return result;
}
}
@ -939,4 +947,15 @@ public class PanelGroupService {
//数据源变更
panelAppTemplateService.editDatasource(request.getDatasourceList());
}
public void toTop(String panelId) {
Long time = System.currentTimeMillis();
PanelGroupWithBLOBs request = new PanelGroupWithBLOBs();
request.setId(panelId);
request.setPanelSort(time);
request.setUpdateTime(time);
request.setUpdateBy(AuthUtils.getUser().getUsername());
panelGroupMapper.updateByPrimaryKeySelective(request);
}
}

View File

@ -4,26 +4,26 @@ import io.dataease.auth.config.RsaProperties;
import io.dataease.auth.util.JWTUtils;
import io.dataease.auth.util.RsaUtil;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.commons.utils.*;
import io.dataease.controller.request.panel.link.EnablePwdRequest;
import io.dataease.controller.request.panel.link.LinkRequest;
import io.dataease.controller.request.panel.link.OverTimeRequest;
import io.dataease.controller.request.panel.link.PasswordRequest;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.link.GenerateDto;
import io.dataease.ext.ExtPanelLinkMapper;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.PanelGroupMapper;
import io.dataease.plugins.common.base.mapper.PanelLinkMapper;
import io.dataease.plugins.common.base.mapper.PanelLinkMappingMapper;
import io.dataease.plugins.common.base.mapper.PanelWatermarkMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import io.dataease.ext.ExtPanelLinkMapper;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -47,6 +47,8 @@ public class PanelLinkService {
private ExtPanelLinkMapper extPanelLinkMapper;
@Resource
private PanelLinkMappingMapper panelLinkMappingMapper;
@Resource
private PanelWatermarkMapper panelWatermarkMapper;
@Transactional
public void changeValid(LinkRequest request) {
@ -67,7 +69,7 @@ public class PanelLinkService {
if (!request.isValid()) {
operateType = SysLogConstants.OPERATE_TYPE.DELETELINK;
}
DeLogUtils.save(operateType, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null) ;
DeLogUtils.save(operateType, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null);
}
private PanelLinkExample example(String panelLinkId, Long userId) {
@ -82,7 +84,7 @@ public class PanelLinkService {
po.setEnablePwd(request.isEnablePwd());
mapper.updateByExampleSelective(po, example(request.getResourceId(), AuthUtils.getUser().getUserId()));
PanelGroupWithBLOBs panel = panelGroupMapper.selectByPrimaryKey(request.getResourceId());
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFYLINK, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null) ;
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFYLINK, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null);
}
public void password(PasswordRequest request) {
@ -93,14 +95,14 @@ public class PanelLinkService {
PanelGroupWithBLOBs panel = panelGroupMapper.selectByPrimaryKey(request.getResourceId());
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFYLINK, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null) ;
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFYLINK, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null);
}
public void overTime(OverTimeRequest request) {
request.setUserId(AuthUtils.getUser().getUserId());
extPanelLinkMapper.updateOverTime(request);
PanelGroupWithBLOBs panel = panelGroupMapper.selectByPrimaryKey(request.getResourceId());
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFYLINK, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null) ;
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFYLINK, SysLogConstants.SOURCE_TYPE.PANEL, panel.getId(), panel.getPid(), null, null);
}
private PanelLink findOne(String resourceId) {
@ -232,8 +234,12 @@ public class PanelLinkService {
return pass;
}
public PanelGroupWithBLOBs resourceInfo(String resourceId) {
return panelGroupMapper.selectByPrimaryKey(resourceId);
public PanelGroupDTO resourceInfo(String resourceId) {
PanelGroupWithBLOBs result = panelGroupMapper.selectByPrimaryKey(resourceId);
PanelGroupDTO panelGroupDTO = new PanelGroupDTO();
BeanUtils.copyBean(panelGroupDTO, result);
panelGroupDTO.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
return panelGroupDTO;
}
public String getShortUrl(String resourceId) {

View File

@ -74,7 +74,7 @@ public class SysUserService {
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());
List<Long> roleIds = roles.stream().filter(ObjectUtils::isNotEmpty).map(SysUserRole::getRoleId).collect(Collectors.toList());
item.setRoleIds(roleIds);
});
return lists;

View File

@ -3,4 +3,39 @@ ALTER TABLE `sys_log`
CHANGE COLUMN `login_name` `login_name` VARCHAR (255) NULL COMMENT '登录账号',
CHANGE COLUMN `nick_name` `nick_name` VARCHAR (255) NULL COMMENT '姓名';
UPDATE `sys_menu` SET `component` = 'dataset/Form' WHERE (`menu_id` = '800');
ALTER TABLE `panel_group`
ADD COLUMN `watermark_open` tinyint(1) NULL DEFAULT 1 COMMENT '是否单独打开水印' AFTER `update_time`;
DROP TABLE IF EXISTS `panel_watermark`;
CREATE TABLE `panel_watermark`
(
`id` varchar(50) NOT NULL,
`version` varchar(255) DEFAULT NULL COMMENT '版本号',
`setting_content` longtext COMMENT '设置内容',
`create_by` varchar(255) DEFAULT NULL,
`create_time` bigint(13) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
INSERT INTO `panel_watermark` (`id`, `version`, `setting_content`, `create_by`, `create_time`)
VALUES ('system_default', '1.0',
'{\"enable\":false,\"enablePanelCustom\":true,\"type\":\"custom\",\"content\":\"${time}-${nickName}\",\"watermark_color\":\"#999999\",\"watermark_x_space\":20,\"watermark_y_space\":100,\"watermark_fontsize\":20}',
'admin', NULL);
SET
FOREIGN_KEY_CHECKS = 1;
UPDATE `sys_menu`
SET `component` = 'dataset/Form'
WHERE (`menu_id` = '800');
UPDATE `sys_menu`
SET `component` = 'msg/All'
WHERE (`component` = 'msg/all');
UPDATE `sys_menu`
SET `component` = 'msg/Setting'
WHERE (`component` = 'msg/setting');
ALTER TABLE `panel_group`
ADD COLUMN `panel_sort` bigint(13) NULL COMMENT '排序' AFTER `watermark_open`;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dataease-server</artifactId>
@ -44,7 +44,7 @@
</goals>
<!-- Optional configuration which provides for running any npm command -->
<configuration>
<arguments>install --force</arguments>
<arguments>install</arguments>
</configuration>
</execution>

BIN
frontend/public/dynamic.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 MiB

BIN
frontend/public/lic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,13 +1,46 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>DataEase</title>
<style>
html,
body {
margin: 0 !important;
height: 100%;
}
.no-login-dynamic {
height: 100%;
background: url(./lic.png) no-repeat;
background-size: cover;
text-align: center;
}
span {
color: #000;
font-size: 25px;
font-weight: 500;
position: relative;
top: 130px;
}
</style>
</head>
<body style="height: 100%;">
<div>缺少许可</div>
<div class="no-login-dynamic">
<span>缺少许可</span>
</div>
</body>
<script>
document.getElementsByTagName("body")
</script>
</html>

View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>DataEase</title>
<style>
html,
body {
margin: 0 !important;
height: 100%;
}
.no-login-dynamic {
height: 100%;
background: url(./dynamic.gif) no-repeat;
background-size: cover;
text-align: center;
}
span {
color: #fff;
font-size: 25px;
font-weight: 500;
position: relative;
top: 30px;
}
</style>
</head>
<body style="height: 100%;">
<div id="de-nologin-div" class="no-login-dynamic">
<span>请先登录,即将跳转!</span>
</div>
</body>
<script>
const timer = setTimeout(() => {
window.location.href = "/";
}, 3500)
</script>
</html>

View File

@ -136,6 +136,14 @@ export function fieldListDQ(id, showLoading = true) {
})
}
export function dateformats(id, showLoading = true) {
return request({
url: '/dataset/field/dateformats/' + id,
loading: showLoading,
method: 'post'
})
}
export function batchEdit(data) {
return request({
url: '/dataset/field/batchEdit',

View File

@ -66,6 +66,7 @@ export function viewData(id, panelId, data) {
data
})
}
export function panelSave(data) {
return request({
url: 'panel/group/save',
@ -162,6 +163,10 @@ export function initPanelData(panelId, useCache = false, callback) {
if (response.data) {
// 初始化视图data和style 数据
panelInit(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle))
const watermarkInfo = {
...response.data.watermarkInfo,
settingContent: JSON.parse(response.data.watermarkInfo.settingContent)
}
// 设置当前仪表板全局信息
store.dispatch('panel/setPanelInfo', {
id: response.data.id,
@ -174,7 +179,9 @@ export function initPanelData(panelId, useCache = false, callback) {
creatorName: response.data.creatorName,
updateBy: response.data.updateBy,
updateName: response.data.updateName,
updateTime: response.data.updateTime
updateTime: response.data.updateTime,
watermarkOpen: response.data.watermarkOpen,
watermarkInfo: watermarkInfo
})
// 刷新联动信息
getPanelAllLinkageInfo(panelId).then(rsp => {
@ -230,6 +237,7 @@ export function initViewCache(panelId) {
loading: false
})
}
export function exportDetails(data) {
// 初始化仪表板视图缓存
return request({
@ -268,6 +276,7 @@ export function saveCache(data) {
data
})
}
export function findUserCacheRequest(panelId) {
return request({
url: 'panel/group/findUserCache/' + panelId,
@ -349,3 +358,11 @@ export function findOneWithParent(panelId) {
loading: false
})
}
export function panelToTop(panelId) {
return request({
url: 'panel/group/toTop/' + panelId,
method: 'post',
loading: false
})
}

View File

@ -10,6 +10,10 @@ export function proxyInitPanelData(panelId, proxy, callback) {
if (response.data) {
// 初始化视图data和style 数据
panelInit(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle))
const watermarkInfo = {
...response.data.watermarkInfo,
settingContent: JSON.parse(response.data.watermarkInfo.settingContent)
}
// 设置当前仪表板全局信息
store.dispatch('panel/setPanelInfo', {
id: response.data.id,
@ -23,7 +27,9 @@ export function proxyInitPanelData(panelId, proxy, callback) {
creatorName: response.data.creatorName,
updateBy: response.data.updateBy,
updateName: response.data.updateName,
updateTime: response.data.updateTime
updateTime: response.data.updateTime,
watermarkOpen: response.data.watermarkOpen,
watermarkInfo: watermarkInfo
})
// 刷新联动信息
getPanelAllLinkageInfo(panelId, proxy).then(rsp => {

View File

@ -0,0 +1,22 @@
import request from '@/utils/request'
export function userLoginInfo() {
return request({
url: '/systemInfo/userLoginInfo',
method: 'get',
loading: false
})
}
export function proxyUserLoginInfo(userId) {
return request({
url: '/systemInfo/proxyUserLoginInfo/' + userId,
method: 'get',
loading: false
})
}
export default {
userLoginInfo,
proxyUserLoginInfo
}

View File

@ -96,7 +96,7 @@ import { mapState } from 'vuex'
import DeEditor from '@/components/canvas/components/editor/DeEditor'
import elementResizeDetectorMaker from 'element-resize-detector'
import bus from '@/utils/bus'
import { deepCopy } from '@/components/canvas/utils/utils'
import { deepCopy, imgUrlTrans } from '@/components/canvas/utils/utils'
import { uuid } from 'vue-uuid'
import componentList, {
BASE_MOBILE_STYLE,
@ -113,6 +113,7 @@ import generateID from '@/components/canvas/utils/generateID'
import ButtonDialog from '@/views/panel/filter/ButtonDialog'
import ButtonResetDialog from '@/views/panel/filter/ButtonResetDialog'
import FilterDialog from '@/views/panel/filter/FilterDialog'
import { uploadFileResult } from '@/api/staticResource/staticResource'
export default {
components: { FilterDialog, ButtonResetDialog, ButtonDialog, DeEditor },
@ -147,6 +148,7 @@ export default {
},
data() {
return {
maxImageSize: 15000000,
//
showAttrComponent: [
'custom',
@ -289,6 +291,7 @@ export default {
}
},
canvasScroll(e) {
this.scrollTop = e.target.scrollTop
this.$emit('canvasScroll', { scrollLeft: e.target.scrollLeft, scrollTop: e.target.scrollTop })
bus.$emit('onScroll')
},
@ -411,50 +414,50 @@ export default {
goFile() {
this.$refs.files.click()
},
sizeMessage() {
this.$notify({
message: this.$t('panel.image_size_tips'),
position: 'top-left'
})
},
handleFileChange(e) {
const _this = this
const file = e.target.files[0]
if (!file.type.includes('image')) {
toast('只能插入图片')
toast(this.$t('panel.image_size_tips'))
return
}
const reader = new FileReader()
reader.onload = (res) => {
const fileResult = res.target.result
const img = new Image()
img.onload = () => {
const component = {
...commonAttr,
id: generateID(),
component: 'Picture',
type: 'picture-add',
label: '图片',
icon: '',
hyperlinks: HYPERLINKS,
mobileStyle: BASE_MOBILE_STYLE,
propValue: fileResult,
commonBackground: deepCopy(COMMON_BACKGROUND),
style: {
...PIC_STYLE
}
}
component.auxiliaryMatrix = false
component.style.top = _this.dropComponentInfo.shadowStyle.y
component.style.left = _this.dropComponentInfo.shadowStyle.x
component.style.width = _this.dropComponentInfo.shadowStyle.width
component.style.height = _this.dropComponentInfo.shadowStyle.height
component['canvasId'] = this.canvasId
component['canvasPid'] = this.canvasPid
this.$store.commit('addComponent', {
component: component
})
this.$store.commit('recordSnapshot', 'handleFileChange')
}
img.src = fileResult
if (file.size > this.maxImageSize) {
this.sizeMessage()
}
reader.readAsDataURL(file)
uploadFileResult(file, (fileUrl) => {
const component = {
...commonAttr,
id: generateID(),
component: 'Picture',
type: 'picture-add',
label: '图片',
icon: '',
hyperlinks: HYPERLINKS,
mobileStyle: BASE_MOBILE_STYLE,
propValue: imgUrlTrans(fileUrl),
commonBackground: deepCopy(COMMON_BACKGROUND),
style: {
...PIC_STYLE
}
}
component.auxiliaryMatrix = false
component.style.top = _this.dropComponentInfo.shadowStyle.y
component.style.left = _this.dropComponentInfo.shadowStyle.x
component.style.width = _this.dropComponentInfo.shadowStyle.width
component.style.height = _this.dropComponentInfo.shadowStyle.height
component['canvasId'] = this.canvasId
component['canvasPid'] = this.canvasPid
this.$store.commit('addComponent', {
component: component
})
this.$store.commit('recordSnapshot', 'handleFileChange')
})
},
clearCurrentInfo() {
this.currentWidget = null

View File

@ -138,6 +138,18 @@
<span class="icon iconfont icon-icon_clear_outlined icon16" />
<span class="text14 margin-left8">{{ $t('panel.clean_canvas') }}</span>
</el-dropdown-item>
<el-dropdown-item
v-if="showWatermarkSetting"
>
<span class="icon iconfont icon-WATERMARK icon16" />
<span class="text14 margin-left8">{{ $t('panel.watermark') }}</span>
<el-switch
v-model="panelInfo.watermarkOpen"
:class="[{['grid-active']: panelInfo.watermarkOpen},'margin-left8']"
size="mini"
@change="styleChange"
/>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
@ -250,6 +262,9 @@ export default {
}
},
computed: {
showWatermarkSetting() {
return this.panelInfo.watermarkInfo && this.panelInfo.watermarkInfo.settingContent.enable && this.panelInfo.watermarkInfo.settingContent.enablePanelCustom
},
panelInfo() {
return this.$store.state.panel.panelInfo
},
@ -428,9 +443,10 @@ export default {
if (_this.$store.state.cacheStyleChangeTimes > 0) {
const requestInfo = _this.savePrepare()
const cacheRequest = {
...this.panelInfo,
...deepCopy(this.panelInfo),
...requestInfo
}
cacheRequest.watermarkInfo.settingContent = JSON.stringify(this.panelInfo.watermarkInfo.settingContent)
saveCache(cacheRequest)
_this.$store.state.cacheStyleChangeTimes = 0
}
@ -440,6 +456,7 @@ export default {
//
const requestInfo = {
id: this.panelInfo.id,
watermarkOpen: this.panelInfo.watermarkOpen,
panelStyle: JSON.stringify(this.canvasStyleData),
panelData: JSON.stringify(this.componentData)
}
@ -610,6 +627,9 @@ export default {
}
})
this.cancelMobileLayoutStatue(sourceComponentData)
},
styleChange() {
this.$store.commit('canvasChange')
}
}
}

View File

@ -1,18 +1,43 @@
<template>
<div
v-show="existLinkage"
class="bar-main"
:class="containerClass"
>
<div
v-show="isPublicLink && !isNewBlank"
class="bar-main-left"
v-if="isPublicLink"
ref="widget-div"
class="function-div"
>
<el-button
size="mini"
@click="back2Last"
><i class="icon iconfont el-icon-back" />{{ $t('chart.back') }}</el-button>
<el-button-group size="mini">
<el-button
v-if="!isNewBlank"
size="mini"
@click="back2Last"
><span><svg-icon
style="width: 12px;height: 12px"
icon-class="link-back"
/>{{ $t('pblink.back_parent') }}</span></el-button>
<el-button
v-if="existLinkage"
size="mini"
@click="clearAllLinkage"
><i class="icon iconfont icon-quxiaoliandong" />{{ $t('panel.remove_all_linkage') }}</el-button>
<el-button
size="mini"
@click="exportPDF"
>
<span><svg-icon
style="width: 12px;height: 12px"
icon-class="link-down"
/>{{ $t('panel.down') }}</span></el-button>
</el-button-group>
</div>
<div class="bar-main-right">
<div
v-else-if="existLinkage"
class="bar-main-right"
>
<el-button
size="mini"
type="warning"
@ -43,6 +68,9 @@ export default {
isNewBlank() {
return window.history.length === 1
},
containerClass() {
return this.isPublicLink ? 'trans-pc' : 'bar-main'
},
...mapState([
'componentData'
])
@ -54,6 +82,17 @@ export default {
},
back2Last() {
this.$router.back(-1)
},
exportPDF() {
this.$emit('link-export-pdf')
},
setWidgetStatus() {
if (!this.isPublicLink || !this.$refs['widget-div']) {
return
}
const val = this.$refs['widget-div'].style.display
this.$refs['widget-div'].style.display = val ? '' : 'block'
}
}
}
@ -86,4 +125,37 @@ export default {
}
}
.trans-pc {
position: absolute;
width: 60px;
right: 0;
top: 0;
border-top: 60px solid rgba(245, 74, 69, 0);
border-left: 60px solid transparent;
cursor: pointer;
z-index: 999;
.function-div {
display: none;
position: absolute;
right: 10px;
top: -50px;
width: max-content;
text-align: end;
z-index: 999;
::v-deep button:hover {
background-color: rgba(31, 35, 41, 0.1);
color: #1F2329;
font-weight: bold;
border-color: rgba(31, 35, 41, 0.1)
}
}
&:hover {
border-top: 60px solid rgba(245, 74, 69, 0);;
.function-div {
display: block;
}
}
}
</style>

View File

@ -11,6 +11,7 @@
:terminal="terminal"
:element="config"
:canvas-id="canvasId"
:chart="chart"
:show-position="showPosition"
@showViewDetails="showViewDetails"
/>
@ -65,6 +66,7 @@
:screen-shot="screenShot"
:canvas-style-data="canvasStyleData"
:show-position="showPosition"
@fill-chart-2-parent="setChartData"
/>
</div>
</div>
@ -146,7 +148,8 @@ export default {
},
data() {
return {
previewVisible: false
previewVisible: false,
chart: null
}
},
computed: {
@ -211,6 +214,9 @@ export default {
runAnimation(this.$el, this.config.animations)
},
methods: {
setChartData(chart) {
this.chart = chart
},
getStyle,
getShapeStyleIntDeDrag(style, prop) {
if (prop === 'rotate') {
@ -342,7 +348,7 @@ export default {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
width: 100% !important;
height: 100% !important;
}
</style>

View File

@ -107,6 +107,7 @@
:canvas-style-data="canvasStyleData"
@input="handleInput"
@trigger-plugin-edit="pluginEditHandler"
@fill-chart-2-parent="setChartData"
/>
</de-drag>
<!--拖拽阴影部分-->
@ -931,7 +932,7 @@ export default {
return !this.linkageSettingStatus && !this.batchOptStatus
},
showGrid() {
if (this.canvasStyleData && this.canvasStyleData.aidedDesign) {
if (this.canvasStyleData && this.canvasStyleData.aidedDesign && this.canvasId === 'canvas-main') {
return this.canvasStyleData.aidedDesign.showGrid
} else {
return false
@ -1096,6 +1097,13 @@ export default {
created() {
},
methods: {
setChartData(chart) {
this.componentData.forEach((item, index) => {
if (item.type === 'view' && item.component === 'user-view' && item.propValue.viewId === chart.id) {
this.$refs['deDragRef'][index].setChartData(chart)
}
})
},
triggerResetButton() {
this.triggerSearchButton(true)
},

View File

@ -94,7 +94,7 @@
>
<i
class="icon iconfont icon-shezhi"
style="margin-top:2px"
style="margin-top:2px; width: 16px;"
/>
</span>
</setting-menu>
@ -140,6 +140,11 @@
<i class="icon iconfont icon-com-jump" />
</a>
</span>
<map-layer-controller
v-if="chart && showMapLayerController"
:chart="chart"
/>
</div>
<!--跳转设置-->
@ -162,6 +167,7 @@
<el-dialog
:visible.sync="boardSetVisible"
width="750px"
top="5vh"
class="dialog-css"
:close-on-click-modal="false"
:show-close="false"
@ -185,9 +191,11 @@ import toast from '@/components/canvas/utils/toast'
import FieldsList from '@/components/canvas/components/editor/FieldsList'
import LinkJumpSet from '@/views/panel/linkJumpSet'
import Background from '@/views/background/index'
import MapLayerController from '@/views/chart/components/map/MapLayerController'
import { uploadFileResult } from '@/api/staticResource/staticResource'
export default {
components: { Background, LinkJumpSet, FieldsList, SettingMenu, LinkageField },
components: { Background, LinkJumpSet, FieldsList, SettingMenu, LinkageField, MapLayerController },
props: {
canvasId: {
@ -226,10 +234,15 @@ export default {
type: String,
required: false,
default: 'NotProvided'
},
chart: {
type: Object,
default: null
}
},
data() {
return {
maxImageSize: 15000000,
boardSetVisible: false,
linkJumpSetVisible: false,
linkJumpSetViewId: null,
@ -249,6 +262,13 @@ export default {
},
computed: {
yaxis() {
if (!this.chart) return []
return JSON.parse(this.chart.yaxis)
},
showMapLayerController() {
return this.curComponent.type === 'view' && this.terminal === 'pc' && this.curComponent.propValue.innerType === 'map' && this.yaxis.length > 1
},
detailsShow() {
return this.curComponent.type === 'view' && this.terminal === 'pc' && this.curComponent.propValue.innerType !== 'richTextView'
},
@ -476,20 +496,25 @@ export default {
// ignore
e.preventDefault()
},
sizeMessage() {
this.$notify({
message: this.$t('panel.image_size_tips'),
position: 'top-left'
})
},
handleFileChange(e) {
const file = e.target.files[0]
if (!file.type.includes('image')) {
toast('只能插入图片')
toast(this.$t('panel.image_size_tips'))
return
}
const reader = new FileReader()
reader.onload = (res) => {
const fileResult = res.target.result
this.curComponent.propValue = fileResult
this.$store.commit('recordSnapshot', 'handleFileChange')
if (file.size > this.maxImageSize) {
this.sizeMessage()
}
reader.readAsDataURL(file)
uploadFileResult(file, (fileUrl) => {
this.curComponent.propValue = fileUrl
this.$store.commit('recordSnapshot', 'handleFileChange')
})
},
boardSet() {
this.boardSetVisible = true
@ -519,7 +544,7 @@ export default {
background-color: var(--primary, #3370ff);
}
.bar-main i {
.bar-main ::v-deep i {
color: white;
float: right;
margin-right: 3px;

View File

@ -1,10 +1,18 @@
<template>
<div
:id="previewMainDomId"
v-loading="dataLoading"
:element-loading-text="$t('panel.data_loading')"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(220,220,220,1)"
class="bg"
:style="customStyle"
@scroll="canvasScroll"
>
<canvas-opt-bar />
<canvas-opt-bar
ref="canvas-opt-bar"
@link-export-pdf="downloadAsPDF"
/>
<div
:id="previewDomId"
:ref="previewRefId"
@ -56,6 +64,40 @@
/>
</div>
</div>
<el-dialog
v-if="pdfExportShow"
:title="'['+panelInfo.name+']'+'PDF导出'"
:visible.sync="pdfExportShow"
width="80%"
:top="'8vh'"
:destroy-on-close="true"
class="dialog-css2"
>
<span style="position: absolute;right: 70px;top:15px">
<svg-icon
icon-class="PDF"
class="ds-icon-pdf"
/>
<el-select
v-model="pdfTemplateSelectedIndex"
:placeholder="'切换PDF模板'"
@change="changePdfTemplate()"
>
<el-option
v-for="(item, index) in pdfTemplateAll"
:key="index"
:label="item.name"
:value="index"
/>
</el-select>
</span>
<PDFPreExport
:snapshot="snapshotInfo"
:panel-name="panelInfo.name"
:template-content="pdfTemplateContent"
@closePreExport="closePreExport"
/>
</el-dialog>
</div>
</template>
@ -72,11 +114,15 @@ import CanvasOptBar from '@/components/canvas/components/editor/CanvasOptBar'
import bus from '@/utils/bus'
import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch } from '@/utils/conditionUtil'
import { hasDataPermission } from '@/utils/permission'
import { activeWatermark } from '@/components/canvas/tools/watermark'
import { userLoginInfo } from '@/api/systemInfo/userLogin'
import html2canvas from 'html2canvasde'
import { queryAll } from '@/api/panel/pdfTemplate'
import PDFPreExport from '@/views/panel/export/PDFPreExport'
const erd = elementResizeDetectorMaker()
export default {
components: { ComponentWrapper, CanvasOptBar },
components: { ComponentWrapper, CanvasOptBar, PDFPreExport },
model: {
prop: 'show',
event: 'change'
@ -137,10 +183,16 @@ export default {
type: String,
require: false,
default: 'canvas-main'
},
userId: {
type: String,
require: false
}
},
data() {
return {
canvasInfoTemp: 'preview-temp-canvas-main',
previewMainDomId: 'preview-main-' + this.canvasId,
previewDomId: 'preview-' + this.canvasId,
previewRefId: 'preview-ref-' + this.canvasId,
previewTempDomId: 'preview-temp-' + this.canvasId,
@ -167,7 +219,15 @@ export default {
searchCount: 0,
// 1.pc pc 2.mobile
terminal: 'pc',
buttonFilterMap: null
buttonFilterMap: null,
pdfExportShow: false,
dataLoading: false,
exporting: false,
snapshotInfo: '',
pdfTemplateSelectedIndex: 0,
pdfTemplateContent: '',
templateInfo: {},
pdfTemplateAll: []
}
},
computed: {
@ -216,15 +276,19 @@ export default {
width: '100%'
}
if (this.canvasStyleData.openCommonStyle && this.isMainCanvas()) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
const styleInfo = this.terminal === 'mobile' && this.canvasStyleData.panel.mobileSetting && this.canvasStyleData.panel.mobileSetting.customSetting
? this.canvasStyleData.panel.mobileSetting : this.canvasStyleData.panel
if (styleInfo.backgroundType === 'image' && typeof (styleInfo.imageUrl) === 'string') {
style = {
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
background: `url(${imgUrlTrans(styleInfo.imageUrl)}) no-repeat`
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {
} else if (styleInfo.backgroundType === 'color') {
style = {
background: this.canvasStyleData.panel.color,
...style
background: styleInfo.color
}
} else {
style = {
background: '#f7f8fa'
}
}
}
@ -291,6 +355,7 @@ export default {
this.$cancelRequest('/static-resource/**')
},
mounted() {
this.initWatermark()
this._isMobile()
this.initListen()
this.$store.commit('clearLinkageSettingInfo', false)
@ -300,6 +365,7 @@ export default {
}
bus.$on('trigger-search-button', this.triggerSearchButton)
bus.$on('trigger-reset-button', this.triggerResetButton)
this.initPdfTemplate()
},
beforeDestroy() {
erd.uninstall(this.$refs[this.previewTempRefId])
@ -309,6 +375,14 @@ export default {
bus.$off('trigger-reset-button', this.triggerResetButton)
},
methods: {
initWatermark() {
if (this.panelInfo.watermarkInfo && this.canvasId === 'canvas-main') {
userLoginInfo().then(res => {
const userInfo = res.data
activeWatermark(this.panelInfo.watermarkInfo.settingContent, userInfo, 'preview-main-canvas-main', this.canvasId, this.panelInfo.watermarkOpen)
})
}
},
isMainCanvas() {
return this.canvasId === 'canvas-main'
},
@ -415,19 +489,21 @@ export default {
},
canvasStyleDataInit() {
//
this.searchCount = 0
this.timer && clearInterval(this.timer)
let refreshTime = 300000
if (this.canvasStyleData.refreshTime && this.canvasStyleData.refreshTime > 0) {
if (this.canvasStyleData.refreshUnit === 'second') {
refreshTime = this.canvasStyleData.refreshTime * 1000
} else {
refreshTime = this.canvasStyleData.refreshTime * 60000
if (this.canvasStyleData.refreshViewEnable) {
this.searchCount = 0
this.timer && clearInterval(this.timer)
let refreshTime = 300000
if (this.canvasStyleData.refreshTime && this.canvasStyleData.refreshTime > 0) {
if (this.canvasStyleData.refreshUnit === 'second') {
refreshTime = this.canvasStyleData.refreshTime * 1000
} else {
refreshTime = this.canvasStyleData.refreshTime * 60000
}
}
this.timer = setInterval(() => {
this.searchCount++
}, refreshTime)
}
this.timer = setInterval(() => {
this.searchCount++
}, refreshTime)
},
changeStyleWithScale,
getStyle,
@ -490,6 +566,9 @@ export default {
deselectCurComponent(e) {
if (!this.isClickComponent) {
this.$store.commit('setCurComponent', { component: null, index: null })
if (this.$refs?.['canvas-opt-bar']) {
this.$refs['canvas-opt-bar'].setWidgetStatus()
}
}
},
handleMouseDown() {
@ -525,6 +604,36 @@ export default {
})
}
}, 1500)
},
downloadAsPDF() {
this.dataLoading = true
const domId = this.canvasInfoTemp
setTimeout(() => {
this.exporting = true
setTimeout(() => {
html2canvas(document.getElementById(domId)).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 1) //
this.dataLoading = false
this.exporting = false
if (snapshot !== '') {
this.snapshotInfo = snapshot
this.pdfExportShow = true
}
})
}, 1500)
}, 500)
},
closePreExport() {
this.pdfExportShow = false
},
changePdfTemplate() {
this.pdfTemplateContent = this.pdfTemplateAll[this.pdfTemplateSelectedIndex] ? this.pdfTemplateAll[this.pdfTemplateSelectedIndex].templateContent : ''
},
initPdfTemplate() {
queryAll().then(res => {
this.pdfTemplateAll = res.data
this.changePdfTemplate()
})
}
}
}

View File

@ -89,6 +89,7 @@
:search-count="searchCount"
@onChartClick="chartClick"
@onJumpClick="jumpClick"
@onPageChange="pageClick"
/>
<table-normal
v-else-if="tableShowFlag"
@ -96,6 +97,7 @@
:show-summary="chart.type === 'table-normal'"
:chart="chart"
class="table-class"
@onPageChange="pageClick"
/>
<label-normal
v-else-if="labelShowFlag"
@ -331,7 +333,13 @@ export default {
sourceCustomStyleStr: null,
// obj
sourceCustomStyle: null,
scale: 1
scale: 1,
currentPage: {
page: 1,
pageSize: 20,
show: 0
},
view: {}
}
},
@ -518,6 +526,9 @@ export default {
this.chartScale(this.changeScaleIndex)
},
deep: true
},
'chart.yaxis': function(newVal, oldVal) {
this.$emit('fill-chart-2-parent', this.chart)
}
},
mounted() {
@ -628,6 +639,10 @@ export default {
param.viewId && param.viewId === this.element.propValue.viewId && this.addViewTrackFilter(param)
},
viewInCache(param) {
this.view = param.view
if (this.view && this.view.customAttr) {
this.currentPage.pageSize = parseInt(JSON.parse(this.view.customAttr).size.tablePageSize)
}
param.viewId && param.viewId === this.element.propValue.viewId && this.getDataEdit(param)
},
clearPanelLinkage(param) {
@ -687,10 +702,19 @@ export default {
// method = viewInfo
requestInfo.proxy = { userId: this.panelInfo.proxy }
}
// table-info
if (this.view && this.view.customAttr) {
const attrSize = JSON.parse(this.view.customAttr).size
if (this.chart.type === 'table-info' && this.view.datasetMode === 0 && (!attrSize.tablePageMode || attrSize.tablePageMode === 'page')) {
requestInfo.goPage = this.currentPage.page
requestInfo.pageSize = this.currentPage.pageSize
}
}
method(id, this.panelInfo.id, requestInfo).then(response => {
// echart
if (response.success) {
this.chart = response.data
this.$emit('fill-chart-2-parent', this.chart)
this.getDataOnly(response.data, dataBroadcast)
this.chart['position'] = this.inTab ? 'tab' : 'panel'
//
@ -1132,11 +1156,20 @@ export default {
getDataOnly(sourceResponseData, dataBroadcast) {
if (this.isEdit) {
if ((this.filter.filter && this.filter.filter.length) || (this.filter.linkageFilters && this.filter.linkageFilters.length)) {
viewData(this.chart.id, this.panelInfo.id, {
const requestInfo = {
filter: [],
drill: [],
queryFrom: 'panel'
}).then(response => {
}
// table-info
if (this.view && this.view.customAttr) {
const attrSize = JSON.parse(this.view.customAttr).size
if (this.chart.type === 'table-info' && this.view.datasetMode === 0 && (!attrSize.tablePageMode || attrSize.tablePageMode === 'page')) {
requestInfo.goPage = this.currentPage.page
requestInfo.pageSize = this.currentPage.pageSize
}
}
viewData(this.chart.id, this.panelInfo.id, requestInfo).then(response => {
this.componentViewsData[this.chart.id] = response.data
if (dataBroadcast) {
bus.$emit('prop-change-data')
@ -1149,6 +1182,10 @@ export default {
}
}
}
},
pageClick(page) {
this.currentPage = page
this.getData(this.element.propValue.viewId, false)
}
}
}

View File

@ -0,0 +1,154 @@
// 动态创建水印元素的封装函数
export function watermark(settings, domId) {
const watermarkDom = document.getElementById(domId)
// 默认设置
const defaultSettings = {
watermark_txt: '',
watermark_x: 20, // 水印起始位置x轴坐标
watermark_y: 20, // 水印起始位置Y轴坐标
watermark_rows: 20, // 水印行数
watermark_cols: 20, // 水印列数
watermark_x_space: 100, // 水印x轴间隔
watermark_y_space: 50, // 水印y轴间隔
watermark_color: '#aaa', // 水印字体颜色
watermark_alpha: 0.4, // 水印透明度
watermark_fontsize: '15px', // 水印字体大小
watermark_font: '微软雅黑', // 水印字体
watermark_width: 210, // 水印宽度
watermark_height: 80, // 水印长度
watermark_angle: 20 // 水印倾斜度数
}
// 根据函数的入参调整设置
if (settings && typeof settings === 'object') {
const src = settings || {}
for (const key in src) {
if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key]) {
continue
} else if (src[key]) defaultSettings[key] = src[key]
}
}
// 创建虚拟节点对象,在该节点对象中可以放元素,最后只需在页面中添加该节点对象即可。可提高性能
const oTemp = document.createElement('p')
// 获取页面最大宽度
let page_width = watermarkDom.clientWidth
const cutWidth = page_width * 0.0150
page_width = page_width - cutWidth
// 获取页面最大高度
let page_height = watermarkDom.clientHeight - 56
page_height = page_height < 400 ? 400 : page_height
// page_height = Math.max(page_height, window.innerHeight - 30)
// 如果将水印列数设置为0或水印列数设置过大超过页面最大宽度则重新计算水印列数和水印x轴间隔
if (defaultSettings.watermark_cols === 0 || (parseInt(defaultSettings.watermark_x + defaultSettings.watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space * (defaultSettings.watermark_cols - 1)) > page_width)) {
defaultSettings.watermark_cols = parseInt((page_width - defaultSettings.watermark_x + defaultSettings.watermark_x_space) / (defaultSettings.watermark_width + defaultSettings.watermark_x_space))
defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x - defaultSettings.watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1))
}
// 如果将水印行数设置为0或水印行数设置过大超过页面最大长度则重新计算水印行数和水印y轴间隔
if (defaultSettings.watermark_rows === 0 || (parseInt(defaultSettings.watermark_y + defaultSettings.watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (defaultSettings.watermark_rows - 1)) > page_height)) {
defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height - defaultSettings.watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space))
defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) - defaultSettings.watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1))
}
defaultSettings.watermark_rows = defaultSettings.watermark_rows < 2 ? 2 : defaultSettings.watermark_rows
defaultSettings.watermark_cols = defaultSettings.watermark_cols < 2 ? 2 : defaultSettings.watermark_cols
let x
let y
for (let i = 0; i < defaultSettings.watermark_rows; i++) {
y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i
for (let j = 0; j < defaultSettings.watermark_cols; j++) {
x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j
const mask_div = document.createElement('div')
mask_div.id = 'mask_div' + i + j
mask_div.className = 'mask_div'
mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt))
// 设置水印div倾斜显示
mask_div.style.webkitTransform = 'rotate(-' + defaultSettings.watermark_angle + 'deg)'
mask_div.style.MozTransform = 'rotate(-' + defaultSettings.watermark_angle + 'deg)'
mask_div.style.msTransform = 'rotate(-' + defaultSettings.watermark_angle + 'deg)'
mask_div.style.OTransform = 'rotate(-' + defaultSettings.watermark_angle + 'deg)'
mask_div.style.transform = 'rotate(-' + defaultSettings.watermark_angle + 'deg)'
mask_div.style.visibility = ''
mask_div.style.position = 'absolute'
mask_div.style.left = x + 'px'
mask_div.style.top = y + 'px'
mask_div.style.overflow = 'hidden'
mask_div.style.zIndex = '9999'
// 让水印不遮挡页面的点击事件
mask_div.style.pointerEvents = 'none'
mask_div.style.opacity = defaultSettings.watermark_alpha
mask_div.style.fontSize = defaultSettings.watermark_fontsize
mask_div.style.fontFamily = defaultSettings.watermark_font
mask_div.style.color = defaultSettings.watermark_color
mask_div.style.textAlign = 'center'
mask_div.style.width = defaultSettings.watermark_width + 'px'
mask_div.style.height = defaultSettings.watermark_height + 'px'
mask_div.style.display = 'block'
oTemp.appendChild(mask_div)
}
}
oTemp.setAttribute('id', 'de-watermark-server')
watermarkDom.appendChild(oTemp)
}
export function getNow() {
const d = new Date()
const year = d.getFullYear()
const month = change(d.getMonth() + 1)
const day = change(d.getDate())
const hour = change(d.getHours())
const minute = change(d.getMinutes())
function change(t) {
if (t < 10) {
return '0' + t
} else {
return t
}
}
const time = year + '-' + month + '-' + day + ' ' + hour + ':' + minute
return time
}
export function activeWatermark(watermarkForm, userLoginInfo, domId, canvasId, watermarkOpen) {
// 清理历史水印
const historyWatermarkDom = document.getElementById('de-watermark-server')
if (historyWatermarkDom) {
historyWatermarkDom.remove()
}
if (!(canvasId === 'canvas-main' && ((watermarkForm.enable && !watermarkForm.enablePanelCustom) ||
(watermarkForm.enable && watermarkOpen)))) {
return
}
let watermark_txt
let watermark_width = 120
if (watermarkForm.type === 'custom') {
watermark_txt = watermarkForm.content
watermark_txt = watermark_txt.replaceAll('${ip}', userLoginInfo.ip)
watermark_txt = watermark_txt.replaceAll('${userName}', userLoginInfo.userInfo.userName)
watermark_txt = watermark_txt.replaceAll('${nickName}', userLoginInfo.userInfo.nickName)
watermark_txt = watermark_txt.replaceAll('${time}', getNow())
watermark_width = watermark_txt.length * watermarkForm.watermark_fontsize * 0.75
watermark_width = watermark_width > 350 ? 350 : watermark_width
} else if (watermarkForm.type === 'nickName') {
watermark_txt = userLoginInfo.userInfo.nickName
} else if (watermarkForm.type === 'ip') {
watermark_txt = userLoginInfo.ip
watermark_width = 150
} else if (watermarkForm.type === 'time') {
watermark_txt = getNow()
watermark_width = 200
} else {
watermark_txt = userLoginInfo.userInfo.userName
}
const settings = {
watermark_txt: watermark_txt,
watermark_width: watermark_width,
watermark_color: watermarkForm.watermark_color,
watermark_x_space: watermarkForm.watermark_x_space,
watermark_y_space: watermarkForm.watermark_y_space,
watermark_fontsize: watermarkForm.watermark_fontsize + 'px'
}
watermark(settings, domId)
}
export default { watermark, getNow, activeWatermark }

View File

@ -1,14 +1,13 @@
import {
BASE_MOBILE_STYLE, COMMON_BACKGROUND_NONE,
BASE_MOBILE_STYLE,
COMMON_BACKGROUND_NONE,
HYPERLINKS
} from '@/components/canvas/customComponent/component-list'
import {
ApplicationContext
} from '@/utils/ApplicationContext'
import { ApplicationContext } from '@/utils/ApplicationContext'
import { uuid } from 'vue-uuid'
import store from '@/store'
import { AIDED_DESIGN, PANEL_CHART_INFO, TAB_COMMON_STYLE } from '@/views/panel/panel'
import { AIDED_DESIGN, MOBILE_SETTING, PANEL_CHART_INFO, TAB_COMMON_STYLE } from '@/views/panel/panel'
import html2canvas from 'html2canvasde'
export function deepCopy(target) {
@ -49,6 +48,7 @@ export function toTop(arr, i, j) {
export function toBottom(arr, i) {
arr.unshift(arr.splice(i, 1)[0])
}
export function $(selector) {
return document.querySelector(selector)
}
@ -80,11 +80,13 @@ export function panelDataPrepare(componentData, componentStyle, callback) {
componentStyle.refreshTime = (componentStyle.refreshTime || 5)
componentStyle.refreshViewLoading = (componentStyle.refreshViewLoading || false)
componentStyle.refreshUnit = (componentStyle.refreshUnit || 'minute')
componentStyle.refreshViewEnable = (componentStyle.refreshViewEnable === undefined ? true : componentStyle.refreshViewEnable)
componentStyle.aidedDesign = (componentStyle.aidedDesign || deepCopy(AIDED_DESIGN))
componentStyle.chartInfo = (componentStyle.chartInfo || deepCopy(PANEL_CHART_INFO))
componentStyle.chartInfo.tabStyle = (componentStyle.chartInfo.tabStyle || deepCopy(TAB_COMMON_STYLE))
componentStyle.themeId = (componentStyle.themeId || 'NO_THEME')
componentStyle.panel.themeColor = (componentStyle.panel.themeColor || 'light')
componentStyle.panel.mobileSetting = (componentStyle.panel.mobileSetting || MOBILE_SETTING)
componentData.forEach((item, index) => {
if (item.component && item.component === 'de-date') {
const widget = ApplicationContext.getService(item.serviceName)
@ -209,8 +211,11 @@ export function exportImg(imgName) {
}
export function dataURLToBlob(dataurl) { // ie 图片转格式
const arr = dataurl.split(','); const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1]); let n = bstr.length; const u8arr = new Uint8Array(n)
const arr = dataurl.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}

View File

@ -39,6 +39,7 @@
:active-model="'edit'"
:canvas-id="canvasId"
:element="element"
:chart="chart"
@showViewDetails="showViewDetails"
@amRemoveItem="amRemoveItem"
@amAddItem="amAddItem"
@ -384,6 +385,7 @@ export default {
},
data: function() {
return {
chart: null,
contentDisplay: true,
// tab
parentWidthTabOffset: 40,
@ -802,6 +804,9 @@ export default {
this.beforeDestroyFunction()
},
methods: {
setChartData(chart) {
this.chart = chart
},
//
resetBoundsAndMouseState() {
this.mouseClickPosition = { mouseX: 0, mouseY: 0, x: 0, y: 0, w: 0, h: 0 }
@ -1929,6 +1934,7 @@ export default {
const nodes = this.$el.parentNode.childNodes //
for (const item of nodes) {
if (
item.tagName !== 'svg' &&
item.className !== undefined &&
!item.className.split(' ').includes(this.classNameActive) &&
item.getAttribute('tab-is-check') !== null &&
@ -2114,8 +2120,8 @@ export default {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
width: 100% !important;
height: 100% !important;
}
.drag-on-tab-collision {

View File

@ -139,6 +139,10 @@ export default {
this.innerValues = this.value
this.viewLoaded = false
this.panelId && findOne(this.panelId).then(response => {
const watermarkInfo = {
...response.data.watermarkInfo,
settingContent: JSON.parse(response.data.watermarkInfo.settingContent)
}
this.panelInfo = {
id: response.data.id,
name: response.data.name,
@ -148,7 +152,9 @@ export default {
createBy: response.data.createBy,
createTime: response.data.createTime,
updateBy: response.data.updateBy,
updateTime: response.data.updateTime
updateTime: response.data.updateTime,
watermarkOpen: response.data.watermarkOpen,
watermarkInfo: watermarkInfo
}
this.$store.dispatch('panel/setPanelInfo', this.panelInfo)
panelDataPrepare(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle), rsp => {

View File

@ -1,115 +1,13 @@
<template>
<span>
<el-dropdown
trigger="click"
size="mini"
@command="clickItem"
<span class="">
<el-tag
size="small"
closable
class="item-axis"
@close="removeItem"
>
<span class="el-dropdown-link">
<el-tag
size="small"
class="item-axis"
>
{{ item.name }}<i class="el-icon-arrow-down el-icon--right" />
</el-tag>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-if="isSortWidget"
:disabled="disabledSort"
:command="beforeClickItem('none')"
>
<span
class="de-sort-menu"
:class="!disabledSort && (!sortNode || sortNode.sort === 'none') ? 'de-active-li': ''"
>{{
$t('chart.none')
}}</span>
</el-dropdown-item>
<el-dropdown-item
v-if="isSortWidget"
:disabled="disabledSort"
:command="beforeClickItem('asc')"
>
<span
v-popover:popoverasc
class="el-dropdown-link inner-dropdown-menu de-sort-menu"
:class="!disabledSort && sortNode.sort === 'asc' ? 'de-active-li': ''"
>
<span>
<span>{{ $t('chart.asc') }}</span>
</span>
<i class="el-icon-arrow-right el-icon--right" />
</span>
<el-popover
ref="popoverasc"
v-model="ascFieldsShow"
placement="right-start"
width="120"
:close-delay="500"
trigger="hover"
>
<ul class="de-ul">
<li
v-for="(node, i) in allFields"
:key="node.id"
:index="i"
class="de-sort-field-span"
:class="sortNode.sort === 'asc' && sortNode.id === node.id ? 'de-active-li': ''"
@click="saveAscField(node)"
>
<span>{{ node.name }}</span>
</li>
</ul>
</el-popover>
</el-dropdown-item>
<el-dropdown-item
v-if="isSortWidget"
:disabled="disabledSort"
:command="beforeClickItem('desc')"
>
<span
v-popover:popoverdesc
class="el-dropdown-link inner-dropdown-menu de-sort-menu"
:class="!disabledSort && sortNode.sort === 'desc' ? 'de-active-li': ''"
>
<span>
<span>{{ $t('chart.desc') }}</span>
</span>
<i class="el-icon-arrow-right el-icon--right" />
</span>
<el-popover
ref="popoverdesc"
v-model="descFieldsShow"
placement="right-start"
width="120"
:close-delay="500"
trigger="hover"
>
<ul class="de-ul">
<li
v-for="(node, i) in allFields"
:key="node.id"
:index="i"
class="de-sort-field-span"
:class="sortNode.sort === 'desc' && sortNode.id === node.id ? 'de-active-li': ''"
@click="saveDescField(node)"
>
<span>{{ node.name }}</span>
</li>
</ul>
</el-popover>
</el-dropdown-item>
<el-dropdown-item
:divided="isSortWidget"
icon="el-icon-delete"
:command="beforeClickItem('remove')"
>
<span class="de-delete-field">{{ $t('chart.delete') }}</span>
</el-dropdown-item>
<slot />
</el-dropdown-menu>
</span>
</el-dropdown>
{{ item.name }}
</el-tag>
</span>
</template>
@ -124,103 +22,34 @@ export default {
index: {
type: Number,
required: true
},
allFields: {
type: Array,
default: () => []
},
sort: {
type: Object,
default: () => null
},
isSortWidget: {
type: Boolean,
default: false
}
},
data() {
return {
radio: 0,
ascFieldsShow: false,
descFieldsShow: false,
defaultSortProp: {
sort: 'none'
},
sortNode: null
}
},
computed: {
disabledSort() {
return this.index > 0
}
},
watch: {
index(val, old) {
/* index(val, old) {
if (val !== old) {
this.sortChange('none')
}
}
} */
},
mounted() {
},
created() {
if (!this.sortNode) {
this.sortNode = this.sort && this.sort.id ? JSON.parse(JSON.stringify(this.sort)) : JSON.parse(JSON.stringify(this.defaultSortProp))
}
},
methods: {
clickItem(param) {
if (!param) {
return
}
switch (param.type) {
case 'none':
this.sortChange('none')
break
case 'asc':
this.sortChange('asc')
break
case 'desc':
this.sortChange('desc')
break
case 'remove':
this.removeItem()
break
default:
break
}
},
beforeClickItem(type) {
return {
type: type
}
},
removeItem() {
this.item.index = this.index
this.$emit('closeItem', this.item)
},
saveAscField({ id, name }) {
this.ascFieldsShow = false
const sort = 'asc'
this.sortNode = { id, name, sort }
this.$emit('sort-change', this.sortNode)
},
saveDescField({ id, name }) {
this.descFieldsShow = false
const sort = 'desc'
this.sortNode = { id, name, sort }
this.$emit('sort-change', this.sortNode)
},
sortChange(type) {
this.sortNode.sort = type
if (type === 'none') {
this.sortNode = { sort: 'none' }
}
this.$emit('sort-change', this.sortNode)
}
}
@ -249,51 +78,4 @@ span {
font-size: 12px;
}
.de-ul li {
margin: 5px 2px;
cursor: pointer;
&:hover {
color: #409EFF;
border-color: rgb(198, 226, 255);
background-color: rgb(236, 245, 255);
}
&:before {
content: "";
width: 6px;
height: 6px;
display: inline-block;
border-radius: 50%;
vertical-align: middle;
margin-right: 5px;
}
}
.de-active-li {
&:before {
background: #409EFF;
}
}
.de-sort-menu::before {
content: "";
width: 6px;
height: 6px;
display: inline-block;
border-radius: 50%;
vertical-align: middle;
margin-right: 5px;
}
.de-delete-field {
margin-left: 4px;
}
.de-sort-field-span {
display: inline-flexbox;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

View File

@ -43,11 +43,10 @@
import ElVisualSelect from '@/components/elVisualSelect'
import { linkMultFieldValues, multFieldValues } from '@/api/dataset/dataset'
import bus from '@/utils/bus'
import { isSameVueObj } from '@/utils'
import { isSameVueObj, mergeCustomSortOption } from '@/utils'
import { getLinkToken, getToken } from '@/utils/auth'
import customInput from '@/components/widget/deWidget/customInput'
import { textSelectWidget } from '@/components/widget/deWidget/serviceNameFn.js'
export default {
components: { ElVisualSelect },
mixins: [customInput],
@ -123,6 +122,9 @@ export default {
const i18nKey = this.element.options.attrs.multiple ? 'panel.multiple_choice' : 'panel.single_choice'
const i18nValue = this.$t(i18nKey)
return '(' + i18nValue + ')'
},
isCustomSortWidget() {
return this.element.serviceName === 'textSelectWidget'
}
},
@ -347,7 +349,11 @@ export default {
},
optionData(data) {
if (!data) return null
return data.filter(item => !!item).map(item => {
let tempData = data.filter(item => !!item)
if (this.isCustomSortWidget && this.element.options.attrs?.sort?.sort === 'custom') {
tempData = mergeCustomSortOption(this.element.options.attrs.sort.list, tempData)
}
return tempData.map(item => {
return {
id: item,
text: item

View File

@ -58,7 +58,7 @@ export default {
mounted() {
if (!this.isFilterComponent) return
this.typeTransform().forEach(item => {
const nodeCache = this.$refs.deOutWidget?.$refs[item].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget.$refs[item].$el
const nodeCache = this.$refs.deOutWidget?.$refs[item].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget?.$refs[item].$el
this.styleAttrs.forEach(ele => {
nodeCache.style[this.attrsMap[ele]] = this.element.style[ele]
this[this.element.serviceName] && this[this.element.serviceName](this.selectRange(item), ele, this.element.style[ele])
@ -70,9 +70,11 @@ export default {
let nodeCache = ''
this.styleAttrs.forEach(ele => {
if (!nodeCache) {
nodeCache = this.$refs.deOutWidget?.$refs[type].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget.$refs[type].$el
nodeCache = this.$refs.deOutWidget?.$refs[type].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget?.$refs[type].$el
}
if (nodeCache) {
nodeCache.style[this.attrsMap[ele]] = newValue[ele]
}
nodeCache.style[this.attrsMap[ele]] = newValue[ele]
this[this.element.serviceName] && this[this.element.serviceName](this.selectRange(type), ele, newValue[ele])
})
},

View File

@ -99,6 +99,9 @@ class TextSelectServiceImpl extends WidgetService {
isSortWidget() {
return true
}
isCustomSortWidget() {
return true
}
fillValueDerfault(element) {
const defaultV = element.options.value === null ? '' : element.options.value.toString()

View File

@ -0,0 +1,4 @@
<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.09092 7.00066L7.51207 12.4218C7.64225 12.552 7.64225 12.763 7.51207 12.8932L7.04067 13.3646C6.91049 13.4948 6.69944 13.4948 6.56926 13.3646L0.676707 7.47206C0.416358 7.21171 0.416358 6.7896 0.676707 6.52925L6.56926 0.636694C6.69944 0.506519 6.91049 0.506519 7.04067 0.636694L7.51207 1.1081C7.64225 1.23827 7.64225 1.44933 7.51207 1.5795L2.09092 7.00066Z" fill="#1F2329" />
</svg>

After

Width:  |  Height:  |  Size: 490 B

View File

@ -0,0 +1,4 @@
<svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 11.3327V12.9994C12 13.3675 11.7015 13.666 11.3333 13.666H0.666667C0.298477 13.666 0 13.3675 0 12.9994V11.3327C0 11.1486 0.149238 10.9994 0.333333 10.9994H1C1.18409 10.9994 1.33333 11.1486 1.33333 11.3327V12.3327H10.6667V11.3327C10.6667 11.1486 10.8159 10.9994 11 10.9994H11.6667C11.8508 10.9994 12 11.1486 12 11.3327ZM6.66667 8.35649L8.67365 6.34952C8.80382 6.21934 9.01488 6.21934 9.14505 6.34952L9.61646 6.82092C9.74663 6.95109 9.74663 7.16215 9.61646 7.29232L6.31663 10.5922C6.25154 10.6572 6.16623 10.6898 6.08092 10.6898C5.99562 10.6898 5.91031 10.6572 5.84522 10.5922L2.54539 7.29232C2.41521 7.16215 2.41521 6.95109 2.54539 6.82092L3.01679 6.34952C3.14697 6.21934 3.35802 6.21934 3.4882 6.34952L5.33334 8.19465V0.999349C5.33334 0.815254 5.48257 0.666016 5.66667 0.666016H6.33334C6.51743 0.666016 6.66667 0.815254 6.66667 0.999349V8.35649Z" fill="#1F2329" />
</svg>

After

Width:  |  Height:  |  Size: 984 B

View File

@ -813,7 +813,7 @@ export default {
front_time_out: 'Request timeOut(unit: second, Attention: Refresh browser takes effect after saving)',
msg_time_out: 'Message retention time(unit: day)',
login_type: 'Default login type',
empty_front: 'If empty then default value is 10s',
empty_front: 'If empty then default value is 100s',
empty_msg: 'If empty then default value is 30 days',
front_error: 'Valid range [0 - 300]', // 修改了提示信息
msg_error: 'Valid range [1 - 365]',
@ -915,6 +915,7 @@ export default {
password_input_error: 'Original password input error'
},
chart: {
layer_controller: 'Quota switch',
suspension: 'Suspension',
chart_background: 'Component background',
solid_color: 'Solid color',
@ -1440,7 +1441,12 @@ export default {
proportion: 'Proportion',
label_content: 'Label Content',
percent: 'Percent',
table_index_desc: 'Index Header Name'
table_index_desc: 'Index Header Name',
total_sort: 'Total Sort',
total_sort_none: 'None',
total_sort_asc: 'ASC',
total_sort_desc: 'DESC',
total_sort_field: 'Sort Field'
},
dataset: {
spend_time: 'Spend',
@ -1450,7 +1456,7 @@ export default {
field_rename: 'Rename Field',
params_work: 'Effective only when editing SQL',
sql_variable_limit_1: '1、SQL variables can only be used in where conditions',
sql_variable_limit_2: "2、Exampleselect * from table_name where column_name1='${param_name1}' and column_name2 in '${param_name2}'",
sql_variable_limit_2: '2、Exampleselect * from table_name where column_name1=\'${param_name1}\' and column_name2 in \'${param_name2}\'',
select_year: 'Select Year',
select_month: 'Select Month',
select_date: 'Select Date',
@ -1861,13 +1867,33 @@ export default {
input_placeholder: 'Please enter the 4-digits-letters',
pwd_error: 'Wrong password',
pwd_format_error: 'Please enter the 4-digits-letters',
sure_bt: 'Confirm'
sure_bt: 'Confirm',
back_parent: 'Back to previous'
},
panel: {
to_top: 'To Top',
down: 'Down',
mobile_style_setting: 'Style setting',
mobile_style_setting_tips: 'Customize the mobile background',
board: 'Border',
text: 'Text',
board_background: 'Background',
title_color: 'Title color',
input_style: 'Input box style (color)',
overall_setting: 'Overall setting',
panel_background: 'Panel background',
component_color: 'Component color',
chart_title: 'Chart title',
filter_component: 'Filter component',
enable_refresh_view: 'Enable refresh',
enable_view_loading: 'View loading prompt',
image_size_tips: 'Please do not exceed 15M in the picture',
image_add_tips: 'Only pictures can be inserted',
watermark: 'Watermark',
panel_get_data_error: 'Failed to obtain panel information. The panel may have been deleted. Please check the panel status',
panel_no_save_tips: 'There are unsaved panel',
panel_cache_use_tips: 'It was checked that the last dashboard could not be saved normally. Do you want to use the panel that was not saved last time?',
template_name_tips: "Panel\'s name should not be null",
template_name_tips: 'Panel\'s name should not be null',
panel_background_item: 'Customize panel background',
panel_background_image_tips: 'Currently.Jpeg,.Jpg,.Png,.Gif files are supported, and the size should not exceed 15m',
reUpload: 'reUpload',
@ -1933,15 +1959,15 @@ export default {
repeat_params: 'Repeat Params Exist',
enable_outer_param_set: 'Enable Outer Param Set',
select_param: 'Please Select Param...',
add_param_link_field: "Add Params' Linked Field",
add_param_link_field: 'Add Params\' Linked Field',
add_param: 'Add Param',
enable_param: 'Enable Param',
param_name: 'Param Name',
outer_param_set: 'Outer Param Set',
outer_param_decode_error: 'External Parameter Parsing Error And Does Not Take Effect, Please Check',
input_param_name: "Please Input Param's Name",
input_param_name: 'Please Input Param\'s Name',
params_setting: 'Outer Params Setting',
template_view_tips: "Template's Views. Please Change",
template_view_tips: 'Template\'s Views. Please Change',
edit_web_tips: 'The Inner Event Can Be Used When Then Panel Not In Edit Status',
no_auth_role: 'Unshared roles',
auth_role: 'Shared roles',
@ -2097,8 +2123,8 @@ export default {
content_style: 'Content Style',
canvas_self_adaption: 'Canvas Self Adaption',
panel_save_tips: 'Do you want to save the changes you made to.',
panel_save_warn_tips: "Your changes will be lost if you don't save them",
do_not_save: "Don't Save",
panel_save_warn_tips: 'Your changes will be lost if you don\'t save them',
do_not_save: 'Don\'t Save',
save_and_close: 'Save',
drill: 'drill',
linkage: 'linkage',
@ -2519,7 +2545,9 @@ export default {
pixel_tip: 'Please code custom pixel(such as 2560 * 1600) or select',
task_type: 'Task type',
range_view: 'Displayed data',
range_all: 'All data'
range_all: 'All data',
execute_now: 'Execute now',
fire_now_success: 'Task executing'
},
dynamic_time: {
set_default: 'Set Default',

View File

@ -813,7 +813,7 @@ export default {
front_time_out: '請求超時時間(單位:秒, 註意:保存後刷新瀏覽器生效)',
msg_time_out: '消息保留時間(單位:天)',
login_type: '默認登錄方式',
empty_front: '為空則默認取值10秒',
empty_front: '為空則默認取值100秒',
empty_msg: '為空則默認取值30天',
front_error: '請填寫0-300正整數', // 修改了提示信息
msg_error: '請填寫1-365正整數',
@ -915,6 +915,7 @@ export default {
password_input_error: '原始密碼輸入錯誤'
},
chart: {
layer_controller: '指標切換',
suspension: '懸浮',
chart_background: '組件背景',
solid_color: '純色',
@ -1440,7 +1441,12 @@ export default {
proportion: '佔比',
label_content: '標籤展示',
percent: '占比',
table_index_desc: '表頭名稱'
table_index_desc: '表頭名稱',
total_sort: '總計排序',
total_sort_none: '無',
total_sort_asc: '升序',
total_sort_desc: '降序',
total_sort_field: '排序字段'
},
dataset: {
spend_time: '耗時',
@ -1450,7 +1456,7 @@ export default {
field_rename: '字段重命名',
params_work: '僅在編輯 sql 時生效',
sql_variable_limit_1: '1、SQL變數只能在WHERE條件中使用',
sql_variable_limit_2: "2、示例select * from table_name where column_name1='${param_name1}' and column_name2 in '${param_name2}'",
sql_variable_limit_2: '2、示例select * from table_name where column_name1=\'${param_name1}\' and column_name2 in \'${param_name2}\'',
selesql_variable_limit_2ct_year: '選擇年',
select_month: '選擇月',
select_date: '選擇日期',
@ -1861,9 +1867,29 @@ export default {
input_placeholder: '請輸入4位數字或字母',
pwd_error: '密碼錯誤',
pwd_format_error: '請輸入4位數字或字母',
sure_bt: '確定'
sure_bt: '確定',
back_parent: '返回上一級'
},
panel: {
to_top: '置頂',
down: '下載',
mobile_style_setting: '樣式設置',
mobile_style_setting_tips: '自定義移動端背景',
board: '邊框',
text: '文字',
board_background: '背景',
title_color: '標題顏色',
input_style: '輸入框樣式(顏色)',
overall_setting: '整體配置',
panel_background: '儀表板背景',
component_color: '組件配色',
chart_title: '圖表標題',
filter_component: '過濾組件',
enable_refresh_view: '開啟刷新',
enable_view_loading: '視圖加載提示',
image_size_tips: '圖片請不要大於15M',
image_add_tips: '只能插入圖片',
watermark: '水印',
panel_get_data_error: '獲取儀表板信息失敗,儀表板可能已經被刪除,請檢查儀表板狀態',
panel_no_save_tips: '存在未保存的儀表板',
panel_cache_use_tips: '檢查到上次有儀表板未能正常保存,是否使用上次未保存的儀表板?',
@ -2520,7 +2546,9 @@ export default {
pixel_tip: '可直接輸入分辨率(例如:2560 * 1600)或者選擇',
task_type: '任務類型',
range_view: '展示數據',
range_all: '全部數據'
range_all: '全部數據',
execute_now: '立即執行',
fire_now_success: '任務發起成功'
},
dynamic_time: {
set_default: '設置默認值',

View File

@ -812,7 +812,7 @@ export default {
front_time_out: '请求超时时间(单位:秒, 注意:保存后刷新浏览器生效)',
msg_time_out: '消息保留时间(单位:天)',
login_type: '默认登录方式',
empty_front: '为空则默认取10秒',
empty_front: '为空则默认取100秒',
empty_msg: '为空则默认取30天',
front_error: '请填写0-300正整数', // 修改了提示信息
msg_error: '请填写1-365正整数',
@ -914,6 +914,7 @@ export default {
password_input_error: '原始密码输入错误'
},
chart: {
layer_controller: '指标切换',
suspension: '悬浮',
chart_background: '组件背景',
solid_color: '纯色',
@ -1439,7 +1440,12 @@ export default {
proportion: '占比',
label_content: '标签展示',
percent: '占比',
table_index_desc: '表头名称'
table_index_desc: '表头名称',
total_sort: '总计排序',
total_sort_none: '无',
total_sort_asc: '升序',
total_sort_desc: '降序',
total_sort_field: '排序字段'
},
dataset: {
spend_time: '耗时',
@ -1450,7 +1456,7 @@ export default {
params_work: '仅在编辑sql时生效',
select_year: '选择年',
sql_variable_limit_1: '1、SQL 变量只能在 WHERE 条件中使用',
sql_variable_limit_2: "2、示例select * from table_name where column_name1='${param_name1}' and column_name2 in '${param_name2}'",
sql_variable_limit_2: '2、示例select * from table_name where column_name1=\'${param_name1}\' and column_name2 in \'${param_name2}\'',
select_month: '选择月',
select_date: '选择日期',
select_time: '选择时间',
@ -1861,9 +1867,29 @@ export default {
input_placeholder: '请输入4位数字或字母',
pwd_error: '密码错误',
pwd_format_error: '请输入4位数字或字母',
sure_bt: '确定'
sure_bt: '确定',
back_parent: '返回上一级'
},
panel: {
to_top: '置顶',
down: '下载',
mobile_style_setting: '样式设置',
mobile_style_setting_tips: '自定义移动端背景',
board: '边框',
text: '文字',
board_background: '背景',
title_color: '标题颜色',
input_style: '输入框样式(颜色)',
overall_setting: '整体配置',
panel_background: '仪表板背景',
component_color: '组件配色',
chart_title: '图表标题',
filter_component: '过滤组件',
enable_refresh_view: '开启刷新',
enable_view_loading: '视图加载提示',
image_size_tips: '图片请不要大于15M',
image_add_tips: '只能插入图片',
watermark: '水印',
panel_get_data_error: '获取仪表板信息失败,仪表板可能已经被删除,请检查仪表板状态',
panel_no_save_tips: '存在未保存的仪表板',
panel_cache_use_tips: '检查到上次有仪表板未能正常保存,是否使用上次未保存的仪表板?',
@ -2520,7 +2546,9 @@ export default {
pixel_tip: '可直接输入自定义分辨率(例如:2560 * 1600)或选择',
task_type: '任务类型',
range_view: '展示数据',
range_all: '全部数据'
range_all: '全部数据',
execute_now: '立即执行',
fire_now_success: '任务发起成功'
},
dynamic_time: {
set_default: '设置默认值',

View File

@ -0,0 +1,539 @@
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
font-family: "iconfont logo";
font-size: 160px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* tabs */
.nav-tabs {
position: relative;
}
.nav-tabs .nav-more {
position: absolute;
right: 0;
bottom: 0;
height: 42px;
line-height: 42px;
color: #666;
}
#tabs {
border-bottom: 1px solid #eee;
}
#tabs li {
cursor: pointer;
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
border-bottom: 2px solid transparent;
position: relative;
z-index: 1;
margin-bottom: -1px;
color: #666;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
}
.tab-container .content {
display: none;
}
/* 页面布局 */
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main .logo {
color: #333;
text-align: left;
margin-bottom: 30px;
line-height: 1;
height: 110px;
margin-top: -50px;
overflow: hidden;
*zoom: 1;
}
.main .logo a {
font-size: 160px;
color: #333;
}
.helps {
margin-top: 40px;
}
.helps pre {
padding: 20px;
margin: 10px 0;
border: solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists {
width: 100% !important;
overflow: hidden;
*zoom: 1;
}
.icon_lists li {
width: 100px;
margin-bottom: 10px;
margin-right: 20px;
text-align: center;
list-style: none !important;
cursor: default;
}
.icon_lists li .code-name {
line-height: 1.2;
}
.icon_lists .icon {
display: block;
height: 100px;
line-height: 100px;
font-size: 42px;
margin: 10px auto;
color: #333;
-webkit-transition: font-size 0.25s linear, width 0.25s linear;
-moz-transition: font-size 0.25s linear, width 0.25s linear;
transition: font-size 0.25s linear, width 0.25s linear;
}
.icon_lists .icon:hover {
font-size: 100px;
}
.icon_lists .svg-icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path stroke 溢出 viewBox 部分在 IE 下会显示
normalize.css 中也包含这行 */
overflow: hidden;
}
.icon_lists li .name,
.icon_lists li .code-name {
color: #666;
}
/* markdown 样式 */
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p {
margin: 1em 0;
}
.markdown>p,
.markdown>blockquote,
.markdown>.highlight,
.markdown>ol,
.markdown>ul {
width: 80%;
}
.markdown ul>li {
list-style: circle;
}
.markdown>ul li,
.markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown>ul li p,
.markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol>li {
list-style: decimal;
}
.markdown>ol li,
.markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown strong,
.markdown b {
font-weight: 600;
}
.markdown>table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown>table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown>table th,
.markdown>table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,
.markdown h4:hover .anchor,
.markdown h5:hover .anchor,
.markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown>br,
.markdown>p>br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
/* 代码高亮 */
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre)>code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 2459092 */
src: url('iconfont.woff2?t=1662616551987') format('woff2'),
url('iconfont.woff?t=1662616551987') format('woff'),
url('iconfont.ttf?t=1662616551987') format('truetype');
src: url('iconfont.woff2?t=1668397590143') format('woff2'),
url('iconfont.woff?t=1668397590143') format('woff'),
url('iconfont.ttf?t=1668397590143') format('truetype');
}
.iconfont {
@ -13,6 +13,14 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-WATERMARK:before {
content: "\ea16";
}
.icon-layer:before {
content: "\e63b";
}
.icon-application:before {
content: "\e89e";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,20 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "23072499",
"name": "WATERMARK",
"font_class": "WATERMARK",
"unicode": "ea16",
"unicode_decimal": 59926
},
{
"icon_id": "10904998",
"name": "图层",
"font_class": "layer",
"unicode": "e63b",
"unicode_decimal": 58939
},
{
"icon_id": "12253601",
"name": "application",

View File

@ -25,3 +25,15 @@ export function equalsAny(target, ...sources) {
}
return false
}
export function includesAny(target, ...sources) {
if (!target || !sources) {
return false
}
for (let i = 0; i < sources.length; i++) {
if (target.includes(sources[i])) {
return true
}
}
return false
}

View File

@ -314,6 +314,16 @@ export const isSameVueObj = (source, target) => {
return false
}
export const isSameArr = (source, target) => {
if (!source && !target) return true
if (source?.length && target?.length && source.length === target.length) {
const sortSource = source.sort()
const sortTarget = target.sort()
return JSON.stringify(sortSource) === JSON.stringify(sortTarget)
}
return false
}
export const changeFavicon = link => {
let $favicon = document.querySelector('link[rel="icon"]')
if ($favicon !== null) {
@ -325,3 +335,12 @@ export const changeFavicon = link => {
document.head.appendChild($favicon)
}
}
export const mergeCustomSortOption = (customSortList, sourceList) => {
if (!customSortList?.length) return sourceList?.length ? sourceList : []
if (!sourceList?.length) return customSortList?.length ? customSortList : []
const result = [...customSortList, ...sourceList]
return [...new Set(result)]
}

View File

@ -15,7 +15,7 @@ const DownErrorKey = Config.DownErrorKey
import Cookies from 'js-cookie'
const getTimeOut = () => {
let time = 10
let time = 100
const url = process.env.VUE_APP_BASE_API + 'system/requestTimeOut'
const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {

View File

@ -7,6 +7,7 @@
},
'template-img'
]"
:style="itemStyle"
@click.stop="setBoard"
>
<svg-icon
@ -22,6 +23,7 @@
<script>
import { mapState } from 'vuex'
import { imgUrlTrans } from '@/components/canvas/utils/utils'
import { hexColorToRGBA } from '@/views/chart/chart/util'
export default {
name: 'BackgroundItem',
@ -34,6 +36,15 @@ export default {
}
},
computed: {
itemStyle() {
if (this.curComponent.commonBackground.backgroundColorSelect) {
return {
'background-color': hexColorToRGBA(this.curComponent.commonBackground.color, this.curComponent.commonBackground.alpha)
}
} else {
return {}
}
},
mainIconClass() {
return this.template.url.replace('board/', '').replace('.svg', '')
},
@ -64,72 +75,73 @@ export default {
<style scoped>
.testcase-template {
display: inline-block;
margin: 10px 0px;
width: 90px;
}
.testcase-template {
display: inline-block;
margin: 5px 0px;
width: 90px;
}
.demonstration {
display: block;
font-size: 8px;
color: gray;
text-align: center;
margin: 10px auto;
width: 130px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
.demonstration {
display: block;
font-size: 8px;
color: gray;
text-align: center;
margin: 10px auto;
width: 130px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.template-img {
position: relative;
height: 80px;
width: 130px;
margin: 0 auto;
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;
}
.template-img {
position: relative;
height: 80px;
width: 130px;
margin: 0 auto;
/*box-shadow: 0 0 2px 0 rgba(31, 31, 31, 0.15), 0 1px 2px 0 rgba(31, 31, 31, 0.15);*/
/*border: solid px #fff;*/
box-sizing: border-box;
border-radius: 3px;
}
.template-img:hover {
border: solid 1px #4b8fdf;
border-radius: 3px;
color: deepskyblue;
cursor: pointer;
}
.template-img:hover {
border: solid 1px #4b8fdf;
border-radius: 3px;
color: deepskyblue;
cursor: pointer;
}
.template-img > i{
display:none;
float: right;
color: gray;
margin: 2px;
}
.template-img > i {
display: none;
float: right;
color: gray;
margin: 2px;
}
.template-img > i:hover {
color: red;
}
.template-img > i:hover {
color: red;
}
.template-img:hover > .el-icon-error {
display: inline;
}
.template-img:hover > .el-icon-error {
display: inline;
}
.template-img:hover > .el-icon-edit {
display: inline;
}
.template-img:hover > .el-icon-edit {
display: inline;
}
.template-img-active {
border: solid 1px red;
border-radius: 3px;
color: deepskyblue;
}
.svg-background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.template-img-active {
border: solid 1px red;
border-radius: 3px;
color: deepskyblue;
}
.svg-background {
position: absolute;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
}
</style>

View File

@ -88,7 +88,7 @@
v-if="curComponent.commonBackground.enable"
style="padding-left: 10px"
>
<el-row style="height: 80px;margin-top:10px;margin-bottom:20px;overflow: hidden">
<el-row style="height: 80px;margin-top:0px;margin-bottom:20px;overflow: hidden">
<el-col
:span="4"
style="padding-left: 10px"
@ -150,6 +150,7 @@
</el-col>
<el-col
:span="20"
:style="customStyle"
class="main-row"
>
<el-row
@ -278,8 +279,29 @@ export default {
}
},
computed: {
customStyle() {
let style = {}
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = {
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {
style = {
background: this.canvasStyleData.panel.color,
...style
}
}
}
if (!style.background) {
style.background = '#FFFFFF'
}
return style
},
...mapState([
'curComponent',
'canvasStyleData',
'componentData'
]),
isFilterComponent() {
@ -353,7 +375,8 @@ export default {
}
.main-row {
height: 140px;
padding-left: 10px;
height: 250px;
overflow-y: auto;
}

View File

@ -172,7 +172,9 @@ export const DEFAULT_TOTAL = {
},
calcSubTotals: {
aggregation: 'SUM'
}
},
totalSort: 'none', // asc,desc
totalSortField: ''
},
col: {
showGrandTotals: true,
@ -187,7 +189,9 @@ export const DEFAULT_TOTAL = {
},
calcSubTotals: {
aggregation: 'SUM'
}
},
totalSort: 'none', // asc,desc
totalSortField: ''
}
}
export const DEFAULT_TITLE_STYLE = {

View File

@ -41,8 +41,22 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) {
// 处理shape attr
let customAttr = {}
let isGradient = false
let seriesIndex = 0
if (chart.customAttr) {
customAttr = JSON.parse(chart.customAttr)
if (chart.yaxis && chart.yaxis.length > 1) {
let currentSeriesId = customAttr.currentSeriesId
const yAxis = JSON.parse(chart.yaxis)
if (!currentSeriesId || !yAxis.some(item => item.id === currentSeriesId)) {
currentSeriesId = yAxis[0].id
}
chart.data.series.forEach((item, index) => {
if (item.data[0].quotaList[0].id === currentSeriesId) {
seriesIndex = index
return false
}
})
}
if (customAttr.color) {
const colorValue = customAttr.color.value
@ -57,7 +71,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) {
const tooltip = JSON.parse(JSON.stringify(customAttr.tooltip))
const reg = new RegExp('\n', 'g')
const text = tooltip.formatter.replace(reg, '<br/>')
tooltip.formatter = function(params) {
tooltip.formatter = params => {
const a = params.seriesName
const b = params.name
const c = params.value ? params.value : ''
@ -74,14 +88,14 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) {
if (chart.data) {
chart_option.title.text = chart.title
if (chart.data.series && chart.data.series.length > 0) {
chart_option.series[0].name = chart.data.series[0].name
chart_option.series[0].name = chart.data.series[seriesIndex].name
chart_option.series[0].selectedMode = true
chart_option.series[0].select = BASE_ECHARTS_SELECT
// label
if (customAttr.label) {
const text = customAttr.label.formatter
chart_option.series[0].label = customAttr.label
chart_option.series[0].label.formatter = function(params) {
chart_option.series[0].label.formatter = params => {
const a = params.seriesName
const b = params.name
const c = params.value ? params.value : ''
@ -97,12 +111,12 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) {
}
chart_option.series[0].itemStyle.emphasis.label.show = customAttr.label.show
}
const valueArr = chart.data.series[0].data
const valueArr = chart.data.series[seriesIndex].data
// visualMap
if (!isGradient) {
if (valueArr && valueArr.length > 0) {
const values = []
valueArr.forEach(function(ele) {
valueArr.forEach(ele => {
values.push(ele.value)
})
chart_option.visualMap.min = Math.min(...values)

View File

@ -1,4 +1,4 @@
import { TableSheet, S2Event, PivotSheet, DataCell } from '@antv/s2'
import { TableSheet, S2Event, PivotSheet, DataCell, EXTRA_FIELD, TOTAL_VALUE } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
import { DEFAULT_COLOR_CASE, DEFAULT_TOTAL } from '@/views/chart/chart/chart'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
@ -403,17 +403,6 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
})
}
// data config
const s2DataConfig = {
fields: {
rows: r,
columns: c,
values: v
},
meta: meta,
data: tableData
}
// total config
let totalCfg = {}
const chartObj = JSON.parse(JSON.stringify(chart))
@ -433,6 +422,43 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
totalCfg.row.subTotalsDimensions = r
totalCfg.col.subTotalsDimensions = c
// 解析合计、小计排序
const sortParams = []
if (totalCfg.row.totalSort && totalCfg.row.totalSort !== 'none' && c.length > 0) {
const sort = {
sortFieldId: c[0],
sortMethod: totalCfg.row.totalSort.toUpperCase(),
sortByMeasure: TOTAL_VALUE,
query: {
[EXTRA_FIELD]: totalCfg.row.totalSortField
}
}
sortParams.push(sort)
}
if (totalCfg.col.totalSort && totalCfg.col.totalSort !== 'none' && r.length > 0) {
const sort = {
sortFieldId: r[0],
sortMethod: totalCfg.col.totalSort.toUpperCase(),
sortByMeasure: TOTAL_VALUE,
query: {
[EXTRA_FIELD]: totalCfg.col.totalSortField
}
}
sortParams.push(sort)
}
// data config
const s2DataConfig = {
fields: {
rows: r,
columns: c,
values: v
},
meta: meta,
data: tableData,
sortParams: sortParams
}
// options
const s2Options = {
width: containerDom.offsetWidth,

View File

@ -1,4 +1,5 @@
import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart'
import { equalsAny, includesAny } from '@/utils/StringUtils'
export function hexColorToRGBA(hex, alpha) {
const rgb = [] // 定义rgb数组
@ -353,8 +354,14 @@ export const TYPE_CONFIGS = [
value: 'richTextView',
title: 'chart.rich_text_view',
icon: 'richTextView',
properties: [],
propertyInner: {}
properties: [
'title-selector-ant-v'
],
propertyInner: {
'title-selector-ant-v': [
'title'
]
}
},
{
render: 'antv',
@ -3193,7 +3200,7 @@ export function getColors(chart, colors, reset) {
})
}
}
} else if ((chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('scatter') || chart.type.includes('radar') || chart.type.includes('area')) && !chart.type.includes('group')) {
} else if (includesAny(chart.type, 'bar', 'scatter', 'radar', 'area') && !chart.type.includes('group')) {
if (Object.prototype.toString.call(chart.yaxis) === '[object Array]') {
series = JSON.parse(JSON.stringify(chart.yaxis))
} else {
@ -3209,7 +3216,7 @@ export function getColors(chart, colors, reset) {
})
}
}
} else if (chart.type === 'bar-group') {
} else if (equalsAny(chart.type, 'bar-group', 'line')) {
// 拿到data中的category并去重然后构建seriesColor
const data = chart.data.data
const s = []

View File

@ -12,41 +12,14 @@
style="width: 100%;height: 100%;overflow: hidden;"
:style="{ borderRadius: borderRadius}"
/>
<div
<map-controller
v-if="chart.type === 'map' && showSuspension"
class="map-zoom-box"
>
<div style="margin-bottom: 0.5em;">
<el-button
:style="{'background': buttonTextColor ? 'none' : '', 'opacity': buttonTextColor ? '0.75': '', 'color': buttonTextColor, 'borderColor': buttonTextColor}"
size="mini"
icon="el-icon-plus"
circle
@click="roamMap(true)"
/>
</div>
<div style="margin-bottom: 0.5em;">
<el-button
:style="{'background': buttonTextColor ? 'none' : '', 'opacity': buttonTextColor ? '0.75': '', 'color': buttonTextColor, 'borderColor': buttonTextColor}"
size="mini"
icon="el-icon-refresh"
circle
@click="resetZoom()"
/>
</div>
<div>
<el-button
:style="{'background': buttonTextColor ? 'none' : '', 'opacity': buttonTextColor ? '0.75': '', 'color': buttonTextColor, 'borderColor': buttonTextColor}"
size="mini"
icon="el-icon-minus"
circle
@click="roamMap(false)"
/>
</div>
</div>
:chart="chart"
:button-text-color="buttonTextColor"
@roam-map="roamMap"
@reset-zoom="resetZoom"
/>
<div
:class="loading ? 'symbol-map-loading' : 'symbol-map-loaded'"
/>
@ -81,12 +54,14 @@ import { uuid } from 'vue-uuid'
import { geoJson } from '@/api/map/map'
import ViewTrackBar from '@/components/canvas/components/editor/ViewTrackBar'
import { reverseColor } from '../chart/common/common'
import MapController from './map/MapController.vue'
import { mapState } from 'vuex'
import bus from '@/utils/bus'
export default {
name: 'ChartComponent',
components: {
ViewTrackBar
ViewTrackBar,
MapController
},
props: {
chart: {
@ -178,9 +153,11 @@ export default {
}
},
mounted() {
bus.$on('change-series-id', this.changeSeriesId)
this.preDraw()
},
beforeDestroy() {
bus.$off('change-series-id', this.changeSeriesId)
window.removeEventListener('resize', this.myChart.resize)
this.myChart.dispose()
this.myChart = null
@ -189,6 +166,15 @@ export default {
this.loadThemeStyle()
},
methods: {
changeSeriesId(param) {
const { id, seriesId } = param
if (id !== this.chart.id) {
return
}
const customAttr = JSON.parse(this.chart.customAttr)
customAttr.currentSeriesId = seriesId
this.chart.customAttr = JSON.stringify(customAttr)
},
reDrawView() {
this.myChart.dispatchAction({
type: 'unselect',
@ -237,10 +223,6 @@ export default {
if (that.linkageActiveParam) {
that.reDrawView()
}
that.linkageActiveParam = {
seriesIndex: that.pointParam.seriesIndex,
name: that.pointParam.name
}
if (that.trackMenu.length < 2) { //
that.trackClick(that.trackMenu[0])
} else { //
@ -450,6 +432,10 @@ export default {
this.$emit('onChartClick', this.pointParam)
break
case 'linkage':
this.linkageActiveParam = {
seriesIndex: param.seriesIndex,
name: param.name
}
this.linkageActive()
this.$store.commit('addViewTrackFilter', linkageParam)
break

View File

@ -59,7 +59,7 @@
>
<span class="total-style">
{{ $t('chart.total') }}
<span>{{ (chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0 }}</span>
<span>{{ chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) }}</span>
{{ $t('chart.items') }}
</span>
<el-pagination
@ -211,13 +211,20 @@ export default {
const attr = JSON.parse(this.chart.customAttr)
this.currentPage.pageSize = parseInt(attr.size.tablePageSize ? attr.size.tablePageSize : 20)
data = JSON.parse(JSON.stringify(this.chart.data.tableRow))
if (this.chart.type === 'table-info' && (attr.size.tablePageMode === 'page' || !attr.size.tablePageMode) && data.length > this.currentPage.pageSize) {
//
this.currentPage.show = data.length
const pageStart = (this.currentPage.page - 1) * this.currentPage.pageSize
const pageEnd = pageStart + this.currentPage.pageSize
data = data.slice(pageStart, pageEnd)
this.showPage = true
if (this.chart.datasetMode === 0) {
if (this.chart.type === 'table-info' && (attr.size.tablePageMode === 'page' || !attr.size.tablePageMode) && this.chart.totalItems > this.currentPage.pageSize) {
this.currentPage.show = this.chart.totalItems
this.showPage = true
}
} else {
if (this.chart.type === 'table-info' && (attr.size.tablePageMode === 'page' || !attr.size.tablePageMode) && data.length > this.currentPage.pageSize) {
//
this.currentPage.show = data.length
const pageStart = (this.currentPage.page - 1) * this.currentPage.pageSize
const pageEnd = pageStart + this.currentPage.pageSize
data = data.slice(pageStart, pageEnd)
this.showPage = true
}
}
} else {
this.fields = []
@ -425,14 +432,22 @@ export default {
},
pageChange(val) {
this.currentPage.pageSize = val
this.initData()
this.drawView()
if (this.chart.datasetMode === 0) {
this.$emit('onPageChange', this.currentPage)
} else {
this.initData()
this.drawView()
}
},
pageClick(val) {
this.currentPage.page = val
this.initData()
this.drawView()
if (this.chart.datasetMode === 0) {
this.$emit('onPageChange', this.currentPage)
} else {
this.initData()
this.drawView()
}
},
resetPage() {

View File

@ -15,9 +15,10 @@
<el-checkbox
v-model="titleForm.show"
@change="changeTitleStyle('show')"
>{{ $t('chart.show') }}</el-checkbox>
>{{ $t('chart.show') }}
</el-checkbox>
</el-form-item>
<div v-show="showProperty('show') && titleForm.show">
<div v-show="titleForm.show">
<el-form-item
v-show="showProperty('title')"
v-if="!batchOptStatus"
@ -105,11 +106,13 @@
<el-checkbox
v-model="titleForm.isItalic"
@change="changeTitleStyle('isItalic')"
>{{ $t('chart.italic') }}</el-checkbox>
>{{ $t('chart.italic') }}
</el-checkbox>
<el-checkbox
v-model="titleForm.isBolder"
@change="changeTitleStyle('isBolder')"
>{{ $t('chart.bolder') }}</el-checkbox>
>{{ $t('chart.bolder') }}
</el-checkbox>
</el-form-item>
<el-form-item
v-show="showProperty('letterSpace')"
@ -137,7 +140,8 @@
<el-checkbox
v-model="titleForm.fontShadow"
@change="changeTitleStyle('fontShadow')"
>{{ $t('chart.font_shadow') }}</el-checkbox>
>{{ $t('chart.font_shadow') }}
</el-checkbox>
</el-form-item>
<el-form-item
@ -148,7 +152,8 @@
<el-checkbox
v-model="titleForm.remarkShow"
@change="changeTitleStyle('remarkShow')"
>{{ $t('chart.show') }}</el-checkbox>
>{{ $t('chart.show') }}
</el-checkbox>
</el-form-item>
<span v-show="titleForm.remarkShow">
<el-form-item
@ -204,12 +209,14 @@
<el-button
size="mini"
@click="closeRemark"
>{{ $t('chart.cancel') }}</el-button>
>{{ $t('chart.cancel') }}
</el-button>
<el-button
type="primary"
size="mini"
@click="changeRemark"
>{{ $t('chart.confirm') }}</el-button>
>{{ $t('chart.confirm') }}
</el-button>
</div>
</el-dialog>
</div>
@ -350,7 +357,7 @@ export default {
</script>
<style scoped>
.shape-item{
.shape-item {
padding: 6px;
border: none;
width: 100%;
@ -358,29 +365,35 @@ export default {
justify-content: space-between;
align-items: center;
}
.form-item-slider ::v-deep .el-form-item__label{
.form-item-slider ::v-deep .el-form-item__label {
font-size: 12px;
line-height: 38px;
}
.form-item ::v-deep .el-form-item__label{
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item{
.el-select-dropdown__item {
padding: 0 20px;
}
span{
span {
font-size: 12px
}
.el-form-item{
.el-form-item {
margin-bottom: 6px;
}
.switch-style{
.switch-style {
position: absolute;
right: 10px;
margin-top: -4px;
}
.color-picker-style{
.color-picker-style {
cursor: pointer;
z-index: 1003;
}

View File

@ -0,0 +1,93 @@
<template>
<div
class="map-zoom-box"
>
<div style="margin-bottom: 0.5em;">
<el-button
:style="{'background': buttonTextColor ? 'none' : '', 'opacity': buttonTextColor ? '0.75': '', 'color': buttonTextColor, 'borderColor': buttonTextColor}"
size="mini"
icon="el-icon-plus"
circle
@click="callParent('roamMap', true)"
/>
</div>
<div style="margin-bottom: 0.5em;">
<el-button
:style="{'background': buttonTextColor ? 'none' : '', 'opacity': buttonTextColor ? '0.75': '', 'color': buttonTextColor, 'borderColor': buttonTextColor}"
size="mini"
icon="el-icon-refresh"
circle
@click="callParent('resetZoom')"
/>
</div>
<div>
<el-button
:style="{'background': buttonTextColor ? 'none' : '', 'opacity': buttonTextColor ? '0.75': '', 'color': buttonTextColor, 'borderColor': buttonTextColor}"
size="mini"
icon="el-icon-minus"
circle
@click="callParent('roamMap', false)"
/>
</div>
</div>
</template>
<script>
export default {
name: 'MapController',
props: {
chart: {
type: Object,
required: true
},
buttonTextColor: {
type: String,
default: null
}
},
data() {
return {
}
},
computed: {
yaxis() {
return JSON.parse(this.chart.yaxis)
},
layerOption() {
return this.yaxis.map(this.buildOption)
},
customAttr() {
const attr = JSON.parse(this.chart.customAttr)
if (!attr.currentSeriesId || !this.layerOption.some(item => item.id === attr.currentSeriesId)) {
attr.currentSeriesId = this.layerOption[0].id
}
return attr
}
},
created() {
this.init()
},
methods: {
buildOption({ id, name }) {
return ({ id, name })
},
changeSeriesId(val) {
this.chart.customAttr = JSON.stringify(this.customAttr)
},
callParent(methodName, param) {
this.$emit(methodName, param)
},
init() {
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,126 @@
<template>
<el-popover
placement="right"
title=""
width="150"
trigger="click"
>
<i
slot="reference"
:title="$t('chart.layer_controller')"
class="icon iconfont icon-xuanfu"
style="margin-left: 4px;cursor: pointer;font-size: 14px;"
/>
<div>
<ul class="de-ul">
<li
v-for="(node, i) in layerOption"
:key="node.id"
:index="i"
class="de-sort-field-span"
:class="currentSeriesId === node.id ? 'de-active-li': ''"
@click="changeSeries(node)"
>
<span :title="node.name">{{ node.name }}</span>
</li>
</ul>
</div>
</el-popover>
</template>
<script>
import bus from '@/utils/bus'
export default {
name: 'MapLayerController',
props: {
chart: {
type: Object,
required: true
}
},
data() {
return {
currentSeriesId: null
}
},
computed: {
yaxis() {
return JSON.parse(this.chart.yaxis)
},
layerOption() {
return this.yaxis.map(this.buildOption)
},
customAttr() {
const attr = JSON.parse(this.chart.customAttr)
if (!attr.currentSeriesId || !this.layerOption.some(item => item.id === attr.currentSeriesId)) {
attr.currentSeriesId = this.layerOption[0].id
}
return attr
}
},
created() {
this.init()
},
methods: {
buildOption({ id, name }) {
return ({ id, name })
},
changeSeries(node) {
if (node.id === this.currentSeriesId) return
this.currentSeriesId = node.id
const param = {
id: this.chart.id,
seriesId: this.currentSeriesId
}
bus.$emit('change-series-id', param)
},
init() {
this.currentSeriesId = this.customAttr.currentSeriesId
}
}
}
</script>
<style scoped lang="scss">
.de-ul li {
margin: 5px 2px;
cursor: pointer;
&:hover {
color: #409EFF;
border-color: rgb(198, 226, 255);
background-color: rgb(236, 245, 255);
}
&:before {
content: "";
width: 6px;
height: 6px;
display: inline-block;
border-radius: 50%;
vertical-align: middle;
margin-right: 5px;
}
}
.de-active-li {
&:before {
background: #409EFF;
}
}
.de-sort-field-span {
display: inline-flexbox;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
span {
font-size: 12px;
}
}
</style>

View File

@ -67,6 +67,40 @@
/>
</el-select>
</el-form-item>
<el-form-item
v-if="chart.type === 'table-pivot'"
:label="$t('chart.total_sort')"
class="form-item"
>
<el-radio-group
v-model="totalForm.row.totalSort"
@change="changeTotalCfg('row')"
>
<el-radio label="none">{{ $t('chart.total_sort_none') }}</el-radio>
<el-radio label="asc">{{ $t('chart.total_sort_asc') }}</el-radio>
<el-radio label="desc">{{ $t('chart.total_sort_desc') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="chart.type === 'table-pivot' && totalForm.row.totalSort !== 'none'"
:label="$t('chart.total_sort_field')"
class="form-item"
>
<el-select
v-model="totalForm.row.totalSortField"
class="form-item-select"
:placeholder="$t('chart.total_sort_field')"
size="mini"
@change="changeTotalCfg('row')"
>
<el-option
v-for="option in totalSortFields"
:key="option.dataeaseName"
:label="option.name"
:value="option.dataeaseName"
/>
</el-select>
</el-form-item>
</div>
<el-form-item
@ -190,6 +224,40 @@
/>
</el-select>
</el-form-item>
<el-form-item
v-if="chart.type === 'table-pivot'"
:label="$t('chart.total_sort')"
class="form-item"
>
<el-radio-group
v-model="totalForm.col.totalSort"
@change="changeTotalCfg('col')"
>
<el-radio label="none">{{ $t('chart.total_sort_none') }}</el-radio>
<el-radio label="asc">{{ $t('chart.total_sort_asc') }}</el-radio>
<el-radio label="desc">{{ $t('chart.total_sort_desc') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="chart.type === 'table-pivot' && totalForm.col.totalSort !== 'none'"
:label="$t('chart.total_sort_field')"
class="form-item"
>
<el-select
v-model="totalForm.col.totalSortField"
class="form-item-select"
:placeholder="$t('chart.total_sort_field')"
size="mini"
@change="changeTotalCfg('col')"
>
<el-option
v-for="option in totalSortFields"
:key="option.dataeaseName"
:label="option.name"
:value="option.dataeaseName"
/>
</el-select>
</el-form-item>
</div>
<el-form-item
@ -283,7 +351,8 @@ export default {
{ name: this.$t('chart.avg'), value: 'AVG' },
{ name: this.$t('chart.max'), value: 'MAX' },
{ name: this.$t('chart.min'), value: 'MIN' }
]
],
totalSortFields: []
}
},
computed: {
@ -339,6 +408,27 @@ export default {
} else {
this.totalForm = JSON.parse(JSON.stringify(DEFAULT_TOTAL))
}
this.totalForm.row.totalSort = this.totalForm.row.totalSort ? this.totalForm.row.totalSort : DEFAULT_TOTAL.row.totalSort
this.totalForm.row.totalSortField = this.totalForm.row.totalSortField ? this.totalForm.row.totalSortField : DEFAULT_TOTAL.row.totalSortField
this.totalForm.col.totalSort = this.totalForm.col.totalSort ? this.totalForm.col.totalSort : DEFAULT_TOTAL.col.totalSort
this.totalForm.col.totalSortField = this.totalForm.col.totalSortField ? this.totalForm.col.totalSortField : DEFAULT_TOTAL.col.totalSortField
}
//
if (chart.yaxis) {
if (Object.prototype.toString.call(chart.yaxis) === '[object Array]') {
this.totalSortFields = JSON.parse(JSON.stringify(chart.yaxis))
} else {
this.totalSortFields = JSON.parse(chart.yaxis)
}
if (this.totalSortFields.length > 0) {
if (this.totalForm.row.totalSortField === '') {
this.totalForm.row.totalSortField = this.totalSortFields[0].dataeaseName
}
if (this.totalForm.col.totalSortField === '') {
this.totalForm.col.totalSortField = this.totalSortFields[0].dataeaseName
}
}
}
},
changeTotalCfg(modifyName) {

Some files were not shown because too many files have changed in this diff Show More