Merge branch 'dev' into pr@dev_memory_component

This commit is contained in:
dataeaseShu 2022-12-23 17:37:33 +08:00
commit 8e37d7e69e
53 changed files with 972 additions and 401 deletions

View File

@ -123,7 +123,6 @@ public class HttpClientUtil {
EntityBuilder entityBuilder = EntityBuilder.create();
entityBuilder.setText(json);
entityBuilder.setContentType(ContentType.APPLICATION_JSON);
entityBuilder.setContentEncoding(config.getCharset());
HttpEntity requestEntity = entityBuilder.build();
httpPost.setEntity(requestEntity);

View File

@ -1,6 +1,8 @@
package io.dataease.controller.datasource;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import io.dataease.auth.annotation.DeLog;
import io.dataease.auth.annotation.DePermission;
import io.dataease.commons.constants.DePermissionType;
@ -27,6 +29,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Api(tags = "数据源:数据源管理")
@ -135,7 +138,9 @@ public class DatasourceController {
@ApiIgnore
@PostMapping("/checkApiDatasource")
public ApiDefinition checkApiDatasource(@RequestBody ApiDefinition apiDefinition) throws Exception {
public ApiDefinition checkApiDatasource(@RequestBody Map<String, String> data) throws Exception {
ApiDefinition apiDefinition = new Gson().fromJson(new String(java.util.Base64.getDecoder().decode(data.get("data"))), new TypeToken<ApiDefinition>() {
}.getType());
return datasourceService.checkApiDatasource(apiDefinition);
}

View File

@ -14,6 +14,7 @@ import io.dataease.dto.PermissionProxy;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.panel.PanelExport2App;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.plugins.common.base.domain.PanelGroup;
import io.dataease.service.panel.PanelGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -50,6 +51,12 @@ public class PanelGroupController {
return panelGroupService.tree(request);
}
@ApiOperation("查询当前用户仪表板")
@GetMapping("/list")
public List<PanelGroup> list() {
return panelGroupService.list();
}
@ApiOperation("默认树")
@PostMapping("/defaultTree")
public List<PanelGroupDTO> defaultTree(@RequestBody PanelGroupRequest request) {

View File

@ -20,7 +20,7 @@ public class PanelViewDetailsRequest {
private Integer[] excelTypes;
private List<String[]> details;
private List<Object[]> details;
private String snapshot;
@ -28,6 +28,6 @@ public class PanelViewDetailsRequest {
private int snapshotHeight;
private ViewDetailField[] detailFields;
}

View File

@ -0,0 +1,15 @@
package io.dataease.controller.request.panel;
import lombok.Data;
import java.io.Serializable;
@Data
public class ViewDetailField implements Serializable {
private String name;
private String dataeaseName;
private Integer deType;
}

View File

@ -58,7 +58,8 @@
data_from,
refresh_view_enable,
refresh_unit,
refresh_time)
refresh_time,
view_fields)
SELECT id,
`name`,
title,
@ -89,7 +90,8 @@
data_from,
refresh_view_enable,
refresh_unit,
refresh_time
refresh_time,
view_fields
from chart_view
WHERE chart_view.id = #{id}
</insert>
@ -306,7 +308,8 @@
`chart_type`,
`is_plugin`,
`senior`,
`data_from`)
`data_from`,
`view_fields`)
SELECT #{newChartId},
GET_CHART_VIEW_COPY_NAME(#{oldChartId}, #{panelId}) as `name`,
#{panelId},
@ -334,7 +337,8 @@
'private',
`is_plugin`,
`senior`,
`data_from`
`data_from`,
`view_fields`
FROM chart_view
WHERE id = #{oldChartId}
</insert>
@ -521,7 +525,8 @@
cv.data_from = cve.data_from,
cv.refresh_view_enable = cve.refresh_view_enable,
cv.refresh_unit = cve.refresh_unit,
cv.refresh_time = cve.refresh_time
cv.refresh_time = cve.refresh_time,
cv.view_fields = cve.view_fields
where cve.id = cv.id and cv.id in
<foreach collection="viewIds" item="viewId" open='(' separator=',' close=')'>
#{viewId}
@ -560,7 +565,8 @@
cv.data_from = cve.data_from,
cv.refresh_view_enable = cve.refresh_view_enable,
cv.refresh_unit = cve.refresh_unit,
cv.refresh_time = cve.refresh_time
cv.refresh_time = cve.refresh_time,
cv.view_fields = cve.view_fields
where cve.id = cv.id and cv.id =#{viewId}
</update>

View File

@ -3,6 +3,7 @@ package io.dataease.ext;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.dto.RelationDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.plugins.common.base.domain.PanelGroup;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -30,4 +31,6 @@ public interface ExtPanelGroupMapper {
List<PanelGroupDTO> panelGroupInit();
List<RelationDTO> queryPanelRelation(@Param("panelId") String panelId, @Param("userId") Long userId);
List<PanelGroup> listPanelByUser(@Param("userId") long userId);
}

View File

@ -320,4 +320,38 @@
where pg.id=#{panelId,jdbcType=VARCHAR}
group by dt.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
(
(
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 pg.id
</select>
</mapper>

View File

@ -9,11 +9,13 @@
</collection>
</resultMap>
<resultMap id="LinkJumpInfoMap" type="io.dataease.dto.panel.linkJump.PanelLinkJumpInfoDTO" extends="io.dataease.plugins.common.base.mapper.PanelLinkJumpInfoMapper.BaseResultMap">
<resultMap id="LinkJumpInfoMap" type="io.dataease.dto.panel.linkJump.PanelLinkJumpInfoDTO"
extends="io.dataease.plugins.common.base.mapper.PanelLinkJumpInfoMapper.BaseResultMap">
<result column="source_field_id" jdbcType="VARCHAR" property="sourceFieldId"/>
<result column="source_field_name" jdbcType="VARCHAR" property="sourceFieldName"/>
<result column="publicJumpId" jdbcType="VARCHAR" property="publicJumpId"/>
<collection property="targetViewInfoList" ofType="io.dataease.plugins.common.base.domain.PanelLinkJumpTargetViewInfo">
<collection property="targetViewInfoList"
ofType="io.dataease.plugins.common.base.domain.PanelLinkJumpTargetViewInfo">
<result column="target_view_id" jdbcType="VARCHAR" property="targetViewId"/>
<result column="target_field_id" jdbcType="VARCHAR" property="targetFieldId"/>
</collection>
@ -27,230 +29,244 @@
</resultMap>
<select id="getLinkJumpInfo" resultMap="LinkJumpInfoMap">
SELECT
dataset_table_field.id AS 'source_field_id',
dataset_table_field.NAME AS 'source_field_name',
panel_link_jump_info.id,
panel_link_jump_info.link_jump_id,
panel_link_jump_info.link_type,
panel_link_jump_info.jump_type,
panel_link_jump_info.target_panel_id,
panel_link_jump_info.content,
ifnull( panel_link_mapping.uuid, panel_link_mapping.id ) AS publicJumpId,
ifnull( panel_link_jump_info.checked, 0 ) AS checked,
ifnull( panel_link_jump_info.attach_params, 0 ) AS attach_params,
panel_link_jump_target_view_info.target_view_id,
panel_link_jump_target_view_info.target_field_id
FROM
chart_view
LEFT JOIN dataset_table_field ON chart_view.table_id = dataset_table_field.table_id
LEFT JOIN panel_link_jump ON chart_view.id = panel_link_jump.source_view_id and panel_link_jump.id = #{id}
LEFT JOIN panel_link_jump_info ON panel_link_jump.id = panel_link_jump_info.link_jump_id
SELECT dataset_table_field.id AS 'source_field_id', dataset_table_field.NAME AS 'source_field_name', panel_link_jump_info.id,
panel_link_jump_info.link_jump_id,
panel_link_jump_info.link_type,
panel_link_jump_info.jump_type,
panel_link_jump_info.target_panel_id,
panel_link_jump_info.content,
ifnull(panel_link_mapping.uuid, panel_link_mapping.id) AS publicJumpId,
ifnull(panel_link_jump_info.checked, 0) AS checked,
ifnull(panel_link_jump_info.attach_params, 0) AS attach_params,
panel_link_jump_target_view_info.target_view_id,
panel_link_jump_target_view_info.target_field_id
FROM chart_view
LEFT JOIN dataset_table_field ON chart_view.table_id = dataset_table_field.table_id
LEFT JOIN panel_link_jump
ON chart_view.id = panel_link_jump.source_view_id and panel_link_jump.id = #{id}
LEFT JOIN panel_link_jump_info ON panel_link_jump.id = panel_link_jump_info.link_jump_id
AND dataset_table_field.id = panel_link_jump_info.source_field_id
LEFT JOIN panel_link_jump_target_view_info ON panel_link_jump_info.id = panel_link_jump_target_view_info.link_jump_info_id
LEFT JOIN panel_link_mapping on panel_link_jump_info.target_panel_id = panel_link_mapping.resource_id
WHERE
chart_view.id =#{source_view_id}
LEFT JOIN panel_link_jump_target_view_info
ON panel_link_jump_info.id = panel_link_jump_target_view_info.link_jump_info_id
LEFT JOIN panel_link_mapping on panel_link_jump_info.target_panel_id = panel_link_mapping.resource_id
WHERE chart_view.id = #{source_view_id}
ORDER BY CONVERT(dataset_table_field.NAME using gbk)
</select>
<select id="queryWithPanelId" resultMap="BaseResultMapDTO">
SELECT
chart_view.id AS source_view_id,
panel_link_jump.id,
#{panelId} as 'source_panel_id',
panel_link_jump.link_jump_info,
ifnull( panel_link_jump.checked, 0 ) AS checked
FROM
chart_view
LEFT JOIN panel_link_jump ON chart_view.id = panel_link_jump.source_view_id
WHERE
panel_link_jump.source_panel_id = #{panelId}
and panel_link_jump.checked = 1
SELECT chart_view.id AS source_view_id,
panel_link_jump.id,
#{panelId} as 'source_panel_id', panel_link_jump.link_jump_info,
ifnull(panel_link_jump.checked, 0) AS checked
FROM chart_view
LEFT JOIN panel_link_jump ON chart_view.id = panel_link_jump.source_view_id
WHERE panel_link_jump.source_panel_id = #{panelId}
and panel_link_jump.checked = 1
</select>
<select id="queryWithViewId" resultMap="BaseResultMapDTO">
SELECT
chart_view.id AS source_view_id,
panel_link_jump.id,
#{panelId} as 'source_panel_id',
panel_link_jump.link_jump_info,
ifnull( panel_link_jump.checked, 0 ) AS checked
FROM
chart_view
LEFT JOIN panel_link_jump ON chart_view.id = panel_link_jump.source_view_id
SELECT chart_view.id AS source_view_id,
panel_link_jump.id,
#{panelId} as 'source_panel_id', panel_link_jump.link_jump_info,
ifnull(panel_link_jump.checked, 0) AS checked
FROM chart_view
LEFT JOIN panel_link_jump ON chart_view.id = panel_link_jump.source_view_id
AND panel_link_jump.source_panel_id = #{panelId}
WHERE
chart_view.id = #{viewId}
</select>
<delete id="deleteJumpTargetViewInfo" >
DELETE ljtv
FROM
panel_link_jump_target_view_info ljtv,
panel_link_jump_info lji,
panel_link_jump lj
WHERE
ljtv.link_jump_info_id = lji.id
AND lji.link_jump_id = lj.id
AND lj.source_panel_id = #{panelId}
AND lj.source_view_id = #{viewId}
</delete>
<delete id="deleteJumpInfo" >
DELETE lji
FROM
panel_link_jump_info lji,
panel_link_jump lj
WHERE
lji.link_jump_id = lj.id
AND lj.source_panel_id = #{panelId}
AND lj.source_view_id = #{viewId}
</delete>
<delete id="deleteJump" >
DELETE lj
FROM
panel_link_jump lj
WHERE
lj.source_panel_id = #{panelId}
AND lj.source_view_id = #{viewId}
</delete>
<delete id="deleteJumpTargetViewInfoWithPanel" >
DELETE ljtv
FROM
panel_link_jump_target_view_info ljtv,
panel_link_jump_info lji,
panel_link_jump lj
WHERE
ljtv.link_jump_info_id = lji.id
AND lji.link_jump_id = lj.id
AND (lj.source_panel_id = #{panelId} or lji.target_panel_id = #{panelId})
</delete>
<delete id="deleteJumpInfoWithPanel" >
DELETE lji
FROM
panel_link_jump_info lji,
panel_link_jump lj
WHERE
lji.link_jump_id = lj.id
AND (lj.source_panel_id = #{panelId} or lji.target_panel_id = #{panelId})
</delete>
<delete id="deleteJumpWithPanel" >
DELETE lj
FROM
panel_link_jump lj
WHERE
lj.source_panel_id = #{panelId}
</delete>
<select id="getTargetPanelJumpInfo" resultMap="AllJumpMap">
SELECT DISTINCT
concat( lj.source_view_id, '#', lji.source_field_id ) AS 'sourceInfo',
concat( jtvi.target_view_id, '#', jtvi.target_field_id ) AS 'targetInfo'
FROM
panel_link_jump_target_view_info jtvi
LEFT JOIN panel_link_jump_info lji ON jtvi.link_jump_info_id = lji.id
LEFT JOIN panel_link_jump lj ON lji.link_jump_id = lj.id
WHERE
lj.source_panel_id = #{request.sourcePanelId}
AND lj.source_view_id = #{request.sourceViewId}
AND lji.target_panel_id = #{request.targetPanelId}
AND lji.source_field_id = #{request.sourceFieldId}
WHERE chart_view.id = #{viewId}
</select>
<insert id="copyLinkJump" >
insert into panel_link_jump (id, source_panel_id, source_view_id, link_jump_info, `checked`, copy_from, copy_id)
select
UUID() as id,
panel_view_copy.t_panel_id as source_panel_id,
panel_view_copy.t_chart_view_id as source_view_id,
panel_link_jump.link_jump_info,
panel_link_jump.checked,
panel_link_jump.id as copy_from,
#{copyId} as copy_id
from panel_link_jump inner join
(SELECT
pvs.panel_id as s_panel_id,
pvs.chart_view_id as s_chart_view_id,
pvt.panel_id as t_panel_id,
pvt.chart_view_id as t_chart_view_id
<delete id="deleteJumpTargetViewInfo">
DELETE
ljtv
FROM
panel_view pvt
inner JOIN panel_view pvs ON pvt.copy_from = pvs.id
WHERE
pvt.copy_id = #{copyId}) panel_view_copy on panel_link_jump.source_panel_id = panel_view_copy.s_panel_id
and panel_link_jump.source_view_id = panel_view_copy.s_chart_view_id
</insert>
panel_link_jump_target_view_info ljtv,
panel_link_jump_info lji,
panel_link_jump lj
WHERE
ljtv.link_jump_info_id = lji.id
AND lji.link_jump_id = lj.id
AND lj.source_panel_id =
#{panelId}
AND
lj
.
source_view_id
=
#{viewId}
</delete>
<delete id="deleteJumpInfo">
DELETE
lji
FROM
panel_link_jump_info lji,
panel_link_jump lj
WHERE
lji.link_jump_id = lj.id
AND lj.source_panel_id =
#{panelId}
AND
lj
.
source_view_id
=
#{viewId}
</delete>
<delete id="deleteJump">
DELETE
lj
FROM
panel_link_jump lj
WHERE
lj.source_panel_id =
#{panelId}
AND
lj
.
source_view_id
=
#{viewId}
</delete>
<delete id="deleteJumpTargetViewInfoWithPanel">
DELETE
ljtv
FROM
panel_link_jump_target_view_info ljtv,
panel_link_jump_info lji,
panel_link_jump lj
WHERE
ljtv.link_jump_info_id = lji.id
AND lji.link_jump_id = lj.id
AND (lj.source_panel_id =
#{panelId}
or
lji
.
target_panel_id
=
#{panelId}
)
</delete>
<delete id="deleteJumpInfoWithPanel">
DELETE
lji
FROM
panel_link_jump_info lji,
panel_link_jump lj
WHERE
lji.link_jump_id = lj.id
AND (lj.source_panel_id =
#{panelId}
or
lji
.
target_panel_id
=
#{panelId}
)
</delete>
<delete id="deleteJumpWithPanel">
DELETE
lj
FROM
panel_link_jump lj
WHERE
lj.source_panel_id =
#{panelId}
</delete>
<select id="getTargetPanelJumpInfo" resultMap="AllJumpMap">
SELECT DISTINCT
concat( lj.source_view_id, '#', lji.source_field_id ) AS 'sourceInfo',
concat( jtvi.target_view_id, '#', jtvi.target_field_id ) AS 'targetInfo'
FROM
panel_link_jump_target_view_info jtvi
LEFT JOIN panel_link_jump_info lji ON jtvi.link_jump_info_id = lji.id
LEFT JOIN panel_link_jump lj ON lji.link_jump_id = lj.id
WHERE
lj.source_panel_id = #{request.sourcePanelId}
AND lj.source_view_id = #{request.sourceViewId}
AND lji.target_panel_id = #{request.targetPanelId}
<if test="request.sourceFieldId != null">
AND lji.source_field_id = #{request.sourceFieldId}
</if>
</select>
<insert id="copyLinkJump">
insert into panel_link_jump (id, source_panel_id, source_view_id, link_jump_info, `checked`, copy_from, copy_id)
select UUID() as id,
panel_view_copy.t_panel_id as source_panel_id,
panel_view_copy.t_chart_view_id as source_view_id,
panel_link_jump.link_jump_info,
panel_link_jump.checked,
panel_link_jump.id as copy_from,
#{copyId} as copy_id
from panel_link_jump
inner join
(SELECT pvs.panel_id as s_panel_id,
pvs.chart_view_id as s_chart_view_id,
pvt.panel_id as t_panel_id,
pvt.chart_view_id as t_chart_view_id
FROM panel_view pvt
inner JOIN panel_view pvs ON pvt.copy_from = pvs.id
WHERE pvt.copy_id = #{copyId}) panel_view_copy
on panel_link_jump.source_panel_id = panel_view_copy.s_panel_id
and panel_link_jump.source_view_id = panel_view_copy.s_chart_view_id
</insert>
<insert id="copyLinkJumpInfo">
INSERT INTO panel_link_jump_info (
id,
link_jump_id,
link_type,
jump_type,
target_panel_id,
source_field_id,
content,
`checked`,
`attach_params`,
copy_from,
copy_id
) SELECT
uuid() AS id,
plj_copy.t_id,
link_type,
jump_type,
target_panel_id,
source_field_id,
content,
`checked`,
`attach_params`,
id AS copy_from,
#{copyId}
FROM
panel_link_jump_info
inner JOIN (
SELECT
id AS t_id,
copy_from AS s_id
FROM
panel_link_jump
WHERE
copy_id = #{copyId}
) plj_copy ON panel_link_jump_info.link_jump_id = plj_copy.s_id
INSERT INTO panel_link_jump_info (id,
link_jump_id,
link_type,
jump_type,
target_panel_id,
source_field_id,
content,
`checked`,
`attach_params`,
copy_from,
copy_id)
SELECT uuid() AS id,
plj_copy.t_id,
link_type,
jump_type,
target_panel_id,
source_field_id,
content,
`checked`,
`attach_params`,
id AS copy_from,
#{copyId}
FROM panel_link_jump_info
inner JOIN (SELECT id AS t_id,
copy_from AS s_id
FROM panel_link_jump
WHERE copy_id = #{copyId}) plj_copy ON panel_link_jump_info.link_jump_id = plj_copy.s_id
</insert>
<insert id ="copyLinkJumpTarget">
INSERT INTO panel_link_jump_target_view_info (
target_id,
link_jump_info_id,
target_view_id,
target_field_id,
copy_from,
copy_id
) SELECT
uuid() AS id,
plji_copy.t_id AS link_jump_info_id,
target_view_id,
target_field_id,
copy_from,
#{copyId} AS copy_id
FROM
panel_link_jump_target_view_info
inner JOIN (
SELECT
id AS t_id,
copy_from AS s_id
FROM
panel_link_jump_info
WHERE
copy_id = #{copyId}
) plji_copy ON panel_link_jump_target_view_info.link_jump_info_id = plji_copy.s_id
<insert id="copyLinkJumpTarget">
INSERT INTO panel_link_jump_target_view_info (target_id,
link_jump_info_id,
target_view_id,
target_field_id,
copy_from,
copy_id)
SELECT uuid() AS id,
plji_copy.t_id AS link_jump_info_id,
target_view_id,
target_field_id,
copy_from,
#{copyId} AS copy_id
FROM panel_link_jump_target_view_info
inner JOIN (SELECT id AS t_id,
copy_from AS s_id
FROM panel_link_jump_info
WHERE copy_id = #{copyId}) plji_copy
ON panel_link_jump_target_view_info.link_jump_info_id = plji_copy.s_id
</insert>
</mapper>

View File

@ -6,6 +6,7 @@ import io.dataease.plugins.common.base.domain.MyPlugin;
import io.dataease.service.sys.PluginService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
@ -53,7 +54,7 @@ public class PluginRunner implements ApplicationRunner {
MyPlugin plugin = discardPlugins.get(i);
pluginService.uninstall(plugin.getPluginId());
}
}catch (Exception e) {
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
}
@ -73,10 +74,17 @@ public class PluginRunner implements ApplicationRunner {
String jarPath = jarFile.getAbsolutePath();
if (!StringUtils.equals("default", store) && !jarFile.exists()) {
version = "1.0-SNAPSHOT";
path = pluginDir + store + "/" + moduleName + "-" + version + ".jar";
plugin.setVersion(version);
jarFile = new File(path);
jarPath = jarFile.getAbsolutePath();
}
try {
if (jarFile.exists()) {
pluginService.loadJar(jarPath, plugin);
}else {
} else {
LogUtil.error("插件路径不存在 {} ", jarPath);
}
} catch (Exception e) {

View File

@ -820,6 +820,14 @@ public class CKQueryProvider extends QueryProvider {
return tmpSql;
}
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if(isTable){
return "SELECT COUNT(*) from " + String.format(CKConstants.KEYWORD_TABLE, sql);
}else {
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
}
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
String[] array = fields.stream().map(f -> {
@ -831,12 +839,12 @@ public class CKQueryProvider extends QueryProvider {
}
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table);
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null);
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null);
}
@Override

View File

@ -808,6 +808,17 @@ public class Db2QueryProvider extends QueryProvider {
return tmpSql;
}
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if(isTable){
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
schema = String.format(Db2Constants.KEYWORD_TABLE, schema);
return "SELECT COUNT(*) from " + schema + "." + String.format(Db2Constants.KEYWORD_TABLE, sql);
}else {
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
}
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
String[] array = fields.stream().map(f -> {
@ -817,15 +828,15 @@ public class Db2QueryProvider extends QueryProvider {
}).toArray(String[]::new);
if (ds != null) {
Db2Configuration db2Configuration = new Gson().fromJson(ds.getConfiguration(), Db2Configuration.class);
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), db2Configuration.getSchema() + ".\"" + table + "\"");
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), db2Configuration.getSchema() + String.format(Db2Constants.KEYWORD_TABLE, table));
} else {
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table);
}
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS de_tmp ", fields, null);
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS de_tmp LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null);
}
@Override

View File

@ -1,11 +1,31 @@
package io.dataease.provider.query.doris;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.datasource.entity.PageInfo;
import io.dataease.provider.query.mysql.MysqlQueryProvider;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("dorisQueryProvider")
public class DorisQueryProvider extends MysqlQueryProvider {
public String getSQLWithPage(boolean isTable, String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
if(isTable){
return getSQLTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view);
}else {
return getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view);
}
}
public String getResultCount(boolean isTable, String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
return null;
}
}

View File

@ -770,6 +770,14 @@ public class HiveQueryProvider extends QueryProvider {
return tmpSql;
}
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if(isTable){
return "SELECT COUNT(*) from " + String.format(HiveConstants.KEYWORD_TABLE, sql);
}else {
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
}
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
String[] array = fields.stream().map(f -> {
@ -781,12 +789,12 @@ public class HiveQueryProvider extends QueryProvider {
}
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table);
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null);
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null);
}
@Override

