Merge pull request #4569 from dataease/dev

merge dev
This commit is contained in:
fit2cloudrd 2023-02-20 10:31:15 +08:00 committed by GitHub
commit 8ffec36ca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
76 changed files with 1420 additions and 701 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>dataease-server</artifactId>
<groupId>io.dataease</groupId>
<version>1.18.2</version>
<version>1.18.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -119,7 +119,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>[1.10.0,)</version>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
@ -204,7 +204,7 @@
<dependency>
<groupId>io.dataease</groupId>
<artifactId>dataease-plugin-interface</artifactId>
<version>1.18.2</version>
<version>1.18.3</version>
<exclusions>
<exclusion>
<artifactId>guava</artifactId>
@ -215,12 +215,12 @@
<dependency>
<groupId>io.dataease</groupId>
<artifactId>dataease-plugin-view</artifactId>
<version>1.18.2</version>
<version>1.18.3</version>
</dependency>
<dependency>
<groupId>io.dataease</groupId>
<artifactId>dataease-plugin-datasource</artifactId>
<version>1.18.2</version>
<version>1.18.3</version>
</dependency>
<!-- kettle及数据源依赖 -->
<dependency>

View File

@ -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 {

View File

@ -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("查询")

View File

@ -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);

View File

@ -63,6 +63,7 @@ public class AuthServer implements AuthApi {
@Override
public Object login(@RequestBody LoginDto loginDto) throws Exception {
Map<String, Object> 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<String, Object> result = new HashMap<>();
TokenInfo tokenInfo = TokenInfo.builder().userId(user.getUserId()).username(username).build();
String token = JWTUtils.sign(tokenInfo, realPwd);
// 记录token操作时间

View File

@ -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());
}
}

View File

@ -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<SecurityScheme> securitySchemes=new ArrayList<>();
List<SecurityScheme> securitySchemes = new ArrayList<>();
securitySchemes.add(accessKey());
securitySchemes.add(signature());
List<SecurityContext> 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<Class<?>, Boolean> handlerPackage(final String basePackage) {
private static Function<Class<?>, Boolean> handlerPackage(final String basePackage) {
return input -> {
// 循环判断匹配
for (String strPackage : basePackage.split(splitor)) {

View File

@ -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

View File

@ -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<DatasetTable> batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
return dataSetTableService.batchInsert(datasetTable);
public List<VAuthModelDTO> batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
List<String> 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<DatasetTable> save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
public List<VAuthModelDTO> save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
if (datasetTable.getType().equalsIgnoreCase("excel")) {
return dataSetTableService.saveExcel(datasetTable);
List<String> 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()));
}
}

View File

@ -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);
}

View File

@ -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<PanelPdfTemplate> queryAll() {
return panelPdfTemplateService.queryAll();

View File

@ -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;
}

View File

@ -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<String> excelHeaderKeys;
}

View File

@ -15,18 +15,20 @@ public interface ExtPanelGroupMapper {
List<PanelGroupDTO> 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<String> viewIds);
void removeUselessViews(@Param("panelId") String panelId, @Param("viewIds") List<String> viewIds);
List<PanelGroupDTO> panelGroupInit();

View File

@ -31,6 +31,26 @@
and panel_type = 'self'
</select>
<select id="findShortOneWithPrivileges" resultMap="BaseResultMapDTO">
SELECT panel_group.id,
panel_group.`name`,
panel_group.pid,
panel_group.`level`,
panel_group.node_type,
panel_group.create_by,
panel_group.create_time,
panel_group.panel_type,
panel_group.`name` AS label,
panel_group.`source`,
panel_group.`panel_type`,
panel_group.`status`,
panel_group.`mobile_layout`,
panel_group.`name` as source_panel_name,
get_auths(panel_group.id, 'panel', #{userId}) as `privileges`
from panel_group
where id = #{panelId}
</select>
<select id="panelGroupListDefault" resultMap="BaseResultMapDTO">
SELECT
panel_group.id,
@ -185,20 +205,34 @@
<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}))
where
panel_group.id = #{pid}
or
panel_group.source = #{pid}
<if test="nodeType == 'folder'">
or 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}))
</if>
</delete>
<delete id="deleteCircleView">
delete
from chart_view
where FIND_IN_SET(chart_view.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
where
chart_view.scene_id = #{pid}
<if test="nodeType == 'folder'">
or FIND_IN_SET(chart_view.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
</if>
</delete>
<delete id="deleteCircleViewCache">
delete
from chart_view_cache
where FIND_IN_SET(chart_view_cache.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
where
chart_view_cache.scene_id = #{pid}
<if test="nodeType == 'folder'">
or FIND_IN_SET(chart_view_cache.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
</if>
</delete>
<insert id="copyPanelView">
@ -226,120 +260,106 @@
</delete>
<select id="queryPanelRelation" resultType="io.dataease.dto.RelationDTO" resultMap="io.dataease.ext.ExtDataSourceMapper.RelationResultMap">
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
<select id="queryPanelRelation" resultType="io.dataease.dto.RelationDTO"
resultMap="io.dataease.ext.ExtDataSourceMapper.RelationResultMap">
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
order by id
</select>
<select id="listPanelByUser" resultType="io.dataease.plugins.common.base.domain.PanelGroup"
resultMap="io.dataease.plugins.common.base.mapper.PanelGroupMapper.BaseResultMap">
select
pg.*
from
panel_group pg
join sys_auth sa on sa.auth_source = pg.id
join sys_auth_detail sad on sa.id = sad.auth_id
where
pg.node_type = 'panel'
and
sa.auth_source_type = 'panel'
and
sad.privilege_value = 1
and
(
select pg.*
from panel_group pg
join sys_auth sa on sa.auth_source = pg.id
join sys_auth_detail sad on sa.id = sad.auth_id
where pg.node_type = 'panel'
and sa.auth_source_type = 'panel'
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 = '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 = '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} )
)
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 pg.id
</select>

View File

@ -10,7 +10,9 @@ public interface ExtVAuthModelMapper {
List<VAuthModelDTO> queryAuthModel(@Param("record") VAuthModelRequest record);
List<VAuthModelDTO> queryAuthModelViews (@Param("record") VAuthModelRequest record);
List<VAuthModelDTO> queryAuthModelByIds(@Param("userId") String userId, @Param("modelType") String modelType, @Param("ids") List<String> ids);
List<VAuthModelDTO> queryAuthViewsOriginal (@Param("record") VAuthModelRequest record);
List<VAuthModelDTO> queryAuthModelViews(@Param("record") VAuthModelRequest record);
List<VAuthModelDTO> queryAuthViewsOriginal(@Param("record") VAuthModelRequest record);
}

View File

@ -8,6 +8,29 @@
<result column="is_plugin" jdbcType="VARCHAR" property="isPlugin"/>
</resultMap>
<select id="queryAuthModelByIds" resultMap="ExtResultMap">
SELECT
v_auth_model.id,
v_auth_model.name,
v_auth_model.label,
v_auth_model.pid,
v_auth_model.node_type,
v_auth_model.model_type,
v_auth_model.model_inner_type,
v_auth_model.auth_type,
v_auth_model.create_by,
v_auth_model.level,
v_auth_model.mode,
v_auth_model.data_source_id,
get_auths(v_auth_model.id, #{modelType}, #{userId}) as `privileges`
FROM
v_auth_model where v_auth_model.model_type = #{modelType} and v_auth_model.id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
ORDER BY v_auth_model.node_type desc, CONVERT(v_auth_model.label using gbk) asc
</select>
<select id="queryAuthModel" resultMap="ExtResultMap">
SELECT
v_auth_model.id,
@ -137,10 +160,8 @@
<select id="queryAuthViewsOriginal" resultMap="ExtResultMap">
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
</select>

View File

@ -26,6 +26,7 @@ public class DataSourceInitStartListener implements ApplicationListener<Applicat
datasourceService.initDsCheckJob();
dataSetTableService.updateDatasetTableStatus();
engineService.initSimpleEngine();
datasourceService.updateDemoDs();
CacheUtils.removeAll("ENGINE");
}

View File

@ -16,19 +16,20 @@ import io.dataease.plugins.xpack.auth.dto.request.XpackSysAuthRequest;
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetail;
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO;
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
import io.dataease.service.datasource.DatasourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ApiIgnore
@Api(tags = "xpack权限管理")
@RequestMapping("/plugin/auth")
@RestController
public class XAuthServer {
@ -41,6 +42,7 @@ public class XAuthServer {
@RequiresPermissions("auth:read")
@PostMapping("/authModels")
@I18n
@ApiOperation("根据类型查询权限树")
public List<XpackVAuthModelDTO> 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<String, List<XpackSysAuthDetailDTO>> 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<XpackSysAuthDetail> authDetailsModel(@PathVariable String authType, @PathVariable String direction) {
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
List<XpackSysAuthDetail> 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<DatasourceBaseType> getDatasourceTypes(){
Collection<DataSourceType> activeType = datasourceService.types();
Map<String,String> activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName));
activeTypeMap.put("all","所有数据源");
@ApiOperation("查询授权的数据类型")
public List<DatasourceBaseType> getDatasourceTypes() {
Collection<DataSourceType> activeType = datasourceService.types();
Map<String, String> activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName));
activeTypeMap.put("all", "所有数据源");
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
List<DatasourceBaseType> 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;
}
}

View File

@ -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<JSONObject> fields, JSONObject item) {

View File

@ -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);

View File

