perf(X-Pack): 业务资源禁用移动操作

This commit is contained in:
fit2cloud-chenyw
2026-07-17 17:10:33 +08:00
parent 07de8287de
commit f15bdabd50
20 changed files with 109 additions and 23 deletions

View File

@@ -166,6 +166,9 @@ public class DatasetGroupManage {
@XpackInteract(value = "authResourceTree", before = false)
public void innerEdit(DatasetGroupInfoDTO datasetGroupInfoDTO) {
if (Boolean.TRUE.equals(datasetGroupInfoDTO.getOrgRoot())) {
return;
}
checkName(datasetGroupInfoDTO);
CoreDatasetGroup coreDatasetGroup = BeanUtils.copyBean(new CoreDatasetGroup(), datasetGroupInfoDTO);
coreDatasetGroup.setLastUpdateTime(System.currentTimeMillis());

View File

@@ -38,7 +38,7 @@ public class DatasetDataServer implements DatasetDataApi {
return datasetDataManage.previewSqlWithLog(dto);
}
@Override
// @Override
public Map<String, Object> previewSqlCheck(PreviewSqlDTO dto) throws Exception {
return datasetDataManage.previewSql(dto);
}

View File

@@ -45,6 +45,10 @@ public class DatasetTreeServer implements DatasetTreeApi {
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASET)
@Override
public DatasetNodeDTO rename(DatasetGroupInfoDTO dto) throws Exception {
if (Boolean.TRUE.equals(dto.getOrgRoot())) {
datasetGroupManage.innerEdit(dto);
return dto;
}
return datasetGroupManage.save(dto, true, false);
}

View File

@@ -253,9 +253,17 @@ public class DatasourceServer implements DatasourceApi {
DEException.throwException("名称不能为空!");
}
CoreDatasource datasource = dataSourceManage.getDatasource(dataSourceDTO.getId());
boolean isOrgRoot = Boolean.TRUE.equals(busiDsRequest.getOrgRoot());
if (datasource == null && isOrgRoot) {
datasource = new CoreDatasource();
datasource.setId(dataSourceDTO.getId());
datasource.setName(dataSourceDTO.getName());
}
datasource.setName(dataSourceDTO.getName());
dataSourceDTO.setPid(datasource.getPid());
dataSourceManage.checkName(dataSourceDTO);
if (!isOrgRoot) {
dataSourceManage.checkName(dataSourceDTO);
}
dataSourceManage.innerEditName(datasource);
return dataSourceDTO;
}

View File

@@ -241,6 +241,9 @@ public class CoreVisualizationManage {
@XpackInteract(value = "visualizationResourceTree", before = false)
public void innerEdit(DataVisualizationInfo visualizationInfo) {
if (Boolean.TRUE.equals(visualizationInfo.getOrgRoot())) {
return;
}
// 镜像和主表保持名称一致
Long uid = V3UserUtil.getUid();
visualizationInfo.setUpdateTime(System.currentTimeMillis());

View File

@@ -10,6 +10,7 @@ export interface ResourceOrFolder {
type: string
mobileLayout: boolean
status: boolean
orgRoot?: boolean
}
export interface Panel {

View File

@@ -37,7 +37,8 @@ const props = defineProps({
return {}
}
},
anyManage: propTypes.bool.def(false)
anyManage: propTypes.bool.def(false),
disabledMove: propTypes.bool.def(false)
})
const shareDisable = computed(() => {
@@ -45,14 +46,23 @@ const shareDisable = computed(() => {
})
const shareComponent = ref(null)
const menus = ref([
...props.menuList.map(item => {
if (!props.anyManage && (item.command === 'copy' || item.command === 'move')) {
item.hidden = true
}
return item
})
])
const menus = ref(
props.menuList
.map(item => {
const copy = { ...item }
if (!props.anyManage && (copy.command === 'copy' || copy.command === 'move')) {
copy.hidden = true
}
if (props.node.orgRoot && (copy.command === 'move' || copy.command === 'delete')) {
copy.hidden = true
}
if (props.disabledMove && copy.command === 'move') {
copy.hidden = true
}
return copy
})
.filter(item => !item.hidden)
)
const handleCommand = (command: string | number | object) => {
if (command === 'share') {
// shareComponent.value.invokeMethod({ methodName: 'execute' })
@@ -96,8 +106,7 @@ const menuDisabledCheck = ele => {
:key="ele.label"
:disabled="menuDisabledCheck(ele)"
:class="{
'de-hidden-drop-item':
ele.hidden || (ele.command === 'cancelPublish' && node.extraFlag1 === 0)
'de-hidden-drop-item': ele.command === 'cancelPublish' && node.extraFlag1 === 0
}"
>
<el-icon class="handle-icon" color="#646a73" size="16" v-if="ele.svgName">

View File

@@ -7,6 +7,7 @@ export interface BusiTreeNode {
ext?: number
extraFlag: number
extraFlag1: number
orgRoot?: boolean
children?: BusiTreeNode[]
}

View File

@@ -259,7 +259,8 @@ const saveResource = () => {
name: resourceForm.name,
type: curCanvasType.value,
mobileLayout: state.targetInfo?.extraFlag,
status: state.targetInfo?.extraFlag1
status: state.targetInfo?.extraFlag1,
orgRoot: state.targetInfo?.orgRoot
}
switch (cmd.value) {
@@ -283,7 +284,10 @@ const saveResource = () => {
if (cmd.value === 'move' && !checkParent(params)) {
return
}
if (['newLeaf', 'newLeafAfter', 'newFolder', 'rename', 'move', 'copy'].includes(cmd.value)) {
if (
['newLeaf', 'newLeafAfter', 'newFolder', 'rename', 'move', 'copy'].includes(cmd.value) &&
!params.orgRoot
) {
await dvNameCheck({ opt: cmd.value, ...params })
}
if (cmd.value === 'newLeaf') {

View File

@@ -86,6 +86,7 @@ const defaultProps = {
const mounted = ref(false)
const rootManage = ref(false)
const anyManage = ref(false)
const disabledMove = ref(true)
const { curCanvasType, showPosition } = toRefs(props)
const resourceLabel =
curCanvasType.value === 'dataV' ? t('work_branch.big_data_screen') : t('work_branch.dashboard')
@@ -175,6 +176,11 @@ const { handleDrop, allowDrop, handleDragStart } = treeDraggbleChart(
curCanvasType.value
)
const allowDrag = (node: any) => {
if (disabledMove.value) return false
return !node.data?.orgRoot
}
const menuListWeight = id => {
const pWeight = state.pWeightMap[id]
return pWeight < 7 ? menuList : menuListWithCopy
@@ -781,6 +787,7 @@ defineExpose({
@node-click="nodeClick"
@node-drag-start="handleDragStart"
:allow-drop="proxyAllowDrop"
:allow-drag="allowDrag"
@node-drop="handleDrop"
draggable
>
@@ -859,6 +866,7 @@ defineExpose({
@handle-command="cmd => operation(cmd, data, data.leaf ? 'leaf' : 'folder')"
:node="data"
:any-manage="anyManage"
:disabled-move="disabledMove"
:resource-type="curCanvasType"
:menu-list="data.leaf ? menuListWeight(data.id) : state.folderMenuList"
></dv-handle-more>

View File

@@ -43,6 +43,7 @@ const placeholder = ref('')
const nodeType = ref()
const pid = ref()
const id = ref()
const orgRoot = ref(false)
const cmd = ref('')
const treeRef = ref()
const filterText = ref('')
@@ -173,6 +174,7 @@ const createInit = (type, data: Tree, exec, name: string) => {
id.value = data.id
datasetForm.pid = data.pid as string
datasetForm.name = data.name
orgRoot.value = data.orgRoot
} else {
datasetForm.pid = data.id as string
pid.value = data.id
@@ -242,7 +244,8 @@ const saveDataset = () => {
if (result) {
const params: DatasetOrFolder = {
nodeType: nodeType.value as 'folder' | 'dataset',
name: datasetForm.name
name: datasetForm.name,
orgRoot: orgRoot.value
}
switch (cmd.value) {

View File

@@ -106,6 +106,7 @@ interface Node {
}
const appStore = useAppStoreWithOut()
const rootManage = ref(false)
const disabledMove = ref(true)
const showExport = ref(false)
const rowAuth = ref()
const exportDatasetLoading = ref(false)
@@ -266,6 +267,11 @@ const { handleDrop, allowDrop, handleDragStart } = treeDraggble(
originResourceTree
)
const allowDrag = (node: any) => {
if (disabledMove.value) return false
return !node.data?.orgRoot
}
const generateColumns = (arr: Field[]) =>
arr.map(ele => ({
key: ele.dataeaseName,
@@ -782,8 +788,8 @@ const mouseleave = () => {
appStore.setArrowSide(false)
}
const getMenuList = (val: boolean) => {
return !val
const getMenuList = (val: boolean, data?: any) => {
let list = !val
? menuList
: [
{
@@ -792,6 +798,11 @@ const getMenuList = (val: boolean) => {
command: 'copy'
}
].concat(menuList)
return list.filter(item => {
if (disabledMove.value && item.command === 'move') return false
if (data?.orgRoot && (item.command === 'move' || item.command === 'delete')) return false
return true
})
}
const proxyAllowDrop = throttle((arg1, arg2) => {
@@ -915,6 +926,7 @@ const proxyAllowDrop = throttle((arg1, arg2) => {
highlight-current
@node-drag-start="handleDragStart"
:allow-drop="proxyAllowDrop"
:allow-drag="allowDrag"
@node-drop="handleDrop"
draggable
@node-expand="nodeExpand"
@@ -956,7 +968,7 @@ const proxyAllowDrop = throttle((arg1, arg2) => {
</el-icon>
<handle-more
@handle-command="cmd => operation(cmd, data, data.leaf ? 'dataset' : 'folder')"
:menu-list="getMenuList(data.leaf)"
:menu-list="getMenuList(data.leaf, data)"
></handle-more>
</div>
</span>

View File

@@ -36,6 +36,7 @@ const nodeType = ref()
const pid = ref()
const id = ref()
const oldName = ref()
const orgRoot = ref(false)
const cmd = ref('')
const treeRef = ref()
const filterText = ref('')
@@ -165,6 +166,7 @@ const createInit = (type, data: Tree, exec, name: string) => {
datasetForm.pid = data.pid as string
datasetForm.name = data.name
oldName.value = data.name
orgRoot.value = data.orgRoot
} else {
datasetForm.pid = data.id as string
pid.value = data.id
@@ -245,7 +247,8 @@ const saveDataset = () => {
if (result) {
const params: Omit<DatasetOrFolder, 'nodeType'> & { nodeType: 'folder' | 'datasource' } = {
nodeType: nodeType.value as 'folder' | 'datasource',
name: datasetForm.name.trim()
name: datasetForm.name.trim(),
orgRoot: orgRoot.value
}
switch (cmd.value) {
case 'move':

View File

@@ -153,6 +153,7 @@ const dsTableDetail = reactive({
name: ''
})
const rootManage = ref(false)
const disabledMove = ref(true)
const nickName = ref('')
const dsName = ref('')
const userDrawer = ref(false)
@@ -807,6 +808,11 @@ const { handleDrop, allowDrop, handleDragStart } = treeDraggble(
originResourceTree
)
const allowDrag = (node: any) => {
if (disabledMove.value) return false
return !node.data?.orgRoot
}
const handleCopy = async data => {
getById(data.id).then(res => {
let {
@@ -1108,8 +1114,8 @@ const mouseleave = () => {
appStore.setArrowSide(false)
}
const getMenuList = (val: boolean) => {
return !val
const getMenuList = (val: boolean, data?: any) => {
let list = !val
? menuList
: [
{
@@ -1118,6 +1124,11 @@ const getMenuList = (val: boolean) => {
command: 'copy'
}
].concat(menuList)
return list.filter(item => {
if (disabledMove.value && item.command === 'move') return false
if (data?.orgRoot && (item.command === 'move' || item.command === 'delete')) return false
return true
})
}
</script>
@@ -1232,6 +1243,7 @@ const getMenuList = (val: boolean) => {
:props="defaultProps"
@node-drag-start="handleDragStart"
:allow-drop="proxyAllowDrop"
:allow-drag="allowDrag"
@node-drop="handleDrop"
draggable
@node-click="handleNodeClick"
@@ -1306,7 +1318,7 @@ const getMenuList = (val: boolean) => {
@handle-command="
cmd => operation(cmd, data, data.leaf ? 'datasource' : 'folder')
"
:menu-list="getMenuList(!['Excel'].includes(data.type) && data.leaf)"
:menu-list="getMenuList(!['Excel'].includes(data.type) && data.leaf, data)"
></handle-more>
</div>
</span>

View File

@@ -95,4 +95,7 @@ public class DatasetNodeDTO implements Serializable {
*/
private String unionSql;
@Schema(description = "组织根节点")
private Boolean orgRoot;
}

View File

@@ -22,5 +22,7 @@ public class BusiRenameRequest implements Serializable {
private String nodeType;
@Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED)
private String action;
@Schema(description = "组织根节点")
private Boolean orgRoot;
}

View File

@@ -39,4 +39,7 @@ public class SpreadsheetEditor implements Serializable {
@Schema(description = "备注")
private String remark;
@Schema(description = "组织根节点")
private Boolean orgRoot;
}

View File

@@ -187,6 +187,8 @@ public class DataVisualizationVO implements Serializable {
*/
private VisualizationExport2AppVO appData;
private Boolean orgRoot;
public DataVisualizationVO(Long id, String name, String type, Integer version, String canvasStyleData, String componentData,String appDataStr, Map<Long, ChartViewDTO> canvasViewInfo, Map<Long, VisualizationTemplateExtendDataDTO> extendDataInfo,Map<Long,Long> viewIdMap) {
this.id = id;
this.name = name;

View File

@@ -90,4 +90,6 @@ public class DataFillingDTO implements Serializable {
private String updater;
private boolean useExistsTable;
private Boolean orgRoot;
}

View File

@@ -130,4 +130,7 @@ public class DataVisualizationInfo {
@Column(name = "check_version", length = 50)
private String checkVersion;
@Transient
private Boolean orgRoot;
}