Add AI business blueprint drafts
This commit is contained in:
@@ -81,6 +81,52 @@
|
||||
</template>
|
||||
<el-empty v-else description="点击生成数据库后,这里会展示可编辑表结构" />
|
||||
</div>
|
||||
|
||||
<div class="panel blueprint-panel">
|
||||
<div class="panel-header database-header">
|
||||
<h2 class="panel-title">业务蓝图草稿</h2>
|
||||
<span class="muted">动作数量:{{ database.businessActions.length }}</span>
|
||||
</div>
|
||||
<div v-if="database.businessActions.length" class="blueprint-list">
|
||||
<article
|
||||
v-for="action in database.businessActions"
|
||||
:key="action.code || action.path"
|
||||
class="blueprint-action"
|
||||
>
|
||||
<div class="blueprint-action-header">
|
||||
<div>
|
||||
<h3>{{ action.name || action.code }}</h3>
|
||||
<p class="muted">{{ action.ownerTable || '未指定主表' }}</p>
|
||||
</div>
|
||||
<el-tag size="small" effect="plain">{{ action.method || 'POST' }}</el-tag>
|
||||
</div>
|
||||
<div class="blueprint-path">{{ action.path || '-' }}</div>
|
||||
<div class="blueprint-meta">
|
||||
<span v-if="action.transaction !== false">事务</span>
|
||||
<span v-if="Array.isArray(action.requestFields) && action.requestFields.length">
|
||||
入参:{{ action.requestFields.join('、') }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="Array.isArray(action.rules) && action.rules.length" class="blueprint-section">
|
||||
<strong>规则</strong>
|
||||
<ul>
|
||||
<li v-for="rule in action.rules" :key="rule">{{ rule }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="Array.isArray(action.effects) && action.effects.length" class="blueprint-section">
|
||||
<strong>影响</strong>
|
||||
<ul>
|
||||
<li v-for="effect in action.effects" :key="`${effect.type}-${effect.targetTable}-${effect.targetField}`">
|
||||
{{ effect.description || effect.type }}
|
||||
<span v-if="effect.targetTable"> / {{ effect.targetTable }}</span>
|
||||
<span v-if="effect.targetField">.{{ effect.targetField }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<el-empty v-else description="生成数据库后,这里会展示 AI 识别出的业务动作草稿" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -103,7 +149,7 @@ const loadingProject = ref(false)
|
||||
const databaseView = ref('editor')
|
||||
const projectId = ref(normalizeProjectId(route.query.projectId))
|
||||
const errorMessage = ref('')
|
||||
const database = ref({ tables: [], sql: '', erDiagram: emptyErDiagram() })
|
||||
const database = ref({ tables: [], sql: '', erDiagram: emptyErDiagram(), businessActions: [] })
|
||||
const projectForm = reactive({
|
||||
projectName: '',
|
||||
keyword: String(route.query.keyword || ''),
|
||||
@@ -139,7 +185,8 @@ function normalizeDatabase(payload) {
|
||||
return {
|
||||
tables: Array.isArray(data.tables) ? data.tables : [],
|
||||
sql: data.sql || '',
|
||||
erDiagram: normalizeErDiagram(data.erDiagram)
|
||||
erDiagram: normalizeErDiagram(data.erDiagram),
|
||||
businessActions: Array.isArray(data.businessActions) ? data.businessActions : []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,6 +354,70 @@ onMounted(() => {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.blueprint-list {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.blueprint-action {
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.blueprint-action-header {
|
||||
align-items: flex-start;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.blueprint-action h3 {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.blueprint-path {
|
||||
background: #f6f8fb;
|
||||
border-radius: 6px;
|
||||
color: #2c3e50;
|
||||
font-family: Consolas, Monaco, monospace;
|
||||
font-size: 13px;
|
||||
padding: 8px 10px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.blueprint-meta {
|
||||
color: #64748b;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.blueprint-section {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.blueprint-section strong {
|
||||
color: #1f2d3d;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.blueprint-section ul {
|
||||
color: #475569;
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
margin: 0;
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
.database-header {
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user