20260826224445
This commit is contained in:
1 parent
d750e04eee
commit
60cacfa8fb
9 files changed
+3650
-2124
No files matched your search
@@ -48,7 +48,8 @@ import { buildModuleI18nKey, buildModuleItemI18nKey, syncModuleItemI18nKeys } fr
|
||||
import ModuleBasicPanel from './components/ModuleBasicPanel.vue'
|
||||
import ModuleFieldsPanel from './components/ModuleFieldsPanel.vue'
|
||||
import ModuleListConfigPanel from './components/ModuleListConfigPanel.vue'
|
||||
import ModuleEditConfigPanel from './components/ModuleEditConfigPanel.vue'
|
||||
import ModuleFormEditPanel from './components/ModuleFormEditPanel.vue'
|
||||
import ModuleTableEditPanel from './components/ModuleTableEditPanel.vue'
|
||||
import ModuleQueryConfigPanel from './components/ModuleQueryConfigPanel.vue'
|
||||
import ModuleAutoCodePanel from './components/ModuleAutoCodePanel.vue'
|
||||
import ModulePowersPanel from './components/ModulePowersPanel.vue'
|
||||
@@ -629,16 +630,6 @@ function onAutoCodeUpdate(rows) {
|
||||
}
|
||||
}
|
||||
|
||||
function onGroupsSaved(newGroups, idMapping) {
|
||||
if (!drafts.value) return
|
||||
if (idMapping && idMapping.size) {
|
||||
remapForeignKeys(drafts.value.listConfig || [], ['b_group_id'], idMapping)
|
||||
remapForeignKeys(drafts.value.editConfig || [], ['b_group_id'], idMapping)
|
||||
}
|
||||
drafts.value.groups = cloneData(newGroups)
|
||||
originals.value.groups = cloneData(newGroups)
|
||||
}
|
||||
|
||||
function onModuleI18nSaved() {
|
||||
i18nPanelRef.value?.refreshKey?.()
|
||||
}
|
||||
@@ -679,7 +670,7 @@ function onModuleNewClick({ key }) {
|
||||
|
||||
/* ================= 右侧分组配置导航 ================= */
|
||||
// 配置导航分组:概览 / 数据结构 / 界面配置 / 业务能力 / 高级设置。
|
||||
// 每个导航项唯一激活(activeSection);「分组管理」点击时同时打开分组管理弹窗。
|
||||
// 每个导航项唯一激活(activeSection)。
|
||||
const configGroups = computed(() => {
|
||||
const groups = []
|
||||
groups.push({
|
||||
@@ -753,17 +744,6 @@ const configNavItems = computed(() =>
|
||||
configGroups.value.flatMap((group) => group.items.map((item) => ({ ...item }))),
|
||||
)
|
||||
|
||||
const referencedGroupIds = computed(() => {
|
||||
const ids = new Set()
|
||||
for (const row of drafts.value?.listConfig || []) {
|
||||
if (row.b_group_id != null) ids.add(String(row.b_group_id))
|
||||
}
|
||||
for (const row of drafts.value?.editConfig || []) {
|
||||
if (row.b_group_id != null) ids.add(String(row.b_group_id))
|
||||
}
|
||||
return Array.from(ids)
|
||||
})
|
||||
|
||||
// 编辑方式(form 主表表单 / table 子表表格)决定「表单设计」面板的形态与导航标签
|
||||
const editMode = computed(() => drafts.value?.module?.b_edit_mode || 'form')
|
||||
const editNavLabel = computed(() => (editMode.value === 'table' ? '表格设计' : '表单设计'))
|
||||
@@ -915,6 +895,9 @@ async function saveModule() {
|
||||
['s_autocode', 'autoCode'],
|
||||
['s_power', 'powers'],
|
||||
]
|
||||
// 收集字段/分组的临时 id → 真实 id 映射,用于跨表外键重映射
|
||||
const fieldIdMap = new Map()
|
||||
const groupIdMap = new Map()
|
||||
for (const [table, section] of subTables) {
|
||||
const current = drafts.value[section] || []
|
||||
const previous = originals.value?.[section] || []
|
||||
@@ -927,11 +910,25 @@ async function saveModule() {
|
||||
}
|
||||
const req = tableChange(table, changes)
|
||||
if (hasChanges(req)) {
|
||||
await allocateTemporaryIds([req.inserts || [], req.updates || []])
|
||||
const mapping = await allocateTemporaryIds([req.inserts || [], req.updates || []])
|
||||
if (table === 's_field') mapping.forEach((v, k) => fieldIdMap.set(k, v))
|
||||
if (table === 's_field_group') mapping.forEach((v, k) => groupIdMap.set(k, v))
|
||||
saveReqs.push(req)
|
||||
}
|
||||
}
|
||||
|
||||
// 统一重映射跨表外键:列表/编辑/查询配置中引用字段、分组的临时 id 换成真实 id
|
||||
if (fieldIdMap.size) {
|
||||
for (const section of ['listConfig', 'editConfig', 'queryConfig']) {
|
||||
remapForeignKeys(drafts.value[section] || [], ['b_field_id'], fieldIdMap)
|
||||
}
|
||||
}
|
||||
if (groupIdMap.size) {
|
||||
for (const section of ['listConfig', 'editConfig', 'queryConfig']) {
|
||||
remapForeignKeys(drafts.value[section] || [], ['b_group_id'], groupIdMap)
|
||||
}
|
||||
}
|
||||
|
||||
const i18nPanel = i18nPanelRef.value
|
||||
if (i18nPanel && typeof i18nPanel.reconcileManagedRows === 'function') {
|
||||
i18nPanel.reconcileManagedRows(finalI18nItems.value)
|
||||
@@ -1098,24 +1095,41 @@ loadModuleTree()
|
||||
:query-config="drafts?.queryConfig"
|
||||
:fields="drafts?.fields"
|
||||
:groups="drafts?.groups"
|
||||
:referenced-group-ids="referencedGroupIds"
|
||||
:loading="busy"
|
||||
@update="(v) => onModuleUpdate('listConfig', v)"
|
||||
@groups-saved="onGroupsSaved"
|
||||
@sync-edit="(v) => onModuleUpdate('editConfig', v)"
|
||||
@sync-query="(v) => onModuleUpdate('queryConfig', v)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="isDataModule" v-show="activeSection === 'edit'" class="mm-config-pane">
|
||||
<ModuleEditConfigPanel
|
||||
<ModuleTableEditPanel
|
||||
v-if="editMode === 'table'"
|
||||
:module-id="String(selectedModule.b_id)"
|
||||
:edit-config="drafts?.editConfig"
|
||||
:list-config="drafts?.listConfig"
|
||||
:query-config="drafts?.queryConfig"
|
||||
:fields="drafts?.fields"
|
||||
:groups="drafts?.groups"
|
||||
:edit-mode="editMode"
|
||||
:active="activeSection === 'edit'"
|
||||
:loading="busy"
|
||||
@update="(v) => onModuleUpdate('editConfig', v)"
|
||||
@update:edit-mode="
|
||||
(v) => onModuleUpdate('module', { ...(drafts?.module || {}), b_edit_mode: v })
|
||||
"
|
||||
@update-groups="(v) => onModuleUpdate('groups', v)"
|
||||
@sync-list="(v) => onModuleUpdate('listConfig', v)"
|
||||
@sync-query="(v) => onModuleUpdate('queryConfig', v)"
|
||||
/>
|
||||
<ModuleFormEditPanel
|
||||
v-else
|
||||
:module-id="String(selectedModule.b_id)"
|
||||
:edit-config="drafts?.editConfig"
|
||||
:list-config="drafts?.listConfig"
|
||||
:query-config="drafts?.queryConfig"
|
||||
:fields="drafts?.fields"
|
||||
:groups="drafts?.groups"
|
||||
:referenced-group-ids="referencedGroupIds"
|
||||
:edit-mode="editMode"
|
||||
:active="activeSection === 'edit'"
|
||||
:loading="busy"
|
||||
@@ -1124,7 +1138,6 @@ loadModuleTree()
|
||||
(v) => onModuleUpdate('module', { ...(drafts?.module || {}), b_edit_mode: v })
|
||||
"
|
||||
@update-groups="(v) => onModuleUpdate('groups', v)"
|
||||
@groups-saved="onGroupsSaved"
|
||||
@sync-list="(v) => onModuleUpdate('listConfig', v)"
|
||||
@sync-query="(v) => onModuleUpdate('queryConfig', v)"
|
||||
/>
|
||||
@@ -1419,11 +1432,16 @@ loadModuleTree()
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* ---- 配置导航:横向 Tab 导航(line 类型,不作内部覆盖,组件默认样式即可) ---- */
|
||||
/* ---- 配置导航:横向 Tab 导航(line 类型) ---- */
|
||||
.mm-config-nav.tabs {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
/* 页签高度(42px):仅作用于本页 tab 项,不改变组件内部样式,也不影响按钮 */
|
||||
.mm-config-nav.tabs :deep(.tabs-tab) {
|
||||
height: 42px;
|
||||
}
|
||||
|
||||
/* 标签内布局:图标 + 文字 + badge */
|
||||
.mm-config-nav__icon {
|
||||
flex: none;
|
||||
|
||||
Reference in new issue
Block a user