@ -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<VAuthModelDTO> queryAuthModelByIds(String modelType, List<String> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
List<VAuthModelDTO> result = extVAuthModelMapper.queryAuthModelByIds(String.valueOf(AuthUtils.getUser().getUserId()), modelType, ids);
if (CollectionUtils.isEmpty(result)) {
return new ArrayList<>();
} else {
return result;
}
}
public List<VAuthModelDTO> queryAuthModel(VAuthModelRequest request) {
request.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
List<VAuthModelDTO> 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<VAuthModelDTO> filterPrivileges(VAuthModelRequest request, List<VAuthModelDTO> result) {
if(AuthUtils.getUser().getIsAdmin()){
if (AuthUtils.getUser().getIsAdmin()) {
return result;
}
if (request.getPrivileges() != null) {

View File

@ -526,8 +526,12 @@ public class ChartViewService {
}
}
List<ChartViewFieldDTO> xAxisForRequest = new ArrayList<>();
xAxisForRequest.addAll(xAxis); xAxisForRequest.addAll(extStack);
xAxisForRequest.addAll(xAxis);
xAxisForRequest.addAll(extStack);
datasourceRequest.setXAxis(xAxisForRequest);
List<ChartViewFieldDTO> 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<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) {
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<java.lang.String[]> 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<ChartViewFieldDTO> xAxisForRequest = new ArrayList<>();
xAxisForRequest.addAll(xAxis); xAxisForRequest.addAll(extStack);
xAxisForRequest.addAll(xAxis);
xAxisForRequest.addAll(extStack);
datasourceRequest.setXAxis(xAxisForRequest);
List<ChartViewFieldDTO> 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));

View File

@ -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);
}

View File

@ -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<String[]> rows = datasourceProvider.getData(datasourceRequest);
if (!needMapping) {
List<Object> results = rows.stream().map(row -> row[0]).distinct().collect(Collectors.toList());

View File

@ -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);
}
}

View File

@ -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<Object[]> 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<String> excelHeaderKeys = request.getExcelHeaderKeys();
ChartExtRequest componentFilterInfo = request.getComponentFilterInfo();
componentFilterInfo.setGoPage(1l);
componentFilterInfo.setPageSize(1000000l);
componentFilterInfo.setExcelExportFlag(true);
ChartViewDTO chartViewInfo = chartViewService.getData(request.getViewId(), componentFilterInfo);
List<Map> tableRow = (List) chartViewInfo.getData().get("tableRow");
List<Object[]> result = new ArrayList<>();
for (Map detailMap : tableRow) {
List<Object> 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);
}
}
}
}

View File

