修复: 项目详情批量(任务列表联动刷新/工作流降级标注/中文git乱码/子目录错误行内/零工程空态/切tab保活) + 依赖图批量(节点渲染register/环高亮/防环防重/点击选中) + 销账
This commit is contained in:
@@ -39,6 +39,12 @@
|
||||
<span class="expand-icon">{{ expandedPaths.has(entry.path) ? '▾' : '▸' }}</span>
|
||||
<span class="file-icon">📁</span>
|
||||
<span class="file-name">{{ entry.name }}</span>
|
||||
<!-- B3[PD-P1-6]:展开失败 → 行内 ⚠(title 显原因),点击重试;不设整树 error,不炸其他已展开节点 -->
|
||||
<span
|
||||
v-if="toggleErrors.has(entry.path)"
|
||||
class="dir-toggle-error"
|
||||
:title="$t('fileExplorer.loadFailed') + ': ' + toggleErrors.get(entry.path)"
|
||||
>⚠</span>
|
||||
</div>
|
||||
|
||||
<!-- 文件:点击通知父组件加载预览 -->
|
||||
@@ -93,7 +99,7 @@
|
||||
* 这样设计的好处:刷新(refresh)只需 FileExplorer 清空 loadedChildren 重拉根,
|
||||
* 所有展开的子树因 expandedPaths 被清而卸载,下次展开重新拉取,无脏数据。
|
||||
*/
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { moduleApi, type FileTreeEntry } from '@/api/module'
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -126,6 +132,10 @@ const emit = defineEmits<{
|
||||
const entries = ref<FileTreeEntry[]>([])
|
||||
const loading = ref(false)
|
||||
const error = ref<string | null>(null)
|
||||
// B3[PD-P1-6]:目录展开失败的行内错误态(路径 → 错误信息)。之前把 toggleDir 失败设到 error.value,
|
||||
// 会让整个子树渲染分支(v-else-if="error")替换成错误文案,一次子目录失败就炸掉已展开的其他节点。
|
||||
// 改为按 path 记录,条目行内显 ⚠ + title 原因,点击重试;成功加载即清除。
|
||||
const toggleErrors = reactive(new Map<string, string>())
|
||||
|
||||
/** 拉取当前 subPath 的条目列表。 */
|
||||
async function loadEntries() {
|
||||
@@ -170,8 +180,11 @@ async function toggleDir(entry: FileTreeEntry) {
|
||||
loading.value = true
|
||||
const res = await moduleApi.getModuleFileTree(props.moduleId, entry.path)
|
||||
props.loadedChildren.set(entry.path, res.entries)
|
||||
toggleErrors.delete(entry.path)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : String(e)
|
||||
// B3[PD-P1-6]:行内错误态(该目录 ⚠ + title 原因),不设整树 error;不展开,点击可重试
|
||||
toggleErrors.set(entry.path, e instanceof Error ? e.message : String(e))
|
||||
return
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -335,6 +348,14 @@ watch(
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* B3[PD-P1-6]:目录展开失败的行内 ⚠(flex-shrink 防挤压,危险色) */
|
||||
.dir-toggle-error {
|
||||
flex-shrink: 0;
|
||||
font-size: 11px;
|
||||
color: #e05050;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Git 状态徽章 */
|
||||
.git-badge {
|
||||
flex-shrink: 0;
|
||||
|
||||
Reference in New Issue
Block a user