diff --git a/backend/pom.xml b/backend/pom.xml index ad2bbb4111..039930587b 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -5,7 +5,7 @@ dataease-server io.dataease - 1.18.2 + 1.18.3 4.0.0 @@ -119,7 +119,7 @@ org.apache.commons commons-text - [1.10.0,) + 1.10.0 commons-codec @@ -204,7 +204,7 @@ io.dataease dataease-plugin-interface - 1.18.2 + 1.18.3 guava @@ -215,12 +215,12 @@ io.dataease dataease-plugin-view - 1.18.2 + 1.18.3 io.dataease dataease-plugin-datasource - 1.18.2 + 1.18.3 diff --git a/backend/src/main/java/io/dataease/auth/api/AuthApi.java b/backend/src/main/java/io/dataease/auth/api/AuthApi.java index aeaee10e13..2b15b62e51 100644 --- a/backend/src/main/java/io/dataease/auth/api/AuthApi.java +++ b/backend/src/main/java/io/dataease/auth/api/AuthApi.java @@ -6,14 +6,13 @@ import io.dataease.auth.api.dto.LoginDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; -import springfox.documentation.annotations.ApiIgnore; - import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import springfox.documentation.annotations.ApiIgnore; import java.util.Map; -@Api(tags = "权限:权限管理") +@Api(tags = "登录:登录管理") @ApiSupport(order = 10) @RequestMapping("/api/auth") public interface AuthApi { diff --git a/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java b/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java index 790c4917bb..9b972800f7 100644 --- a/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java +++ b/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java @@ -8,15 +8,17 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; + import java.util.List; -@Api(tags = "权限:动态菜单") +@Api(tags = "登录:动态菜单") @ApiSupport(order = 20) @RequestMapping("/api/dynamicMenu") public interface DynamicMenuApi { /** * 根据heads中获取的token 获取username 获取对应权限的菜单 + * * @return */ @ApiOperation("查询") diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index 464e0c0979..e5bd636789 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -66,14 +66,17 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { if (StringUtils.startsWith(authorization, "Basic")) { return false; } - if (!TokenCacheUtils.validate(authorization)) { + if (!TokenCacheUtils.validate(authorization) && !TokenCacheUtils.validateDelay(authorization)) { throw new AuthenticationException(expireMessage); } // 当没有出现登录超时 且需要刷新token 则执行刷新token if (JWTUtils.loginExpire(authorization)) { + TokenCacheUtils.remove(authorization); throw new AuthenticationException(expireMessage); } if (JWTUtils.needRefresh(authorization)) { + TokenCacheUtils.addWithTtl(authorization, 1L); + TokenCacheUtils.remove(authorization); authorization = refreshToken(request, response); } JWTToken token = new JWTToken(authorization); diff --git a/backend/src/main/java/io/dataease/auth/server/AuthServer.java b/backend/src/main/java/io/dataease/auth/server/AuthServer.java index 3eefede2df..6e1fdafd57 100644 --- a/backend/src/main/java/io/dataease/auth/server/AuthServer.java +++ b/backend/src/main/java/io/dataease/auth/server/AuthServer.java @@ -63,6 +63,7 @@ public class AuthServer implements AuthApi { @Override public Object login(@RequestBody LoginDto loginDto) throws Exception { + Map result = new HashMap<>(); String username = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, loginDto.getUsername()); String pwd = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, loginDto.getPassword()); @@ -147,9 +148,11 @@ public class AuthServer implements AuthApi { AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 0); DataEaseException.throwException(appendLoginErrorMsg(Translator.get("i18n_id_or_pwd_error"), lockStatus)); } + if(user.getIsAdmin() && user.getPassword().equals("40b8893ea9ebc2d631c4bb42bb1e8996")){ + result.put("passwordModified", false); + } } - Map result = new HashMap<>(); TokenInfo tokenInfo = TokenInfo.builder().userId(user.getUserId()).username(username).build(); String token = JWTUtils.sign(tokenInfo, realPwd); // 记录token操作时间 diff --git a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java index e17f293b51..338adbf2da 100644 --- a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java @@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils; public class TokenCacheUtils { private static final String KEY = "sys_token_store"; + private static final String DELAY_KEY = "sys_token_store_delay"; public static void add(String token, Long userId) { CacheUtils.put(KEY, token, userId, null, null); @@ -25,4 +26,13 @@ public class TokenCacheUtils { Object sys_token_store = CacheUtils.get(KEY, token); return ObjectUtils.isNotEmpty(sys_token_store) && StringUtils.isNotBlank(sys_token_store.toString()) && userId == Long.parseLong(sys_token_store.toString()); } + + public static void addWithTtl(String token, Long userId) { + CacheUtils.put(DELAY_KEY, token, userId, 3, 5); + } + + public static boolean validateDelay(String token) { + Object tokenObj = CacheUtils.get(DELAY_KEY, token); + return ObjectUtils.isNotEmpty(tokenObj) && StringUtils.isNotBlank(tokenObj.toString()); + } } diff --git a/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java b/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java index eff1bb147e..c5b13ab877 100644 --- a/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java +++ b/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java @@ -7,15 +7,19 @@ import com.google.common.base.Predicate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.context.annotation.*; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; import springfox.documentation.RequestHandler; -import springfox.documentation.builders.*; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; import springfox.documentation.oas.annotations.EnableOpenApi; import springfox.documentation.service.*; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; + import java.util.ArrayList; import java.util.List; @@ -23,7 +27,7 @@ import java.util.List; @EnableOpenApi @Configuration @Import(BeanValidatorPluginsConfiguration.class) -public class Knife4jConfiguration implements BeanPostProcessor{ +public class Knife4jConfiguration implements BeanPostProcessor { private static final String splitor = ","; @@ -33,7 +37,6 @@ public class Knife4jConfiguration implements BeanPostProcessor{ private String version; - @Autowired public Knife4jConfiguration(OpenApiExtensionResolver openApiExtensionResolver) { this.openApiExtensionResolver = openApiExtensionResolver; @@ -41,7 +44,7 @@ public class Knife4jConfiguration implements BeanPostProcessor{ @Bean(value = "authApi") public Docket authApi() { - return defaultApi("权限管理", "io.dataease.auth"); + return defaultApi("登录管理", "io.dataease.auth"); } @Bean(value = "chartApi") @@ -69,24 +72,24 @@ public class Knife4jConfiguration implements BeanPostProcessor{ return defaultApi("系统管理", "io.dataease.controller.sys,io.dataease.plugins.server"); } - private ApiInfo apiInfo(){ + private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("DataEase") .description("人人可用的开源数据可视化分析工具") .termsOfServiceUrl("https://dataease.io") - .contact(new Contact("Dataease","https://www.fit2cloud.com/dataease/index.html","dataease@fit2cloud.com")) + .contact(new Contact("Dataease", "https://www.fit2cloud.com/dataease/index.html", "dataease@fit2cloud.com")) .version(version) .build(); } private Docket defaultApi(String groupName, String packageName) { - List securitySchemes=new ArrayList<>(); + List securitySchemes = new ArrayList<>(); securitySchemes.add(accessKey()); securitySchemes.add(signature()); List securityContexts = new ArrayList<>(); securityContexts.add(securityContext()); - Docket docket=new Docket(DocumentationType.OAS_30) + Docket docket = new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) .groupName(groupName) .select() @@ -131,7 +134,7 @@ public class Knife4jConfiguration implements BeanPostProcessor{ return input -> declaringClass(input).transform(handlerPackage(basePackage)).or(true); } - private static Function, Boolean> handlerPackage(final String basePackage) { + private static Function, Boolean> handlerPackage(final String basePackage) { return input -> { // 循环判断匹配 for (String strPackage : basePackage.split(splitor)) { diff --git a/backend/src/main/java/io/dataease/controller/dataset/DataSetGroupController.java b/backend/src/main/java/io/dataease/controller/dataset/DataSetGroupController.java index 8833cccf3a..b8e3488641 100644 --- a/backend/src/main/java/io/dataease/controller/dataset/DataSetGroupController.java +++ b/backend/src/main/java/io/dataease/controller/dataset/DataSetGroupController.java @@ -9,8 +9,10 @@ import io.dataease.commons.constants.SysLogConstants; import io.dataease.commons.utils.DeLogUtils; import io.dataease.controller.request.dataset.DataSetGroupRequest; import io.dataease.dto.SysLogDTO; +import io.dataease.dto.authModel.VAuthModelDTO; import io.dataease.dto.dataset.DataSetGroupDTO; import io.dataease.plugins.common.base.domain.DatasetGroup; +import io.dataease.service.authModel.VAuthModelService; import io.dataease.service.dataset.DataSetGroupService; import io.dataease.service.kettle.KettleService; import io.swagger.annotations.Api; @@ -18,7 +20,9 @@ import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.Logical; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; + import javax.annotation.Resource; +import java.util.Arrays; import java.util.List; /** @@ -35,14 +39,18 @@ public class DataSetGroupController { @Resource private KettleService kettleService; + @Resource + private VAuthModelService vAuthModelService; + @DePermissions(value = { @DePermission(type = DePermissionType.DATASET, value = "id"), @DePermission(type = DePermissionType.DATASET, value = "pid", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE) }, logical = Logical.AND) @ApiOperation("保存") @PostMapping("/save") - public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) throws Exception { - return dataSetGroupService.save(datasetGroup); + public VAuthModelDTO save(@RequestBody DatasetGroup datasetGroup) throws Exception { + DataSetGroupDTO result = dataSetGroupService.save(datasetGroup); + return vAuthModelService.queryAuthModelByIds("dataset", Arrays.asList(result.getId())).get(0); } @ApiIgnore diff --git a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java index 6927f2b870..3fd116cee9 100644 --- a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java +++ b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java @@ -16,6 +16,7 @@ import io.dataease.controller.handler.annotation.I18n; import io.dataease.controller.request.dataset.DataSetExportRequest; import io.dataease.controller.request.dataset.DataSetTableRequest; import io.dataease.controller.response.DataSetDetail; +import io.dataease.dto.authModel.VAuthModelDTO; import io.dataease.dto.dataset.DataSetTableDTO; import io.dataease.dto.dataset.ExcelFileData; import io.dataease.plugins.common.base.domain.DatasetSqlLog; @@ -24,6 +25,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableField; import io.dataease.plugins.common.base.domain.DatasetTableIncrementalConfig; import io.dataease.plugins.common.dto.dataset.SqlVariableDetails; import io.dataease.plugins.common.dto.datasource.TableField; +import io.dataease.service.authModel.VAuthModelService; import io.dataease.service.dataset.DataSetTableService; import io.swagger.annotations.*; import org.apache.shiro.authz.annotation.Logical; @@ -35,6 +37,7 @@ import javax.servlet.http.HttpServletResponse; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @Author gin @@ -48,14 +51,18 @@ public class DataSetTableController { @Resource private DataSetTableService dataSetTableService; + @Resource + private VAuthModelService vAuthModelService; + @DePermissions(value = { @DePermission(type = DePermissionType.DATASET, value = "id"), @DePermission(type = DePermissionType.DATASET, value = "sceneId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE) }, logical = Logical.AND) @ApiOperation("批量保存") @PostMapping("batchAdd") - public List batchAdd(@RequestBody List datasetTable) throws Exception { - return dataSetTableService.batchInsert(datasetTable); + public List batchAdd(@RequestBody List datasetTable) throws Exception { + List ids = dataSetTableService.batchInsert(datasetTable).stream().map(DatasetTable::getId).collect(Collectors.toList()); + return vAuthModelService.queryAuthModelByIds("dataset", ids); } @DePermissions(value = { @@ -65,11 +72,12 @@ public class DataSetTableController { }, logical = Logical.AND) @ApiOperation("更新") @PostMapping("update") - public List save(@RequestBody DataSetTableRequest datasetTable) throws Exception { + public List save(@RequestBody DataSetTableRequest datasetTable) throws Exception { if (datasetTable.getType().equalsIgnoreCase("excel")) { - return dataSetTableService.saveExcel(datasetTable); + List ids = dataSetTableService.saveExcel(datasetTable).stream().map(DatasetTable::getId).collect(Collectors.toList()); + return vAuthModelService.queryAuthModelByIds("dataset", ids); } else { - return Collections.singletonList(dataSetTableService.save(datasetTable)); + return vAuthModelService.queryAuthModelByIds("dataset", Collections.singletonList(dataSetTableService.save(datasetTable).getId())); } } diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java index dbe2e68035..2e46bab9ef 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java @@ -88,7 +88,7 @@ public class PanelGroupController { @DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANEL_LEVEL_MANAGE) }, logical = Logical.AND) @I18n - public String update(@RequestBody PanelGroupRequest request) { + public PanelGroupDTO update(@RequestBody PanelGroupRequest request) { return panelGroupService.update(request); } diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java b/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java index c499a468c5..01297b83e6 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java @@ -1,6 +1,7 @@ package io.dataease.controller.panel; import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import io.dataease.controller.handler.annotation.I18n; import io.dataease.plugins.common.base.domain.PanelPdfTemplate; import io.dataease.service.panel.PanelPdfTemplateService; import io.swagger.annotations.Api; @@ -26,6 +27,7 @@ public class PanelPdfTemplateController { private PanelPdfTemplateService panelPdfTemplateService; @GetMapping("queryAll") + @I18n @ApiOperation("查询所有仪表板模板") public List queryAll() { return panelPdfTemplateService.queryAll(); diff --git a/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java b/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java index 51d5cc3c74..b593df605b 100644 --- a/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java +++ b/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java @@ -5,6 +5,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; + import java.util.List; /** @@ -48,4 +49,6 @@ public class ChartExtRequest { private Long pageSize; + private Boolean excelExportFlag = false; + } diff --git a/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java b/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java index dc2293f938..41e3c09e0b 100644 --- a/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java +++ b/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java @@ -1,5 +1,6 @@ package io.dataease.controller.request.panel; +import io.dataease.controller.request.chart.ChartExtRequest; import lombok.Data; import java.util.List; @@ -30,4 +31,8 @@ public class PanelViewDetailsRequest { private ViewDetailField[] detailFields; + private ChartExtRequest componentFilterInfo; + + private List excelHeaderKeys; + } diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java index 30dbcd2c75..a1fdf5af1a 100644 --- a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java +++ b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java @@ -15,18 +15,20 @@ public interface ExtPanelGroupMapper { List panelGroupListDefault(PanelGroupRequest request); //会级联删除pid 下的所有数据 - int deleteCircle(@Param("pid") String pid); + int deleteCircle(@Param("pid") String pid, @Param("nodeType") String nodeType); - int deleteCircleView(@Param("pid") String pid); + int deleteCircleView(@Param("pid") String pid, @Param("nodeType") String nodeType); - int deleteCircleViewCache(@Param("pid") String pid); + int deleteCircleViewCache(@Param("pid") String pid, @Param("nodeType") String nodeType); - PanelGroupDTO findOneWithPrivileges(@Param("panelId") String panelId,@Param("userId") String userId); + PanelGroupDTO findOneWithPrivileges(@Param("panelId") String panelId, @Param("userId") String userId); + + PanelGroupDTO findShortOneWithPrivileges(@Param("panelId") String panelId, @Param("userId") String userId); void copyPanelView(@Param("pid") String panelId); //移除未使用的视图 - void removeUselessViews(@Param("panelId") String panelId,@Param("viewIds") List viewIds); + void removeUselessViews(@Param("panelId") String panelId, @Param("viewIds") List viewIds); List panelGroupInit(); diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml index 2f99cbe477..6b3d058df8 100644 --- a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml +++ b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml @@ -31,6 +31,26 @@ and panel_type = 'self' + + - select - ifnull(ds.id,'') `id`, - ds.name, - ds_auth.auths, - 'link' `type`, - dt.id sub_id, - dt.name sub_name, - dt_auth.auths sub_auths, - if(dt.id is not null,'dataset',null) sub_type - from - panel_group pg - join - chart_view cv on cv.scene_id = pg.id - join - dataset_table dt on cv.table_id = dt.id - left join - ( - select - t_dt.id,group_concat(distinct sad.privilege_type) auths - from - dataset_table t_dt - left join sys_auth sa on sa.auth_source = t_dt.id - left join sys_auth_detail sad on sa.id = sad.auth_id - where - sa.auth_source_type = 'dataset' - and - sad.privilege_value = 1 - and - ( - ( - sa.auth_target_type = 'dept' - AND sa.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = #{userId,jdbcType=BIGINT} ) - ) - or - ( - sa.auth_target_type = 'user' - AND sa.auth_target = #{userId,jdbcType=BIGINT} - ) - or - ( - sa.auth_target_type = 'role' - AND sa.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId,jdbcType=BIGINT} ) - ) - ) - group by sa.auth_source - ) dt_auth on dt.id = dt_auth.id - left join datasource ds on dt.data_source_id = ds.id - left join - ( - select - t_pg.id,group_concat(distinct sad.privilege_type) auths - from - panel_group t_pg - left join sys_auth sa on sa.auth_source = t_pg.id - left join sys_auth_detail sad on sa.id = sad.auth_id - where - sa.auth_source_type = 'link' - and - sad.privilege_value = 1 - and - ( - ( - sa.auth_target_type = 'dept' - AND sa.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = #{userId,jdbcType=BIGINT} ) - ) - OR - ( - sa.auth_target_type = 'user' - AND sa.auth_target = #{userId,jdbcType=BIGINT} - ) - OR - ( - sa.auth_target_type = 'role' - AND sa.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId,jdbcType=BIGINT} ) - ) - ) - group by sa.auth_source - ) ds_auth on ds_auth.id = ds.id - where pg.id=#{panelId,jdbcType=VARCHAR} - group by id,sub_id + diff --git a/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.java b/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.java index 6c58a2807e..be71d05844 100644 --- a/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.java +++ b/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.java @@ -10,7 +10,9 @@ public interface ExtVAuthModelMapper { List queryAuthModel(@Param("record") VAuthModelRequest record); - List queryAuthModelViews (@Param("record") VAuthModelRequest record); + List queryAuthModelByIds(@Param("userId") String userId, @Param("modelType") String modelType, @Param("ids") List ids); - List queryAuthViewsOriginal (@Param("record") VAuthModelRequest record); + List queryAuthModelViews(@Param("record") VAuthModelRequest record); + + List queryAuthViewsOriginal(@Param("record") VAuthModelRequest record); } diff --git a/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.xml b/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.xml index 9363041cda..0ae460a5e7 100644 --- a/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.xml +++ b/backend/src/main/java/io/dataease/ext/ExtVAuthModelMapper.xml @@ -8,6 +8,29 @@ + + - SELECT - * - FROM - v_history_chart_view viewsOriginal + SELECT * + FROM v_history_chart_view viewsOriginal ORDER BY viewsOriginal.node_type desc, CONVERT(viewsOriginal.label using gbk) asc diff --git a/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java b/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java index fed96e7708..157c2f97aa 100644 --- a/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java +++ b/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java @@ -26,6 +26,7 @@ public class DataSourceInitStartListener implements ApplicationListener authModels(@RequestBody XpackBaseTreeRequest request) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); CurrentUserDto user = AuthUtils.getUser(); @@ -49,6 +51,7 @@ public class XAuthServer { @RequiresPermissions("auth:read") @PostMapping("/authDetails") + @ApiOperation("查询权限源目标映射关系") public Map> authDetails(@RequestBody XpackSysAuthRequest request) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); return sysAuthService.searchAuthDetails(request); @@ -57,6 +60,7 @@ public class XAuthServer { @RequiresPermissions("auth:read") @GetMapping("/authDetailsModel/{authType}/{direction}") @I18n + @ApiOperation("查询授权明细") public List authDetailsModel(@PathVariable String authType, @PathVariable String direction) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); List authDetails = sysAuthService.searchAuthDetailsModel(authType); @@ -72,6 +76,7 @@ public class XAuthServer { @RequiresPermissions("auth:read") @PostMapping("/authChange") + @ApiOperation("变更授权信息") public void authChange(@RequestBody XpackSysAuthRequest request) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); CurrentUserDto user = AuthUtils.getUser(); @@ -157,17 +162,18 @@ public class XAuthServer { } @GetMapping("/getDatasourceTypes") - public List getDatasourceTypes(){ - Collection activeType = datasourceService.types(); - Map activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName)); - activeTypeMap.put("all","所有数据源"); + @ApiOperation("查询授权的数据类型") + public List getDatasourceTypes() { + Collection activeType = datasourceService.types(); + Map activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName)); + activeTypeMap.put("all", "所有数据源"); AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); List presentTypes = sysAuthService.getDatasourceTypes(); presentTypes.stream().forEach(datasourceBaseType -> { - if(activeTypeMap.get(datasourceBaseType.getType())!=null){ + if (activeTypeMap.get(datasourceBaseType.getType()) != null) { datasourceBaseType.setName(activeTypeMap.get(datasourceBaseType.getType())); } }); - return presentTypes; + return presentTypes; } } diff --git a/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java b/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java index ddbcb5c9e0..913168cf15 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java @@ -336,14 +336,15 @@ public class ApiProvider extends Provider { o.put("deType", 0); o.put("extField", 0); o.put("checked", false); -// for (DatasetTableFieldDTO fieldDTO : apiDefinition.getFields()) { -// if (StringUtils.isNotEmpty(o.getString("jsonPath")) && StringUtils.isNotEmpty(fieldDTO.getJsonPath()) && fieldDTO.getJsonPath().equals(o.getString("jsonPath"))) { -// o.put("checked", true); -// o.put("deExtractType", fieldDTO.getDeExtractType()); -// o.put("name", fieldDTO.getName()); -// } -// } - + if (!apiDefinition.isUseJsonPath()) { + for (DatasetTableFieldDTO fieldDTO : apiDefinition.getFields()) { + if (StringUtils.isNotEmpty(o.getString("jsonPath")) && StringUtils.isNotEmpty(fieldDTO.getJsonPath()) && fieldDTO.getJsonPath().equals(o.getString("jsonPath"))) { + o.put("checked", true); + o.put("deExtractType", fieldDTO.getDeExtractType()); + o.put("name", fieldDTO.getName()); + } + } + } } static private boolean hasItem(ApiDefinition apiDefinition, List fields, JSONObject item) { diff --git a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java index 204a3f73f0..26e12c4b12 100644 --- a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java @@ -155,7 +155,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("previewSql"); st_sql.add("isGroup", isGroup); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); String customWheres = transCustomFilterList(tableObj, fieldCustomFilter); // row permissions tree @@ -345,7 +348,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("querySql"); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields); if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); @@ -435,7 +441,10 @@ public class DorisQueryProvider extends QueryProvider { 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(xFields)) { + st_sql.add("useAliasForGroup", true); + 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(); @@ -558,7 +567,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("querySql"); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields); if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); @@ -672,7 +684,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("querySql"); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields); if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); diff --git a/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java b/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java index 5273a13743..87d09f4fb0 100644 --- a/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java +++ b/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java @@ -4,7 +4,7 @@ import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.TreeUtils; import io.dataease.controller.request.authModel.VAuthModelRequest; import io.dataease.dto.authModel.VAuthModelDTO; -import io.dataease.ext.*; +import io.dataease.ext.ExtVAuthModelMapper; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; @@ -25,10 +25,22 @@ public class VAuthModelService { @Resource private ExtVAuthModelMapper extVAuthModelMapper; + public List queryAuthModelByIds(String modelType, List ids) { + if (CollectionUtils.isEmpty(ids)) { + return new ArrayList<>(); + } + List result = extVAuthModelMapper.queryAuthModelByIds(String.valueOf(AuthUtils.getUser().getUserId()), modelType, ids); + if (CollectionUtils.isEmpty(result)) { + return new ArrayList<>(); + } else { + return result; + } + } + public List queryAuthModel(VAuthModelRequest request) { request.setUserId(String.valueOf(AuthUtils.getUser().getUserId())); List result = extVAuthModelMapper.queryAuthModel(request); - if(CollectionUtils.isEmpty(result)){ + if (CollectionUtils.isEmpty(result)) { return new ArrayList<>(); } if (request.getPrivileges() != null) { @@ -44,7 +56,7 @@ public class VAuthModelService { } private List filterPrivileges(VAuthModelRequest request, List result) { - if(AuthUtils.getUser().getIsAdmin()){ + if (AuthUtils.getUser().getIsAdmin()) { return result; } if (request.getPrivileges() != null) { diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 2cb580c952..fb4ea88283 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -526,8 +526,12 @@ public class ChartViewService { } } List xAxisForRequest = new ArrayList<>(); - xAxisForRequest.addAll(xAxis); xAxisForRequest.addAll(extStack); + xAxisForRequest.addAll(xAxis); + xAxisForRequest.addAll(extStack); datasourceRequest.setXAxis(xAxisForRequest); + List yAxisForRequest = new ArrayList<>(); + yAxisForRequest.addAll(yAxis); + datasourceRequest.setYAxis(yAxisForRequest); data = datasourceProvider.getData(datasourceRequest); } else if (table.getMode() == 1) {// 抽取 datasourceRequest.setDatasource(ds); @@ -655,7 +659,7 @@ public class ChartViewService { Map mapAttr = gson.fromJson(view.getCustomAttr(), Map.class); Map mapSize = (Map) mapAttr.get("size"); if (StringUtils.equalsIgnoreCase(view.getType(), "table-info") && table.getMode() == 0) { - if (StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) { + if (StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page") && !chartExtRequest.getExcelExportFlag()) { if (chartExtRequest.getGoPage() == null) { chartExtRequest.setGoPage(1L); } @@ -1036,6 +1040,7 @@ public class ChartViewService { } if (StringUtils.isNotEmpty(totalPageSql) && StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) { datasourceRequest.setQuery(totalPageSql); + datasourceRequest.setTotalPageFlag(true); java.util.List tmpData = datasourceProvider.getData(datasourceRequest); totalItems = CollectionUtils.isEmpty(tmpData) ? 0 : Long.valueOf(tmpData.get(0)[0]); totalPage = (totalItems / pageInfo.getPageSize()) + (totalItems % pageInfo.getPageSize() > 0 ? 1 : 0); @@ -1043,8 +1048,13 @@ public class ChartViewService { datasourceRequest.setQuery(querySql); List xAxisForRequest = new ArrayList<>(); - xAxisForRequest.addAll(xAxis); xAxisForRequest.addAll(extStack); + xAxisForRequest.addAll(xAxis); + xAxisForRequest.addAll(extStack); datasourceRequest.setXAxis(xAxisForRequest); + List yAxisForRequest = new ArrayList<>(); + yAxisForRequest.addAll(yAxis); + datasourceRequest.setYAxis(yAxisForRequest); + datasourceRequest.setTotalPageFlag(false); data = datasourceProvider.getData(datasourceRequest); if (CollectionUtils.isNotEmpty(assistFields)) { datasourceAssistRequest.setQuery(assistSQL(datasourceRequest.getQuery(), assistFields)); diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index 344eb45540..2a6ba0f346 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -34,6 +34,7 @@ import io.dataease.plugins.common.base.mapper.*; import io.dataease.plugins.common.constants.DatasetType; import io.dataease.plugins.common.constants.DatasourceTypes; import io.dataease.plugins.common.constants.DeTypeConstants; +import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO; import io.dataease.plugins.common.dto.dataset.SqlVariableDetails; import io.dataease.plugins.common.dto.datasource.DataSourceType; import io.dataease.plugins.common.dto.datasource.TableField; @@ -712,6 +713,7 @@ public class DataSetTableService { datasourceRequest.setPreviewData(true); try { datasourceRequest.setPageable(true); + datasourceRequest.setPermissionFields(fields); data.addAll(datasourceProvider.getData(datasourceRequest)); } catch (Exception e) { logger.error(e.getMessage()); @@ -1147,8 +1149,8 @@ public class DataSetTableService { subSelect.setAlias(new Alias(rightItem.getAlias().toString(), false)); } join.setRightItem(subSelect); - joinsList.add(join); } + joinsList.add(join); } plainSelect.setJoins(joinsList); } diff --git a/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java b/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java index 4ad4eb61e4..a06283d097 100644 --- a/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java +++ b/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java @@ -195,6 +195,7 @@ public class DirectFieldService implements DataSetFieldService { datasourceRequest.setQuery(qp.createQuerySQL(tableName, permissionFields, !needSort, null, customFilter, rowPermissionsTree, deSortFields)); } LogUtil.info(datasourceRequest.getQuery()); + datasourceRequest.setPermissionFields(permissionFields); List rows = datasourceProvider.getData(datasourceRequest); if (!needMapping) { List results = rows.stream().map(row -> row[0]).distinct().collect(Collectors.toList()); diff --git a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java index 76d2f12ef4..80474a31b3 100644 --- a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java +++ b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java @@ -63,6 +63,8 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; @Service @@ -646,4 +648,22 @@ public class DatasourceService { addJob(basicInfo.getDsCheckIntervalType(), Integer.valueOf(basicInfo.getDsCheckInterval())); } + public void updateDemoDs() { + Datasource datasource = datasourceMapper.selectByPrimaryKey("76026997-94f9-4a35-96ca-151084638969"); + MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfiguration.class); + Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:mysql://(.*):(\\d+)/(.*)"); + Matcher matcher = WITH_SQL_FRAGMENT.matcher(env.getProperty("spring.datasource.url")); + if (!matcher.find()) { + return; + } + mysqlConfiguration.setHost(matcher.group(1)); + mysqlConfiguration.setPort(Integer.valueOf(matcher.group(2))); + mysqlConfiguration.setDataBase(matcher.group(3).split("\\?")[0]); + mysqlConfiguration.setExtraParams(matcher.group(3).split("\\?")[1]); + mysqlConfiguration.setUsername(env.getProperty("spring.datasource.username")); + mysqlConfiguration.setPassword(env.getProperty("spring.datasource.password")); + datasource.setConfiguration(new Gson().toJson(mysqlConfiguration)); + datasourceMapper.updateByPrimaryKeyWithBLOBs(datasource); + } + } diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java index 125abb63c0..3aac71fbe5 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -10,6 +10,7 @@ import io.dataease.auth.api.dto.CurrentUserDto; import io.dataease.commons.constants.*; import io.dataease.commons.utils.*; import io.dataease.controller.request.authModel.VAuthModelRequest; +import io.dataease.controller.request.chart.ChartExtRequest; import io.dataease.controller.request.dataset.DataSetTableRequest; import io.dataease.controller.request.panel.*; import io.dataease.dto.DatasourceDTO; @@ -182,7 +183,7 @@ public class PanelGroupService { } - public String update(PanelGroupRequest request) { + public PanelGroupDTO update(PanelGroupRequest request) { String panelId = request.getId(); request.setUpdateTime(System.currentTimeMillis()); request.setUpdateBy(AuthUtils.getUser().getUsername()); @@ -254,7 +255,7 @@ public class PanelGroupService { DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFY, sourceType, request.getId(), request.getPid(), null, sourceType); } this.removePanelAllCache(panelId); - return panelId; + return extPanelGroupMapper.findShortOneWithPrivileges(panelId, String.valueOf(AuthUtils.getUser().getUserId())); } public void move(PanelGroupRequest request) { @@ -294,14 +295,17 @@ public class PanelGroupService { public void deleteCircle(String id) { Assert.notNull(id, "id cannot be null"); - sysAuthService.checkTreeNoManageCount("panel", id); PanelGroupWithBLOBs panel = panelGroupMapper.selectByPrimaryKey(id); SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, sourceType, panel.getId(), panel.getPid(), null, null); + String nodeType = panel.getNodeType(); + if ("folder".equals(nodeType)) { + sysAuthService.checkTreeNoManageCount("panel", id); + } //清理view 和 view cache - extPanelGroupMapper.deleteCircleView(id); - extPanelGroupMapper.deleteCircleViewCache(id); + extPanelGroupMapper.deleteCircleView(id, nodeType); + extPanelGroupMapper.deleteCircleViewCache(id, nodeType); // 同时会删除对应默认仪表盘 - extPanelGroupMapper.deleteCircle(id); + extPanelGroupMapper.deleteCircle(id, nodeType); storeService.removeByPanelId(id); shareService.delete(id, null); panelLinkService.deleteByResourceId(id); @@ -649,6 +653,7 @@ public class PanelGroupService { public void exportPanelViewDetails(PanelViewDetailsRequest request, HttpServletResponse response) throws IOException { OutputStream outputStream = response.getOutputStream(); try { + findExcelData(request); String snapshot = request.getSnapshot(); List details = request.getDetails(); Integer[] excelTypes = request.getExcelTypes(); @@ -1086,6 +1091,32 @@ public class PanelGroupService { request.setUpdateTime(time); request.setUpdateBy(AuthUtils.getUser().getUsername()); panelGroupMapper.updateByPrimaryKeySelective(request); + } + + public void findExcelData(PanelViewDetailsRequest request) { + ChartViewWithBLOBs viewInfo = chartViewService.get(request.getViewId()); + if ("table-info".equals(viewInfo.getType())) { + try { + List excelHeaderKeys = request.getExcelHeaderKeys(); + ChartExtRequest componentFilterInfo = request.getComponentFilterInfo(); + componentFilterInfo.setGoPage(1l); + componentFilterInfo.setPageSize(1000000l); + componentFilterInfo.setExcelExportFlag(true); + ChartViewDTO chartViewInfo = chartViewService.getData(request.getViewId(), componentFilterInfo); + List tableRow = (List) chartViewInfo.getData().get("tableRow"); + List result = new ArrayList<>(); + for (Map detailMap : tableRow) { + List detailObj = new ArrayList<>(); + for (String key : excelHeaderKeys) { + detailObj.add(detailMap.get(key)); + } + result.add(detailObj.toArray()); + } + request.setDetails(result); + } catch (Exception e) { + throw new RuntimeException(e); + } + } } } diff --git a/backend/src/main/resources/db/migration/V50__1.18.3.sql b/backend/src/main/resources/db/migration/V50__1.18.3.sql new file mode 100644 index 0000000000..4974cb230d --- /dev/null +++ b/backend/src/main/resources/db/migration/V50__1.18.3.sql @@ -0,0 +1,6 @@ +UPDATE `my_plugin` +SET `version` = '1.18.3' +where `plugin_id` > 0 + and `version` = '1.18.2'; +UPDATE `panel_pdf_template` SET `name` = 'I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS',`template_content` = '
\n
\n $t(''panel.panel_name''):$panelName$
\n $t(''panel.export_time''):$yyyy-MM-dd hh:mm:ss$
\n $t(''panel.export_user''):$nickName$
\n $t(''panel.you_can_type_here'')\n
\n
\n \n
\n
' WHERE id='1'; +UPDATE `panel_pdf_template` SET `name` = 'I18N_PANEL_PDF_TEMPLATE_ONLY_PIC' WHERE id='2'; diff --git a/backend/src/main/resources/ehcache/ehcache.xml b/backend/src/main/resources/ehcache/ehcache.xml index c1fedd7f25..f8d8591b20 100644 --- a/backend/src/main/resources/ehcache/ehcache.xml +++ b/backend/src/main/resources/ehcache/ehcache.xml @@ -279,5 +279,17 @@ diskPersistent="false" /> + + \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 63c80bb089..3e28818c0a 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -62,7 +62,7 @@ i18n_panel_list=Dashboard i18n_processing_data=Processing data now, Refresh later i18n_union_already_exists=Union relation already exists i18n_union_field_exists=The same field can't in two dataset -i18n_cron_time_error=Start time can't greater then end time +i18n_cron_time_error=Start time can't greater than end time i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled,Please Connect Admin i18n_username_exists=ID is already exists i18n_nickname_exists=NickName is already exists @@ -134,7 +134,7 @@ theme_name_empty=name can not be empty i18n_public_chart=\u3010Public Chart\u3011 i18n_class_blue=Blue Tone \u63D2\u4EF6\u7BA1\u7406=Plugins -i18n_plugin_not_allow_delete=The plugin in in use cannot be deleted +i18n_plugin_not_allow_delete=The plugin in use cannot be deleted i18n_wrong_content=Wrong content i18n_wrong_tel=Wrong tel format i18n_wrong_email=Wrong email format @@ -146,7 +146,7 @@ OPERATE_TYPE_DELETE=Delete OPERATE_TYPE_SHARE=Share OPERATE_TYPE_UNSHARE=Unshare OPERATE_TYPE_AUTHORIZE=Authorize -OPERATE_TYPE_UNAUTHORIZE=Unauthorize +OPERATE_TYPE_UNAUTHORIZE=Unauthorized OPERATE_TYPE_CREATELINK=Create Link OPERATE_TYPE_DELETELINK=Delete Link OPERATE_TYPE_MODIFYLINK=Modify Link @@ -261,4 +261,16 @@ I18N_LOG_FORMAT_PREFIX=With authority of %s\u3010%s\u3011 \u6C34\u5370\u7BA1\u7406=Watermark \u8840\u7F18\u5173\u7CFB=Relationship -I18N_CRON_ERROR=Cron expression error \ No newline at end of file +I18N_CRON_ERROR=Cron expression error +I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS=Default template with params +I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=Default template only screenshot +\u8FB9\u68461=Border 1 +\u8FB9\u68462=Border 2 +\u8FB9\u68463=Border 3 +\u8FB9\u68464=Border 4 +\u8FB9\u68465=Border 5 +\u8FB9\u68466=Border 6 +\u8FB9\u68467=Border 7 +\u8FB9\u68468=Border 8 +\u8FB9\u68469=Border 9 +\u8FB9\u684610=Border 10 diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index a0a278575f..c1afe1cd28 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -262,4 +262,6 @@ I18N_LOG_FORMAT_PREFIX=\u4EE5%s\u3010%s\u3011\u6743\u9650 \u8840\u7F18\u5173\u7CFB=\u8840\u7F18\u5173\u7CFB I18N_CRON_ERROR=cron\u8868\u8FBE\u5F0F\u9519\u8BEF +I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS=\u9ED8\u8BA4\u6A21\u677F(\u52A0\u53C2\u6570\u6837\u5F0F) +I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8BA4\u6A21\u677F(\u53EA\u622A\u56FE) diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index fe253c3b6f..b5b4f68656 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -257,4 +257,16 @@ I18N_LOG_FORMAT_PREFIX=\u4EE5%s\u3010%s\u3011\u6B0A\u9650 \u6C34\u5370\u7BA1\u7406=\u6C34\u5370\u7BA1\u7406 \u8840\u7F18\u5173\u7CFB=\u8840\u7DE3\u95DC\u7CFB -I18N_CRON_ERROR=cron\u8868\u9054\u5F0F\u932F\u8AA4 \ No newline at end of file +I18N_CRON_ERROR=cron\u8868\u9054\u5F0F\u932F\u8AA4 +I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS=\u9ED8\u8A8D\u6A21\u677F(\u52A0\u53C3\u6578\u6A23\u5F0F) +I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8A8D\u6A21\u677F(\u53EA\u622A\u5716) +\u8FB9\u68461=\u908A\u6846 1 +\u8FB9\u68462=\u908A\u6846 2 +\u8FB9\u68463=\u908A\u6846 3 +\u8FB9\u68464=\u908A\u6846 4 +\u8FB9\u68465=\u908A\u6846 5 +\u8FB9\u68466=\u908A\u6846 6 +\u8FB9\u68467=\u908A\u6846 7 +\u8FB9\u68468=\u908A\u6846 8 +\u8FB9\u68469=\u908A\u6846 9 +\u8FB9\u684610=\u908A\u6846 10 diff --git a/backend/src/main/resources/sql/sqlTemplate.stg b/backend/src/main/resources/sql/sqlTemplate.stg index 41cd934e64..d24d71b521 100644 --- a/backend/src/main/resources/sql/sqlTemplate.stg +++ b/backend/src/main/resources/sql/sqlTemplate.stg @@ -1,4 +1,4 @@ -querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs) +querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs, useAliasForGroup) ::=<< SELECT @@ -23,10 +23,14 @@ FROM WHERE }; separator="\nAND "> - + GROUP BY }; separator=",\n"> + +GROUP BY + }; separator=",\n"> + ORDER BY }; separator=",\n"> @@ -34,7 +38,7 @@ ORDER BY >> -previewSql(limitFiled, groups, aggregators, filters, orders, table, isGroup, notUseAs) +previewSql(limitFiled, groups, aggregators, filters, orders, table, isGroup, notUseAs, useAliasForGroup) ::=<< SELECT @@ -59,10 +63,14 @@ FROM WHERE }; separator="\nAND "> - + GROUP BY }; separator=",\n"> + +GROUP BY + }; separator=",\n"> + ORDER BY }; separator=",\n"> diff --git a/frontend/package.json b/frontend/package.json index f312476501..3816f0a7ab 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "dataease", - "version": "1.18.2", + "version": "1.18.3", "description": "dataease front", "private": true, "scripts": { diff --git a/frontend/pom.xml b/frontend/pom.xml index d49c6b1aa2..123e82483a 100644 --- a/frontend/pom.xml +++ b/frontend/pom.xml @@ -6,7 +6,7 @@ dataease-server io.dataease - 1.18.2 + 1.18.3 4.0.0 diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 184adffb84..1ec6edbbca 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -6,17 +6,49 @@ ref="de-theme" component-name="ThemeSetting" /> + + + diff --git a/frontend/src/components/canvas/components/TextAttr.vue b/frontend/src/components/canvas/components/TextAttr.vue index 59a66cf145..d0fca3718b 100644 --- a/frontend/src/components/canvas/components/TextAttr.vue +++ b/frontend/src/components/canvas/components/TextAttr.vue @@ -466,7 +466,7 @@ export default { initFontSize: 12, initActiveFontSize: 18, miniFontSize: 12, - maxFontSize: 128, + maxFontSize: 256, textAlignOptions: [ { icon: 'iconfont icon-juzuo', diff --git a/frontend/src/components/canvas/customComponent/UserView.vue b/frontend/src/components/canvas/customComponent/UserView.vue index ea90bbee57..da4713b75f 100644 --- a/frontend/src/components/canvas/customComponent/UserView.vue +++ b/frontend/src/components/canvas/customComponent/UserView.vue @@ -770,6 +770,9 @@ export default { if (response.success) { this.chart = response.data this.view = response.data + if (this.chart.type.includes('table')) { + this.$store.commit('setLastViewRequestInfo', { viewId: id, requestInfo: requestInfo }) + } this.buildInnerRefreshTimer(this.chart.refreshViewEnable, this.chart.refreshUnit, this.chart.refreshTime) this.$emit('fill-chart-2-parent', this.chart) this.getDataOnly(response.data, dataBroadcast) @@ -912,6 +915,7 @@ export default { tableChart.customAttr.color.tableHeaderFontColor = '#7c7e81' tableChart.customAttr.color.tableFontColor = '#7c7e81' tableChart.customAttr.color.tableStripe = true + tableChart.customAttr.size.tablePageMode = 'pull' tableChart.customStyle.text.show = false tableChart.customAttr = JSON.stringify(tableChart.customAttr) tableChart.customStyle = JSON.stringify(tableChart.customStyle) diff --git a/frontend/src/components/canvas/customComponent/UserViewDialog.vue b/frontend/src/components/canvas/customComponent/UserViewDialog.vue index a61588c35e..a3a4d023ce 100644 --- a/frontend/src/components/canvas/customComponent/UserViewDialog.vue +++ b/frontend/src/components/canvas/customComponent/UserViewDialog.vue @@ -87,9 +87,20 @@ import html2canvas from 'html2canvasde' import { hexColorToRGBA } from '@/views/chart/chart/util' import { deepCopy, exportImg, imgUrlTrans } from '@/components/canvas/utils/utils' import { getLinkToken, getToken } from '@/utils/auth' + export default { name: 'UserViewDialog', - components: { LabelNormalText, ChartComponentS2, ChartComponentG2, DeMainContainer, DeContainer, ChartComponent, TableNormal, LabelNormal, PluginCom }, + components: { + LabelNormalText, + ChartComponentS2, + ChartComponentG2, + DeMainContainer, + DeContainer, + ChartComponent, + TableNormal, + LabelNormal, + PluginCom + }, props: { chart: { type: Object, @@ -123,8 +134,7 @@ export default { return this.chart.type === 'table-normal' || this.chart.type === 'table-info' }, customStyle() { - let style = { - } + let style = {} if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { style = { @@ -186,7 +196,8 @@ export default { 'isClickComponent', 'curComponent', 'componentData', - 'canvasStyleData' + 'canvasStyleData', + 'lastViewRequestInfo' ]), mapChart() { if (this.chart.type && (this.chart.type === 'map' || this.chart.type === 'buddle-map')) { @@ -211,7 +222,7 @@ export default { } }) } - const result = { ...temp, ...{ DetailAreaCode: DetailAreaCode }} + const result = { ...temp, ...{ DetailAreaCode: DetailAreaCode } } this.setLastMapChart(result) return result } @@ -285,6 +296,8 @@ export default { snapshot: snapshot, snapshotWidth: width, snapshotHeight: height, + componentFilterInfo: this.lastViewRequestInfo[this.chart.id], + excelHeaderKeys: excelHeaderKeys, detailFields } let method = innerExportDetails @@ -313,43 +326,49 @@ export default { diff --git a/frontend/src/components/canvas/utils/style.js b/frontend/src/components/canvas/utils/style.js index d6e254e97a..448ac7e418 100644 --- a/frontend/src/components/canvas/utils/style.js +++ b/frontend/src/components/canvas/utils/style.js @@ -381,7 +381,10 @@ export function adaptCurThemeCommonStyle(component) { if (isFilterComponent(component.component)) { const filterStyle = store.state.canvasStyleData.chartInfo.filterStyle for (const styleKey in filterStyle) { - Vue.set(component.style, styleKey, filterStyle[styleKey]) + // 位置属性不修改 + if (styleKey !== 'horizontal' && styleKey !== 'vertical') { + Vue.set(component.style, styleKey, filterStyle[styleKey]) + } } } else if (isTabComponent(component.component)) { const tabStyle = store.state.canvasStyleData.chartInfo.tabStyle diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index 220e083b0f..c39fd6efa2 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -8,7 +8,7 @@ import { import { ApplicationContext } from '@/utils/ApplicationContext' import { uuid } from 'vue-uuid' import store from '@/store' -import { AIDED_DESIGN, MOBILE_SETTING, PANEL_CHART_INFO, TAB_COMMON_STYLE, PAGE_LINE_DESIGN } from '@/views/panel/panel' +import { AIDED_DESIGN, MOBILE_SETTING, PAGE_LINE_DESIGN, PANEL_CHART_INFO, TAB_COMMON_STYLE } from '@/views/panel/panel' import html2canvas from 'html2canvasde' export function deepCopy(target) { @@ -271,3 +271,135 @@ export function findCurComponentIndex(componentData, curComponent) { } return curIndex } + +export function deleteTreeNode(nodeId, tree, nodeTarget) { + if (!nodeId || !tree || !tree.length) { + return + } + for (let i = 0, len = tree.length; i < len; i++) { + if (tree[i].id === nodeId) { + if (nodeTarget) { + nodeTarget['target'] = tree[i] + } + tree.splice(i, 1) + return + } else if (tree[i].children && tree[i].children.length) { + deleteTreeNode(nodeId, tree[i].children, nodeTarget) + } + } +} + +export function moveTreeNode(nodeInfo, tree) { + const nodeTarget = { target: null } + deleteTreeNode(nodeInfo.id, tree, nodeTarget) + if (nodeTarget.target) { + nodeTarget.target.pid = nodeInfo.pid + insertTreeNode(nodeTarget.target, tree) + } +} + +export function updateTreeNode(nodeInfo, tree) { + if (!nodeInfo) { + return + } + for (let i = 0, len = tree.length; i < len; i++) { + if (tree[i].id === nodeInfo.id) { + tree[i].name = nodeInfo.name + tree[i].label = nodeInfo.label + if (tree[i].isDefault) { + tree[i].isDefault = nodeInfo.isDefault + } + return + } else if (tree[i].children && tree[i].children.length) { + updateTreeNode(nodeInfo, tree[i].children) + } + } +} + +export function toDefaultTree(nodeId, tree) { + if (!nodeId) { + return + } + for (let i = 0, len = tree.length; i < len; i++) { + if (tree[i].id === nodeId) { + tree[i].isDefault = true + return + } else if (tree[i].children && tree[i].children.length) { + toDefaultTree(nodeId, tree[i].children) + } + } +} + +export function insertTreeNode(nodeInfo, tree) { + if (!nodeInfo) { + return + } + if (nodeInfo.pid === 0 || nodeInfo.pid === '0') { + tree.push(nodeInfo) + return + } + for (let i = 0, len = tree.length; i < len; i++) { + if (tree[i].id === nodeInfo.pid) { + if (!tree[i].children) { + tree[i].children = [] + } + tree[i].children.push(nodeInfo) + return + } else if (tree[i].children && tree[i].children.length) { + insertTreeNode(nodeInfo, tree[i].children) + } + } +} + +export function insertBatchTreeNode(nodeInfoArray, tree) { + if (!nodeInfoArray || nodeInfoArray.size === 0) { + return + } + const pid = nodeInfoArray[0].pid + for (let i = 0, len = tree.length; i < len; i++) { + if (tree[i].id === pid) { + if (!tree[i].children) { + tree[i].children = [] + } + tree[i].children = tree[i].children.concat(nodeInfoArray) + return + } else if (tree[i].children && tree[i].children.length) { + insertBatchTreeNode(nodeInfoArray, tree[i].children) + } + } +} + +export function updateCacheTree(opt, treeName, nodeInfo, tree) { + if (opt === 'new' || opt === 'copy') { + insertTreeNode(nodeInfo, tree) + } else if (opt === 'move') { + moveTreeNode(nodeInfo, tree) + } else if (opt === 'rename') { + updateTreeNode(nodeInfo, tree) + } else if (opt === 'delete') { + deleteTreeNode(nodeInfo, tree) + } else if (opt === 'newFirstFolder') { + tree.push(nodeInfo) + } else if (opt === 'batchNew') { + insertBatchTreeNode(nodeInfo, tree) + } else if (opt === 'toDefaultPanel') { + toDefaultTree(nodeInfo.source, tree) + } + localStorage.setItem(treeName, JSON.stringify(tree)) +} + +export function formatDatasetTreeFolder(tree) { + if (tree && tree.length) { + for (let len = tree.length - 1; len > -1; len--) { + if (tree[len].modelInnerType !== 'group') { + tree.splice(len, 1) + } else if (tree[len].children && tree[len].children.length) { + formatDatasetTreeFolder(tree[len].children) + } + } + } +} + +export function getCacheTree(treeName) { + return JSON.parse(localStorage.getItem(treeName)) +} diff --git a/frontend/src/components/widget/deWidget/TitlePosition.vue b/frontend/src/components/widget/deWidget/TitlePosition.vue index 1af68342f3..fb9b0e2645 100644 --- a/frontend/src/components/widget/deWidget/TitlePosition.vue +++ b/frontend/src/components/widget/deWidget/TitlePosition.vue @@ -19,12 +19,14 @@ {{ $t('chart.text_pos_left') }} {{ $t('chart.text_pos_center') }} + >{{ $t('chart.text_pos_center') }} + {{ $t('chart.text_pos_right') }} @@ -36,12 +38,14 @@ {{ $t('chart.text_pos_top') }} {{ $t('chart.text_pos_center') }} + >{{ $t('chart.text_pos_center') }} + @@ -73,6 +77,12 @@ export default { type: String, default: '' } + }, + + methods: { + styleChange() { + this.$store.commit('canvasChange') + } } } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index f97d2eb399..765cc7595a 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -2316,7 +2316,13 @@ export default { fold: 'Fold', expand: 'Expand', pdf_export: 'PDF Export', - switch_pdf_template: 'Switch PDF Template' + switch_pdf_template: 'Switch PDF Template', + pdf_template_with_params: 'Default template(with params)', + pdf_template_only_pic: 'Default template(only screenshot)', + panel_name: 'Panel name', + export_user: 'Export User', + export_time: 'Export Time', + you_can_type_here: 'You can type here' }, plugin: { local_install: 'Local installation', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index ee62fb3c3d..8c23dfbe84 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -2310,7 +2310,13 @@ export default { fold: '收起', expand: '展開', pdf_export: 'PDF 導出', - switch_pdf_template: '切換 PDF 模板' + switch_pdf_template: '切換 PDF 模板', + pdf_template_with_params: '默認模板(加參數樣式)', + pdf_template_only_pic: '默認模板(只截圖)', + panel_name: '儀錶板名稱', + export_user: '導出用戶', + export_time: '導出時間', + you_can_type_here: '可以在這裡輸入其他內容' }, plugin: { local_install: '本地安裝', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 1fb1fe5f52..767c2d7f44 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -2310,7 +2310,13 @@ export default { fold: '收起', expand: '展开', pdf_export: 'PDF 导出', - switch_pdf_template: '切换 PDF 模板' + switch_pdf_template: '切换 PDF 模板', + pdf_template_with_params: '默认模板(加参数样式)', + pdf_template_only_pic: '默认模板(只截图)', + panel_name: '仪表板名称', + export_user: '导出用户', + export_time: '导出时间', + you_can_type_here: '可以在这里输入其他内容' }, plugin: { local_install: '本地安装', diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 0eca5b451d..29ce410ffb 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -365,7 +365,7 @@ export default { if (result !== 'success' && result !== 'fail') { window.location.href = result } else { - this.$router.push('/login') + this.$router.push(`/login?redirect=${this.$route.fullPath}`) } }, loadUiInfo() { diff --git a/frontend/src/permission.js b/frontend/src/permission.js index ba89f734a7..c5961184b6 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -53,7 +53,7 @@ const routeBefore = (callBack) => { callBack() } } -router.beforeEach(async(to, from, next) => routeBefore(() => { +router.beforeEach(async (to, from, next) => routeBefore(() => { // start progress bar NProgress.start() const mobileIgnores = ['/delink'] @@ -118,8 +118,7 @@ router.beforeEach(async(to, from, next) => routeBefore(() => { next() } else { // other pages that do not have permission to access are redirected to the login page. - // next(`/login?redirect=${to.path}`) - next('/login') + next(`/login?redirect=${to.path}`) NProgress.done() } } diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 72622c1890..1b8bed91f8 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -152,7 +152,8 @@ const data = { }, previewVisible: false, previewComponentData: [], - currentCanvasNewId: [] + currentCanvasNewId: [], + lastViewRequestInfo: {} }, mutations: { ...animation.mutations, @@ -610,6 +611,9 @@ const data = { resetViewEditInfo(state) { state.panelViewEditInfo = {} }, + setLastViewRequestInfo(state, viewRequestInfo) { + state.lastViewRequestInfo[viewRequestInfo.viewId] = viewRequestInfo.requestInfo + }, removeCurBatchComponentWithId(state, id) { for (let index = 0; index < state.curBatchOptComponents.length; index++) { const element = state.curBatchOptComponents[index] diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index 5d8795d358..91ca204667 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -13,6 +13,7 @@ const getDefaultState = () => { name: '', user: {}, roles: [], + passwordModified: true, avatar: '', // 第一次加载菜单时用到 loadMenus: false, @@ -66,7 +67,10 @@ const mutations = { if (language && i18n.locale !== language) { i18n.locale = language } - } + }, + SET_PASSWORD_MODIFIED: (state, passwordModified) => { + state.passwordModified = passwordModified + }, } const actions = { @@ -79,6 +83,12 @@ const actions = { commit('SET_TOKEN', data.token) commit('SET_LOGIN_MSG', null) setToken(data.token) + let passwordModified = true + if (data.hasOwnProperty('passwordModified')) { + passwordModified = data.passwordModified + } + commit('SET_PASSWORD_MODIFIED', passwordModified) + localStorage.setItem('passwordModified', passwordModified) resolve() }).catch(error => { reject(error) @@ -192,7 +202,7 @@ const actions = { setLanguage({ commit }, language) { languageApi(language).then(() => { commit('SET_LANGUAGE', language) - router.go(0) + location.reload() }) }, setLinkToken({ commit }, linkToken) { diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index e07bc87886..c76b43b777 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -828,8 +828,12 @@ div:focus { color: #1F2329 !important; } -.de-select-grid-class { - .el-checkbox__input.is-checked:not(.is-disabled)+.el-checkbox__label { +.el-radio__input.is-checked:not(.is-disabled)+.el-radio__label { + color: var(--deTextPrimary, #1F2329) !important; +} + +.de-select-grid-class{ + .el-checkbox__input.is-checked:not(.is-disabled)+.el-checkbox__label, .el-radio__input.is-checked:not(.is-disabled)+.el-radio__label { color: #3370ff !important; } } @@ -1176,9 +1180,6 @@ div:focus { color: var(--deTextPrimary, #1F2329) !important; } -.el-radio__input.is-checked:not(.is-disabled)+.el-radio__label { - color: var(--deTextPrimary, #1F2329) !important; -} .date-filter-poper>.el-scrollbar>.el-select-dropdown__wrap { max-height: 230px !important; diff --git a/frontend/src/utils/StringUtils.js b/frontend/src/utils/StringUtils.js index 0707dc2bd4..8fb157234e 100644 --- a/frontend/src/utils/StringUtils.js +++ b/frontend/src/utils/StringUtils.js @@ -1,3 +1,5 @@ +import i18n from '@/lang' + // 替换所有 标准模板格式 为 $panelName$ export function pdfTemplateReplaceAll(content, source, target) { const pattern = '\\$' + source + '\\$' @@ -37,3 +39,20 @@ export function includesAny(target, ...sources) { } return false } + +// 替换字符串中的国际化内容, 格式为$t('xxx') +export function replaceInlineI18n(rawString) { + const res = [] + const reg = /\$t\('([\w.]+)'\)/gm + let tmp + if (!rawString) { + return res + } + while ((tmp = reg.exec(rawString)) !== null) { + res.push(tmp) + } + res.forEach((tmp) => { + rawString = rawString.replaceAll(tmp[0], i18n.t(tmp[1])) + }) + return rawString +} diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js index 78536360fc..477c20817c 100644 --- a/frontend/src/utils/request.js +++ b/frontend/src/utils/request.js @@ -1,7 +1,7 @@ import axios from 'axios' import store from '@/store' import { $alert, $error } from './message' -import { getToken, getIdToken } from '@/utils/auth' +import { getToken, getIdToken, setToken } from '@/utils/auth' import Config from '@/settings' import i18n from '@/lang' import { tryShowLoading, tryHideLoading } from './loading' @@ -157,6 +157,7 @@ const checkAuth = response => { // token到期后自动续命 刷新token if (response.headers[RefreshTokenKey]) { const refreshToken = response.headers[RefreshTokenKey] + setToken(refreshToken) store.dispatch('user/refreshToken', refreshToken) } diff --git a/frontend/src/views/background/index.vue b/frontend/src/views/background/index.vue index bcb72f375f..58cd92aa7b 100644 --- a/frontend/src/views/background/index.vue +++ b/frontend/src/views/background/index.vue @@ -179,13 +179,13 @@ :span="5" style="padding-left: 10px;padding-top: 8px" > - 输入框样式(颜色): + {{ $t('panel.input_style') }}: - 边框 + {{ $t('panel.board') }} - 文字 + {{ $t('panel.text') }} - 背景 + {{ $t('panel.background') }} {{ $t('chart.total') }} {{ - (chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) - }} + (chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) + }} {{ $t('chart.items') }} { - console.log(valid) }) } } diff --git a/frontend/src/views/dataset/add/AddApi.vue b/frontend/src/views/dataset/add/AddApi.vue index 1224414b3c..8001c55ee1 100644 --- a/frontend/src/views/dataset/add/AddApi.vue +++ b/frontend/src/views/dataset/add/AddApi.vue @@ -9,7 +9,7 @@ class="arrow-right" @click="showLeft = true" > - +

{{ - `${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}` - }} + `${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}` + }}
diff --git a/frontend/src/views/dataset/add/AddDB.vue b/frontend/src/views/dataset/add/AddDB.vue index e7774cbc41..f613e85486 100644 --- a/frontend/src/views/dataset/add/AddDB.vue +++ b/frontend/src/views/dataset/add/AddDB.vue @@ -9,7 +9,7 @@ class="arrow-right" @click="showLeft = true" > - +

{{ - `${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}` - }} + `${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}` + }}
\ No newline at end of file diff --git a/frontend/src/views/system/user/PersonPwd.vue b/frontend/src/views/system/user/PersonPwd.vue index 55e6939488..8e5a4f1ca1 100644 --- a/frontend/src/views/system/user/PersonPwd.vue +++ b/frontend/src/views/system/user/PersonPwd.vue @@ -5,45 +5,7 @@
{{ $t('user.change_password') }}
- - - - - - - - - - - - {{ $t('commons.confirm') }} - - +
@@ -51,39 +13,9 @@