20260730173012
This commit is contained in:
1 parent
84673b3d3d
commit
4929b78434
25 files changed
+1796
-68
No files matched your search
@@ -38,6 +38,7 @@ const treeLoading = ref(false);
|
||||
const expandedTreeKeys = ref([]);
|
||||
const selectedModuleId = ref(null);
|
||||
const skipLoad = ref(false);
|
||||
const expandTimer = ref(null);
|
||||
const activeTab = ref("basic");
|
||||
function buildTreeContextMenu(node) {
|
||||
const items = [];
|
||||
@@ -442,24 +443,54 @@ async function loadModuleConfig(moduleId) {
|
||||
}
|
||||
|
||||
// ---- 树节点选择 ----
|
||||
function clearExpandTimer() {
|
||||
if (expandTimer.value != null) {
|
||||
clearTimeout(expandTimer.value);
|
||||
expandTimer.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
function onTreeSelect(keys, info) {
|
||||
if (busy.value) return;
|
||||
if (info?.node?.isFmsRoot) {
|
||||
selectedModuleId.value = null;
|
||||
clearExpandTimer();
|
||||
return;
|
||||
}
|
||||
const nodeKey = info?.node?.key ?? keys[0];
|
||||
if (nodeKey == null) return;
|
||||
|
||||
const key = String(nodeKey);
|
||||
selectedModuleId.value = key;
|
||||
|
||||
const node = findNode(key);
|
||||
if (!node?.children?.length) return;
|
||||
const hasChildren = node?.children?.length;
|
||||
|
||||
clearExpandTimer();
|
||||
|
||||
if (!hasChildren) {
|
||||
// 叶子节点:立即加载数据
|
||||
selectedModuleId.value = key;
|
||||
return;
|
||||
}
|
||||
|
||||
// 父节点:处理展开/收起
|
||||
const expandedKeys = expandedTreeKeys.value.map(String);
|
||||
expandedTreeKeys.value = expandedKeys.includes(key)
|
||||
? expandedKeys.filter((item) => item !== key)
|
||||
: [...expandedKeys, key];
|
||||
const isCurrentlyExpanded = expandedKeys.includes(key);
|
||||
|
||||
if (isCurrentlyExpanded) {
|
||||
// 收起:立即生效,同时加载数据
|
||||
expandedTreeKeys.value = expandedKeys.filter((item) => item !== key);
|
||||
selectedModuleId.value = key;
|
||||
} else {
|
||||
// 展开:立即高亮选中节点,动画完毕后再加载数据
|
||||
expandedTreeKeys.value = [...expandedKeys, key];
|
||||
skipLoad.value = true;
|
||||
selectedModuleId.value = key; // 立即高亮,watch 中 skipLoad=true 跳过加载
|
||||
expandTimer.value = setTimeout(() => {
|
||||
expandTimer.value = null;
|
||||
loadedModuleId.value = null;
|
||||
void loadModuleConfig(key);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
watch(selectedModuleId, (id) => {
|
||||
@@ -1009,11 +1040,26 @@ async function syncFields() {
|
||||
}
|
||||
}
|
||||
|
||||
// 视图中不存在的已有字段标记为不可用
|
||||
// 视图中不存在的已有字段:从字段定义中移除,并清理其在列表/编辑/查询配置中的残留行。
|
||||
const removedFieldIds = new Set();
|
||||
for (const existing of existingFields) {
|
||||
const fieldName = existing.b_field ? existing.b_field.toLowerCase() : "";
|
||||
if (!viewColumnSet.has(fieldName)) {
|
||||
mergedFields.push({ ...existing, b_canuse: 0 });
|
||||
removedFieldIds.add(String(existing.b_id));
|
||||
}
|
||||
}
|
||||
if (removedFieldIds.size > 0) {
|
||||
for (const section of ["listConfig", "editConfig", "queryConfig"]) {
|
||||
drafts.value[section] = (drafts.value[section] || []).filter(
|
||||
(row) => !removedFieldIds.has(String(row.b_field_id)),
|
||||
);
|
||||
}
|
||||
// 多语言面板中移除旧字段对应的受管翻译行(_managedId 格式为 field:<b_id>)
|
||||
if (i18nPanelRef.value) {
|
||||
const managedIds = new Set(
|
||||
Array.from(removedFieldIds).map((id) => `field:${id}`),
|
||||
);
|
||||
i18nPanelRef.value.removeByManagedIds(managedIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1125,12 +1171,8 @@ void loadTree().catch((e) => message.error("模块树加载失败:" + (e.messa
|
||||
:selected-keys="selectedModuleId ? [selectedModuleId] : []"
|
||||
:context-menu="buildTreeContextMenu"
|
||||
:context-menu-disabled="busy"
|
||||
draggable
|
||||
:allow-drop="allowDrop"
|
||||
@select="onTreeSelect"
|
||||
@menu-click="onTreeMenuClick"
|
||||
@drop="onTreeDrop"
|
||||
@drag-start="onTreeDragStart"
|
||||
>
|
||||
<template #title="node">
|
||||
<span class="mm-tree-node">
|
||||
|
||||
Reference in new issue
Block a user