View File

@ -768,6 +768,14 @@ public class ImpalaQueryProvider extends QueryProvider {
return tmpSql;
}
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if(isTable){
return "SELECT COUNT(*) from " + String.format(ImpalaConstants.KEYWORD_TABLE, sql);
}else {
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
}
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
String[] array = fields.stream().map(f -> {
@ -779,12 +787,12 @@ public class ImpalaQueryProvider extends QueryProvider {
}
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), table);
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null);
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", fields, null);
}
@Override

View File

@ -808,12 +808,12 @@ public class MysqlQueryProvider extends QueryProvider {
}
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table);
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null);
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null);
}
public String transTreeItem(SQLObj tableObj, DatasetRowPermissionsTreeItem item) {
@ -1346,4 +1346,5 @@ public class MysqlQueryProvider extends QueryProvider {
"{\"dateformat\": \"%Y%m%d %H:%i:%S\"}\n" +
"]", Dateformat.class);
}
}

View File

@ -860,25 +860,94 @@ public class OracleQueryProvider extends QueryProvider {
return tmpSql;
}
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if (isTable) {
String schema = new Gson().fromJson(ds.getConfiguration(), OracleConfiguration.class).getSchema();
schema = String.format(OracleConstants.KEYWORD_TABLE, schema);
return "SELECT COUNT(*) from " + schema + "." + String.format(OracleConstants.KEYWORD_TABLE, sql);
} else {
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
}
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
String[] array = fields.stream().map(f -> {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(" \"").append(f.getOriginName()).append("\"");
return stringBuilder.toString();
}).toArray(String[]::new);
OracleConfiguration oracleConfiguration = new Gson().fromJson(ds.getConfiguration(), OracleConfiguration.class);
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), oracleConfiguration.getSchema() + ".\"" + table + "\"");
List<ChartViewFieldDTO> xAxis = new ArrayList<>();
ChartViewFieldDTO chartViewFieldDTO = new ChartViewFieldDTO();
chartViewFieldDTO.setOriginName("ROWNUM");
xAxis.add(chartViewFieldDTO);
fields.forEach(datasetTableField -> {
ChartViewFieldDTO f = new ChartViewFieldDTO();
f.setOriginName(datasetTableField.getOriginName());
f.setDeType(0);
xAxis.add(f);
});
List<ChartFieldCustomFilterDTO> fieldCustomFilter = new ArrayList<>();
ChartFieldCustomFilterDTO chartFieldCustomFilterDTO = new ChartFieldCustomFilterDTO();
DatasetTableField datasetTableField = new DatasetTableField();
datasetTableField.setOriginName("ROWNUM");
datasetTableField.setDeType(0);
chartFieldCustomFilterDTO.setField(datasetTableField);
List<ChartCustomFilterItemDTO> filterItemDTOS = new ArrayList<>();
ChartCustomFilterItemDTO itemDTO = new ChartCustomFilterItemDTO();
itemDTO.setTerm("le");
itemDTO.setValue("DE_ALL");
filterItemDTOS.add(itemDTO);
chartFieldCustomFilterDTO.setFilter(filterItemDTOS);
fieldCustomFilter.add(chartFieldCustomFilterDTO);
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(OracleConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(OracleConstants.ALIAS_FIX, String.format(TABLE_ALIAS_PREFIX, 0)))
.build();
setSchema(tableObj, ds);
List<SQLObj> xFields = new ArrayList<>();
if (CollectionUtils.isNotEmpty(xAxis)) {
for (int i = 0; i < xAxis.size(); i++) {
ChartViewFieldDTO x = xAxis.get(i);
if (x.getOriginName().equalsIgnoreCase("ROWNUM")) {
xFields.add(SQLObj.builder()
.fieldName(x.getOriginName())
.fieldAlias("DE_ROWNUM")
.build());
continue;
}
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
String fieldAlias = String.format(OracleConstants.KEYWORD_TABLE, x.getOriginName());
xFields.add(getXFields(x, originField, fieldAlias));
}
}
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
ST st_sql = stg.getInstanceOf("previewSql");
st_sql.add("isGroup", false);
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String sql = st_sql.render();
ST st = stg.getInstanceOf("previewSql");
st.add("isGroup", false);
SQLObj tableSQL = SQLObj.builder()
.tableName(String.format(OracleConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build();
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return "SELECT * FROM (" + sqlFix(st.render()) + ") DE_RESULT_TMP " + " WHERE DE_ROWNUM >= DE_OFFSET";
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
String[] array = fields.stream().map(f -> {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(" \"").append(f.getOriginName()).append("\"");
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), " (" + sqlFix(sql) + ") DE_TMP ");
return createRawQuerySQL("(" + sqlFix(sql) + ")", fields, null);
}
@Override

View File

@ -800,6 +800,16 @@ public class PgQueryProvider extends QueryProvider {
return tmpSql;
}
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if(isTable){
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, sql);
return "SELECT COUNT(*) from " + String.format(PgConstants.KEYWORD_TABLE, tableWithSchema);
}else {
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
}
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
String[] array = fields.stream().map(f -> {
@ -810,15 +820,15 @@ public class PgQueryProvider extends QueryProvider {
if (ds != null) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table);
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), tableWithSchema);
} else {
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), table);
}
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null);
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", fields, null);
}
@Override