@ -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` = '<div style=\"margin-top: 5px\">\n <div contenteditable=\"true\"> \n $t(''panel.panel_name'')$panelName$ </br>\n $t(''panel.export_time'')$yyyy-MM-dd hh:mm:ss$ </br>\n $t(''panel.export_user'')$nickName$ </br>\n $t(''panel.you_can_type_here'')\n </div>\n <div>\n <img width=\"100%\" src=\"$snapshot$\">\n </div>\n </div>' WHERE id='1';
UPDATE `panel_pdf_template` SET `name` = 'I18N_PANEL_PDF_TEMPLATE_ONLY_PIC' WHERE id='2';

View File

@ -279,5 +279,17 @@
diskPersistent="false"
/>
<cache
name="sys_token_store_delay"
eternal="false"
maxElementsInMemory="100"
maxElementsOnDisk="3000"
overflowToDisk="true"
diskPersistent="false"
timeToIdleSeconds="3"
timeToLiveSeconds="5"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>

View File

@ -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
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

View File

@ -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)

View File

@ -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
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

View File

@ -1,4 +1,4 @@
querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs)
querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs, useAliasForGroup)
::=<<
SELECT
<if(limitFiled)>
@ -23,10 +23,14 @@ FROM
WHERE
<filters:{filter|<if(filter)><filter><endif>}; separator="\nAND ">
<endif>
<if(groups)>
<if(groups && !useAliasForGroup)>
GROUP BY
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
<endif>
<if(groups && useAliasForGroup)>
GROUP BY
<groups:{group|<if(group)><group.fieldAlias><endif>}; separator=",\n">
<endif>
<if(orders)>
ORDER BY
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; 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
<if(limitFiled)>
@ -59,10 +63,14 @@ FROM
WHERE
<filters:{filter|<if(filter)><filter><endif>}; separator="\nAND ">
<endif>
<if(isGroup && groups)>
<if(groups && !useAliasForGroup)>
GROUP BY
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
<endif>
<if(groups && useAliasForGroup)>
GROUP BY
<groups:{group|<if(group)><group.fieldAlias><endif>}; separator=",\n">
<endif>
<if(orders)>
ORDER BY
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">

View File

@ -1,6 +1,6 @@
{
"name": "dataease",
"version": "1.18.2",
"version": "1.18.3",
"description": "dataease front",
"private": true,
"scripts": {

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>dataease-server</artifactId>
<groupId>io.dataease</groupId>
<version>1.18.2</version>
<version>1.18.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,17 +6,49 @@
ref="de-theme"
component-name="ThemeSetting"
/>
<el-dialog
v-if="$route.path !== '/login'"
:visible.sync="showPasswordModifiedDialog"
append-to-body
:title="$t('user.change_password')"
:show-close="false"
>
<PasswordUpdateForm oldPwd="dataease" />
</el-dialog>
</div>
</template>
<script>
import PluginCom from '@/views/system/plugin/PluginCom'
import { mapState } from 'vuex'
import PasswordUpdateForm from '@/views/system/user/PasswordUpdateForm.vue'
export default {
name: 'App',
components: { PluginCom },
beforeCreate() {
components: { PluginCom, PasswordUpdateForm },
computed: {
...mapState('user', [
'passwordModified',
])
},
data() {
return {
showPasswordModifiedDialog: false
}
},
mounted() {
const passwordModified = JSON.parse(localStorage.getItem('passwordModified'))
if (typeof passwordModified === 'boolean') {
this.$store.commit('user/SET_PASSWORD_MODIFIED', passwordModified)
}
},
watch: {
passwordModified: {
handler(val) {
this.showPasswordModifiedDialog = !val
},
immediate: true
}
}
}
</script>

View File

@ -466,7 +466,7 @@ export default {
initFontSize: 12,
initActiveFontSize: 18,
miniFontSize: 12,
maxFontSize: 128,
maxFontSize: 256,
textAlignOptions: [
{
icon: 'iconfont icon-juzuo',

View File

@ -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)

View File

@ -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 {
</script>
<style lang="scss" scoped>
.ms-aside-container {
height: 70vh;
min-width: 400px;
max-width: 400px;
padding: 0 0;
}
.ms-main-container {
height: 70vh;
border: 1px solid #E6E6E6;
}
.chart-class{
height: 100%;
}
.table-class{
height: 100%;
}
.canvas-class{
position: relative;
width: 100%;
height: 100%;
background-size: 100% 100% !important;
}
.abs-container {
position: absolute;
width: 100%;
margin-left: -20px;
.ms-main-container {
padding: 0px !important;
}
}
.ms-aside-container {
height: 70vh;
min-width: 400px;
max-width: 400px;
padding: 0 0;
}
.svg-background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.ms-main-container {
height: 70vh;
border: 1px solid #E6E6E6;
}
.chart-class {
height: 100%;
}
.table-class {
height: 100%;
}
.canvas-class {
position: relative;
width: 100%;
height: 100%;
background-size: 100% 100% !important;
}
.abs-container {
position: absolute;
width: 100%;
margin-left: -20px;
.ms-main-container {
padding: 0px !important;
}
}
.svg-background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>

View File

@ -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

View File

@ -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))
}

View File

@ -19,12 +19,14 @@
<el-radio-group
v-model="styleInfo.horizontal"
size="mini"
@change="styleChange"
>
<el-radio-button label="left">{{ $t('chart.text_pos_left') }}</el-radio-button>
<el-radio-button
:disabled="styleInfo.vertical === 'center' && elementType !== 'de-select-grid'"
label="center"
>{{ $t('chart.text_pos_center') }}</el-radio-button>
>{{ $t('chart.text_pos_center') }}
</el-radio-button>
<el-radio-button label="right">{{ $t('chart.text_pos_right') }}</el-radio-button>
</el-radio-group>
</el-form-item>
@ -36,12 +38,14 @@
<el-radio-group
v-model="styleInfo.vertical"
size="mini"
@change="styleChange"
>
<el-radio-button label="top">{{ $t('chart.text_pos_top') }}</el-radio-button>
<el-radio-button
:disabled="styleInfo.horizontal === 'center'"
label="center"
>{{ $t('chart.text_pos_center') }}</el-radio-button>
>{{ $t('chart.text_pos_center') }}
</el-radio-button>
</el-radio-group>
</el-form-item>
@ -73,6 +77,12 @@ export default {
type: String,
default: ''
}
},
methods: {
styleChange() {
this.$store.commit('canvasChange')
}
}
}

View File

@ -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',

View File

@ -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: '本地安裝',

View File

@ -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: '本地安装',

View File

@ -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() {

View File

@ -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()
}
}

View File

@ -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]

View File

@ -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) {

View File

@ -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;

View File

@ -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
}

View File

@ -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)
}

View File

@ -179,13 +179,13 @@
:span="5"
style="padding-left: 10px;padding-top: 8px"
>
输入框样式(颜色):
{{ $t('panel.input_style') }}:
</el-col>
<el-col
:span="2"
style="padding-left: 10px;padding-top: 8px"
>
边框
{{ $t('panel.board') }}
</el-col>
<el-col
:span="3"
@ -202,7 +202,7 @@
:span="2"
style="padding-left: 10px;padding-top: 8px"
>
文字
{{ $t('panel.text') }}
</el-col>
<el-col
:span="3"
@ -219,7 +219,7 @@
:span="2"
style="padding-left: 10px;padding-top: 8px"
>
背景
{{ $t('panel.background') }}
</el-col>
<el-col
:span="3"

View File

@ -67,8 +67,8 @@
>
{{ $t('chart.total') }}
<span>{{
(chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
}}</span>
(chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
}}</span>
{{ $t('chart.items') }}
</span>
<de-pagination
@ -339,7 +339,7 @@ export default {
if (this.chart.type === 'table-pivot') {
rowData = { ...meta.rowQuery, ...meta.colQuery }
rowData[meta.valueField] = meta.fieldValue
} else if (this.showPage) {
} else if (this.showPage && (this.chart.datasetMode === 1 || (this.chart.datasetMode === 0 && this.not_support_page_dataset.includes(this.chart.datasourceType)))) {
const rowIndex = (this.currentPage.page - 1) * this.currentPage.pageSize + meta.rowIndex
rowData = this.chart.data.tableRow[rowIndex]
} else {

View File

@ -393,7 +393,6 @@ export default {
},
getItemTagType() {
this.$refs['markForm'].validate((valid) => {
console.log(valid)
})
}
}

View File

@ -9,7 +9,7 @@
class="arrow-right"
@click="showLeft = true"
>
<i class="el-icon-d-arrow-right" />
<i class="el-icon-d-arrow-right"/>
</p>
<div
v-show="showLeft"
@ -172,8 +172,8 @@
class="data"
>
<span class="result-num">{{
`${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}`
}}</span>
`${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}`
}}</span>
<div class="table-grid">
<ux-grid
ref="plxTable"
@ -214,11 +214,12 @@
</template>
<script>
import { listApiDatasource, post, isKettleRunning } from '@/api/dataset/dataset'
import { isKettleRunning, listApiDatasource, post } from '@/api/dataset/dataset'
import { dbPreview, engineMode } from '@/api/system/engine'
import cancelMix from './cancelMix'
import msgCfm from '@/components/msgCfm/index'
import { pySort } from './util'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'AddApi',
@ -442,6 +443,7 @@ export default {
post('/dataset/table/batchAdd', tables)
.then((response) => {
this.openMessageSuccess('deDataset.set_saved_successfully')
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
this.cancel(response.data)
})
.finally(() => {
@ -485,10 +487,12 @@ export default {
border-top-right-radius: 13px;
border-bottom-right-radius: 13px;
}
.table-list {
p {
margin: 0;
}
height: 100%;
width: 240px;
padding: 16px 12px;
@ -501,6 +505,7 @@ export default {
display: flex;
justify-content: space-between;
color: var(--deTextPrimary, #1f2329);
i {
cursor: pointer;
font-size: 12px;
@ -511,6 +516,7 @@ export default {
.search {
margin: 12px 0;
}
.ds-list {
margin: 12px 0 24px 0;
width: 100%;
@ -519,6 +525,7 @@ export default {
.table-checkbox-list {
height: calc(100% - 190px);
overflow-y: auto;
.item {
height: 40px;
width: 100%;
@ -556,12 +563,14 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
.error-name-exist {
position: absolute;
top: 10px;
right: 10px;
}
}
.not-allow {
cursor: not-allowed;
color: var(--deTextDisable, #bbbfc4);
@ -573,6 +582,7 @@ export default {
font-family: PingFang SC;
flex: 1;
overflow: hidden;
.top-table-detail {
height: 64px;
width: 100%;
@ -580,6 +590,7 @@ export default {
background: #f5f6f7;
display: flex;
align-items: center;
.el-select {
width: 120px;
margin-right: 12px;
@ -593,6 +604,7 @@ export default {
display: flex;
align-items: center;
position: relative;
.name {
font-size: 14px;
font-weight: 400;
@ -611,6 +623,7 @@ export default {
height: calc(100% - 140px);
width: 100%;
box-sizing: border-box;
.result-num {
font-weight: 400;
display: inline-block;

View File

@ -5,7 +5,7 @@
class="title-text"
>
<span style="line-height: 26px;">
{{ param.tableId?$t('dataset.edit_custom_table'):$t('dataset.add_custom_table') }}
{{ param.tableId ? $t('dataset.edit_custom_table') : $t('dataset.add_custom_table') }}
</span>
<el-row style="float: right">
<el-button
@ -24,7 +24,7 @@
</el-button>
</el-row>
</el-row>
<el-divider />
<el-divider/>
<el-row>
<el-form :inline="true">
<el-form-item
@ -105,9 +105,10 @@
</template>
<script>
import { post, getTable } from '@/api/dataset/dataset'
import { getTable, post } from '@/api/dataset/dataset'
import DatasetGroupSelector from '../common/DatasetGroupSelector'
import DatasetCustomField from '../common/DatasetCustomField'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'AddCustom',
@ -252,6 +253,12 @@ export default {
}
post('/dataset/table/update', table).then(response => {
// this.$store.dispatch('dataset/setSceneData', new Date().getTime())
if (table.id) {
const renameNode = { id: table.id, name: table.name, label: table.name }
updateCacheTree('rename', 'dataset-tree', renameNode, JSON.parse(localStorage.getItem('dataset-tree')))
} else {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.$emit('saveSuccess', table)
this.cancel()
})
@ -296,49 +303,50 @@ export default {
</script>
<style scoped>
.el-divider--horizontal {
margin: 12px 0;
}
.el-divider--horizontal {
margin: 12px 0;
}
.form-item {
margin-bottom: 6px;
}
.form-item {
margin-bottom: 6px;
}
.el-checkbox {
margin-bottom: 14px;
margin-left: 0;
margin-right: 14px;
}
.el-checkbox {
margin-bottom: 14px;
margin-left: 0;
margin-right: 14px;
}
.el-checkbox.is-bordered + .el-checkbox.is-bordered {
margin-left: 0;
}
.el-checkbox.is-bordered + .el-checkbox.is-bordered {
margin-left: 0;
}
.dataPreview ::v-deep .el-card__header{
padding: 0 8px 12px;
}
.dataPreview ::v-deep .el-card__header {
padding: 0 8px 12px;
}
.dataPreview ::v-deep .el-card__body{
padding:10px;
}
.dataPreview ::v-deep .el-card__body {
padding: 10px;
}
span{
font-size: 14px;
}
span {
font-size: 14px;
}
.panel-height{
height: calc(100vh - 56px - 15px - 26px - 25px - 43px);
}
.panel-height {
height: calc(100vh - 56px - 15px - 26px - 25px - 43px);
}
.blackTheme .panel-height{
height: calc(100vh - 56px - 15px - 26px - 25px - 43px);
border-color: var(--TableBorderColor) !important;
}
.blackTheme .panel-height {
height: calc(100vh - 56px - 15px - 26px - 25px - 43px);
border-color: var(--TableBorderColor) !important;
}
.span-number{
color: #0a7be0;
}
.table-count{
color: #606266;
}
.span-number {
color: #0a7be0;
}
.table-count {
color: #606266;
}
</style>

View File

@ -9,7 +9,7 @@
class="arrow-right"
@click="showLeft = true"
>
<i class="el-icon-d-arrow-right" />
<i class="el-icon-d-arrow-right"/>
</p>
<div
v-show="showLeft"
@ -179,8 +179,8 @@
class="data"
>
<span class="result-num">{{
`${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}`
}}</span>
`${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')}`
}}</span>
<div class="table-grid">
<ux-grid
ref="plxTable"
@ -221,12 +221,14 @@
</template>
<script>
import { listDatasource, post, isKettleRunning } from '@/api/dataset/dataset'
import { engineMode, dbPreview } from '@/api/system/engine'
import { isKettleRunning, listDatasource, post } from '@/api/dataset/dataset'
import { dbPreview, engineMode } from '@/api/system/engine'
import msgCfm from '@/components/msgCfm/index'
import cancelMix from './cancelMix'
import { pySort } from './util'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'AddDB',
mixins: [msgCfm, cancelMix],
@ -460,6 +462,7 @@ export default {
post('/dataset/table/batchAdd', tables)
.then((response) => {
this.openMessageSuccess('deDataset.set_saved_successfully')
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
this.cancel(response.data)
})
.finally(() => {
@ -503,10 +506,12 @@ export default {
border-top-right-radius: 13px;
border-bottom-right-radius: 13px;
}
.table-list {
p {
margin: 0;
}
height: 100%;
width: 240px;
padding: 16px 12px;
@ -519,6 +524,7 @@ export default {
display: flex;
justify-content: space-between;
color: var(--deTextPrimary, #1f2329);
i {
cursor: pointer;
font-size: 12px;
@ -529,6 +535,7 @@ export default {
.search {
margin: 12px 0;
}
.ds-list {
margin: 12px 0 24px 0;
width: 100%;
@ -537,6 +544,7 @@ export default {
.table-checkbox-list {
height: calc(100% - 190px);
overflow-y: auto;
.item {
height: 40px;
width: 100%;
@ -574,12 +582,14 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
.error-name-exist {
position: absolute;
top: 10px;
right: 10px;
}
}
.not-allow {
cursor: not-allowed;
color: var(--deTextDisable, #bbbfc4);
@ -591,6 +601,7 @@ export default {
font-family: PingFang SC;
flex: 1;
overflow: hidden;
.top-table-detail {
height: 64px;
width: 100%;
@ -598,6 +609,7 @@ export default {
background: #f5f6f7;
display: flex;
align-items: center;
.el-select {
width: 120px;
margin-right: 12px;
@ -611,6 +623,7 @@ export default {
display: flex;
align-items: center;
position: relative;
.name {
font-size: 14px;
font-weight: 400;
@ -629,6 +642,7 @@ export default {
height: calc(100% - 140px);
width: 100%;
box-sizing: border-box;
.result-num {
font-weight: 400;
display: inline-block;

View File

@ -8,7 +8,7 @@
class="arrow-right"
@click="showLeft = true"
>
<i class="el-icon-d-arrow-right" />
<i class="el-icon-d-arrow-right"/>
</p>
<div
v-show="showLeft"
@ -21,16 +21,16 @@
effect="dark"
placement="right"
>
<div slot="content">
{{ $t('dataset.excel_info_1') }}<br>
{{ $t('dataset.excel_info_2') }}<br>
{{ $t('dataset.excel_info_3') }}
</div>
<i class="el-icon-warning-outline" /> </el-tooltip></span>
<i
class="el-icon-d-arrow-left"
@click="showLeft = false"
/>
<div slot="content">
{{ $t('dataset.excel_info_1') }}<br>
{{ $t('dataset.excel_info_2') }}<br>
{{ $t('dataset.excel_info_3') }}
</div>
<i class="el-icon-warning-outline"/> </el-tooltip></span>
<i
class="el-icon-d-arrow-left"
@click="showLeft = false"
/>
</p>
<el-upload
:action="baseUrl + 'dataset/table/excel/upload'"
@ -160,7 +160,7 @@
:key="field.fieldName + field.fieldType"
@command="(type) => handleCommand(type, field)"
>
<span class="type-switch">
<span class="type-switch">
<svg-icon
v-if="field.fieldType === 'TEXT'"
icon-class="field_text"
@ -179,7 +179,7 @@
icon-class="field_value"
class="field-icon-value"
/>
<i class="el-icon-arrow-down el-icon--right" /></span>
<i class="el-icon-arrow-down el-icon--right"/></span>
<el-dropdown-menu
slot="dropdown"
style="width: 178px"
@ -237,8 +237,11 @@ import { $alert } from '@/utils/message'
import store from '@/store'
import msgCfm from '@/components/msgCfm/index'
import cancelMix from './cancelMix'
import Config from "@/settings";
import { updateCacheTree } from '@/components/canvas/utils/utils'
const token = getToken()
const RefreshTokenKey = Config.RefreshTokenKey
export default {
name: 'AddExcel',
@ -453,6 +456,12 @@ export default {
this.$refs.tree.setCheckedKeys(this.defaultCheckedKeys)
})
this.fileList = fileList
if (response.headers[RefreshTokenKey]) {
const refreshToken = response.headers[RefreshTokenKey]
setToken(refreshToken)
store.dispatch('user/refreshToken', refreshToken)
}
},
save() {
@ -569,6 +578,9 @@ export default {
table.mergeSheet = false
post('/dataset/table/update', table)
.then((response) => {
if (!table.id) {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.openMessageSuccess('deDataset.set_saved_successfully')
this.cancel(response.data)
})
@ -582,6 +594,9 @@ export default {
this.loading = true
post('/dataset/table/update', table)
.then((response) => {
if (!table.id) {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.openMessageSuccess('deDataset.set_saved_successfully')
this.cancel(response.data)
})
@ -637,10 +652,12 @@ export default {
border-top-right-radius: 13px;
border-bottom-right-radius: 13px;
}
.table-list {
p {
margin: 0;
}
height: 100%;
width: 240px;
padding: 16px 12px;
@ -653,6 +670,7 @@ export default {
display: flex;
justify-content: space-between;
color: var(--deTextPrimary, #1f2329);
i {
font-size: 14px;
color: var(--deTextPlaceholder, #8f959e);
@ -666,10 +684,12 @@ export default {
.table-checkbox-list {
height: calc(100% - 100px);
overflow-y: auto;
.custom-tree-node {
position: relative;
width: 80%;
display: flex;
.label {
overflow: hidden;
white-space: nowrap;
@ -677,11 +697,13 @@ export default {
width: 85%;
}
}
.error-name-exist {
position: absolute;
top: 0;
right: 0;
}
.item {
height: 40px;
width: 215px;
@ -719,6 +741,7 @@ export default {
display: flex;
align-items: center;
position: relative;
.name {
font-size: 14px;
font-weight: 400;
@ -749,10 +772,12 @@ export default {
padding: 2px 1.5px;
display: inline-block;
cursor: pointer;
i {
margin-left: 4px;
font-size: 12px;
}
&:hover {
background: rgba(31, 35, 41, 0.1);
border-radius: 4px;

View File

@ -70,7 +70,7 @@
class="de-text-btn"
@click="dataReference = true"
>
<svg-icon icon-class="data-reference" />
<svg-icon icon-class="data-reference"/>
{{ $t('deDataset.data_reference') }}
</el-button>
<el-button
@ -80,17 +80,17 @@
class="de-text-btn"
@click="variableMgm"
>
<svg-icon icon-class="reference-setting" />
<svg-icon icon-class="reference-setting"/>
{{ $t('sql_variable.variable_mgm') }}
</el-button>
<el-divider direction="vertical" />
<el-divider direction="vertical"/>
<el-button
class="de-text-btn"
type="text"
size="small"
@click="getSQLPreview"
>
<svg-icon icon-class="reference-play" />
<svg-icon icon-class="reference-play"/>
{{ $t('deDataset.run_a_query') }}
</el-button>
</el-col>
@ -111,7 +111,7 @@
dataTable = ''
;keywords = ''
"
><i class="el-icon-arrow-left" /> {{ $t('chart.back') }}</span>
><i class="el-icon-arrow-left"/> {{ $t('chart.back') }}</span>
<span v-else>{{ $t('deDataset.data_reference') }}</span>
<i
style="cursor: pointer"
@ -131,7 +131,7 @@
:title="(showTable && dataTable) || selectedDatasource.name"
class="grey-name"
>
<svg-icon icon-class="db-de" />
<svg-icon icon-class="db-de"/>
{{ (showTable && dataTable) || selectedDatasource.name }}
</span>
<span class="grey">
@ -146,59 +146,61 @@
v-if="!dataSource"
class="no-select-datasource"
>{{
$t('deDataset.to_start_using')
}}</span>
$t('deDataset.to_start_using')
}}</span>
<template v-else>
<el-input :placeholder="$t('fu.search_bar.please_input')" style="padding: 5px" size="small" v-model="keywords"></el-input>
<el-input :placeholder="$t('fu.search_bar.please_input')" style="padding: 5px" size="small"
v-model="keywords"
></el-input>
<div
v-if="dataSource && !dataTable"
v-loading="tableLoading"
class="item-list"
>
<div
v-for="ele in tableDataCopy"
:key="ele.name"
class="table-or-field"
@click="typeSwitch(ele)"
v-if="dataSource && !dataTable"
v-loading="tableLoading"
class="item-list"
>
<div
v-for="ele in tableDataCopy"
:key="ele.name"
class="table-or-field"
@click="typeSwitch(ele)"
>
<span
:title="ele.remark"
class="name"
>{{ ele.name }}</span>
<i
v-clipboard:copy="ele.name"
v-clipboard:success="onCopy"
v-clipboard:error="onError"
class="el-icon-document-copy"
@click.stop
/>
<i
v-clipboard:copy="ele.name"
v-clipboard:success="onCopy"
v-clipboard:error="onError"
class="el-icon-document-copy"
@click.stop
/>
</div>
</div>
</div>
<div
v-else-if="dataSource && dataTable"
v-loading="tableLoading"
class="item-list"
>
<div
v-for="ele in fieldDataCopy"
:key="ele.fieldName"
class="table-or-field field"
v-else-if="dataSource && dataTable"
v-loading="tableLoading"
class="item-list"
>
<div
v-for="ele in fieldDataCopy"
:key="ele.fieldName"
class="table-or-field field"
>
<span
:title="ele.remarks"
class="name"
>{{ ele.fieldName }}</span>
<i
v-clipboard:copy="ele.fieldName"
v-clipboard:success="onCopy"
v-clipboard:error="onError"
class="el-icon-document-copy"
@click.stop
/>
<i
v-clipboard:copy="ele.fieldName"
v-clipboard:success="onCopy"
v-clipboard:error="onError"
class="el-icon-document-copy"
@click.stop
/>
</div>
</div>
</div>
</template>
</div>
<div class="sql-table">
<div
@ -229,10 +231,10 @@
v-if="tabActive === 'result'"
class="result-num"
>{{
`(${$t('dataset.preview_show')} 1000 ${$t(
'dataset.preview_item'
)})`
}}</span>
`(${$t('dataset.preview_show')} 1000 ${$t(
'dataset.preview_item'
)})`
}}</span>
<span
class="drag"
@ -269,7 +271,8 @@
:image-size="60"
:image="errImg"
:description="$t('deDataset.run_failed')"
>{{ errMsgCont }}</el-empty>
>{{ errMsgCont }}
</el-empty>
<el-table
v-else
:data="plxTableData"
@ -365,7 +368,7 @@
direction="rtl"
>
<div class="content">
<i class="el-icon-info" />
<i class="el-icon-info"/>
{{ $t('dataset.sql_variable_limit_1') }}<br>
{{ $t('dataset.sql_variable_limit_2') }}<br>
</div>
@ -451,7 +454,7 @@
:content="$t('commons.parameter_effect')"
placement="top"
>
<i class="el-icon-warning" />
<i class="el-icon-warning"/>
</el-tooltip>
</template>
<template slot-scope="scope">
@ -519,14 +522,16 @@
secondary
@click="closeVariableMgm"
>{{
$t('dataset.cancel')
}}</deBtn>
$t('dataset.cancel')
}}
</deBtn>
<deBtn
type="primary"
@click="saveVariable()"
>{{
$t('dataset.confirm')
}}</deBtn>
$t('dataset.confirm')
}}
</deBtn>
</div>
</el-drawer>
</div>
@ -536,9 +541,8 @@
</template>
<script>
import { post, listDatasource, isKettleRunning } from '@/api/dataset/dataset'
import { getTable, isKettleRunning, listDatasource, post } from '@/api/dataset/dataset'
import { codemirror } from 'vue-codemirror'
import { getTable } from '@/api/dataset/dataset'
import { Base64 } from 'js-base64'
//
import 'codemirror/lib/codemirror.css'
@ -568,6 +572,8 @@ import cancelMix from './cancelMix'
import { pySort } from './util'
import _ from 'lodash'
import GridTable from '@/components/gridTable/index.vue'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'AddSQL',
components: { codemirror, GridTable },
@ -575,7 +581,8 @@ export default {
props: {
param: {
type: Object,
default: () => {}
default: () => {
}
}
},
data() {
@ -762,7 +769,7 @@ export default {
this.fieldData = res.data
this.fieldDataCopy = this.arrSort([...this.fieldData])
})
.finally(() => {
.finally(() => {
this.tableLoading = false
})
},
@ -827,8 +834,8 @@ export default {
},
arrSort(arr = [], field = 'fieldName') {
arr.sort((a, b) => {
return a[field][0].toLowerCase().charCodeAt() - b[field][0].toLowerCase().charCodeAt()
})
return a[field][0].toLowerCase().charCodeAt() - b[field][0].toLowerCase().charCodeAt()
})
return arr
},
@ -923,16 +930,17 @@ export default {
listSqlLog() {
post(
'/dataset/table/sqlLog/' +
this.paginationConfig.currentPage +
'/' +
this.paginationConfig.pageSize,
this.paginationConfig.currentPage +
'/' +
this.paginationConfig.pageSize,
{ id: this.param.tableId, dataSourceId: this.dataSource }
)
.then((response) => {
this.sqlData = response.data.listObject
this.paginationConfig.total = response.data.itemCount
})
.catch(() => {})
.catch(() => {
})
},
save() {
if (!this.dataSource || this.datasource === '') {
@ -965,6 +973,12 @@ export default {
}
post('/dataset/table/update', table)
.then((response) => {
if (table.id) {
const renameNode = { id: table.id, name: table.name, label: table.name }
updateCacheTree('rename', 'dataset-tree', renameNode, JSON.parse(localStorage.getItem('dataset-tree')))
} else {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.openMessageSuccess('deDataset.set_saved_successfully')
this.cancel(response.data)
})
@ -975,14 +989,16 @@ export default {
onCopy(e) {
this.openMessageSuccess('commons.copy_success')
},
onError(e) {},
onError(e) {
},
showSQL(val) {
this.sql = val || ''
},
onCmReady(cm) {
this.codemirror.setSize('-webkit-fill-available', 'auto')
},
onCmFocus(cm) {},
onCmFocus(cm) {
},
onCmCodeChange(newCode) {
this.sql = newCode
this.$emit('codeChange', this.sql)
@ -1068,6 +1084,7 @@ export default {
.select-type {
width: 180px;
.el-input__inner {
padding-left: 32px;
}
@ -1079,6 +1096,7 @@ export default {
top: 50%;
transform: translateY(-50%);
}
.content {
height: 62px;
width: 822px;
@ -1097,14 +1115,17 @@ export default {
font-size: 14px;
color: var(--primary, #3370ff);
}
margin-bottom: 16px;
}
}
.dataset-sql {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
.sql-editer {
background: #f5f6f7;
padding: 16px 24px;
@ -1115,11 +1136,13 @@ export default {
display: flex;
flex-direction: row-reverse;
overflow: hidden;
.data-reference {
width: 280px;
height: 100%;
overflow: hidden;
border-left: 1px solid var(--deCardStrokeColor, #dee0e3);
.no-select-datasource {
font-family: PingFang SC;
font-size: 14px;
@ -1129,6 +1152,7 @@ export default {
width: 100%;
padding: 16px 12px;
}
.table-database-name {
font-family: PingFang SC;
font-size: 16px;
@ -1136,6 +1160,7 @@ export default {
color: var(--deTextPrimary, #1f2329);
padding: 16px 12px;
border-bottom: 1px solid var(--deCardStrokeColor, #dee0e3);
p {
display: flex;
align-items: center;
@ -1161,6 +1186,7 @@ export default {
padding: 16px 8px;
height: calc(100vh - 242px);
overflow: auto;
.table-or-field {
height: 40px;
width: 100%;
@ -1203,34 +1229,40 @@ export default {
i {
display: block;
}
background: rgba(31, 35, 41, 0.1);
}
}
}
}
.sql-table {
flex: 1;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
.code-container {
background: #f5f6f7;
box-sizing: border-box;
min-height: 248px;
color: var(--deTextPrimary, #1f2329);
.CodeMirror {
height: 100% !important;
}
}
}
}
.sql-result {
font-family: PingFang SC;
font-size: 14px;
overflow-y: auto;
box-sizing: border-box;
flex: 1;
.sql-title {
user-select: none;
height: 54px;
@ -1247,6 +1279,7 @@ export default {
color: var(--deTextSecondary, #646a73);
margin-left: 12px;
}
.drag {
position: absolute;
top: 0;
@ -1271,6 +1304,7 @@ export default {
padding: 0 25px 18px 25px;
overflow-y: auto;
box-sizing: border-box;
.el-empty__bottom,
.el-empty__description p {
font-family: PingFang SC;
@ -1281,16 +1315,20 @@ export default {
}
}
}
.table-container {
height: calc(100% - 125px);
padding: 0 24px;
.mar6 {
margin-right: 6px;
}
.mar3 {
margin-left: -3px;
}
}
.table-container-filter {
height: calc(100% - 110px);
}

View File

@ -53,8 +53,8 @@
<div class="sql-title">
{{ $t('deDataset.data_preview') }}
<span class="result-num">{{
`(${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')})`
}}</span>
`(${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')})`
}}</span>
<span
class="drag"
@mousedown="mousedownDrag"
@ -96,13 +96,15 @@
secondary
@click="closeSelectDs()"
>{{
$t('dataset.cancel')
}}</deBtn>
$t('dataset.cancel')
}}
</deBtn>
<deBtn
:disabled="!tempDs.id"
type="primary"
@click="confirmSelectDs()"
>{{ $t('dataset.confirm') }}</deBtn>
>{{ $t('dataset.confirm') }}
</deBtn>
</div>
</el-drawer>
@ -120,20 +122,22 @@
size="840px"
direction="rtl"
>
<union-edit :union-param="unionParam" />
<union-edit :union-param="unionParam"/>
<div class="de-foot">
<deBtn
secondary
@click="closeEditUnion()"
>{{
$t('dataset.cancel')
}}</deBtn>
$t('dataset.cancel')
}}
</deBtn>
<deBtn
type="primary"
@click="confirmEditUnion()"
>{{
$t('dataset.confirm')
}}</deBtn>
$t('dataset.confirm')
}}
</deBtn>
</div>
</el-drawer>
</div>
@ -148,6 +152,8 @@ import { post } from '@/api/dataset/dataset'
import UnionPreview from '@/views/dataset/add/union/UnionPreview'
import cancelMix from './cancelMix'
import msgCfm from '@/components/msgCfm/index'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'AddUnion',
components: {
@ -267,6 +273,12 @@ export default {
}
post('/dataset/table/update', table)
.then((response) => {
if (table.id) {
const renameNode = { id: table.id, name: table.name, label: table.name }
updateCacheTree('rename', 'dataset-tree', renameNode, JSON.parse(localStorage.getItem('dataset-tree')))
} else {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.$emit('saveSuccess', table)
this.cancel(response.data)
})
@ -413,6 +425,7 @@ export default {
overflow-y: auto;
box-sizing: border-box;
flex: 1;
.sql-title {
user-select: none;
height: 54px;
@ -437,6 +450,7 @@ export default {
color: var(--deTextSecondary, #646a73);
margin-left: 12px;
}
.drag {
position: absolute;
top: 0;

View File

@ -17,14 +17,14 @@
v-if="table.mode === 0"
class="de-tag primary"
>{{
$t('dataset.direct_connect')
}}</span>
$t('dataset.direct_connect')
}}</span>
<span
v-if="table.mode === 1"
class="de-tag warning"
>{{
$t('dataset.sync_data')
}}</span>
$t('dataset.sync_data')
}}</span>
</template>
<span
v-if="syncStatus === 'Underway'"
@ -33,7 +33,7 @@
>
{{ $t('dataset.dataset_sync') }}
</span>
<el-divider direction="vertical" />
<el-divider direction="vertical"/>
<span class="create-by">{{ $t('dataset.create_by') }}</span>
<span class="create-by">:{{ table.creatorName || 'N/A' }}</span>
<el-popover
@ -59,6 +59,7 @@
:span="8"
>
<deBtn
v-if="hasDataPermission('manage', param.privileges)"
:disabled="!previewDataSuccess"
type="primary"
icon="el-icon-download"
@ -79,11 +80,11 @@
</deBtn>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="0">
<svg-icon icon-class="icon_add-entry_outlined" />
<svg-icon icon-class="icon_add-entry_outlined"/>
{{ $t('dataset.excel_replace') + $t('chart.chart_data') }}
</el-dropdown-item>
<el-dropdown-item command="1">
<svg-icon icon-class="icon_doc-replace_outlined" />
<svg-icon icon-class="icon_doc-replace_outlined"/>
{{ $t('dataset.excel_add') + $t('chart.chart_data') }}
</el-dropdown-item>
</el-dropdown-menu>
@ -220,7 +221,7 @@
>
<div class="tree-cont">
<div class="content">
<rowAuth ref="rowAuth" />
<rowAuth ref="rowAuth"/>
</div>
</div>
</el-form-item>
@ -233,7 +234,8 @@
<deBtn
secondary
@click="closeExport"
>{{ $t('dataset.cancel') }}</deBtn>
>{{ $t('dataset.cancel') }}
</deBtn>
<deBtn
type="primary"
@click="exportDatasetRequest"
@ -520,12 +522,14 @@ export default {
border-radius: 4px;
border: 1px solid var(--deBorderBase, #DCDFE6);
overflow: auto;
.content {
height: 100%;
width: 100%;
}
}
}
.icon-class {
color: #6c6c6c;
}
@ -546,6 +550,7 @@ export default {
overflow-y: hidden;
width: 100%;
box-sizing: border-box;
.de-dataset-name {
display: flex;
font-family: PingFang SC;

View File

@ -18,7 +18,7 @@
:label="$t('dataset.name')"
prop="name"
>
<el-input v-model="datasetForm.name" />
<el-input v-model="datasetForm.name"/>
</el-form-item>
<el-form-item
:label="$t('deDataset.folder')"
@ -44,8 +44,8 @@
slot-scope="{ data }"
class="custom-tree-node-dataset"
>
<span v-if="data.type === 'group'">
<svg-icon icon-class="scene" />
<span v-if="data.modelInnerType === 'group'">
<svg-icon icon-class="scene"/>
</span>
<span
style="
@ -84,7 +84,8 @@
<deBtn
secondary
@click="resetForm"
>{{ $t('dataset.cancel') }}</deBtn>
>{{ $t('dataset.cancel') }}
</deBtn>
<deBtn
type="primary"
@click="saveDataset"
@ -97,7 +98,8 @@
<script>
import { post } from '@/api/dataset/dataset'
import { datasetTypeMap } from './options'
import { groupTree } from '@/api/dataset/dataset'
import { formatDatasetTreeFolder, getCacheTree } from '@/components/canvas/utils/utils'
export default {
data() {
return {
@ -203,21 +205,8 @@ export default {
)
},
tree() {
this.loading = true
groupTree({
name: '',
pid: '0',
level: 0,
type: 'group',
children: [],
sort: 'type desc,name asc'
})
.then((res) => {
this.tData = res.data
})
.finally(() => {
this.loading = false
})
this.tData = getCacheTree('dataset-tree')
formatDatasetTreeFolder(this.tData)
},
nodeClick({ id, label }) {
this.selectDatasets = [

View File

@ -111,8 +111,8 @@
class="no-tdata-new"
@click="() => clickAdd()"
>{{
$t('deDataset.create')
}}</span>
$t('deDataset.create')
}}</span>
</div>
<el-tree
v-else
@ -134,7 +134,7 @@
>
<span style="display: flex; flex: 1; width: 0">
<span>
<svg-icon icon-class="scene" />
<svg-icon icon-class="scene"/>
</span>
<span
style="
@ -242,15 +242,15 @@
class="de-card-dropdown"
>
<el-dropdown-item command="rename">
<svg-icon icon-class="de-ds-rename" />
<svg-icon icon-class="de-ds-rename"/>
{{ $t('dataset.rename') }}
</el-dropdown-item>
<el-dropdown-item command="move">
<svg-icon icon-class="de-ds-move" />
<svg-icon icon-class="de-ds-move"/>
{{ $t('dataset.move_to') }}
</el-dropdown-item>
<el-dropdown-item command="delete">
<svg-icon icon-class="de-ds-trash" />
<svg-icon icon-class="de-ds-trash"/>
{{ $t('dataset.delete') }}
</el-dropdown-item>
</el-dropdown-menu>
@ -353,15 +353,15 @@
class="de-card-dropdown"
>
<el-dropdown-item command="editTable">
<svg-icon icon-class="de-ds-rename" />
<svg-icon icon-class="de-ds-rename"/>
{{ $t('dataset.rename') }}
</el-dropdown-item>
<el-dropdown-item command="moveDs">
<svg-icon icon-class="de-ds-move" />
<svg-icon icon-class="de-ds-move"/>
{{ $t('dataset.move_to') }}
</el-dropdown-item>
<el-dropdown-item command="deleteTable">
<svg-icon icon-class="de-ds-trash" />
<svg-icon icon-class="de-ds-trash"/>
{{ $t('dataset.delete') }}
</el-dropdown-item>
</el-dropdown-menu>
@ -405,7 +405,8 @@
<deBtn
secondary
@click="close()"
>{{ $t('dataset.cancel') }}</deBtn>
>{{ $t('dataset.cancel') }}
</deBtn>
<deBtn
type="primary"
@click="saveGroup(groupForm)"
@ -433,7 +434,7 @@
:label="$t('dataset.name')"
prop="name"
>
<el-input v-model="tableForm.name" />
<el-input v-model="tableForm.name"/>
</el-form-item>
</el-form>
<div
@ -444,8 +445,9 @@
secondary
@click="closeTable()"
>{{
$t('dataset.cancel')
}}</deBtn>
$t('dataset.cancel')
}}
</deBtn>
<deBtn
type="primary"
@click="saveTable(tableForm)"
@ -467,8 +469,8 @@
:title="moveDialogTitle"
class="text-overflow"
>{{
moveDialogTitle
}}</span>
moveDialogTitle
}}</span>
{{ $t('dataset.m2') }}
</template>
<group-move-selector
@ -481,8 +483,9 @@
secondary
@click="closeMoveGroup()"
>{{
$t('dataset.cancel')
}}</deBtn>
$t('dataset.cancel')
}}
</deBtn>
<deBtn
:disabled="groupMoveConfirmDisabled"
type="primary"
@ -505,8 +508,8 @@
:title="moveDialogTitle"
class="text-overflow"
>{{
moveDialogTitle
}}</span>
moveDialogTitle
}}</span>
{{ $t('dataset.m2') }}
</template>
<group-move-selector
@ -518,8 +521,9 @@
secondary
@click="closeMoveDs()"
>{{
$t('dataset.cancel')
}}</deBtn>
$t('dataset.cancel')
}}
</deBtn>
<deBtn
:disabled="dsMoveConfirmDisabled"
type="primary"
@ -530,21 +534,12 @@
</el-drawer>
<!-- 新增数据集文件夹 -->
<CreatDsGroup ref="CreatDsGroup" />
<CreatDsGroup ref="CreatDsGroup"/>
</el-col>
</template>
<script>
import {
loadTable,
getScene,
addGroup,
delGroup,
delTable,
post,
isKettleRunning,
alter
} from '@/api/dataset/dataset'
import { addGroup, alter, delGroup, delTable, getScene, isKettleRunning, loadTable, post } from '@/api/dataset/dataset'
import { getDatasetRelationship } from '@/api/chart/chart.js'
import msgContent from '@/views/system/datasource/MsgContent.vue'
@ -555,6 +550,7 @@ import { engineMode } from '@/api/system/engine'
import _ from 'lodash'
import msgCfm from '@/components/msgCfm/index'
import { checkPermission } from '@/utils/permission'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'Group',
@ -688,34 +684,49 @@ export default {
})
},
mounted() {
const { id, name } = this.$route.params
this.treeLoading = true
queryAuthModel({ modelType: 'dataset' }, true)
.then((res) => {
localStorage.setItem('dataset-tree', JSON.stringify(res.data))
this.tData = res.data || []
this.$nextTick(() => {
this.$refs.datasetTreeRef?.filter(this.filterText)
if (id && name.includes(this.filterText)) {
this.dfsTableData(this.tData, id)
} else {
const currentNodeId = sessionStorage.getItem('dataset-current-node')
if (currentNodeId) {
sessionStorage.setItem('dataset-current-node', '')
this.dfsTableData(this.tData, currentNodeId)
}
}
})
})
.finally(() => {
this.treeLoading = false
})
this.refresh()
this.init(true)
},
beforeDestroy() {
sessionStorage.setItem('dataset-current-node', this.currentNodeId)
},
methods: {
init(cache = true) {
const { id, name } = this.$route.params
const modelInfo = localStorage.getItem('dataset-tree')
const userCache = modelInfo && cache
if (userCache) {
this.tData = JSON.parse(modelInfo)
this.queryAfter(id)
} else {
this.treeLoading = true
}
queryAuthModel({ modelType: 'dataset' }, !userCache)
.then((res) => {
localStorage.setItem('dataset-tree', JSON.stringify(res.data))
if (!userCache) {
this.tData = res.data || []
this.queryAfter(id)
}
})
.finally(() => {
this.treeLoading = false
})
this.refresh()
},
queryAfter(id) {
this.$nextTick(() => {
this.$refs.datasetTreeRef?.filter(this.filterText)
if (id && name.includes(this.filterText)) {
this.dfsTableData(this.tData, id)
} else {
const currentNodeId = sessionStorage.getItem('dataset-current-node')
if (currentNodeId) {
sessionStorage.setItem('dataset-current-node', '')
this.dfsTableData(this.tData, currentNodeId)
}
}
})
},
getDatasetRelationship({ queryType, label, id }) {
return getDatasetRelationship(id).then((res) => {
const arr = res.data ? [res.data] : []
@ -852,7 +863,8 @@ export default {
this.close()
this.openMessageSuccess('dataset.save_success')
this.expandedArray.push(group.pid)
this.treeNode()
const opt = group.id ? 'rename' : 'new'
updateCacheTree(opt, 'dataset-tree', res.data, this.tData)
})
} else {
return false
@ -872,7 +884,9 @@ export default {
this.openMessageSuccess('dataset.save_success')
_this.expandedArray.push(table.sceneId)
_this.$refs.datasetTreeRef.setCurrentKey(table.id)
_this.treeNode()
const renameNode = { id: table.id, name: table.name, label: table.name }
updateCacheTree('rename', 'dataset-tree', renameNode, this.tData)
('rename', 'dataset-tree', response.data, this.tData)
this.$emit('switchComponent', { name: '' })
})
} else {
@ -894,11 +908,12 @@ export default {
.then(() => {
delGroup(data.id).then((response) => {
this.openMessageSuccess('dataset.delete_success')
this.treeNode()
updateCacheTree('delete', 'dataset-tree', data.id, this.tData)
this.$emit('switchComponent', { name: '' })
})
})
.catch(() => {})
.catch(() => {
})
},
async deleteTable(data) {
@ -916,7 +931,7 @@ export default {
cb: () => {
delTable(data.id).then((response) => {
this.openMessageSuccess('dataset.delete_success')
this.treeNode()
updateCacheTree('delete', 'dataset-tree', data.id, this.tData)
this.$emit('switchComponent', { name: '' })
this.$store.dispatch('dataset/setTable', new Date().getTime())
})
@ -1108,7 +1123,7 @@ export default {
addGroup(this.groupForm).then((res) => {
this.openMessageSuccess('dept.move_success')
this.closeMoveGroup()
this.treeNode()
updateCacheTree('move', 'dataset-tree', res.data, this.tData)
})
},
targetGroup(val) {
@ -1133,12 +1148,14 @@ export default {
},
saveMoveDs() {
const newSceneId = this.tDs.id
const nodeId = this.dsForm.id
this.dsForm.sceneId = newSceneId
this.dsForm.isRename = true
alter(this.dsForm).then((res) => {
this.closeMoveDs()
this.expandedArray.push(newSceneId)
this.treeNode()
const moveNode = { id: nodeId, pid: newSceneId }
updateCacheTree('move', 'dataset-tree', moveNode, this.tData)
this.openMessageSuccess('移动成功')
})
},
@ -1213,6 +1230,7 @@ export default {
.custom-tree-container {
margin-top: 10px;
.no-tdata {
text-align: center;
margin-top: 80px;
@ -1220,6 +1238,7 @@ export default {
font-size: 14px;
color: var(--deTextSecondary, #646a73);
font-weight: 400;
.no-tdata-new {
cursor: pointer;
color: var(--primary, #3370ff);
@ -1273,6 +1292,7 @@ export default {
width: 100%;
display: flex;
}
.scene-title-name {
width: 100%;
overflow: hidden;
@ -1280,9 +1300,11 @@ export default {
white-space: nowrap;
text-overflow: ellipsis;
}
.father .child {
visibility: hidden;
}
.father:hover .child {
visibility: visible;
}
@ -1299,19 +1321,25 @@ export default {
padding: 10px 24px;
height: 100%;
overflow-y: auto;
.main-area-input {
//width: calc(100% - 80px);
.el-input-group__append {
width: 70px;
background: transparent;
.el-input__inner {
padding-left: 12px;
}
}
}
.title-css {
display: flex;
justify-content: space-between;
}
.el-icon-plus {
width: 28px;
height: 28px;
@ -1332,6 +1360,7 @@ export default {
}
}
}
.de-dataset-dropdown {
.el-dropdown-menu__item {
height: 40px;
@ -1342,6 +1371,7 @@ export default {
font-family: PingFang SC;
font-size: 14px;
font-weight: 400;
.svg-icon {
margin-right: 8.75px;
width: 16.5px;
@ -1358,6 +1388,7 @@ export default {
color: #fff;
}
}
.de-top-border {
border-top: 1px solid rgba(31, 35, 41, 0.15);
}

View File

@ -23,8 +23,8 @@
:class="treeClass(data, node)"
>
<span style="display: flex; flex: 1; width: 0">
<span v-if="data.type === 'group'">
<svg-icon icon-class="scene" />
<span v-if="data.modelInnerType === 'group'">
<svg-icon icon-class="scene"/>
</span>
<span
style="
@ -44,7 +44,7 @@
</template>
<script>
import { groupTree } from '@/api/dataset/dataset'
import { formatDatasetTreeFolder, getCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'GroupMoveSelector',
@ -87,22 +87,23 @@ export default {
},
methods: {
tree(group) {
groupTree(group).then((res) => {
if (this.moveDir) {
this.tData = [
{
id: '0',
name: this.$t('dataset.dataset_group'),
pid: '0',
privileges: 'grant,manage,use',
type: 'group',
children: res.data
}
]
return
}
this.tData = res.data
})
const treeData = getCacheTree('dataset-tree')
formatDatasetTreeFolder(treeData)
if (this.moveDir) {
this.tData = [
{
id: '0',
name: this.$t('dataset.dataset_group'),
pid: '0',
privileges: 'grant,manage,use',
modelInnerType: 'group',
children: treeData
}
]
return
} else {
this.tData = treeData
}
},
filterNode(value, data) {
if (!value) return true
@ -143,10 +144,12 @@ export default {
<style lang="scss">
.ds-move-tree {
height: 100%;
.tree {
height: calc(100% - 115px);
overflow-y: auto;
}
.select-tree-keywords {
color: var(--primary, #3370ff);
}

View File

@ -39,7 +39,7 @@
import JsPDF from 'jspdf'
import html2canvas from 'html2canvasde'
import { formatTimeToStr } from './date.js'
import { pdfTemplateReplaceAll } from '@/utils/StringUtils.js'
import { pdfTemplateReplaceAll, replaceInlineI18n } from '@/utils/StringUtils.js'
export default {
name: 'PDFPreExport',
@ -121,6 +121,7 @@ export default {
for (const [key, value] of Object.entries(this.varsInfo)) {
this.templateContentChange = pdfTemplateReplaceAll(this.templateContentChange, key, value || '')
}
this.templateContentChange = replaceInlineI18n(this.templateContentChange)
},
cancel() {

View File

@ -459,6 +459,7 @@ import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
import TreeSelector from '@/components/treeSelector'
import { queryAuthModel } from '@/api/authModel/authModel'
import msgCfm from '@/components/msgCfm/index'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default {
name: 'PanelList',
@ -469,7 +470,7 @@ export default {
lastActiveDefaultPanelId: null, //
responseSource: 'panelQuery',
defaultExpansion: false,
clearLocalStorage: ['chart-tree', 'dataset-tree'],
clearLocalStorage: ['dataset-tree'],
historyRequestId: null,
lastActiveNode: null, //
lastActiveNodeData: null,
@ -578,7 +579,7 @@ export default {
all: this.$t('commons.all'),
folder: this.$t('commons.folder')
},
initLocalStorage: ['chart', 'dataset']
initLocalStorage: ['dataset']
}
},
computed: {
@ -611,7 +612,6 @@ export default {
}
},
beforeDestroy() {
bus.$off('newPanelFromMarket', this.newPanelFromMarket)
},
mounted() {
this.clearCanvas()
@ -654,18 +654,12 @@ export default {
})
this.responseSource = 'panelQuery'
},
newPanelFromMarket(panelInfo) {
if (panelInfo) {
this.tree()
this.edit(panelInfo, null)
}
},
initCache() {
//
this.initLocalStorage.forEach((item) => {
if (!localStorage.getItem(item + '-tree')) {
queryAuthModel({ modelType: item }, false).then((res) => {
localStorage.setItem(item + '-tree', JSON.stringify(res.data))
localStorage.setItem(item + '-tree', JSON.stringify(res.data || []))
})
}
})
@ -673,8 +667,10 @@ export default {
closeEditPanelDialog(panelInfo) {
this.editPanel.visible = false
if (panelInfo) {
this.defaultTree(false)
this.tree()
if (this.editPanel.optType === 'toDefaultPanel') {
this.defaultTree(false)
}
updateCacheTree(this.editPanel.optType, 'panel-main-tree', panelInfo, this.tData)
if (this.editPanel.optType === 'rename' && panelInfo.id === this.$store.state.panel.panelInfo.id) {
this.$store.state.panel.panelInfo.name = panelInfo.name
}
@ -689,13 +685,7 @@ export default {
return
}
//
if (this.editPanel.optType === 'copy') {
this.lastActiveNode.parent.data.children.push(panelInfo)
} else {
if (!this.lastActiveNodeData.children) {
this.$set(this.lastActiveNodeData, 'children', [])
}
this.lastActiveNodeData.children.push(panelInfo)
if (this.editPanel.optType !== 'copy') {
this.lastActiveNode.expanded = true
}
this.activeNodeAndClick(panelInfo)
@ -745,6 +735,7 @@ export default {
this.editPanel = {
visible: true,
titlePre: this.$t('panel.to_default'),
optType: 'toDefaultPanel',
panelInfo: {
id: param.data.id,
name: param.data.name,
@ -869,7 +860,7 @@ export default {
showClose: true
})
this.clearCanvas()
this.tree()
updateCacheTree('delete', 'panel-main-tree', data.id, this.tData)
this.defaultTree(false)
})
}
@ -906,7 +897,7 @@ export default {
this.tData = JSON.parse(modelInfo)
}
groupTree(this.groupForm, !userCache).then((res) => {
localStorage.setItem('panel-main-tree', JSON.stringify(res.data))
localStorage.setItem('panel-main-tree', JSON.stringify(res.data || []))
if (!userCache) {
this.tData = res.data
}
@ -937,7 +928,7 @@ export default {
defaultTree(requestInfo, false).then((res) => {
localStorage.setItem('panel-default-tree', JSON.stringify(res.data))
if (!userCache) {
this.defaultData = res.data
this.defaultData = res.data || []
if (showFirst && this.defaultData && this.defaultData.length > 0) {
this.activeDefaultNodeAndClickOnly(this.defaultData[0].id)
}
@ -1054,7 +1045,7 @@ export default {
_this.$nextTick(() => {
document.querySelector('.is-current').firstChild.click()
//
if (panelInfo.nodeType === 'panel') {
if (panelInfo.nodeType === 'panel' && this.editPanel.optType !== 'copy') {
_this.edit(this.lastActiveNodeData, this.lastActiveNode)
}
})
@ -1109,11 +1100,11 @@ export default {
id: 'panel_list',
name: _this.$t('panel.panel_list'),
label: _this.$t('panel.panel_list'),
children: res.data
children: res.data || []
}
]
} else {
_this.tGroupData = res.data
_this.tGroupData = res.data || []
}
_this.moveGroup = true
})
@ -1126,7 +1117,7 @@ export default {
this.moveInfo.pid = this.tGroup.id
this.moveInfo['optType'] = 'move'
panelUpdate(this.moveInfo).then((response) => {
this.tree()
updateCacheTree('move', 'panel-main-tree', response.data, this.tData)
this.closeMoveGroup()
})
},

View File

@ -240,7 +240,7 @@ export default {
showClose: true
})
this.loading = false
this.$emit('closeEditPanelDialog', { id: response.data, name: this.editPanel.panelInfo.name })
this.$emit('closeEditPanelDialog', response.data)
}).catch(() => {
this.loading = false
})

View File

@ -67,6 +67,7 @@
@editeTodisable="editDatasource"
:canEdit="canEdit"
ref="DsFormContent"
@refresh-type="refreshType"
:config-from-tabs="configFromTabs"
/>
</div>
@ -101,6 +102,9 @@ export default {
}
},
methods: {
refreshType(form) {
this.$emit('refresh-type', form)
},
editDatasource(type = false) {
this.$refs.DsFormContent.editDatasource(type)
this.canEdit = type

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,6 @@
<div class="container-wrapper">
<el-form
ref="form"
:rules="rules"
:inline="true"
:model="formInline"
class="de-form-inline"
@ -15,6 +14,7 @@
<el-form-item
prop="queryType"
:label="$t('commons.adv_search.search') + $t('table.type')"
:required="true"
>
<el-select
v-model="formInline.queryType"
@ -31,8 +31,8 @@
</el-select>
</el-form-item>
<el-form-item
prop="dataSourceName"
:label="queryTypeTitle"
:error="errorMsg"
>
<el-popover
v-model="showTree"
@ -72,24 +72,15 @@
</span>
</span>
</el-tree>
<el-select
<el-input
ref="treeSelect"
slot="reference"
v-model="formInline.dataSourceName"
filterable
remote
:filter-method="filterMethod"
:title="nodeData.name"
popper-class="tree-select"
@focus="showTree = true"
>
<el-option
v-for="item in ignoredOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
v-model="querySelected"
:placeholder="queryPlaceholder"
@click.native.stop="showTree = true"
@input="onQueryInput"
@focus="onQueryFocus"
/>
</el-popover>
</el-form-item>
<el-form-item style="float: right">
@ -186,10 +177,6 @@ export default {
queryType: 'datasource',
dataSourceName: ''
},
rules: {
queryType: [{ required: true, trigger: 'blur' }],
dataSourceName: [{ required: true, trigger: 'blur', message: this.$t('chart.name_can_not_empty') }]
},
queryTypeNameList: [
{
label: 'commons.datasource',
@ -218,11 +205,13 @@ export default {
total: 0
},
resourceTreeData: [],
ignoredOptions: [],
showTree: false,
nodeData: {},
popoverSize: 400,
currentNode: {}
currentNode: {},
querySelected: '',
queryPlaceholder: '',
errorMsg: ''
}
},
computed: {
@ -271,7 +260,9 @@ export default {
data,
activeQueryType(activeIcon) {
this.activeIcon = activeIcon
this.onSubmit()
if (this.formInline.dataSourceName) {
this.onSubmit()
}
},
async searchDetail(id, queryType, name) {
switch (queryType) {
@ -289,7 +280,7 @@ export default {
}
this.formInline = { queryType, dataSourceName: id }
this.nodeData = { id, name }
this.ignoredOptions = [this.nodeData]
this.querySelected = this.queryPlaceholder = name
this.$refs.resourceTree.setCurrentKey(id)
const currentParents = this.$refs.resourceTree.getNodePath(this.nodeData)
currentParents.forEach((node) => {
@ -438,6 +429,7 @@ export default {
this.resourceTreeData = []
this.nodeData = {}
this.currentNode = {}
this.querySelected = this.queryPlaceholder = ''
switch (val) {
case 'datasource': {
this.listDatasource()
@ -456,15 +448,16 @@ export default {
}
},
onSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.activeIcon === 'date') {
this.getChartData()
} else {
this.$refs.consanguinity.getChartData(this.current)
}
}
})
if (!this.formInline.dataSourceName) {
this.errorMsg = this.$t('chart.name_can_not_empty')
return
}
this.errorMsg = ''
if (this.activeIcon === 'date') {
this.getChartData()
} else {
this.$refs.consanguinity.getChartData(this.current)
}
},
handleSizeChange(pageSize) {
this.paginationConfig.currentPage = 1
@ -528,32 +521,38 @@ export default {
}
return data.name.toLowerCase().indexOf(value.toLowerCase()) !== -1
},
filterMethod(filterText) {
onQueryInput(filterText) {
this.$refs.resourceTree.filter(filterText)
},
onQueryFocus() {
this.querySelected = ''
},
nodeClick(data, node) {
if (node.isLeaf) {
this.ignoredOptions = [{ id: data.id, name: data.name }]
this.formInline.dataSourceName = data.id
this.showTree = false
this.nodeData = data
this.currentNode = node
this.querySelected = this.queryPlaceholder = data.name
this.errorMsg = ''
}
},
resetFilter() {
if (this.showTree) {
this.showTree = false
this.querySelected = this.queryPlaceholder = this.nodeData.name
this.$refs.resourceTree.filter()
this.$refs.resourceTree.setCurrentKey(this.formInline.dataSourceName)
if (this.formInline.dataSourceName === '') {
this.$refs.resourceTree.setCurrentKey(null)
}
const nodesMap = this.$refs.resourceTree.store.nodesMap || {}
let currentParents = []
if (this.formInline.dataSourceName) {
const currentParents = this.$refs.resourceTree.getNodePath(this.nodeData).map((item) => item.id)
const nodesMap = this.$refs.resourceTree.store.nodesMap || {}
for (const key in nodesMap) {
nodesMap[key].expanded = currentParents.includes(key)
}
currentParents = this.$refs.resourceTree.getNodePath(this.nodeData).map((item) => item.id)
}
for (const key in nodesMap) {
nodesMap[key].expanded = currentParents.includes(key)
}
}
}

View File

@ -0,0 +1,111 @@
<template>
<el-form
ref="createUserForm"
:model="form"
:rules="rule"
size="small"
label-width="auto"
label-position="right"
>
<el-form-item v-if="!oldPwd" :label="$t('user.origin_passwd')" prop="oldPwd">
<dePwd v-model="form.oldPwd" />
</el-form-item>
<el-form-item :label="$t('user.new_passwd')" prop="newPwd">
<dePwd v-model="form.newPwd" />
</el-form-item>
<el-form-item :label="$t('user.confirm_passwd')" prop="repeatPwd">
<dePwd v-model="form.repeatPwd" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="save">{{
$t('commons.confirm')
}}</el-button>
</el-form-item>
</el-form>
</template>
<script>
import { updatePersonPwd } from '@/api/system/user'
import dePwd from '@/components/deCustomCm/DePwd.vue'
export default {
name: 'PasswordUpdateForm',
components: { dePwd },
props: {
oldPwd: {
type: String,
default: ""
}
},
data() {
return {
form: {},
rule: {
oldPwd: [
{
required: true,
message: this.$t('user.input_password'),
trigger: 'blur'
}
],
newPwd: [
{
required: true,
message: this.$t('user.input_password'),
trigger: 'blur'
},
{
required: true,
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
}
],
repeatPwd: [
{
required: true,
message: this.$t('user.input_password'),
trigger: 'blur'
},
{ required: true, trigger: 'blur', validator: this.repeatValidator }
]
}
}
},
created() {
if (this.oldPwd) {
this.form.oldPwd = this.oldPwd
}
},
methods: {
repeatValidator(rule, value, callback) {
if (value !== this.form.newPwd) {
callback(new Error(this.$t('member.inconsistent_passwords')))
} else {
callback()
}
},
save() {
this.$refs.createUserForm.validate((valid) => {
if (valid) {
const param = {
password: this.form.oldPwd,
newPassword: this.form.newPwd
}
updatePersonPwd(param).then((res) => {
this.$success(this.$t('commons.save_success'))
this.$store.commit('user/SET_PASSWORD_MODIFIED', true)
this.logout()
})
} else {
return false
}
})
},
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push('/')
}
}
}
</script>

View File

@ -5,45 +5,7 @@
<div class="form-header">
<span>{{ $t('user.change_password') }}</span>
</div>
<el-form
ref="createUserForm"
:model="form"
:rules="rule"
size="small"
label-width="auto"
label-position="right"
>
<el-form-item
:label="$t('user.origin_passwd')"
prop="oldPwd"
>
<dePwd
v-model="form.oldPwd"
/>
</el-form-item>
<el-form-item
:label="$t('user.new_passwd')"
prop="newPwd"
>
<dePwd
v-model="form.newPwd"
/>
</el-form-item>
<el-form-item
:label="$t('user.confirm_passwd')"
prop="repeatPwd"
>
<dePwd
v-model="form.repeatPwd"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="save"
>{{ $t('commons.confirm') }}</el-button>
</el-form-item>
</el-form>
<PasswordUpdateForm />
</el-card>
</div>
</layout-content>
@ -51,39 +13,9 @@
<script>
import LayoutContent from '@/components/business/LayoutContent'
import { updatePersonPwd } from '@/api/system/user'
import dePwd from '@/components/deCustomCm/DePwd.vue'
import PasswordUpdateForm from './PasswordUpdateForm'
export default {
components: { LayoutContent, dePwd },
data() {
return {
form: {
},
rule: {
oldPwd: [
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' }
],
newPwd: [
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
{
required: true,
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
}
],
repeatPwd: [
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
{ required: true, trigger: 'blur', validator: this.repeatValidator }
]
}
}
},
components: { LayoutContent, PasswordUpdateForm },
mounted() {
this.$nextTick(() => {
this.$store.dispatch('app/toggleSideBarHide', true)
@ -92,36 +24,6 @@ export default {
created() {
this.$store.dispatch('app/toggleSideBarHide', true)
},
methods: {
repeatValidator(rule, value, callback) {
if (value !== this.form.newPwd) {
callback(new Error(this.$t('member.inconsistent_passwords')))
} else {
callback()
}
},
save() {
this.$refs.createUserForm.validate(valid => {
if (valid) {
const param = {
password: this.form.oldPwd,
newPassword: this.form.newPwd
}
updatePersonPwd(param).then(res => {
this.$success(this.$t('commons.save_success'))
this.logout()
})
} else {
return false
}
})
},
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push('/')
}
}
}
</script>
<style lang="scss" scoped>

View File

@ -413,6 +413,10 @@ export default {
}
},
phoneRegex(rule, value, callback) {
if (!value || !`${value}`.trim()) {
callback()
return
}
const regep = new RegExp(/^1[3-9]\d{9}$/)
if (!regep.test(value)) {

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>dataease-server</artifactId>
<groupId>io.dataease</groupId>
<version>1.18.2</version>
<version>1.18.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.dataease</groupId>
<artifactId>dataease-server</artifactId>
<version>1.18.2</version>
<version>1.18.3</version>
<packaging>pom</packaging>
<parent>