diff --git a/RuoYi-Vue/easycode-web/src/views/DiagramCenterView.vue b/RuoYi-Vue/easycode-web/src/views/DiagramCenterView.vue new file mode 100644 index 0000000..6ea6dd6 --- /dev/null +++ b/RuoYi-Vue/easycode-web/src/views/DiagramCenterView.vue @@ -0,0 +1,1778 @@ + + + + + + 图表中心 + {{ project.projectName || '项目' }} 的 ER 图、功能模块图、架构图和 AI 图表。 + + + 返回项目 + 编辑项目 + + + + + + + + + + + + + + + {{ architectureDiagram.title }} + {{ architectureStatsText }} + + + 黑白模式 + SVG + PNG + + + + + + + + + {{ error }} + + + + + + + + + + + + {{ architectureDiagram.title }} + + + + + + + + {{ layer.title }} + + + {{ layer.subtitle }} + + + + + + {{ shortText(component.title, 14) }} + + + {{ shortText(detail, 15) }} + + + + + + + + 横切关注点 + + + + + {{ shortText(concern.title, 12) }} + + + {{ shortText(detail, 12) }} + + + + + + + + + + + + + {{ flowchartDiagram.title }} + {{ flowchartStatsText }} + + + SVG + PNG + + + + + + + + + {{ error }} + + + + + + + + + + + + {{ flowchartDiagram.title }} + + + + + + {{ edge.label }} + + + + + + + + + + {{ line }} + + + + + + + + + + + + + + + {{ currentGraph.title }} + {{ currentGraph.description }} + + + SVG + PNG + + + + + + + + + + + + + + + {{ edge.label }} + + + + + + + {{ shortText(node.label, 16) }} + + + {{ shortText(node.lane, 14) }} + + + + + + + + + + + + + + + + + + + + + + diff --git a/RuoYi-Vue/easycode-web/src/views/diagramCenterModuleView.test.mjs b/RuoYi-Vue/easycode-web/src/views/diagramCenterModuleView.test.mjs new file mode 100644 index 0000000..4b48f73 --- /dev/null +++ b/RuoYi-Vue/easycode-web/src/views/diagramCenterModuleView.test.mjs @@ -0,0 +1,44 @@ +import test from 'node:test' +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import { fileURLToPath } from 'node:url' +import { dirname, resolve } from 'node:path' + +const currentDir = dirname(fileURLToPath(import.meta.url)) + +function readView(name) { + return readFileSync(resolve(currentDir, name), 'utf8') +} + +test('diagram center binds module diagram source and layout state', () => { + const source = readView('DiagramCenterView.vue') + + assert.equal(source.includes('const moduleDiagramSourceMode = ref'), true) + assert.equal(source.includes('const moduleDiagramOutlineText = ref'), true) + assert.equal(source.includes('const moduleDiagramLayoutOptions = ref'), true) + assert.equal(source.includes('v-model:source-mode="moduleDiagramSourceMode"'), true) + assert.equal(source.includes('v-model:outline-text="moduleDiagramOutlineText"'), true) + assert.equal(source.includes('v-model:layout-options="moduleDiagramLayoutOptions"'), true) + assert.equal(source.includes(':editable="true"'), true) +}) + +test('diagram center saves module diagram source, outline, layout, and graph data', () => { + const source = readView('DiagramCenterView.vue') + + assert.equal(source.includes('function moduleDiagramPayload'), true) + assert.equal(source.includes('sourceMode: moduleDiagramSourceMode.value'), true) + assert.equal(source.includes('outlineText,'), true) + assert.equal(source.includes('layoutOptions: moduleDiagramLayoutOptions.value'), true) + assert.equal(source.includes('graph: moduleDiagramGraph.value'), true) + assert.equal(source.includes('diagramJson: JSON.stringify(moduleDiagramPayload())'), true) +}) + +test('diagram center restores saved module diagram payload', () => { + const source = readView('DiagramCenterView.vue') + + assert.equal(source.includes('function applySavedModuleDiagram'), true) + assert.equal(source.includes("savedDiagrams.value.find((item) => item.diagramType === 'module')"), true) + assert.equal(source.includes('moduleDiagramSourceMode.value = payload.sourceMode'), true) + assert.equal(source.includes('moduleDiagramOutlineText.value = payload.outlineText'), true) + assert.equal(source.includes('moduleDiagramLayoutOptions.value ='), true) +})
{{ project.projectName || '项目' }} 的 ER 图、功能模块图、架构图和 AI 图表。