feat: 补充公司账户角色和状态相关字段

This commit is contained in:
2026-08-24 15:11:30 +08:00
parent ecb53524bd
commit 2de29b0ac0
9 changed files with 127 additions and 37 deletions
@@ -39,12 +39,16 @@ const searchForm = ref({
status: undefined as number | undefined,
});
// 状态选项
// 公司成员角色选项(org_company_member.role)
const companyRoleOptions = [
{ label: '公司拥有者', value: 'owner' },
{ label: '成员', value: 'member' },
];
// 状态选项(sys_user.status:0=停用,1=正常)
const statusOptions = [
{ label: '正常', value: 0 },
{ label: '删除', value: 1 },
{ label: '停用', value: 2 },
{ label: '冻结', value: 3 },
{ label: '正常', value: 1 },
{ label: '停用', value: 0 },
];
// 搜索表单配置
@@ -78,6 +82,16 @@ const formOptions = computed(() => ({
onPressEnter: () => gridReloadRef.value?.(),
},
},
{
fieldName: 'role',
label: '成员角色',
component: 'Select',
componentProps: {
options: companyRoleOptions,
placeholder: '请选择成员角色',
onChange: () => gridReloadRef.value?.(),
},
},
{
fieldName: 'status',
label: '状态',
@@ -134,8 +148,9 @@ const gridOptions: VxeGridProps<any> = {
},
{
field: 'role',
title: '角色',
minWidth: 100,
title: '成员角色',
minWidth: 110,
slots: { default: 'role' },
},
{
field: 'status',
@@ -289,26 +304,33 @@ const handleBatchDelete = async () => {
}
};
// 获取状态文本
const getStatusText = (status: number) => {
const statusMap = {
0: '正常',
1: '删除',
2: '停用',
3: '冻结',
// 获取公司成员角色文本
const getRoleText = (role?: string, roleName?: string) => {
if (roleName) return roleName;
const roleMap: Record<string, string> = {
owner: '公司拥有者',
member: '成员',
};
return statusMap[status as keyof typeof statusMap] || '未知';
return role ? roleMap[role] || role : '-';
};
// 获取状态文本
const getStatusText = (status: number, statusName?: string) => {
if (statusName) return statusName;
const statusMap: Record<number, string> = {
0: '停用',
1: '正常',
};
return statusMap[status] || '未知';
};
// 获取状态颜色
const getStatusColor = (status: number) => {
const colorMap = {
0: 'green',
1: 'red',
2: 'orange',
3: 'purple',
const colorMap: Record<number, string> = {
0: 'orange',
1: 'green',
};
return colorMap[status as keyof typeof colorMap] || 'default';
return colorMap[status] || 'default';
};
// 处理模态框成功回调
@@ -340,10 +362,17 @@ function handleModalSuccess() {
</Space>
</template>
<!-- 成员角色列 -->
<template #role="{ row }">
<Tag :color="row.role === 'owner' ? 'gold' : 'blue'">
{{ getRoleText(row.role, row.roleName) }}
</Tag>
</template>
<!-- 状态列 -->
<template #status="{ row }">
<Tag :color="getStatusColor(row.status)">
{{ getStatusText(row.status) }}
{{ getStatusText(row.status, row.statusName) }}
</Tag>
</template>