commit
26b9b12a67
@ -1,18 +1,13 @@
|
||||
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.model.AuthURD;
|
||||
import io.dataease.commons.utils.AopUtils;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import io.dataease.service.decatch.DeCatchProcess;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@ -20,9 +15,6 @@ import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
public class DeCleanerAnnotationHandler {
|
||||
@ -43,15 +35,16 @@ public class DeCleanerAnnotationHandler {
|
||||
paramValue = AopUtils.getParamValue(arg, key, 0);
|
||||
}
|
||||
|
||||
|
||||
switch (type.name()) {
|
||||
case "DATASOURCE":
|
||||
cleanDataSource(paramValue);
|
||||
catchProcess().cleanDataSource(paramValue);
|
||||
break;
|
||||
case "DATASET":
|
||||
cleanDataSet(paramValue);
|
||||
catchProcess().cleanDataSet(paramValue);
|
||||
break;
|
||||
default:
|
||||
cleanPanel(paramValue);
|
||||
catchProcess().cleanPanel(paramValue);
|
||||
break;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
@ -60,78 +53,10 @@ public class DeCleanerAnnotationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void cleanCacheParent(String pid, String type) {
|
||||
if (StringUtils.isBlank(pid) || StringUtils.isBlank(type)) {
|
||||
return;
|
||||
}
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
List<String> resourceIds = AuthUtils.parentResources(pid.toString(), type);
|
||||
if (CollectionUtils.isEmpty(resourceIds))return;
|
||||
resourceIds.forEach(resourceId -> {
|
||||
AuthURD authURD = AuthUtils.authURDR(resourceId);
|
||||
Optional.ofNullable(authURD.getUserIds()).ifPresent(ids -> {
|
||||
ids.forEach(id -> {
|
||||
CacheUtils.remove("user_"+type, "user" + id);
|
||||
});
|
||||
});
|
||||
Optional.ofNullable(authURD.getRoleIds()).ifPresent(ids -> {
|
||||
ids.forEach(id -> {
|
||||
CacheUtils.remove("role_"+type, "role" + id);
|
||||
});
|
||||
});
|
||||
Optional.ofNullable(authURD.getDeptIds()).ifPresent(ids -> {
|
||||
ids.forEach(id -> {
|
||||
List<String> depts = AuthUtils.getAuthModels(id.toString(), "dept", user.getUserId(), user.getIsAdmin());
|
||||
depts.forEach(deptId -> {
|
||||
CacheUtils.remove("dept_"+type, "dept" + deptId);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
public DeCatchProcess catchProcess() {
|
||||
return CommonBeanFactory.getBean(DeCatchProcess.class);
|
||||
}
|
||||
|
||||
public void cleanPanel(Object pid) {
|
||||
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());
|
||||
});
|
||||
|
||||
Optional.ofNullable(pid).ifPresent(resourceId -> {
|
||||
cleanCacheParent(resourceId.toString(), "panel");
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void cleanDataSet(Object pid) {
|
||||
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());
|
||||
});
|
||||
|
||||
Optional.ofNullable(pid).ifPresent(resourceId -> {
|
||||
cleanCacheParent(resourceId.toString(), "dataset");
|
||||
});
|
||||
}
|
||||
|
||||
public void cleanDataSource(Object pid) {
|
||||
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());
|
||||
});
|
||||
|
||||
Optional.ofNullable(pid).ifPresent(resourceId -> {
|
||||
cleanCacheParent(resourceId.toString(), "link");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -62,8 +62,20 @@ public class PanelGroupController {
|
||||
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
|
||||
}, logical = Logical.AND)
|
||||
@I18n
|
||||
public PanelGroup saveOrUpdate(@RequestBody PanelGroupRequest request) {
|
||||
return panelGroupService.saveOrUpdate(request);
|
||||
public PanelGroup save(@RequestBody PanelGroupRequest request) throws Exception{
|
||||
String panelId = panelGroupService.save(request);
|
||||
return findOne(panelId);
|
||||
}
|
||||
|
||||
@ApiOperation("更新")
|
||||
@PostMapping("/update")
|
||||
@DePermissions(value = {
|
||||
@DePermission(type = DePermissionType.PANEL, value = "id"),
|
||||
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
|
||||
}, logical = Logical.AND)
|
||||
@I18n
|
||||
public String update(@RequestBody PanelGroupRequest request) {
|
||||
return panelGroupService.update(request);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@ -107,7 +119,7 @@ public class PanelGroupController {
|
||||
@ApiOperation("仪表板组件信息")
|
||||
@GetMapping("/queryPanelComponents/{id}")
|
||||
@I18n
|
||||
public Map queryPanelComponents(@PathVariable String id){
|
||||
public Map queryPanelComponents(@PathVariable String id) {
|
||||
return panelGroupService.queryPanelComponents(id);
|
||||
}
|
||||
|
||||
@ -115,15 +127,15 @@ public class PanelGroupController {
|
||||
@PostMapping("/exportDetails")
|
||||
@I18n
|
||||
public void exportDetails(@RequestBody PanelViewDetailsRequest request, HttpServletResponse response) throws IOException {
|
||||
panelGroupService.exportPanelViewDetails(request,response);
|
||||
panelGroupService.exportPanelViewDetails(request, response);
|
||||
}
|
||||
|
||||
@ApiOperation("更新仪表板状态")
|
||||
@PostMapping("/updatePanelStatus/{panelId}")
|
||||
@I18n
|
||||
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
|
||||
public void updatePanelStatus(@PathVariable String panelId,@RequestBody PanelGroupBaseInfoRequest request){
|
||||
panelGroupService.updatePanelStatus(panelId,request);
|
||||
public void updatePanelStatus(@PathVariable String panelId, @RequestBody PanelGroupBaseInfoRequest request) {
|
||||
panelGroupService.updatePanelStatus(panelId, request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -365,6 +365,7 @@
|
||||
custom_filter,
|
||||
drill_fields,
|
||||
SNAPSHOT,
|
||||
senior,
|
||||
data_from)
|
||||
SELECT pv_copy.chart_view_id AS id,
|
||||
`name`,
|
||||
@ -392,6 +393,7 @@
|
||||
custom_filter,
|
||||
drill_fields,
|
||||
SNAPSHOT,
|
||||
senior,
|
||||
data_from
|
||||
FROM (
|
||||
SELECT panel_id,
|
||||
|
||||
@ -79,8 +79,11 @@ public class JdbcProvider extends DefaultJdbcProvider {
|
||||
List<TableField> list = new LinkedList<>();
|
||||
try (Connection connection = getConnectionFromPool(datasourceRequest)) {
|
||||
if (datasourceRequest.getDatasource().getType().equalsIgnoreCase("oracle")) {
|
||||
Method setRemarksReporting = extendedJdbcClassLoader.loadClass("oracle.jdbc.driver.OracleConnection").getMethod("setRemarksReporting", boolean.class);
|
||||
setRemarksReporting.invoke(((DruidPooledConnection) connection).getConnection(), true);
|
||||
OracleConfiguration oracleConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), OracleConfiguration.class);
|
||||
if (isDefaultClassLoader(oracleConfiguration.getCustomDriver())) {
|
||||
Method setRemarksReporting = extendedJdbcClassLoader.loadClass("oracle.jdbc.driver.OracleConnection").getMethod("setRemarksReporting", boolean.class);
|
||||
setRemarksReporting.invoke(((DruidPooledConnection) connection).getConnection(), true);
|
||||
}
|
||||
}
|
||||
DatabaseMetaData databaseMetaData = connection.getMetaData();
|
||||
ResultSet resultSet = databaseMetaData.getColumns(null, "%", datasourceRequest.getTable(), "%");
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package io.dataease.service.datasource;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.constants.SysLogConstants;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
@ -8,14 +9,13 @@ import io.dataease.commons.utils.DeLogUtils;
|
||||
import io.dataease.dto.DriverDTO;
|
||||
import io.dataease.dto.SysLogDTO;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.domain.DeDriver;
|
||||
import io.dataease.plugins.common.base.domain.DeDriverDetails;
|
||||
import io.dataease.plugins.common.base.domain.DeDriverDetailsExample;
|
||||
import io.dataease.plugins.common.base.domain.*;
|
||||
import io.dataease.plugins.common.base.mapper.DeDriverDetailsMapper;
|
||||
import io.dataease.plugins.common.base.mapper.DeDriverMapper;
|
||||
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
|
||||
import io.dataease.plugins.datasource.provider.DefaultJdbcProvider;
|
||||
import io.dataease.plugins.datasource.provider.ExtendedJdbcClassLoader;
|
||||
import io.dataease.provider.ProviderFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -27,10 +27,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
@ -78,6 +75,15 @@ public class DriverService {
|
||||
}
|
||||
|
||||
public DeDriver save(DeDriver deDriver) {
|
||||
if(StringUtils.isEmpty(deDriver.getName()) || StringUtils.isEmpty(deDriver.getType())){
|
||||
throw new RuntimeException("Name or Type cannot be empty.");
|
||||
}
|
||||
DeDriverExample example = new DeDriverExample();
|
||||
example.createCriteria().andNameEqualTo(deDriver.getName());
|
||||
if(CollectionUtil.isNotEmpty(deDriverMapper.selectByExample(example))){
|
||||
throw new RuntimeException(Translator.get("I18N_DRIVER_REPEAT_NAME"));
|
||||
}
|
||||
|
||||
deDriver.setCreateTime(System.currentTimeMillis());
|
||||
deDriver.setId(UUID.randomUUID().toString());
|
||||
deDriverMapper.insert(deDriver);
|
||||
@ -96,12 +102,15 @@ public class DriverService {
|
||||
return deDriverDetailsMapper.selectByExampleWithBLOBs(example);
|
||||
}
|
||||
|
||||
public void deleteDriverFile(String driverFileId) {
|
||||
public void deleteDriverFile(String driverFileId) throws Exception{
|
||||
DeDriverDetails deDriverDetails = deDriverDetailsMapper.selectByPrimaryKey(driverFileId);
|
||||
DeDriver deDriver = deDriverMapper.selectByPrimaryKey(deDriverDetails.getDeDriverId());
|
||||
DeFileUtils.deleteFile(DRIVER_PATH + deDriverDetails.getDeDriverId() + "/" + deDriverDetails.getFileName());
|
||||
SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, SysLogConstants.SOURCE_TYPE.DRIVER_FILE, deDriverDetails.getId(), deDriverDetails.getDeDriverId(), null, null);
|
||||
DeLogUtils.save(sysLogDTO);
|
||||
deDriverDetailsMapper.deleteByPrimaryKey(driverFileId);
|
||||
DefaultJdbcProvider defaultJdbcProvider = (DefaultJdbcProvider)ProviderFactory.getProvider(deDriver.getType());
|
||||
defaultJdbcProvider.reloadCustomJdbcClassLoader(deDriver);
|
||||
}
|
||||
|
||||
public DeDriverDetails saveJar(MultipartFile file, String driverId) throws Exception {
|
||||
@ -129,6 +138,9 @@ public class DriverService {
|
||||
deDriverDetailsMapper.insert(deDriverDetails);
|
||||
SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.UPLOADFILE, SysLogConstants.SOURCE_TYPE.DRIVER_FILE, deDriverDetails.getId(), driverId, null, null);
|
||||
DeLogUtils.save(sysLogDTO);
|
||||
DeDriver deDriver = deDriverMapper.selectByPrimaryKey(driverId);
|
||||
DefaultJdbcProvider defaultJdbcProvider = (DefaultJdbcProvider)ProviderFactory.getProvider(deDriver.getType());
|
||||
defaultJdbcProvider.reloadCustomJdbcClassLoader(deDriver);
|
||||
return deDriverDetails;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
package io.dataease.service.decatch;
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.model.AuthURD;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2022/5/31
|
||||
* Description:
|
||||
*/
|
||||
@Service
|
||||
public class DeCatchProcess {
|
||||
|
||||
@Async("taskExecutor")
|
||||
public void cleanPanel(Object pid) {
|
||||
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());
|
||||
});
|
||||
|
||||
Optional.ofNullable(pid).ifPresent(resourceId -> {
|
||||
cleanCacheParent(resourceId.toString(), "panel");
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Async("taskExecutor")
|
||||
public void cleanDataSet(Object pid) {
|
||||
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());
|
||||
});
|
||||
|
||||
Optional.ofNullable(pid).ifPresent(resourceId -> {
|
||||
cleanCacheParent(resourceId.toString(), "dataset");
|
||||
});
|
||||
}
|
||||
|
||||
@Async("taskExecutor")
|
||||
public void cleanDataSource(Object pid) {
|
||||
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());
|
||||
});
|
||||
|
||||
Optional.ofNullable(pid).ifPresent(resourceId -> {
|
||||
cleanCacheParent(resourceId.toString(), "link");
|
||||
});
|
||||
}
|
||||
|
||||
private void cleanCacheParent(String pid, String type) {
|
||||
if (StringUtils.isBlank(pid) || StringUtils.isBlank(type)) {
|
||||
return;
|
||||
}
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
List<String> resourceIds = AuthUtils.parentResources(pid.toString(), type);
|
||||
if (CollectionUtils.isEmpty(resourceIds))return;
|
||||
resourceIds.forEach(resourceId -> {
|
||||
AuthURD authURD = AuthUtils.authURDR(resourceId);
|
||||
Optional.ofNullable(authURD.getUserIds()).ifPresent(ids -> {
|
||||
ids.forEach(id -> {
|
||||
CacheUtils.remove("user_"+type, "user" + id);
|
||||
});
|
||||
});
|
||||
Optional.ofNullable(authURD.getRoleIds()).ifPresent(ids -> {
|
||||
ids.forEach(id -> {
|
||||
CacheUtils.remove("role_"+type, "role" + id);
|
||||
});
|
||||
});
|
||||
Optional.ofNullable(authURD.getDeptIds()).ifPresent(ids -> {
|
||||
ids.forEach(id -> {
|
||||
List<String> depts = AuthUtils.getAuthModels(id.toString(), "dept", user.getUserId(), user.getIsAdmin());
|
||||
depts.forEach(deptId -> {
|
||||
CacheUtils.remove("dept_"+type, "dept" + deptId);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -121,20 +121,22 @@ public class PanelGroupService {
|
||||
}
|
||||
|
||||
@DeCleaner(value = DePermissionType.PANEL, key = "pid")
|
||||
public PanelGroup saveOrUpdate(PanelGroupRequest request) {
|
||||
public String save(PanelGroupRequest request) {
|
||||
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType());
|
||||
String panelId = newPanel(request);
|
||||
panelGroupMapper.insertSelective(request);
|
||||
// 清理权限缓存
|
||||
clearPermissionCache();
|
||||
sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL);
|
||||
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.CREATE, sourceType, panelId, request.getPid(), null, null);
|
||||
return panelId;
|
||||
}
|
||||
|
||||
|
||||
public String update(PanelGroupRequest request) {
|
||||
String panelId = request.getId();
|
||||
if (StringUtils.isNotEmpty(panelId)) {
|
||||
panelViewService.syncPanelViews(request);
|
||||
}
|
||||
if (StringUtils.isEmpty(panelId)) { // 新建
|
||||
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType());
|
||||
panelId = newPanel(request);
|
||||
panelGroupMapper.insertSelective(request);
|
||||
// 清理权限缓存
|
||||
clearPermissionCache();
|
||||
sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL);
|
||||
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.CREATE, sourceType, panelId, request.getPid(), null, null);
|
||||
} else if ("toDefaultPanel".equals(request.getOptType())) { // 转存为默认仪表板
|
||||
panelViewService.syncPanelViews(request);
|
||||
if ("toDefaultPanel".equals(request.getOptType())) { // 转存为默认仪表板
|
||||
panelId = UUID.randomUUID().toString();
|
||||
PanelGroupWithBLOBs newDefaultPanel = panelGroupMapper.selectByPrimaryKey(request.getId());
|
||||
newDefaultPanel.setPanelType(PanelConstants.PANEL_TYPE.SYSTEM);
|
||||
@ -191,19 +193,9 @@ public class PanelGroupService {
|
||||
request.setPid(panel.getPid());
|
||||
}
|
||||
}
|
||||
|
||||
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFY, sourceType, request.getId(), request.getPid(), null, sourceType);
|
||||
}
|
||||
|
||||
//带有权限的返回
|
||||
PanelGroupRequest authRequest = new PanelGroupRequest();
|
||||
authRequest.setId(panelId);
|
||||
authRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupList(authRequest);
|
||||
if (!CollectionUtils.isNotEmpty(panelGroupDTOList)) {
|
||||
DataEaseException.throwException("未查询到用户对应的资源权限,请尝试刷新重新保存");
|
||||
}
|
||||
return panelGroupDTOList.get(0);
|
||||
return panelId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -154,4 +154,5 @@ SOURCE_TYPE_DRIVER=DRIVER
|
||||
SOURCE_TYPE_DRIVER_FILE=DRIVER FILE
|
||||
SOURCE_TYPE_MENU=MENU
|
||||
|
||||
I18N_DRIVER_NOT_DELETE=Drivers in use cannot be deleted
|
||||
I18N_DRIVER_NOT_DELETE=Drivers in use cannot be deleted
|
||||
I18N_DRIVER_REPEAT_NAME=Driver name cannot be same.
|
||||
@ -158,3 +158,4 @@ I18N_USER=操作人
|
||||
I18N_TIME=操作时间
|
||||
|
||||
I18N_DRIVER_NOT_DELETE=使用中的驱动不允许删除
|
||||
I18N_DRIVER_REPEAT_NAME=名称重复
|
||||
|
||||
@ -153,4 +153,5 @@ SOURCE_TYPE_DRIVER=驅動
|
||||
SOURCE_TYPE_DRIVER_FILE=驅動文件
|
||||
SOURCE_TYPE_MENU=菜單
|
||||
|
||||
I18N_DRIVER_NOT_DELETE=使用中的驅動不允許删除
|
||||
I18N_DRIVER_NOT_DELETE=使用中的驅動不允許删除
|
||||
I18N_DRIVER_REPEAT_NAME=名稱重複
|
||||
@ -72,6 +72,16 @@ export function panelSave(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function panelUpdate(data) {
|
||||
return request({
|
||||
url: 'panel/group/update',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function findOne(id) {
|
||||
return request({
|
||||
url: 'panel/group/findOne/' + id,
|
||||
|
||||
@ -2,10 +2,11 @@
|
||||
<div class="bg" :style="customStyle" @scroll="canvasScroll">
|
||||
<div id="canvasInfoMain" ref="canvasInfoMain" :style="canvasInfoMainStyle">
|
||||
<el-row v-if="showUnpublishedArea" class="custom-position">
|
||||
<pre>
|
||||
<svg-icon icon-class="unpublished" style="font-size: 75px" />
|
||||
{{ $t('panel.panel_off') }}
|
||||
</pre>
|
||||
<div style="text-align: center">
|
||||
<svg-icon icon-class="unpublished" style="font-size: 75px" />
|
||||
<br>
|
||||
<span>{{ $t('panel.panel_off') }}</span>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row v-else-if="componentDataShow.length===0" class="custom-position">
|
||||
{{ $t('panel.panelNull') }}
|
||||
|
||||
@ -87,7 +87,7 @@ import { mapState } from 'vuex'
|
||||
import { commonStyle, commonAttr } from '@/components/canvas/custom-component/component-list'
|
||||
import eventBus from '@/components/canvas/utils/eventBus'
|
||||
import { deepCopy, mobile2MainCanvas } from '@/components/canvas/utils/utils'
|
||||
import { panelSave } from '@/api/panel/panel'
|
||||
import { panelUpdate } from '@/api/panel/panel'
|
||||
import { saveLinkage, getPanelAllLinkageInfo } from '@/api/panel/linkage'
|
||||
import bus from '@/utils/bus'
|
||||
import {
|
||||
@ -295,7 +295,7 @@ export default {
|
||||
})
|
||||
// 无需保存条件
|
||||
requestInfo.panelData = JSON.stringify(components)
|
||||
panelSave(requestInfo).then(response => {
|
||||
panelUpdate(requestInfo).then(response => {
|
||||
this.$store.commit('refreshSaveStatus')
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
|
||||
@ -549,14 +549,7 @@ export default {
|
||||
// 将视图传入echart组件
|
||||
if (response.success) {
|
||||
this.chart = response.data
|
||||
if (this.isEdit) {
|
||||
this.componentViewsData[this.chart.id] = {
|
||||
'title': this.chart.title,
|
||||
'render': this.chart.render,
|
||||
'type': this.chart.type,
|
||||
'isPlugin': this.chart.isPlugin
|
||||
}
|
||||
}
|
||||
this.getDataOnly(response.data)
|
||||
this.chart['position'] = this.inTab ? 'tab' : 'panel'
|
||||
// 记录当前数据
|
||||
this.panelViewDetailsInfo[id] = JSON.stringify(this.chart)
|
||||
@ -613,7 +606,6 @@ export default {
|
||||
tableChart.customStyle = JSON.stringify(tableChart.customStyle)
|
||||
eventBus.$emit('openChartDetailsDialog', { chart: this.chart, tableChart: tableChart })
|
||||
},
|
||||
|
||||
chartClick(param) {
|
||||
if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) {
|
||||
(this.chart.type === 'map' || this.chart.type === 'buddle-map') && this.sendToChildren(param)
|
||||
@ -867,6 +859,21 @@ export default {
|
||||
}
|
||||
this.mergeScale()
|
||||
}
|
||||
},
|
||||
getDataOnly(sourceResponseData) {
|
||||
if (this.isEdit) {
|
||||
if ((this.filter.filter && this.filter.filter.length) || (this.filter.linkageFilters && this.filter.linkageFilters.length)) {
|
||||
viewData(this.chart.id, this.panelInfo.id, {
|
||||
filter: [],
|
||||
drill: [],
|
||||
queryFrom: 'panel'
|
||||
}).then(response => {
|
||||
this.componentViewsData[this.chart.id] = response.data
|
||||
})
|
||||
} else {
|
||||
this.componentViewsData[this.chart.id] = sourceResponseData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,8 +411,7 @@ const list = [
|
||||
verticalAlign: 'middle',
|
||||
borderStyle: 'solid',
|
||||
borderColor: '#000000',
|
||||
time_margin: 0,
|
||||
padding: 10
|
||||
time_margin: 0
|
||||
},
|
||||
formatInfo: {
|
||||
openMode: '0',
|
||||
|
||||
@ -130,7 +130,7 @@ export function baseGaugeOption(chart_option, chart, scale = 1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(chart_option.series[0])
|
||||
// console.log(chart_option.series[0])
|
||||
// console.log(chart_option);
|
||||
componentStyle(chart_option, chart)
|
||||
return chart_option
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div ref="tableContainer" :style="bg_class" style="padding: 8px;width: 100%;height: 100%;overflow: hidden;">
|
||||
<div ref="tableContainer" :style="bg_class" style="width: 100%;height: 100%;overflow: hidden;">
|
||||
<view-track-bar ref="viewTrack" :track-menu="trackMenu" class="track-bar" :style="trackBarStyleTime" @trackClick="trackClick" />
|
||||
<p v-show="title_show" ref="title" :style="title_class">{{ chart.title }}</p>
|
||||
<div
|
||||
|
||||
@ -1191,7 +1191,7 @@ export default {
|
||||
return this.chartConfig ? this.chartConfig.propertyInner : null
|
||||
},
|
||||
chartType() {
|
||||
return this.chart.type
|
||||
return this.chart ? this.chart.type : null
|
||||
},
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
@ -1199,7 +1199,8 @@ export default {
|
||||
...mapState([
|
||||
'curComponent',
|
||||
'panelViewEditInfo',
|
||||
'allViewRender'
|
||||
'allViewRender',
|
||||
'componentViewsData'
|
||||
])
|
||||
/* pluginRenderOptions() {
|
||||
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
|
||||
@ -1238,6 +1239,9 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.bindPluginEvent()
|
||||
this.initFromPanel()
|
||||
this.chartInit()
|
||||
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views'))
|
||||
if (plugins) {
|
||||
this.loadPluginType()
|
||||
@ -1253,9 +1257,6 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.bindPluginEvent()
|
||||
this.initFromPanel()
|
||||
this.chartInit()
|
||||
},
|
||||
activated() {
|
||||
},
|
||||
@ -1282,7 +1283,9 @@ export default {
|
||||
this.resetDrill()
|
||||
this.initFromPanel()
|
||||
this.getChart(this.param.id)
|
||||
this.getData(this.param.id)
|
||||
if (this.componentViewsData[this.param.id]) {
|
||||
this.chart = this.componentViewsData[this.param.id]
|
||||
}
|
||||
},
|
||||
bindPluginEvent() {
|
||||
bus.$on('show-dimension-edit-filter', this.showDimensionEditFilter)
|
||||
@ -1599,7 +1602,7 @@ export default {
|
||||
const view = this.buildParam(true, 'chart', false, switchType)
|
||||
if (!view) return
|
||||
viewEditSave(this.panelInfo.id, view).then(() => {
|
||||
this.getData(this.param.id)
|
||||
// this.getData(this.param.id)
|
||||
bus.$emit('view-in-cache', { type: 'propChange', viewId: this.param.id })
|
||||
})
|
||||
},
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
</el-col>
|
||||
<el-col :span="16" :style="classBackground" class="preview-show" />
|
||||
</el-row>
|
||||
<el-row v-if="inputType==='new_outer_template'" class="preview" :style="classBackground" />
|
||||
<el-row v-if="inputType==='new_outer_template'" class="preview" :style="classBackground" />
|
||||
<el-row class="root-class">
|
||||
<el-button size="mini" @click="cancel()">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" @click="save()">{{ $t('commons.confirm') }}</el-button>
|
||||
@ -32,7 +32,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { panelSave } from '@/api/panel/panel'
|
||||
import { panelSave, panelUpdate } from '@/api/panel/panel'
|
||||
import { showTemplateList } from '@/api/system/template'
|
||||
import TemplateAllList from './TemplateAllList'
|
||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||
@ -147,17 +147,31 @@ export default {
|
||||
}
|
||||
this.editPanel.panelInfo['newFrom'] = this.inputType
|
||||
this.loading = true
|
||||
panelSave(this.editPanel.panelInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
if (this.editPanel.optType === 'new') {
|
||||
panelSave(this.editPanel.panelInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
this.loading = false
|
||||
this.$emit('closeEditPanelDialog', response.data)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
this.loading = false
|
||||
this.$emit('closeEditPanelDialog', response.data)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
panelUpdate(this.editPanel.panelInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
this.loading = false
|
||||
this.$emit('closeEditPanelDialog', response.data)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
handleFileChange(e) {
|
||||
const file = e.target.files[0]
|
||||
|
||||
@ -228,7 +228,7 @@ import LinkGenerate from '@/views/link/generate'
|
||||
import { uuid } from 'vue-uuid'
|
||||
import bus from '@/utils/bus'
|
||||
import EditPanel from './EditPanel'
|
||||
import { addGroup, delGroup, groupTree, defaultTree, panelSave, initPanelData } from '@/api/panel/panel'
|
||||
import {addGroup, delGroup, groupTree, defaultTree, panelSave, initPanelData, panelUpdate} from '@/api/panel/panel'
|
||||
import { mapState } from 'vuex'
|
||||
import {
|
||||
DEFAULT_COMMON_CANVAS_STYLE_STRING
|
||||
@ -779,7 +779,7 @@ export default {
|
||||
saveMoveGroup() {
|
||||
this.moveInfo.pid = this.tGroup.id
|
||||
this.moveInfo['optType'] = 'move'
|
||||
panelSave(this.moveInfo).then(response => {
|
||||
panelUpdate(this.moveInfo).then(response => {
|
||||
this.tree()
|
||||
this.closeMoveGroup()
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user