forked from github/dataease
fix: 修复资源文件夹可以移动到其自身的子文件夹造成移动后文件夹不显示问题
This commit is contained in:
parent
3dcb2d1663
commit
096de8a3d1
@ -91,13 +91,12 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
@Resource
|
||||
private VisualizationWatermarkMapper watermarkMapper;
|
||||
|
||||
@DeLog(id = "#p0", ot = LogOT.READ, stExp = "#p1")
|
||||
@Override
|
||||
public DataVisualizationVO findCopyResource(Long dvId, String busiFlag) {
|
||||
DataVisualizationVO result = findById(dvId, busiFlag);
|
||||
if(result !=null && result.getPid() == -1){
|
||||
if (result != null && result.getPid() == -1) {
|
||||
return result;
|
||||
}else{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -136,6 +135,11 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
} else {
|
||||
visualizationInfo.setSelfWatermarkStatus(0);
|
||||
}
|
||||
if (DataVisualizationConstants.RESOURCE_OPT_TYPE.COPY.equals(request.getOptType())) {
|
||||
// 复制更新 新建权限插入
|
||||
visualizationInfoMapper.deleteById(request.getId());
|
||||
visualizationInfo.setNodeType(DataVisualizationConstants.NODE_TYPE.LEAF);
|
||||
}
|
||||
Long newDvId = coreVisualizationManage.innerSave(visualizationInfo);
|
||||
request.setId(newDvId);
|
||||
//保存视图信
|
||||
@ -158,24 +162,19 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
} else {
|
||||
visualizationInfo.setSelfWatermarkStatus(0);
|
||||
}
|
||||
if (DataVisualizationConstants.RESOURCE_OPT_TYPE.COPY.equals(request.getOptType())) {
|
||||
// 复制更新 新建权限插入
|
||||
visualizationInfoMapper.deleteById(dvId);
|
||||
visualizationInfo.setNodeType(DataVisualizationConstants.NODE_TYPE.LEAF);
|
||||
coreVisualizationManage.innerSave(visualizationInfo);
|
||||
} else {
|
||||
// 检查当前节点的pid是否一致如果不一致 需要调用move 接口(预存 可能会出现pid =-1的情况)
|
||||
if (request.getPid() != -1) {
|
||||
QueryWrapper<DataVisualizationInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("pid", request.getPid());
|
||||
queryWrapper.eq("id", dvId);
|
||||
if (!visualizationInfoMapper.exists(queryWrapper)) {
|
||||
request.setMoveFromUpdate(true);
|
||||
coreVisualizationManage.move(request);
|
||||
}
|
||||
|
||||
// 检查当前节点的pid是否一致如果不一致 需要调用move 接口(预存 可能会出现pid =-1的情况)
|
||||
if (request.getPid() != -1) {
|
||||
QueryWrapper<DataVisualizationInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("pid", request.getPid());
|
||||
queryWrapper.eq("id", dvId);
|
||||
if (!visualizationInfoMapper.exists(queryWrapper)) {
|
||||
request.setMoveFromUpdate(true);
|
||||
coreVisualizationManage.move(request);
|
||||
}
|
||||
coreVisualizationManage.innerEdit(visualizationInfo);
|
||||
}
|
||||
coreVisualizationManage.innerEdit(visualizationInfo);
|
||||
|
||||
//保存视图信
|
||||
chartDataManage.saveChartViewFromVisualization(request.getComponentData(), dvId, request.getCanvasViewInfo());
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ export function canvasSave(callBack) {
|
||||
watermarkInfo: null
|
||||
}
|
||||
|
||||
const method = dvInfo.value.id ? updateCanvas : saveCanvas
|
||||
const method = dvInfo.value.id && dvInfo.value.optType !== 'copy' ? updateCanvas : saveCanvas
|
||||
method(canvasInfo).then(res => {
|
||||
dvMainStore.updateDvInfoId(res.data)
|
||||
snapshotStore.resetStyleChangeTimes()
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { BusiTreeNode } from '@/models/tree/TreeNode'
|
||||
|
||||
export function deepCopy(target) {
|
||||
if (target === null || target === undefined) {
|
||||
return target
|
||||
@ -80,3 +82,14 @@ export const getQueryString = (name: string) => {
|
||||
export const isLarkPlatform = () => {
|
||||
return !!getQueryString('state') && !!getQueryString('code')
|
||||
}
|
||||
|
||||
export function cutTargetTree(tree: BusiTreeNode[], targetId: string | number) {
|
||||
tree.forEach((node, index) => {
|
||||
if (node.id === targetId) {
|
||||
tree.splice(index, 1)
|
||||
return
|
||||
} else if (node.children) {
|
||||
cutTargetTree(node.children, targetId)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
saveCanvas
|
||||
} from '@/api/visualization/dataVisualization'
|
||||
import { ElMessage } from 'element-plus-secondary'
|
||||
import { cutTargetTree } from '@/utils/utils'
|
||||
const props = defineProps({
|
||||
curCanvasType: {
|
||||
type: String,
|
||||
@ -154,6 +155,9 @@ const optInit = (type, data: BusiTreeNode, exec, parentSelect = false) => {
|
||||
state.tData[0].name = curCanvasType.value === 'dataV' ? '数据大屏' : '仪表板'
|
||||
}
|
||||
tData = [...state.tData]
|
||||
if ('move' === exec) {
|
||||
cutTargetTree(state.tData, data.id)
|
||||
}
|
||||
if (['newLeaf', 'newFolder'].includes(exec)) {
|
||||
resourceForm.pid = data.id as string
|
||||
pid.value = data.id
|
||||
|
Loading…
Reference in New Issue
Block a user