Merge pull request #4157 from dataease/pr@dev@feat_relationship_analyze

Merge branch 'dev' into pr@dev@feat_relationship_analyze
This commit is contained in:
wisonic-s 2022-12-21 18:00:13 +08:00 committed by GitHub
commit c3fcf796c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 3 deletions

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

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

@ -5,6 +5,7 @@ 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;
@ -151,6 +152,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());

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