View File

@ -807,6 +807,16 @@ public class RedshiftQueryProvider extends QueryProvider {
return tmpSql;
}
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if(isTable){
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, sql);
return "SELECT COUNT(*) from " + String.format(ImpalaConstants.KEYWORD_TABLE, tableWithSchema);
}else {
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
}
}
@Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
String[] array = fields.stream().map(f -> {
@ -817,15 +827,15 @@ public class RedshiftQueryProvider extends QueryProvider {
if (ds != null) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table);
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), tableWithSchema);
} else {
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), table);
}
}
@Override
public String createRawQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null);
return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", fields, null);
}
@Override

View File

@ -9,6 +9,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@ -27,7 +28,9 @@ public class VAuthModelService {
public List<VAuthModelDTO> queryAuthModel(VAuthModelRequest request) {
request.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
List<VAuthModelDTO> result = extVAuthModelMapper.queryAuthModel(request);
if(CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
if (request.getPrivileges() != null) {
result = filterPrivileges(request, result);
}

View File

@ -927,7 +927,9 @@ public class ChartViewService {
PageInfo pageInfo = new PageInfo();
pageInfo.setGoPage(chartExtRequest.getGoPage());
if (StringUtils.equalsIgnoreCase(view.getResultMode(), "custom")) {
pageInfo.setPageSize(Math.min(view.getResultCount() - (chartExtRequest.getGoPage() - 1) * chartExtRequest.getPageSize(), chartExtRequest.getPageSize()));
if (StringUtils.equalsIgnoreCase(view.getType(), "table-info") && table.getMode() == 0) {
pageInfo.setPageSize(Math.min(view.getResultCount() - (chartExtRequest.getGoPage() - 1) * chartExtRequest.getPageSize(), chartExtRequest.getPageSize()));
}
} else {
pageInfo.setPageSize(chartExtRequest.getPageSize());
}

View File

@ -1116,6 +1116,9 @@ public class DataSetTableService {
if (dsType.equals(DatasourceTypes.oracle.getType())) {
subSelect.setAlias(new Alias(fromItem.getAlias().toString(), false));
} else {
if(fromItem.getAlias() == null){
throw new Exception("Failed to parse sql, Every derived table must have its own alias");
}
subSelect.setAlias(new Alias(fromItem.getAlias().toString()));
}
plainSelect.setFromItem(subSelect);
@ -2818,7 +2821,7 @@ public class DataSetTableService {
boolean hasSubBinaryExpression = false;
try {
BinaryExpression leftBinaryExpression = (BinaryExpression) expr.getLeftExpression();
hasSubBinaryExpression = leftBinaryExpression.getLeftExpression() instanceof BinaryExpression;
hasSubBinaryExpression = leftBinaryExpression.getLeftExpression() instanceof Expression;
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -96,6 +96,7 @@ public class ExtractDataService {
@Resource
private KettleService kettleService;
private static final String lastUpdateTime = "${__last_update_time__}";
private static final String currentUpdateTime = "${__current_update_time__}";
private static final String separator = "|DE|";
@ -104,6 +105,9 @@ public class ExtractDataService {
@Value("${kettle.files.keep:false}")
private boolean kettleFilesKeep;
@Value("${extract.page.size:50000}")
private Long extractPageSize;
private static final String shellScript = "result=`curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load`\n" +
"if [ $? -eq 0 ] ; then\n" +
@ -433,7 +437,23 @@ public class ExtractDataService {
extractApiData(datasetTable, datasource, datasetTableFields, extractType);
return;
}
extractDataByKettle(datasetTable, datasource, datasetTableFields, extractType, selectSQL);
Map<String, String> sql = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
if (StringUtils.isNotEmpty(sql.get("totalSql"))) {
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(datasource);
Provider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
datasourceRequest.setQuery(sql.get("totalSql"));
List<String[]> tmpData = datasourceProvider.getData(datasourceRequest);
Long totalItems = CollectionUtils.isEmpty(tmpData) ? 0 : Long.valueOf(tmpData.get(0)[0]);
Long totalPage = (totalItems / extractPageSize) + (totalItems % extractPageSize > 0 ? 1 : 0);
for (Long i = 0L; i < totalPage; i++) {
Long offset = i * extractPageSize;
Long all = offset + extractPageSize;
extractDataByKettle(datasetTable, datasource, datasetTableFields, extractType, sql.get("selectSQL").replace("DE_OFFSET", offset.toString()).replace("DE_PAGE_SIZE", extractPageSize.toString()).replace("DE_ALL", all.toString()));
}
} else {
extractDataByKettle(datasetTable, datasource, datasetTableFields, extractType, selectSQL);
}
}
private void extractApiData(DatasetTable datasetTable, Datasource datasource, List<DatasetTableField> datasetTableFields, String extractType) throws Exception {
@ -923,7 +943,6 @@ public class ExtractDataService {
}
}
transMeta.addDatabase(dataMeta);
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
inputSteps = inputStep(transMeta, selectSQL, mysqlConfiguration);
udjcStep = udjc(datasetTableFields, DatasourceTypes.mysql, mysqlConfiguration);
break;
@ -931,7 +950,6 @@ public class ExtractDataService {
SqlServerConfiguration sqlServerConfiguration = new Gson().fromJson(datasource.getConfiguration(), SqlServerConfiguration.class);
dataMeta = new DatabaseMeta("db", "MSSQLNATIVE", "Native", sqlServerConfiguration.getHost().trim(), sqlServerConfiguration.getDataBase(), sqlServerConfiguration.getPort().toString(), sqlServerConfiguration.getUsername(), sqlServerConfiguration.getPassword());
transMeta.addDatabase(dataMeta);
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
inputSteps = inputStep(transMeta, selectSQL, sqlServerConfiguration);
udjcStep = udjc(datasetTableFields, DatasourceTypes.sqlServer, sqlServerConfiguration);
break;
@ -939,7 +957,6 @@ public class ExtractDataService {
PgConfiguration pgConfiguration = new Gson().fromJson(datasource.getConfiguration(), PgConfiguration.class);
dataMeta = new DatabaseMeta("db", "POSTGRESQL", "Native", pgConfiguration.getHost().trim(), pgConfiguration.getDataBase(), pgConfiguration.getPort().toString(), pgConfiguration.getUsername(), pgConfiguration.getPassword());
transMeta.addDatabase(dataMeta);
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
inputSteps = inputStep(transMeta, selectSQL, pgConfiguration);
udjcStep = udjc(datasetTableFields, DatasourceTypes.pg, pgConfiguration);
break;
@ -952,7 +969,6 @@ public class ExtractDataService {
dataMeta = new DatabaseMeta("db", "ORACLE", "Native", oracleConfiguration.getHost().trim(), oracleConfiguration.getDataBase(), oracleConfiguration.getPort().toString(), oracleConfiguration.getUsername(), oracleConfiguration.getPassword());
}
transMeta.addDatabase(dataMeta);
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
inputSteps = inputStep(transMeta, selectSQL, oracleConfiguration);
udjcStep = udjc(datasetTableFields, DatasourceTypes.oracle, oracleConfiguration);
break;
@ -961,7 +977,6 @@ public class ExtractDataService {
dataMeta = new DatabaseMeta("db", "ORACLE", "Native", chConfiguration.getHost().trim(), chConfiguration.getDataBase().trim(), chConfiguration.getPort().toString(), chConfiguration.getUsername(), chConfiguration.getPassword());
dataMeta.setDatabaseType("Clickhouse");
transMeta.addDatabase(dataMeta);
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
inputSteps = inputStep(transMeta, selectSQL, chConfiguration);
udjcStep = udjc(datasetTableFields, DatasourceTypes.ck, chConfiguration);
break;
@ -970,7 +985,6 @@ public class ExtractDataService {
dataMeta = new DatabaseMeta("db", "DB2", "Native", db2Configuration.getHost().trim(), db2Configuration.getDataBase().trim(), db2Configuration.getPort().toString(), db2Configuration.getUsername(), db2Configuration.getPassword());
dataMeta.setDatabaseType("DB2");
transMeta.addDatabase(dataMeta);
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
inputSteps = inputStep(transMeta, selectSQL, db2Configuration);
udjcStep = udjc(datasetTableFields, DatasourceTypes.db2, db2Configuration);
break;
@ -1019,11 +1033,13 @@ public class ExtractDataService {
FileUtils.writeStringToFile(file, transXml, "UTF-8");
}
private String getSelectSQL(String extractType, DatasetTable datasetTable, Datasource datasource, List<DatasetTableField> datasetTableFields, String selectSQL) {
private Map<String, String> getSelectSQL(String extractType, DatasetTable datasetTable, Datasource datasource, List<DatasetTableField> datasetTableFields, String selectSQL) {
Map<String, String> sql = new HashMap<>();
if (extractType.equalsIgnoreCase("all_scope") && datasetTable.getType().equalsIgnoreCase(DatasetType.DB.name())) {
String tableName = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
QueryProvider qp = ProviderFactory.getQueryProvider(datasource.getType());
selectSQL = qp.createRawQuerySQL(tableName, datasetTableFields, datasource);
sql.put("selectSQL", qp.createRawQuerySQL(tableName, datasetTableFields, datasource));
sql.put("totalSql", qp.getTotalCount(true, tableName, datasource));
}
if (extractType.equalsIgnoreCase("all_scope") && datasetTable.getType().equalsIgnoreCase(DatasetType.SQL.name())) {
@ -1033,13 +1049,17 @@ public class ExtractDataService {
selectSQL = new String(java.util.Base64.getDecoder().decode(selectSQL));
}
QueryProvider qp = ProviderFactory.getQueryProvider(datasource.getType());
selectSQL = qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields);
sql.put("totalSql", qp.getTotalCount(false, selectSQL, datasource));
sql.put("selectSQL", qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields));
}
if (!extractType.equalsIgnoreCase("all_scope")) {
QueryProvider qp = ProviderFactory.getQueryProvider(datasource.getType());
selectSQL = qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields);
sql.put("totalSql", qp.getTotalCount(false, selectSQL, datasource));
sql.put("selectSQL", qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields));
}
return selectSQL;
return sql;
}
private List<StepMeta> inputStep(TransMeta transMeta, String selectSQL, JdbcConfiguration jdbcConfiguration) {

View File

@ -1,10 +1,12 @@
package io.dataease.service.panel;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.constants.*;
import io.dataease.commons.utils.*;
import io.dataease.controller.request.authModel.VAuthModelRequest;
@ -41,6 +43,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.pentaho.di.core.util.UUIDUtil;
import org.slf4j.Logger;
@ -151,6 +154,17 @@ public class PanelGroupService {
return TreeUtils.mergeTree(panelGroupDTOList, "default_panel");
}
public List<PanelGroup> list() {
CurrentUserDto user = AuthUtils.getUser();
if (user.getIsAdmin()) {
PanelGroupExample example = new PanelGroupExample();
example.setOrderByClause("name");
example.createCriteria().andNodeTypeEqualTo("panel");
return panelGroupMapper.selectByExample(example);
}
return extPanelGroupMapper.listPanelByUser(user.getUserId());
}
@DeCleaner(value = DePermissionType.PANEL, key = "pid")
public String save(PanelGroupRequest request) {
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType());
@ -630,13 +644,15 @@ public class PanelGroupService {
OutputStream outputStream = response.getOutputStream();
try {
String snapshot = request.getSnapshot();
List<String[]> details = request.getDetails();
List<Object[]> details = request.getDetails();
Integer[] excelTypes = request.getExcelTypes();
details.add(0, request.getHeader());
Workbook wb = new XSSFWorkbook();
//明细sheet
Sheet detailsSheet = wb.createSheet("数据");
//给单元格设置样式
CellStyle cellStyle = wb.createCellStyle();
Font font = wb.createFont();
@ -651,30 +667,104 @@ public class PanelGroupService {
//设置单元格填充样式(使用纯色背景颜色填充)
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
if (CollectionUtils.isNotEmpty(details)) {
for (int i = 0; i < details.size(); i++) {
Row row = detailsSheet.createRow(i);
String[] rowData = details.get(i);
Boolean mergeHead = false;
ViewDetailField[] detailFields = request.getDetailFields();
if (ArrayUtil.isNotEmpty(detailFields)) {
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
String[] detailField = Arrays.stream(detailFields).map(field -> field.getName()).collect(Collectors.toList()).toArray(new String[detailFields.length]);
Object[] header = request.getHeader();
Row row = detailsSheet.createRow(0);
int headLen = header.length;
int detailFieldLen = detailField.length;
for (int i = 0; i < headLen; i++) {
Cell cell = row.createCell(i);
cell.setCellValue(header[i].toString());
if (i < headLen - 1) {
CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 1, i, i);
detailsSheet.addMergedRegion(cellRangeAddress);
} else {
for (int j = i + 1; j < detailFieldLen + i; j++) {
row.createCell(j).setCellStyle(cellStyle);
}
CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 0, i, i + detailFieldLen - 1);
detailsSheet.addMergedRegion(cellRangeAddress);
}
cell.setCellStyle(cellStyle);
detailsSheet.setColumnWidth(i, 255 * 20);
}
Row detailRow = detailsSheet.createRow(1);
for (int i = 0; i < headLen - 1; i++) {
Cell cell = detailRow.createCell(i);
cell.setCellStyle(cellStyle);
}
for (int i = 0; i < detailFieldLen; i++) {
int colIndex = headLen - 1 + i;
Cell cell = detailRow.createCell(colIndex);
cell.setCellValue(detailField[i]);
cell.setCellStyle(cellStyle);
detailsSheet.setColumnWidth(colIndex, 255 * 20);
}
details.add(1, detailField);
mergeHead = true;
}
if (CollectionUtils.isNotEmpty(details) && (!mergeHead || details.size() > 2)) {
int realDetailRowIndex = 2;
for (int i = (mergeHead ? 2 : 0); i < details.size(); i++) {
Row row = detailsSheet.createRow(realDetailRowIndex > 2 ? realDetailRowIndex : i);
Object[] rowData = details.get(i);
if (rowData != null) {
for (int j = 0; j < rowData.length; j++) {
Object cellValObj = rowData[j];
if (mergeHead && j == rowData.length - 1 && (cellValObj.getClass().isArray() || cellValObj instanceof ArrayList)) {
Object[] detailRowArray = ((List<Object>) cellValObj).toArray(new Object[((List<?>) cellValObj).size()]);
int detailRowArrayLen = detailRowArray.length;
int temlJ = j;
while (detailRowArrayLen > 1 && temlJ-- > 0) {
CellRangeAddress cellRangeAddress = new CellRangeAddress(realDetailRowIndex, realDetailRowIndex + detailRowArrayLen - 1, temlJ, temlJ);
detailsSheet.addMergedRegion(cellRangeAddress);
}
for (int k = 0; k < detailRowArrayLen; k++) {
List<Object> detailRows = (List<Object>) detailRowArray[k];
Row curRow = row;
if (k > 0) {
curRow = detailsSheet.createRow(realDetailRowIndex + k);
}
for (int l = 0; l < detailRows.size(); l++) {
Object col = detailRows.get(l);
Cell cell = curRow.createCell(j + l);
cell.setCellValue(col.toString());
}
}
realDetailRowIndex += detailRowArrayLen;
break;
}
Cell cell = row.createCell(j);
if (i == 0) {// 头部
cell.setCellValue(rowData[j]);
cell.setCellValue(cellValObj.toString());
cell.setCellStyle(cellStyle);
//设置列的宽度
detailsSheet.setColumnWidth(j, 255 * 20);
} else {
// with DataType
if ((excelTypes[j] == DeTypeConstants.DE_INT || excelTypes[j] == DeTypeConstants.DE_FLOAT) && StringUtils.isNotEmpty(rowData[j])) {
if ((excelTypes[j] == DeTypeConstants.DE_INT || excelTypes[j] == DeTypeConstants.DE_FLOAT) && StringUtils.isNotEmpty(cellValObj.toString())) {
try {
cell.setCellValue(Double.valueOf(rowData[j]));
cell.setCellValue(Double.valueOf(cellValObj.toString()));
} catch (Exception e) {
LogUtil.warn("export excel data transform error");
}
} else {
cell.setCellValue(rowData[j]);
cell.setCellValue(cellValObj.toString());
}
}
}
}
}

View File

@ -227,7 +227,7 @@ public class PluginService {
LogUtil.error(msg);
DEException.throwException(msg);
}
deleteJarFile(myPlugin);
myPlugin = deleteJarFile(myPlugin);
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
@ -258,18 +258,26 @@ public class PluginService {
return true;
}
private void deleteJarFile(MyPlugin plugin) {
private MyPlugin deleteJarFile(MyPlugin plugin) {
String version = plugin.getVersion();
String moduleName = plugin.getModuleName();
String fileName = moduleName + "-" + version + ".jar";
String path = pluginDir + plugin.getStore() + "/" + fileName;
File jarFile = new File(path);
if (!StringUtils.equals("default", plugin.getStore()) && !jarFile.exists()) {
version = "1.0-SNAPSHOT";
fileName = moduleName + "-" + version + ".jar";
path = pluginDir + plugin.getStore() + "/" + fileName;
jarFile = new File(path);
plugin.setVersion(version);
}
FileUtil.del(jarFile);
if (plugin.getCategory().equalsIgnoreCase("datasource")) {
File driverFile = new File(pluginDir + plugin.getStore() + "/" + plugin.getDsType() + "Driver");
FileUtil.del(driverFile);
}
return plugin;
}
/**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -139,6 +139,10 @@ export default {
sourceFieldId: jumpParam.sourceFieldId,
targetPanelId: this.panelId
}
//
if (jumpParam.sourceType && jumpParam.sourceType === 'table-pivot') {
jumpRequestParam.targetPanelId = null
}
try {
//
queryTargetPanelJumpInfo(jumpRequestParam).then(rsp => {

View File

@ -936,7 +936,7 @@ export default {
// name namedimension
if (param.name) {
param.dimensionList.forEach(dimensionItem => {
if (dimensionItem.value === param.name) {
if (dimensionItem.id === param.name) {
dimension = dimensionItem
sourceInfo = param.viewId + '#' + dimension.id
jumpInfo = this.nowPanelJumpInfo[sourceInfo]

View File

@ -250,8 +250,32 @@ export default {
const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name)
const excelTypes = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.deType)
const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName)
const excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => excelHeaderKeys.map(i => item[i]))
let excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => excelHeaderKeys.map(i => item[i]))
const excelName = this.chart.name
let detailFields = []
if (this.chart.data.detailFields?.length) {
detailFields = this.chart.data.detailFields.map(item => {
const temp = {
name: item.name,
deType: item.deType,
dataeaseName: item.dataeaseName
}
return temp
})
excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => {
const temp = excelHeaderKeys.map(i => {
if (i === 'detail' && !item[i] && Array.isArray(item['details'])) {
const arr = item['details']
if (arr?.length) {
return arr.map(ele => detailFields.map(field => ele[field.dataeaseName]))
}
return null
}
return item[i]
})
return temp
})
}
const request = {
viewId: this.chart.id,
viewName: excelName,
@ -260,7 +284,8 @@ export default {
excelTypes: excelTypes,
snapshot: snapshot,
snapshotWidth: width,
snapshotHeight: height
snapshotHeight: height,
detailFields
}
let method = innerExportDetails
const token = this.$store.getters.token || getToken()

View File

@ -66,7 +66,7 @@
@mousedown.stop.prevent="handleDown(handlei, $event)"
@touchstart.stop.prevent="handleTouchDown(handlei, $event)"
>
<slot :name="handlei" />
<slot :name="handlei"/>
</div>
<div
:id="componentCanvasId"
@ -95,7 +95,7 @@
class="svg-background"
:icon-class="mainSlotSvgInner"
/>
<slot />
<slot/>
</div>
</div>
</div>
@ -2170,31 +2170,31 @@ export default {
}
.de-drag-top {
left: 0;
top: 0;
left: 1px;
top: 1px;
height: 12px;
width: 100%;
width: calc(100% - 2px);
}
.de-drag-right {
right: 0;
top: 0;
right: 1px;
top: 1px;
width: 16px;
height: 100%;
height: calc(100% - 30px);
}
.de-drag-bottom {
left: 0;
bottom: 0;
left: 1px;
bottom: 1px;
height: 12px;
width: 100%;
width: calc(100% - 2px);
}
.de-drag-left {
left: 0;
top: 0;
left: 1px;
top: 1px;
width: 16px;
height: 100%;
height: calc(100% - 2px);
}
</style>

View File

@ -908,7 +908,14 @@ export const BASE_MAP = {
},
itemStyle: {
normal: {
},
emphasis: {
label: {
show: false
}
}
}
},
series: [

View File

@ -153,7 +153,7 @@ export function getLabel(chart) {
// label value formatter
if (chart.type && chart.type !== 'waterfall') {
label.formatter = function(param) {
let yAxis, extStack
let yAxis, extStack, xaxisExt
let res = param.value
try {
yAxis = JSON.parse(chart.yaxis)
@ -165,11 +165,16 @@ export function getLabel(chart) {
} catch (e) {
extStack = JSON.parse(JSON.stringify(chart.extStack))
}
try {
xaxisExt = JSON.parse(chart.xaxisExt)
} catch (e) {
xaxisExt = JSON.parse(JSON.stringify(chart.xaxisExt))
}
if (equalsAny(chart.type, 'bar-stack', 'line-stack',
if (equalsAny(chart.type, 'line', 'bar-stack', 'line-stack',
'bar-stack-horizontal', 'percentage-bar-stack', 'percentage-bar-stack-horizontal')) {
let f
if (extStack && extStack.length > 0) {
if (extStack?.length > 0 || xaxisExt?.length > 0) {
f = yAxis[0]
} else {
for (let i = 0; i < yAxis.length; i++) {
@ -371,7 +376,7 @@ export function getTooltip(chart) {
} else {
res = param.value
}
obj.value = res
obj.value = res === null ? '' : res
return obj
}
}

View File

@ -23,6 +23,9 @@ export const formatterType = [
]
export function valueFormatter(value, formatter) {
if (value === null || value === undefined) {
return null
}
// 1.unit 2.decimal 3.thousand separator and suffix
let result
if (formatter.type === 'auto') {

View File

@ -61,9 +61,8 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
if (customAttr.color) {
const colorValue = customAttr.color.value
isGradient = isGradientValue(colorValue)
// chart_option.color = customAttr.color.colors
if (customAttr.color.areaBorderColor) {
chart_option.series[0].itemStyle.normal.borderColor = customAttr.color.areaBorderColor
chart_option.geo.itemStyle.normal.borderColor = customAttr.color.areaBorderColor
}
}
// tooltip
@ -94,8 +93,8 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
// label
if (customAttr.label) {
const text = customAttr.label.formatter
chart_option.series[0].label = customAttr.label
chart_option.series[0].label.formatter = params => {
chart_option.geo.label = customAttr.label
chart_option.geo.label.formatter = params => {
const a = params.seriesName
const b = params.name
const c = params.value ? params.value : ''
@ -103,13 +102,14 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
}
chart_option.series[0].labelLine = customAttr.label.labelLine
if (customAttr.label.bgColor) {
chart_option.series[0].label.backgroundColor = customAttr.label.bgColor
chart_option.geo.label.backgroundColor = customAttr.label.bgColor
}
if (customAttr.label.showShadow) {
chart_option.series[0].label.shadowBlur = 2
chart_option.series[0].label.showdowColor = customAttr.label.shadowColor
chart_option.geo.label.shadowBlur = 2
chart_option.geo.label.showdowColor = customAttr.label.shadowColor
}
chart_option.series[0].itemStyle.emphasis.label.show = customAttr.label.show
chart_option.geo.itemStyle.emphasis.label.show = customAttr.label.show
delete chart_option.geo.label.formatter
}
const valueArr = chart.data.series[seriesIndex].data
// visualMap
@ -231,9 +231,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
return con?.color || '#b02a02'
}
},
encode: {
tooltip: 2
},
silent: true,
data: markData
}

View File

@ -32,6 +32,21 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
const drillFilters = JSON.parse(JSON.stringify(chart.drillFilters))
const drillExp = drillFilters[drillFilters.length - 1].datasetTableField
// 记录下钻起始字段的index
let xAxis = []
try {
xAxis = JSON.parse(chart.xaxis)
} catch (err) {
xAxis = JSON.parse(JSON.stringify(chart.xaxis))
}
let index = 0
for (let i = 0; i < xAxis.length; i++) {
if (xAxis[i].id === drillFilters[0].fieldId) {
index = i
break
}
}
// 移除所有下钻字段
const removeField = []
for (let i = 0; i < chart.drillFilters.length; i++) {
@ -78,6 +93,11 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
}
}
})
// 修正下钻字段的index获取下钻位置元素添加到index位置并删除
const ele = columns[columns.length - 1]
columns.splice(index, 0, ele)
columns.splice(columns.length - 1, 1)
} else {
fields.forEach(ele => {
const f = getCurrentField(chart.xaxis, ele)
@ -190,6 +210,21 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
const drillFilters = JSON.parse(JSON.stringify(chart.drillFilters))
const drillExp = drillFilters[drillFilters.length - 1].datasetTableField
// 记录下钻起始字段的index
let xAxis
try {
xAxis = JSON.parse(chart.xaxis)
} catch (err) {
xAxis = JSON.parse(JSON.stringify(chart.xaxis))
}
let index = 0
for (let i = 0; i < xAxis.length; i++) {
if (xAxis[i].id === drillFilters[0].fieldId) {
index = i
break
}
}
// 移除所有下钻字段
const removeField = []
for (let i = 0; i < chart.drillFilters.length; i++) {
@ -230,6 +265,17 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
}
}
})
// 修正下钻字段的index获取下钻位置元素添加到index位置并删除
let yAxis
try {
yAxis = JSON.parse(chart.yaxis)
} catch (err) {
yAxis = JSON.parse(JSON.stringify(chart.yaxis))
}
const ele = columns[columns.length - 1 - yAxis.length]
columns.splice(index, 0, ele)
columns.splice(columns.length - 1 - yAxis.length, 1)
} else {
fields.forEach(ele => {
const f = getCurrentField(chart.yaxis, ele)
@ -301,7 +347,7 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
return s2
}
export function baseTablePivot(s2, container, chart, action, tableData) {
export function baseTablePivot(s2, container, chart, action, headerAction, tableData) {
const containerDom = document.getElementById(container)
// row and column
@ -476,6 +522,8 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
// click
s2.on(S2Event.DATA_CELL_CLICK, action)
s2.on(S2Event.ROW_CELL_CLICK, headerAction)
s2.on(S2Event.COL_CELL_CLICK, headerAction)
// theme
const customTheme = getCustomTheme(chart)

View File

@ -3186,7 +3186,7 @@ export const TYPE_CONFIGS = [
'show',
'fontSize',
'color',
'formatter',
'label-bg',
'label-show-shadow',
'label-shadow-color'

View File

@ -332,6 +332,13 @@ export default {
})
return
}
if (this.canvasStyleData.panel.themeColor === 'dark') {
chart_option.legend['pageIconColor'] = '#ffffff'
chart_option.legend['pageIconInactiveColor'] = '#8c8c8c'
} else {
chart_option.legend['pageIconColor'] = '#000000'
chart_option.legend['pageIconInactiveColor'] = '#8c8c8c'
}
this.myEcharts(chart_option)
this.$nextTick(() => (this.linkageActive()))
},

View File

@ -58,6 +58,7 @@ import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart'
import { baseMixOptionAntV } from '@/views/chart/chart/mix/mix_antv'
import ChartTitleUpdate from './ChartTitleUpdate.vue'
import { equalsAny } from '@/utils/StringUtils'
import { mapState } from 'vuex'
export default {
name: 'ChartComponentG2',
@ -140,7 +141,10 @@ export default {
chartInfo() {
const { id, title } = this.chart
return { id, title }
}
},
...mapState([
'canvasStyleData'
])
},
watch: {
chart: {
@ -280,6 +284,24 @@ export default {
if (this.myChart && chart.type !== 'liquid' && this.searchCount > 0) {
this.myChart.options.animation = false
}
if (this.myChart.options.legend) {
let pageNavigatorInactiveFill, pageNavigatorFill
if (this.canvasStyleData.panel.themeColor === 'dark') {
pageNavigatorFill = '#ffffff'
pageNavigatorInactiveFill = '#8c8c8c'
} else {
pageNavigatorFill = '#000000'
pageNavigatorInactiveFill = '#8c8c8c'
}
this.myChart.options.legend['pageNavigator'] = {
marker: {
style: {
inactiveFill: pageNavigatorInactiveFill, //
fill: pageNavigatorFill //
}
}
}
}
if (this.antVRenderStatus) {
this.myChart.render()

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
@ -308,7 +308,7 @@ export default {
} else if (chart.type === 'table-normal') {
this.myChart = baseTableNormal(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
} else if (chart.type === 'table-pivot') {
this.myChart = baseTablePivot(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
this.myChart = baseTablePivot(this.myChart, this.chartId, chart, this.antVAction, this.tableHeaderClick, this.tableData)
} else {
if (this.myChart) {
this.antVRenderStatus = false
@ -347,16 +347,19 @@ export default {
}
const dimensionList = []
for (const key in rowData) {
if (meta.fieldValue === rowData[key]) {
if (nameIdMap[key]) {
dimensionList.push({ id: nameIdMap[key], value: rowData[key] })
}
}
this.antVActionPost(dimensionList, nameIdMap[meta.valueField] || 'null')
},
antVActionPost(dimensionList, name) {
this.pointParam = {
data: {
dimensionList: dimensionList,
quotaList: [],
name: meta.fieldValue || 'null'
name: name,
sourceType: this.chart.type
}
}
@ -368,6 +371,22 @@ export default {
this.$refs.viewTrack.trackButtonClick()
}
},
tableHeaderClick(param) {
const cell = this.myChart.getCell(param.target)
const meta = cell.getMeta()
const rowData = meta.query
const nameIdMap = this.chart.data.fields.reduce((pre, next) => {
pre[next['dataeaseName']] = next['id']
return pre
}, {})
const dimensionList = []
for (const key in rowData) {
if (nameIdMap[key]) {
dimensionList.push({ id: nameIdMap[key], value: rowData[key] })
}
}
this.antVActionPost(dimensionList, nameIdMap[meta.field] || 'null')
},
setBackGroundBorder() {
if (this.chart.customStyle) {
const customStyle = JSON.parse(this.chart.customStyle)

View File

@ -1,8 +1,8 @@
<template>
<span style="position: relative;display: inline-block;">
<span style="position: relative;display: inline-block;width: calc(100% - 6px)">
<i
class="el-icon-arrow-down el-icon-delete"
style="position: absolute;top: 6px;right: 4px;color: #878d9f;cursor: pointer;z-index: 1;"
style="position: absolute;top: 6px;right: 0px;color: #878d9f;cursor: pointer;z-index: 1;"
@click="removeItem"
/>
<span class="el-dropdown-link">

View File

@ -178,13 +178,18 @@ export default {
addLocationXaxis(e) {
this.dragCheckType(this.busiFieldMap.locationXaxis, 'd')
this.dragMoveDuplicate(this.busiFieldMap.locationXaxis, e)
this.busiFieldMap.locationXaxis = [this.busiFieldMap.locationXaxis[0]]
if (this.busiFieldMap.locationXaxis?.length) {
this.busiFieldMap.locationXaxis = [this.busiFieldMap.locationXaxis[0]]
}
this.calcData(true)
},
addLocationYaxis(e) {
this.dragCheckType(this.busiFieldMap.locationYaxis, 'd')
this.dragMoveDuplicate(this.busiFieldMap.locationYaxis, e)
this.busiFieldMap.locationYaxis = [this.busiFieldMap.locationYaxis[0]]
if (this.busiFieldMap.locationYaxis?.length) {
this.busiFieldMap.locationYaxis = [this.busiFieldMap.locationYaxis[0]]
}
this.calcData(true)
},
locationXItemRemove(item) {

View File

@ -76,11 +76,8 @@
v-model="functionForm.emptyDataStrategy"
@change="changeFunctionCfg"
>
<el-radio :label="'breakLine'">{{ chart.type.includes('bar')?$t('chart.set_zero'):$t('chart.break_line') }}</el-radio>
<el-radio
v-if="chart.type.includes('line') || chart.type.includes('area')"
:label="'setZero'"
>{{ $t('chart.set_zero') }}</el-radio>
<el-radio :label="'breakLine'">{{ $t('chart.break_line') }}</el-radio>
<el-radio :label="'setZero'">{{ $t('chart.set_zero') }}</el-radio>
<el-radio :label="'ignoreData'">{{ $t('chart.ignore_data') }}</el-radio>
</el-radio-group>
</el-form-item>

View File

@ -35,7 +35,7 @@
:key="field.name"
:field="field.child ? '' : field.dataeaseName"
:resizable="true"
:sortable="(!field.child || !field.child.length)"
:sortable="(!mergeCells || !mergeCells.length) && (!field.child || !field.child.length)"
:title="field.name"
:width="columnWidth"
>

View File

@ -275,6 +275,7 @@
:control-attrs="myAttrs"
:child-views="childViews"
:dataset-params="datasetParams"
:activeName="activeName"
/>
<filter-foot :element="currentElement" />

View File

@ -166,7 +166,7 @@
<el-popover
placement="bottom-end"
:disabled="!attrs.enableParameters"
width="200"
width="420"
>
<div class="view-container-class">
<el-tabs
@ -215,12 +215,12 @@
v-model="attrs.parameters"
>
<el-checkbox
v-for="(item ) in childViews.datasetParams"
v-for="(item ) in allParams"
:key="item.id"
:label="item.id"
class="de-checkbox"
>
<div class="span-div">
<div class="span-div2">
<span
v-if="item.alias && item.alias.length <= 7"
style="margin-left: 6px"
@ -280,6 +280,9 @@ export default {
datasetParams: {
type: Array,
default: () => []
},
activeName:{
}
},
data() {
@ -327,16 +330,41 @@ export default {
}
this.attrs.parameters = parameters
}
this.allParams = this.childViews.datasetParams
this.allParams = JSON.parse(JSON.stringify(this.childViews.datasetParams))
}
},
'datasetParams': {
handler(newName, oldName) {
this.allParams = JSON.parse(JSON.stringify(this.childViews.datasetParams))
if (this.datasetParams.length > 0) {
this.allParams = this.childViews.datasetParams
for (var j = 0; j < this.datasetParams.length; j++) {
var hasParam = false
for (var i = 0; i < this.childViews.datasetParams.length; i++) {
if (this.childViews.datasetParams[i].id.split('|DE|')[0] !== this.datasetParams[j].id.split('|DE|')[0]) {
if (this.childViews.datasetParams[i].id === this.datasetParams[j].id) {
hasParam = true
}
}
if(!hasParam){
this.allParams.push(this.datasetParams[j])
}
}
}
}
},
'activeName':{
handler(newName, oldName) {
if(this.activeName === 'assembly'){
this.allParams = JSON.parse(JSON.stringify(this.childViews.datasetParams))
}else {
if (this.datasetParams.length > 0) {
for (var j = 0; j < this.datasetParams.length; j++) {
var hasParam = false
for (var i = 0; i < this.childViews.datasetParams.length; i++) {
if (this.childViews.datasetParams[i].id === this.datasetParams[j].id) {
hasParam = true
}
}
if(!hasParam){
this.allParams.push(this.datasetParams[j])
}
}
@ -475,6 +503,13 @@ export default {
overflow: hidden;
}
.span-div2 {
width: 350px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.de-ul li {
margin: 5px 2px;
cursor: pointer;

View File

@ -222,7 +222,8 @@
icon="el-icon-plus"
round
@click="addLinkJumpField"
>{{ $t('panel.add_jump_field') }}</el-button>
>{{ $t('panel.add_jump_field') }}
</el-button>
</el-row>
<i
slot="reference"
@ -301,7 +302,7 @@
clearable
/>
<div class="field-height">
<el-divider />
<el-divider/>
<draggable
v-model="linkJumpInfoArray"
:options="{group:{name: 'drag',pull:'clone'},sort: true}"
@ -361,12 +362,14 @@
<el-button
size="mini"
@click="cancel()"
>{{ $t('commons.cancel') }}</el-button>
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="primary"
size="mini"
@click="save()"
>{{ $t('commons.confirm') }}</el-button>
>{{ $t('commons.confirm') }}
</el-button>
</el-row>
</el-row>
</template>
@ -487,9 +490,7 @@ export default {
'panelViewDetailsInfo'
])
},
watch: {
},
watch: {},
created() {
},
mounted() {
@ -509,7 +510,7 @@ export default {
checkAllAxisStr = chartDetails.xaxis + chartDetails.xaxisExt + yaxisNew + chartDetails.yaxisExt + chartDetails.drillFields
checkJumpStr = checkAllAxisStr
} else if (chartDetails.type === 'table-pivot') {
checkJumpStr = chartDetails.yaxis + chartDetails.yaxisExt + chartDetails.drillFields
checkJumpStr = checkAllAxisStr
} else if (chartDetails.type === 'table-info') {
checkJumpStr = chartDetails.xaxis + chartDetails.drillFields
} else {
@ -657,7 +658,10 @@ export default {
pos2.line = pos1.line
pos2.ch = pos1.ch
this.$refs.myCm.codemirror.replaceRange(param, pos2)
this.$refs.myCm.codemirror.markText(pos2, { line: pos2.line, ch: param.length + pos2.ch }, { atomic: true, selectRight: true })
this.$refs.myCm.codemirror.markText(pos2, { line: pos2.line, ch: param.length + pos2.ch }, {
atomic: true,
selectRight: true
})
},
matchToAuto() {
if (!this.name2Auto.length) return
@ -665,7 +669,10 @@ export default {
const search = this.$refs.myCm.codemirror.getSearchCursor(ele, { line: 0, ch: 0 })
if (search.find()) {
const { from, to } = search.pos
this.$refs.myCm.codemirror.markText({ line: from.line, ch: from.ch - 1 }, { line: to.line, ch: to.ch + 1 }, { atomic: true, selectRight: true })
this.$refs.myCm.codemirror.markText({ line: from.line, ch: from.ch - 1 }, {
line: to.line,
ch: to.ch + 1
}, { atomic: true, selectRight: true })
}
})
},
@ -696,41 +703,46 @@ export default {
<style scoped>
.my_table ::v-deep .el-table__row>td{
.my_table ::v-deep .el-table__row > td {
/* 去除表格线 */
border: none;
padding: 0 0;
}
.my_table ::v-deep .el-table th.is-leaf {
/* 去除上边框 */
border: none;
border: none;
}
.my_table ::v-deep .el-table::before{
.my_table ::v-deep .el-table::before {
/* 去除下边框 */
height: 0;
}
.root-class {
margin: 15px 0px 5px;
text-align: center;
}
.preview {
margin-top: 5px;
border:1px solid #E6E6E6;
height:350px !important;
overflow:hidden;
background-size: 100% 100% !important;
}
.preview-show {
border-left:1px solid #E6E6E6;
height:350px;
background-size: 100% 100% !important;
}
.top_border {
border-top:1px solid #E6E6E6;
.root-class {
margin: 15px 0px 5px;
text-align: center;
}
.slot-class{
.preview {
margin-top: 5px;
border: 1px solid #E6E6E6;
height: 350px !important;
overflow: hidden;
background-size: 100% 100% !important;
}
.preview-show {
border-left: 1px solid #E6E6E6;
height: 350px;
background-size: 100% 100% !important;
}
.top_border {
border-top: 1px solid #E6E6E6;
}
.slot-class {
color: white;
}
@ -739,13 +751,14 @@ export default {
text-align: center;
}
.ellip{
.ellip {
/*width: 100%;*/
margin-left: 10px;
margin-right: 10px;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
overflow: hidden; /*超出部分隐藏*/
white-space: nowrap; /*不换行*/
text-overflow: ellipsis; /*超出部分文字以...显示*/
text-align: center;
background-color: #f7f8fa;
color: #3d4d66;
@ -755,23 +768,25 @@ export default {
border-radius: 3px;
}
.select-filed{
.select-filed {
/*width: 100%;*/
margin-left: 10px;
margin-right: 10px;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
overflow: hidden; /*超出部分隐藏*/
white-space: nowrap; /*不换行*/
text-overflow: ellipsis; /*超出部分文字以...显示*/
color: #3d4d66;
font-size: 12px;
line-height: 35px;
height: 35px;
border-radius: 3px;
}
::v-deep .el-popover{
::v-deep .el-popover {
height: 200px;
overflow: auto;
}
.custom-position {
flex: 1;
display: flex;
@ -781,17 +796,20 @@ export default {
flex-flow: row nowrap;
color: #9ea6b2;
}
.tree-style {
padding: 10px 15px;
height: 100%;
overflow-y: auto;
}
/deep/ .vue-treeselect__control{
/deep/ .vue-treeselect__control {
height: 28px;
}
/deep/ .vue-treeselect__single-value{
color:#606266;
line-height: 28px!important;
/deep/ .vue-treeselect__single-value {
color: #606266;
line-height: 28px !important;
}
.custom-tree-node {
@ -801,26 +819,30 @@ export default {
justify-content: space-between;
font-size: 14px;
}
.auth-span{
.auth-span {
float: right;
width:30px;
width: 30px;
margin-right: 5px
}
.tree-head{
.tree-head {
height: 30px;
line-height: 30px;
border-bottom: 1px solid var(--TableBorderColor, #e6e6e6);
background-color: var(--SiderBG, #f7f8fa);
font-size: 12px;
color: var(--TableColor, #3d4d66) ;
color: var(--TableColor, #3d4d66);
}
/deep/ .vue-treeselect__placeholder{
line-height:28px
}
/deep/ .el-tree--highlight-current .el-tree-node.is-current >.el-tree-node__content {
/deep/ .vue-treeselect__placeholder {
line-height: 28px
}
/deep/ .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
background-color: #8dbbef !important;
}
.codemirror {
height: 190px;
overflow-y: auto;
@ -929,12 +951,12 @@ span {
font-size: 12px;
}
.field-height ::v-deep .el-divider--horizontal{
margin: 2px 0!important;
.field-height ::v-deep .el-divider--horizontal {
margin: 2px 0 !important;
}
::v-deep .CodeMirror {
height: 190px!important;
height: 190px !important;
}
</style>

View File

@ -800,7 +800,7 @@ export default {
data.request = JSON.stringify(data.request)
this.loading = true
this.disabledNext = true
checkApiDatasource(data).then(res => {
checkApiDatasource({'data': Base64.encode(JSON.stringify(data))}).then(res => {
this.loading = false
this.disabledNext = false
this.apiItem.status = 'Success'
@ -858,7 +858,7 @@ export default {
const data = JSON.parse(JSON.stringify(this.apiItem))
data.request = JSON.stringify(data.request)
this.loading = true
checkApiDatasource(data).then(res => {
checkApiDatasource({'data': Base64.encode(JSON.stringify(data))}).then(res => {
this.loading = false
this.$success(i18n.t('commons.success'))
this.apiItem.fields = res.data.fields

View File

@ -734,6 +734,7 @@ import { checkApiDatasource, getSchema } from '@/api/system/datasource'
import ApiHttpRequestForm from '@/views/system/datasource/ApiHttpRequestForm'
import dePwd from '@/components/deCustomCm/DePwd.vue'
import msgCfm from '@/components/msgCfm'
import { Base64 } from 'js-base64'
export default {
name: 'DsConfiguration',
components: {
@ -1069,10 +1070,10 @@ export default {
}
this.$refs.apiItemBasicInfo.validate((valid) => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.apiItem))
const data = Base64.encode(JSON.stringify(this.apiItem))
this.loading = true
this.disabledNext = true
checkApiDatasource(data)
checkApiDatasource({'data': data})
.then((res) => {
this.loading = false
this.disabledNext = false

View File

@ -1000,7 +1000,7 @@ export default {
method = this.formType === 'add' ? appApply : appEdit
}
if (
this.formType === 'modify' &&
this.formType === 'modify' && this.$route.query.showModel !== 'copy' &&
this.originConfiguration !== form.configuration
) {
if (repeat && !isAppMarket) {

View File

@ -174,7 +174,10 @@
{{ $t('chart.edit') }}
</el-dropdown-item>
<el-dropdown-item command="copy" v-show="showView === 'Datasource'">
<i class="el-icon-edit" />
<svg-icon
icon-class="de-copy"
class="de-copy-icon"
/>
{{ $t('commons.copy') }}
</el-dropdown-item>
<el-dropdown-item command="delete">
@ -899,4 +902,9 @@ export default {
margin-left: 0;
}
}
.de-copy-icon {
cursor: pointer;
margin-right: 5px;
color: var(--deTextSecondary, #646a73);
}
</style>

View File

@ -228,7 +228,7 @@ export default {
]
}
pluginLists(0, 0, param).then((response) => {
this.data = response.data.listObject
this.data = response.data.listObject.filter(item => item.pluginId > 1)
this.data.forEach((ele) => {
if (ele.cost) {
ele.cost = ele.cost.toLocaleString()
@ -283,10 +283,10 @@ export default {
this.handlerConfirm(options)
},
btnDisabled(row) {
return row.pluginId < 4
return row.store === 'default'
},
updateDisabled(row) {
return row.pluginId === 1
return row.store === 'default'
}
}
}