Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	backend/src/main/java/io/dataease/service/panel/PanelGroupService.java
This commit is contained in:
wangjiahao 2022-02-14 18:58:33 +08:00
commit a58f92ed03
37 changed files with 556 additions and 94 deletions

View File

@ -0,0 +1,14 @@
package io.dataease.auth.annotation;
import io.dataease.commons.constants.DePermissionType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DeCleaner {
DePermissionType value();
}

View File

@ -0,0 +1,74 @@
package io.dataease.auth.aop;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.listener.util.CacheUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
@Aspect
@Component
public class DeCleanerAnnotationHandler {
@Around(value = "@annotation(io.dataease.auth.annotation.DeCleaner)")
public Object CleanerAround(ProceedingJoinPoint point) {
try {
CurrentUserDto user = AuthUtils.getUser();
MethodSignature ms = (MethodSignature) point.getSignature();
Method method = ms.getMethod();
DeCleaner deCleaner = method.getAnnotation(DeCleaner.class);
DePermissionType type = deCleaner.value();
switch (type.name()) {
case "DATASOURCE":
cleanDataSource();
break;
case "DATASET":
cleanDataSet();
break;
default:
cleanPanel();
break;
}
return point.proceed(point.getArgs());
}catch (Throwable e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
public void cleanPanel() {
CurrentUserDto user = AuthUtils.getUser();
CacheUtils.remove(AuthConstants.USER_PANEL_NAME, "user" + user.getUserId());
CacheUtils.remove(AuthConstants.DEPT_PANEL_NAME, "dept" + user.getDeptId());
user.getRoles().forEach(role -> {
CacheUtils.remove(AuthConstants.ROLE_PANEL_NAME, "role" + role.getId());
});
}
public void cleanDataSet() {
CurrentUserDto user = AuthUtils.getUser();
CacheUtils.remove(AuthConstants.USER_DATASET_NAME, "user" + user.getUserId());
CacheUtils.remove(AuthConstants.DEPT_DATASET_NAME, "dept" + user.getDeptId());
user.getRoles().forEach(role -> {
CacheUtils.remove(AuthConstants.ROLE_DATASET_NAME, "role" + role.getId());
});
}
public void cleanDataSource() {
CurrentUserDto user = AuthUtils.getUser();
CacheUtils.remove(AuthConstants.USER_LINK_NAME, "user" + user.getUserId());
CacheUtils.remove(AuthConstants.DEPT_LINK_NAME, "dept" + user.getDeptId());
user.getRoles().forEach(role -> {
CacheUtils.remove(AuthConstants.ROLE_LINK_NAME, "role" + role.getId());
});
}
}

View File

@ -1,12 +1,15 @@
package io.dataease.auth.service.impl;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.entity.AuthItem;
import io.dataease.auth.service.ExtAuthService;
import io.dataease.base.domain.SysAuth;
import io.dataease.base.mapper.ext.ExtAuthMapper;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.model.AuthURD;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.listener.util.CacheUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@ -146,4 +149,7 @@ public class ExtAuthServiceImpl implements ExtAuthService {
public void clearRoleResource(Long roleId) {
LogUtil.info("all permission resource of role {} is cleanning...", roleId);
}
}

View File

@ -40,7 +40,7 @@
sys_auth a
LEFT JOIN sys_auth_detail d on d.auth_id = a.id
WHERE
auth_source_type = 'datasource'
auth_source_type = 'link'
AND auth_target_type = 'user'
AND auth_target = #{userId}
AND d.privilege_value = 1
@ -80,7 +80,7 @@
sys_auth a
LEFT JOIN sys_auth_detail d on d.auth_id = a.id
WHERE
auth_source_type = 'datasource'
auth_source_type = 'link'
AND auth_target_type = 'role'
AND auth_target = #{roleId}
AND d.privilege_value = 1
@ -119,7 +119,7 @@
sys_auth a
LEFT JOIN sys_auth_detail d on d.auth_id = a.id
WHERE
auth_source_type = 'datasource'
auth_source_type = 'link'
AND auth_target_type = 'dept'
AND auth_target = #{deptId}
AND d.privilege_value = 1

View File

@ -4,6 +4,7 @@ import io.dataease.auth.api.dto.CurrentRoleDto;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.entity.AuthItem;
import io.dataease.auth.service.ExtAuthService;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.model.AuthURD;
import org.apache.commons.lang3.StringUtils;
@ -56,7 +57,7 @@ public class AuthUtils {
Long deptId = user.getDeptId();
List<CurrentRoleDto> roles = user.getRoles();
Set<AuthItem> result = new HashSet<>();
if (StringUtils.equals("link", type)) {
if (StringUtils.equals(DePermissionType.DATASOURCE.name().toLowerCase(), type)) {
Set<AuthItem> userSet = extAuthService.dataSourceIdByUser(userId).stream().collect(Collectors.toSet());
Set<AuthItem> roleSet = roles.stream().map(role -> extAuthService.dataSourceIdByRole(role.getId())).flatMap(Collection::stream).collect(Collectors.toSet());
Set<AuthItem> deptSet = extAuthService.dataSourceIdByDept(deptId).stream().collect(Collectors.toSet());
@ -69,7 +70,7 @@ public class AuthUtils {
return result;
}
else if (StringUtils.equals("dataset", type)) {
else if (StringUtils.equals(DePermissionType.DATASET.name().toLowerCase(), type)) {
Set<AuthItem> userSet = extAuthService.dataSetIdByUser(userId).stream().collect(Collectors.toSet());
Set<AuthItem> roleSet = roles.stream().map(role -> extAuthService.dataSetIdByRole(role.getId())).flatMap(Collection::stream).collect(Collectors.toSet());
Set<AuthItem> deptSet = extAuthService.dataSetIdByDept(deptId).stream().collect(Collectors.toSet());
@ -81,7 +82,7 @@ public class AuthUtils {
});
return result;
}
else if (StringUtils.equals("panel", type)) {
else if (StringUtils.equals(DePermissionType.PANEL.name().toLowerCase(), type)) {
Set<AuthItem> userSet = extAuthService.panelIdByUser(userId).stream().collect(Collectors.toSet());
Set<AuthItem> roleSet = roles.stream().map(role -> extAuthService.panelIdByRole(role.getId())).flatMap(Collection::stream).collect(Collectors.toSet());
Set<AuthItem> deptSet = extAuthService.panelIdByDept(deptId).stream().collect(Collectors.toSet());

View File

@ -1,13 +1,19 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.ExtractDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -28,12 +34,18 @@ public class DataSetGroupController {
@Resource
private ExtractDataService extractDataService;
@RequiresPermissions("data:read")
@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) {
return dataSetGroupService.save(datasetGroup);
}
@RequiresPermissions("data:read")
@ApiOperation("查询树")
@PostMapping("/tree")
public List<DataSetGroupDTO> tree(@RequestBody DataSetGroupRequest datasetGroup) {
@ -46,6 +58,8 @@ public class DataSetGroupController {
return dataSetGroupService.treeNode(datasetGroup);
}
@RequiresPermissions("data:read")
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void tree(@PathVariable String id) throws Exception {

View File

@ -1,9 +1,13 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.base.domain.DatasetTable;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.base.domain.DatasetTableIncrementalConfig;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.response.DataSetDetail;
import io.dataease.dto.datasource.TableFiled;
@ -11,6 +15,8 @@ import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.ExcelFileData;
import io.dataease.service.dataset.DataSetTableService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -30,12 +36,24 @@ public class DataSetTableController {
@Resource
private DataSetTableService dataSetTableService;
@RequiresPermissions("data:read")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id"),
@DePermission(type = DePermissionType.DATASET, value = "sceneId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASET_LEVEL_USE)
}, logical = Logical.AND)
@ApiOperation("批量保存")
@PostMapping("batchAdd")
public void batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
dataSetTableService.batchInsert(datasetTable);
}
@RequiresPermissions("data:read")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASET, value = "sceneId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASET_LEVEL_USE)
}, logical = Logical.AND)
@ApiOperation("更新")
@PostMapping("update")
public void save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
@ -46,12 +64,19 @@ public class DataSetTableController {
}
}
@RequiresPermissions("data:read")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASET, value = "sceneId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASET_LEVEL_USE)
}, logical = Logical.AND)
@ApiOperation("修改")
@PostMapping("alter")
public void alter(@RequestBody DataSetTableRequest request) throws Exception {
dataSetTableService.alter(request);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@ApiParam(name = "id", value = "数据集ID", required = true) @PathVariable String id) throws Exception {
@ -70,6 +95,7 @@ public class DataSetTableController {
return dataSetTableService.listAndGroup(dataSetTableRequest);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_USE)
@ApiOperation("详息")
@PostMapping("get/{id}")
public DatasetTable get(@ApiParam(name = "id", value = "数据集ID", required = true) @PathVariable String id) {

View File

@ -3,7 +3,11 @@ package io.dataease.controller.datasource;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.base.domain.Datasource;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
@ -15,6 +19,8 @@ import io.dataease.service.datasource.DatasourceService;
import io.dataease.dto.DatasourceDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -31,18 +37,24 @@ public class DatasourceController {
@Resource
private DatasourceService datasourceService;
@RequiresPermissions("datasource:add")
@DePermission(type = DePermissionType.DATASOURCE, value = "id")
@ApiOperation("新增数据源")
@PostMapping("/add")
public Datasource addDatasource(@RequestBody Datasource datasource) throws Exception{
return datasourceService.addDatasource(datasource);
}
@RequiresPermissions("datasource:read")
@DePermission(type = DePermissionType.DATASOURCE, value = "id")
@ApiOperation("验证数据源")
@PostMapping("/validate")
public ResultHolder validate(@RequestBody Datasource datasource) throws Exception {
return datasourceService.validate(datasource);
}
@RequiresPermissions("datasource:read")
@DePermission(type = DePermissionType.DATASOURCE)
@ApiOperation("验证数据源")
@GetMapping("/validate/{datasourceId}")
public ResultHolder validate(@PathVariable String datasourceId) {
@ -64,6 +76,7 @@ public class DatasourceController {
return getDatasourceList().stream().filter(datasourceDTO -> datasourceDTO.getType().equalsIgnoreCase(type)).collect(Collectors.toList());
}
@RequiresPermissions("datasource:read")
@ApiIgnore
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<DatasourceDTO>> getDatasourceList(@RequestBody BaseGridRequest request, @PathVariable int goPage, @PathVariable int pageSize) throws Exception {
@ -71,12 +84,15 @@ public class DatasourceController {
return PageUtils.setPageInfo(page, datasourceService.gridQuery(request));
}
@DePermission(type = DePermissionType.DATASOURCE, level = ResourceAuthLevel.LINK_LEVEL_MANAGE)
@ApiOperation("删除数据源")
@PostMapping("/delete/{datasourceID}")
public void deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) throws Exception {
datasourceService.deleteDatasource(datasourceID);
}
@RequiresPermissions("datasource:add")
@DePermission(type = DePermissionType.DATASOURCE, value = "id", level = ResourceAuthLevel.LINK_LEVEL_MANAGE)
@ApiOperation("更新数据源")
@PostMapping("/update")
public void updateDatasource(@RequestBody Datasource Datasource) {

View File

@ -11,6 +11,7 @@ import io.dataease.service.FileService;
import io.dataease.service.system.EmailService;
import io.dataease.service.system.SystemParameterService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -39,11 +40,13 @@ public class SystemParameterController {
private EmailService emailService;
@RequiresPermissions("sysparam:read")
@GetMapping("/mail/info")
public MailInfo mailInfo() {
return emailService.mailInfo();
}
@RequiresPermissions("sysparam:read")
@GetMapping("/basic/info")
public BasicInfo basicInfo() {
return systemParameterService.basicInfo();
@ -55,11 +58,13 @@ public class SystemParameterController {
return StringUtils.isNotBlank(basicInfo.getFrontTimeOut()) ? Integer.parseInt(basicInfo.getFrontTimeOut()) : 10;
}
@RequiresPermissions("sysparam:read")
@PostMapping("/edit/email")
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
emailService.editMail(systemParameter);
}
@RequiresPermissions("sysparam:read")
@PostMapping("/edit/basic")
public void editBasic(@RequestBody List<SystemParameter> systemParameter) {
systemParameterService.editBasic(systemParameter);
@ -76,6 +81,7 @@ public class SystemParameterController {
}
@RequiresPermissions("sysparam:read")
@GetMapping("/base/info")
public List<SystemParameterDTO> getBaseInfo() {
return systemParameterService.getSystemParameterInfo(ParamConstants.Classify.BASE.getValue());

View File

@ -3,6 +3,7 @@ package io.dataease.plugins.server;
import java.util.List;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -36,6 +37,7 @@ public class ThemeServer {
return themeXpackService.queryItems(themeId);
}
@RequiresPermissions("sysparam:read")
@PostMapping("/save")
public void save(@RequestPart("request") ThemeRequest request,
@RequestPart(value = "file", required = false) MultipartFile bodyFile) {
@ -55,6 +57,7 @@ public class ThemeServer {
}
@RequiresPermissions("sysparam:read")
@PostMapping("/delete/{themeId}")
public void delete(@PathVariable("themeId") int themeId) {
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);

View File

@ -14,6 +14,7 @@ import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO;
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
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;
@ -25,6 +26,7 @@ public class XAuthServer {
private static final Set<String> cacheTypes = new HashSet<>();
@RequiresPermissions("auth:read")
@PostMapping("/authModels")
@I18n
public List<XpackVAuthModelDTO> authModels(@RequestBody XpackBaseTreeRequest request) {
@ -33,12 +35,14 @@ public class XAuthServer {
return sysAuthService.searchAuthModelTree(request, user.getUserId(), user.getIsAdmin());
}
@RequiresPermissions("auth:read")
@PostMapping("/authDetails")
public Map<String, List<XpackSysAuthDetailDTO>> authDetails(@RequestBody XpackSysAuthRequest request) {
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
return sysAuthService.searchAuthDetails(request);
}
@RequiresPermissions("auth:read")
@GetMapping("/authDetailsModel/{authType}/{direction}")
@I18n
public List<XpackSysAuthDetail> authDetailsModel(@PathVariable String authType, @PathVariable String direction) {
@ -54,6 +58,7 @@ public class XAuthServer {
return authDetails;
}
@RequiresPermissions("auth:read")
@PostMapping("/authChange")
public void authChange(@RequestBody XpackSysAuthRequest request) {
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);

View File

@ -14,6 +14,7 @@ import io.dataease.plugins.xpack.dept.dto.response.XpackSysDept;
import io.dataease.plugins.xpack.dept.service.DeptXpackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -66,6 +67,7 @@ public class XDeptServer {
return nodes;
}
@RequiresPermissions("dept:add")
@ApiOperation("创建")
@PostMapping("/create")
public int create(@RequestBody XpackCreateDept dept){
@ -73,6 +75,7 @@ public class XDeptServer {
return deptService.add(dept);
}
@RequiresPermissions("dept:del")
@ApiOperation("删除")
@PostMapping("/delete")
public void delete(@RequestBody List<XpackDeleteDept> requests){
@ -83,6 +86,7 @@ public class XDeptServer {
deptService.batchDelete(requests);
}
@RequiresPermissions("dept:edit")
@ApiOperation("更新")
@PostMapping("/update")
public int update(@RequestBody XpackCreateDept dept){
@ -91,6 +95,7 @@ public class XDeptServer {
}
@RequiresPermissions("dept:del")
@ApiIgnore
@ApiOperation("删除")
@PostMapping("/nodesByDeptId/{deptId}")

View File

@ -4,6 +4,7 @@ package io.dataease.plugins.server;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisplayXpackService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -22,6 +23,7 @@ public class XDisplayServer {
return disPlayXpackService.systemSettings();
}
@RequiresPermissions("sysparam:read")
@PostMapping(value="/save", consumes = {"multipart/form-data"})
public void saveUIInfo(@RequestPart("request") Map<String,List<SysSettingDto>> systemParameterMap, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws Exception {
DisplayXpackService disPlayXpackService = SpringContextUtil.getBean(DisplayXpackService.class);

View File

@ -20,6 +20,7 @@ import io.dataease.service.ScheduleService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -39,6 +40,7 @@ public class XEmailTaskServer {
@Resource
private PriorityThreadPoolExecutor priorityExecutor;
@RequiresPermissions("task-email:read")
@PostMapping("/queryTasks/{goPage}/{pageSize}")
public Pager<List<XpackTaskGridDTO>> queryTask(@PathVariable int goPage, @PathVariable int pageSize,
@RequestBody XpackGridRequest request) {
@ -71,6 +73,7 @@ public class XEmailTaskServer {
return listPager;
}
@RequiresPermissions("task-email:add")
@PostMapping("/save")
public void save(@RequestBody XpackEmailCreate param) throws Exception {
XpackEmailTaskRequest request = param.fillContent();
@ -81,6 +84,7 @@ public class XEmailTaskServer {
scheduleService.addSchedule(globalTask);
}
@RequiresPermissions("task-email:read")
@PostMapping("/queryForm/{taskId}")
public XpackEmailCreate queryForm(@PathVariable Long taskId) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
@ -141,6 +145,7 @@ public class XEmailTaskServer {
}
@RequiresPermissions("task-email:del")
@PostMapping("/delete/{taskId}")
public void delete(@PathVariable Long taskId) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);

View File

@ -6,6 +6,7 @@ import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.ldap.dto.response.LdapInfo;
import io.dataease.plugins.xpack.ldap.service.LdapXpackService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -21,6 +22,7 @@ public class XLdapServer {
return ldapXpackService.info();
}
@RequiresPermissions("sysparam:read")
@PostMapping("/save")
public void save(@RequestBody List<SysSettingDto> settings) {
LdapXpackService ldapXpackService = SpringContextUtil.getBean(LdapXpackService.class);

View File

@ -5,6 +5,7 @@ import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.oidc.service.OidcXpackService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
@ -21,6 +22,7 @@ public class XOidcServer {
return oidcXpackService.oidcSettings();
}
@RequiresPermissions("sysparam:read")
@PostMapping("/save")
public void save(@RequestBody List<SysSettingDto> settings) {
OidcXpackService oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class);

View File

@ -13,6 +13,7 @@ import io.dataease.plugins.xpack.role.dto.response.XpackRoleItemDto;
import io.dataease.plugins.xpack.role.service.RoleXpackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -26,6 +27,7 @@ public class XRoleServer {
@Autowired
private ExtAuthService extAuthService;
@RequiresPermissions("role:add")
@ApiOperation("新增角色")
@PostMapping("/create")
public void create(@RequestBody XpackRoleDto role){
@ -34,6 +36,7 @@ public class XRoleServer {
}
@RequiresPermissions("role:del")
@ApiOperation("删除角色")
@PostMapping("/delete/{roleId}")
public void delete(@PathVariable("roleId") Long roleId){
@ -43,6 +46,7 @@ public class XRoleServer {
}
@RequiresPermissions("role:edit")
@ApiOperation("更新角色")
@PostMapping("/update")
public void update(@RequestBody XpackRoleDto role){
@ -50,6 +54,7 @@ public class XRoleServer {
roleXpackService.update(role);
}
@RequiresPermissions("role:read")
@ApiOperation("分页查询")
@PostMapping("/roleGrid/{goPage}/{pageSize}")
public Pager<List<XpackRoleDto>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody XpackGridRequest request) {

View File

@ -1,9 +1,11 @@
package io.dataease.service.dataset;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.base.domain.DatasetGroupExample;
import io.dataease.base.mapper.DatasetGroupMapper;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.TreeUtils;
@ -39,6 +41,7 @@ public class DataSetGroupService {
@Resource
private SysAuthService sysAuthService;
@DeCleaner(DePermissionType.DATASET)
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
checkName(datasetGroup);
if (StringUtils.isEmpty(datasetGroup.getId())) {

View File

@ -2,10 +2,12 @@ package io.dataease.service.datasource;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.*;
import io.dataease.base.mapper.ext.ExtDataSourceMapper;
import io.dataease.base.mapper.ext.query.GridExample;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.AuthURD;
import io.dataease.commons.utils.AuthUtils;
@ -51,6 +53,7 @@ public class DatasourceService {
@Resource
private CommonThreadPool commonThreadPool;
@DeCleaner(DePermissionType.DATASOURCE)
public Datasource addDatasource(Datasource datasource) throws Exception{
checkName(datasource);
long currentTimeMillis = System.currentTimeMillis();

View File

@ -1,5 +1,6 @@
package io.dataease.service.panel;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.ChartViewMapper;
import io.dataease.base.mapper.PanelGroupMapper;
@ -7,6 +8,7 @@ import io.dataease.base.mapper.VAuthModelMapper;
import io.dataease.base.mapper.ext.ExtPanelGroupMapper;
import io.dataease.base.mapper.ext.ExtPanelLinkJumpMapper;
import io.dataease.base.mapper.ext.ExtVAuthModelMapper;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.TreeUtils;
@ -83,6 +85,7 @@ public class PanelGroupService {
return TreeUtils.mergeTree(panelGroupDTOList, "default_panel");
}
@DeCleaner(DePermissionType.PANEL)
@Transactional
public PanelGroup saveOrUpdate(PanelGroupRequest request) {
try {

View File

@ -16,8 +16,15 @@
{{ $t('chart.chart_error_tips') }}
</div>
</div>
<plugin-com
v-if="isPlugin"
:ref="element.propValue.id"
:component-name="chart.type + '-view'"
:obj="{chart, trackMenu, searchCount, terminalType: scaleCoefficientType}"
class="chart-class"
/>
<chart-component
v-if="charViewShowFlag"
v-else-if="charViewShowFlag"
:ref="element.propValue.id"
class="chart-class"
:chart="chart"
@ -28,7 +35,7 @@
@onJumpClick="jumpClick"
/>
<chart-component-g2
v-if="charViewG2ShowFlag"
v-else-if="charViewG2ShowFlag"
:ref="element.propValue.id"
class="chart-class"
:chart="chart"
@ -38,7 +45,7 @@
@onJumpClick="jumpClick"
/>
<chart-component-s2
v-if="charViewS2ShowFlag"
v-else-if="charViewS2ShowFlag"
:ref="element.propValue.id"
class="chart-class"
:chart="chart"
@ -48,13 +55,13 @@
@onJumpClick="jumpClick"
/>
<table-normal
v-if="tableShowFlag"
v-else-if="tableShowFlag"
:ref="element.propValue.id"
:show-summary="chart.type === 'table-normal'"
:chart="chart"
class="table-class"
/>
<label-normal v-if="labelShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" />
<label-normal v-else-if="labelShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" />
<div style="position: absolute;left: 8px;bottom:8px;">
<drill-path :drill-filters="drillFilters" @onDrillJump="drillJump" />
</div>
@ -82,10 +89,11 @@ import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
import EditBarView from '@/components/canvas/components/Editor/EditBarView'
import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import { pluginTypes } from '@/api/chart/chart'
import PluginCom from '@/views/system/plugin/PluginCom'
export default {
name: 'UserView',
components: { ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
components: { PluginCom, ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
props: {
element: {
type: Object,
@ -108,6 +116,7 @@ export default {
required: false,
default: false
},
// eslint-disable-next-line vue/require-default-prop
componentIndex: {
type: Number,
required: false
@ -153,7 +162,9 @@ export default {
pre: null,
preCanvasPanel: null,
sourceCustomAttrStr: null,
sourceCustomStyleStr: null
sourceCustomStyleStr: null,
isPlugin: false,
plugins: []
}
},
computed: {
@ -260,6 +271,7 @@ export default {
},
watch: {
'cfilters': {
handler: function(val1, val2) {
if (isChange(val1, val2) && !this.isFirstLoad) {
@ -320,6 +332,7 @@ export default {
}
},
'chartType': function(newVal, oldVal) {
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
if (newVal === 'map' && newVal !== oldVal) {
this.initAreas()
}
@ -334,6 +347,12 @@ export default {
deep: true
}
},
beforeCreate() {
pluginTypes().then(res => {
this.plugins = res.data
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
})
},
created() {
this.refId = uuid.v1
if (this.element && this.element.propValue && this.element.propValue.viewId) {

View File

@ -1022,7 +1022,8 @@ export default {
table_column_adapt: 'Adapt',
table_column_custom: 'Custom',
chart_table_pivot: 'Pivot Table',
table_pivot_row: 'Data Row'
table_pivot_row: 'Data Row',
field_error_tips: 'This field is changed(Include dimension、quotafield typedeleted),please edit again.'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',

View File

@ -1022,7 +1022,8 @@ export default {
table_column_adapt: '自適應',
table_column_custom: '自定義',
chart_table_pivot: '透視表',
table_pivot_row: '數據行'
table_pivot_row: '數據行',
field_error_tips: '該字段所對應的數據集原始字段發生變更(包括維度、指標,字段類型,字段被刪除等),建議重新編輯'
},
dataset: {
sheet_warn: '有多個 Sheet 頁,默認抽取第一個',

View File

@ -1024,7 +1024,8 @@ export default {
table_column_adapt: '自适应',
table_column_custom: '自定义',
chart_table_pivot: '透视表',
table_pivot_row: '数据行'
table_pivot_row: '数据行',
field_error_tips: '该字段所对应的数据集原始字段发生变更(包括维度、指标,字段类型,字段被删除等),建议重新编辑'
},
dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个',

View File

@ -106,7 +106,7 @@ export function getSize(chart) {
size.cellCfg = {
height: s.tableItemHeight
}
if (!s.tableColumnMode || s.tableColumnMode === 'adapt') {
if (s.tableColumnMode && s.tableColumnMode === 'adapt') {
delete size.cellCfg.width
size.layoutWidthType = 'compact'
} else {

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -10,6 +10,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
@ -17,7 +18,7 @@
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -27,6 +28,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
@ -120,8 +122,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'ChartDragItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -138,10 +144,30 @@ export default {
conf: {
type: String,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -208,6 +234,9 @@ export default {
return {
type: type
}
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -10,13 +10,14 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -26,6 +27,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
@ -100,8 +102,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'DimensionExtItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -114,10 +120,27 @@ export default {
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -188,6 +211,9 @@ export default {
this.item.index = this.index
this.item.removeType = 'dimensionExt'
this.$emit('onDimensionItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -10,13 +10,14 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -26,6 +27,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
@ -103,8 +105,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'DimensionItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -117,10 +123,27 @@ export default {
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -192,6 +215,9 @@ export default {
this.item.index = this.index
this.item.removeType = 'dimension'
this.$emit('onDimensionItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -10,10 +10,11 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -23,6 +24,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag>
<el-dropdown-menu slot="dropdown">
@ -36,8 +38,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'DrillItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -50,10 +56,30 @@ export default {
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -79,6 +105,9 @@ export default {
removeItem() {
this.item.index = this.index
this.$emit('onDimensionItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -8,10 +8,11 @@
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -19,6 +20,7 @@
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag>
<el-dropdown-menu slot="dropdown">
@ -35,8 +37,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'FilterItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -49,10 +55,30 @@ export default {
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -85,6 +111,9 @@ export default {
removeItem() {
this.item.index = this.index
this.$emit('onFilterItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -13,13 +13,14 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="chart.type !== 'table-info' && item.summary" class="summary-span">
{{ $t('chart.' + item.summary) }}<span v-if="item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -32,6 +33,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="chart.type !== 'table-info' && item.summary" class="summary-span">
{{ $t('chart.' + item.summary) }}<span v-if="item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
</span>
@ -75,22 +77,6 @@
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<!-- 快速计算先隐藏-->
<!-- <el-dropdown-item v-if="item.id !== 'count'">-->
<!-- <el-dropdown placement="right-start" size="mini" style="width: 100%" @command="quickCalc">-->
<!-- <span class="el-dropdown-link inner-dropdown-menu">-->
<!-- <span>-->
<!-- <i class="el-icon-s-grid" />-->
<!-- <span>{{ $t('chart.quick_calc') }}</span>-->
<!-- <span class="summary-span-item">()</span>-->
<!-- </span>-->
<!-- <i class="el-icon-arrow-right el-icon&#45;&#45;right" />-->
<!-- </span>-->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- <el-dropdown-item :command="beforeQuickCalc('none')"></el-dropdown-item>-->
<!-- </el-dropdown-menu>-->
<!-- </el-dropdown>-->
<!-- </el-dropdown-item>-->
<!--同比/环比-->
<el-dropdown-item v-show="chart.type !== 'table-info'">
@ -144,9 +130,12 @@
<script>
import { compareItem } from '@/views/chart/chart/compare'
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'QuotaExtItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -163,12 +152,21 @@ export default {
chart: {
type: Object,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
compareItem: compareItem,
disableEditCompare: false
disableEditCompare: false,
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
@ -177,6 +175,12 @@ export default {
},
'chart.extStack': function() {
this.isEnableCompare()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -296,6 +300,9 @@ export default {
this.item.index = this.index
this.item.calcType = 'quotaExt'
this.$emit('editItemCompare', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -13,13 +13,14 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="chart.type !== 'table-info' && item.summary" class="summary-span">
{{ $t('chart.' + item.summary) }}<span v-if="item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -32,6 +33,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="chart.type !== 'table-info' && item.summary" class="summary-span">
{{ $t('chart.' + item.summary) }}<span v-if="item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
</span>
@ -75,22 +77,6 @@
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<!-- 快速计算先隐藏-->
<!-- <el-dropdown-item v-if="item.id !== 'count'">-->
<!-- <el-dropdown placement="right-start" size="mini" style="width: 100%" @command="quickCalc">-->
<!-- <span class="el-dropdown-link inner-dropdown-menu">-->
<!-- <span>-->
<!-- <i class="el-icon-s-grid" />-->
<!-- <span>{{ $t('chart.quick_calc') }}</span>-->
<!-- <span class="summary-span-item">()</span>-->
<!-- </span>-->
<!-- <i class="el-icon-arrow-right el-icon&#45;&#45;right" />-->
<!-- </span>-->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- <el-dropdown-item :command="beforeQuickCalc('none')"></el-dropdown-item>-->
<!-- </el-dropdown-menu>-->
<!-- </el-dropdown>-->
<!-- </el-dropdown-item>-->
<!--同比/环比-->
<el-dropdown-item v-show="chart.type !== 'table-info'">
@ -144,9 +130,12 @@
<script>
import { compareItem } from '@/views/chart/chart/compare'
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'QuotaItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -163,17 +152,32 @@ export default {
chart: {
type: Object,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
compareItem: compareItem,
disableEditCompare: false
disableEditCompare: false,
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
'chart': function() {
this.isEnableCompare()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -293,6 +297,9 @@ export default {
this.item.index = this.index
this.item.calcType = 'quota'
this.$emit('editItemCompare', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -0,0 +1,21 @@
<template>
<div class="tips-class">
<el-tooltip class="item" effect="dark" :content="$t('chart.field_error_tips')" placement="bottom">
<span><i class="el-icon-warning" /></span>
</el-tooltip>
</div>
</template>
<script>
export default {
name: 'FieldErrorTips'
}
</script>
<style scoped>
.tips-class{
position: absolute;
right: 10px;
z-index: 10;
}
</style>

View File

@ -0,0 +1,33 @@
export function getItemType(dimensionData, quotaData, item) {
// 将item的字段在数据集维度、指标字段中查询一遍如果遇到id不存在、字段类型不一致、维度指标不一致则提示
const status = item.groupType
let checked = false
if (status === 'd') {
for (let i = 0; i < dimensionData.length; i++) {
const ele = dimensionData[i]
if (ele.id === item.id && ele.deType === item.deType && ele.groupType === item.groupType) {
checked = true
break
}
}
}
if (status === 'q') {
for (let i = 0; i < quotaData.length; i++) {
const ele = quotaData[i]
if (ele.id === item.id && ele.deType === item.deType && ele.groupType === item.groupType) {
checked = true
break
}
}
}
if (checked) {
if (status === 'd') {
return ''
} else if (status === 'q') {
return 'success'
}
} else {
return 'danger'
}
}

View File

@ -271,6 +271,8 @@
:param="param"
:index="index"
:item="item"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onDimensionItemChange="dimensionItemChange"
@onDimensionItemRemove="dimensionItemRemove"
@editItemFilter="showDimensionEditFilter"
@ -323,6 +325,8 @@
:param="param"
:index="index"
:item="item"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onDimensionItemChange="dimensionItemChange"
@onDimensionItemRemove="dimensionItemRemove"
@editItemFilter="showDimensionEditFilter"
@ -376,6 +380,8 @@
:index="index"
:item="item"
:chart="chart"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onQuotaItemChange="quotaItemChange"
@onQuotaItemRemove="quotaItemRemove"
@editItemFilter="showQuotaEditFilter"
@ -413,6 +419,8 @@
:index="index"
:item="item"
:chart="chart"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onQuotaItemChange="quotaItemChange"
@onQuotaItemRemove="quotaItemRemove"
@editItemFilter="showQuotaEditFilter"
@ -450,6 +458,8 @@
:param="param"
:index="index"
:item="item"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onItemChange="stackItemChange"
@onItemRemove="stackItemRemove"
/>
@ -490,6 +500,8 @@
:param="param"
:index="index"
:item="item"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onItemChange="bubbleItemChange"
@onItemRemove="bubbleItemRemove"
/>
@ -522,6 +534,8 @@
:param="param"
:index="index"
:item="item"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onFilterItemRemove="filterItemRemove"
@editItemFilter="showEditFilter"
/>
@ -558,6 +572,8 @@
:param="param"
:index="index"
:item="item"
:dimension-data="dimensionData"
:quota-data="quotaData"
@onDimensionItemChange="drillItemChange"
@onDimensionItemRemove="drillItemRemove"
/>
@ -568,7 +584,6 @@
</div>
</el-row>
</div>
</el-row>
</div>
</el-col>

View File

@ -27,19 +27,9 @@
"style": {
"navigationBarTitleText": "",
"app-plus": {
"titleNView": {
"type": "transparent",
"buttons": [{
"type": "share"
}]
}
},
"h5": {
"titleNView": {
"type": "transparent",
"buttons": []
}
}
"titleNView": false,
"bounce": "none"
}
}
},
{

View File

@ -1,33 +1,36 @@
<template>
<view class="page dataease-main">
<uni-nav-bar :title="banner.title" >
<view slot="right">
<uni-nav-bar :fixed="false" left-icon="arrowleft" @clickLeft="back" :title="banner.title" >
<block slot="right">
<uni-row class="demo-uni-row" >
<uni-col :span="12" @click="enshrine">
<uni-icons v-if="hasStar" type="star-filled" size="18" color="#007AFF"></uni-icons>
<uni-icons v-else type="star" size="18" color="#999"></uni-icons>
<uni-col :span="12">
<view @click="enshrine">
<uni-icons v-if="hasStar" type="star-filled" size="18" color="#007AFF"></uni-icons>
<uni-icons v-else type="star" size="18" color="#999"></uni-icons>
</view>
</uni-col>
<uni-col :span="12" @click="refresh" style="margin: 0 10rpx;">
<uni-icons type="reload" size="18" color="#999"></uni-icons>
<uni-col :span="12" style="margin: 0 10rpx;">
<view @click="refresh">
<uni-icons type="reload" size="18" color="#999" ></uni-icons>
</view>
</uni-col>
</uni-row>
</view>
</block>
</uni-nav-bar>
<view class="article-content">
<view class="article-content" style="height: 100% !important;">
<view v-if="url">
<web-view
:webview-styles="webViewStyles"
style="height: calc(100vh - 112px);"
style="height: 100vh;"
>
</web-view>
</view>
</view>
<!-- #ifdef MP-WEIXIN || MP-QQ -->
<ad v-if="htmlNodes.length > 0" unit-id="adunit-01b7a010bf53d74e"></ad>
<!-- #endif -->
</view>
@ -271,7 +274,7 @@
}
.article-content {
height: 100vh;
margin: 5px 0;
background: #ffffff;
}
@ -295,6 +298,36 @@
margin-left: 5px;
}
.input-view {
/* #ifndef APP-PLUS-NVUE */
display: flex;
/* #endif */
flex-direction: row;
// width: 500rpx;
flex: 1;
background-color: #f8f8f8;
height: $nav-height;
border-radius: 15px;
padding: 0 15px;
flex-wrap: nowrap;
margin: 7px 0;
line-height: $nav-height;
}
.input-uni-icon {
line-height: $nav-height;
}
.nav-bar-input {
height: $nav-height;
line-height: $nav-height;
/* #ifdef APP-PLUS-NVUE */
width: 370rpx;
/* #endif */
padding: 0 5px;
font-size: 14px;
background-color: #f8f8f8;
}
</style>