refactor platform menus and entity statuses

This commit is contained in:
david
2026-07-29 13:18:52 +08:00
parent 978dc446d9
commit afd9dbdeb5
48 changed files with 510 additions and 421 deletions

View File

@@ -439,8 +439,8 @@ function openStatus(row: Row) {
type: 'select',
required: true,
options: [
{ label: '启用', value: 'enabled' },
{ label: '停用', value: 'disabled' },
{ label: '启用', value: 1 },
{ label: '停用', value: 2 },
{ label: '归档', value: 'archived' },
],
},
@@ -606,7 +606,7 @@ onMounted(async () => {
if (props.definition.fields.some((field) => field.key === 'platform_role_code')) {
const result = await platformApi.listRole();
roleOptions.value = result.list.filter(
(role) => !role.is_system && role.status === 'enabled',
(role) => !role.is_system && role.status === 1,
);
}
});

View File

@@ -11,7 +11,7 @@
<a-space>
{{ node.title }}
<a-button v-if="canEdit" size="mini" @click.stop="openEdit(node)">编辑</a-button>
<a-button v-if="canChangeStatus" size="mini" @click.stop="confirmStatus(node)">{{ node.status === 'enabled' ? '停用' : '启用' }}</a-button>
<a-button v-if="canChangeStatus" size="mini" @click.stop="confirmStatus(node)">{{ node.status === 1 ? '停用' : '启用' }}</a-button>
<a-button v-if="canArchive" size="mini" status="danger" @click.stop="confirmArchive(node)">归档</a-button>
</a-space>
</template>
@@ -89,10 +89,10 @@ function reset(data?: Node) {
}
function confirmStatus(node: Node) {
const status = node.status === 'enabled' ? 'disabled' : 'enabled';
const status = node.status === 1 ? 2 : 1;
Modal.warning({
title: status === 'enabled' ? '确认启用' : '确认停用',
content: `确定要${status === 'enabled' ? '启用' : '停用'}${String(node.name ?? node.identity)}”吗?`,
title: status === 1 ? '确认启用' : '确认停用',
content: `确定要${status === 1 ? '启用' : '停用'}${String(node.name ?? node.identity)}”吗?`,
onOk: async () => {
try {
await resourceApi.updateStatus(