diff --git a/apps/web/apps/web-antd/src/views/company/components/CompanyColPage.vue b/apps/web/apps/web-antd/src/views/company/components/CompanyColPage.vue
index 3457502a..5e14f61f 100644
--- a/apps/web/apps/web-antd/src/views/company/components/CompanyColPage.vue
+++ b/apps/web/apps/web-antd/src/views/company/components/CompanyColPage.vue
@@ -8,11 +8,16 @@ import CompanySidebarList from '#/views/company/components/CompanySidebarList.vu
defineOptions({ name: 'CompanyColPage' });
-/** 公司侧栏:展开/宽度走全局持久化,菜单分配与权限页跨页共用 */
+/** 公司侧栏:展开/宽度走全局持久化,菜单/权限/账户等跨页共用 */
withDefaults(
defineProps<{
selectedCompanyId?: number;
+ showAllOption?: boolean;
+ allOptionLabel?: string;
+ allOptionHint?: string;
+ showAddAction?: boolean;
+ addPermissionCode?: string;
autoContentHeight?: boolean;
leftMinWidth?: number;
leftMaxWidth?: number;
@@ -23,6 +28,11 @@ withDefaults(
splitLine?: boolean;
}>(),
{
+ showAllOption: false,
+ allOptionLabel: '全部公司',
+ allOptionHint: '全部记录',
+ showAddAction: false,
+ addPermissionCode: undefined,
autoContentHeight: true,
leftMinWidth: 16,
leftMaxWidth: 36,
@@ -36,7 +46,8 @@ withDefaults(
const emit = defineEmits<{
'update:selectedCompanyId': [id: number | undefined];
- select: [company: CompanyVO.CompanyInfoVO];
+ select: [company: CompanyVO.CompanyInfoVO | null];
+ addForCompany: [company: CompanyVO.CompanyInfoVO];
}>();
const { width: leftWidth, collapsed: leftCollapsed } =
@@ -73,10 +84,16 @@ const { width: leftWidth, collapsed: leftCollapsed } =
:collapsed="!!isCollapsed"
show-collapse-action
:selected-company-id="selectedCompanyId"
+ :show-all-option="showAllOption"
+ :all-option-label="allOptionLabel"
+ :all-option-hint="allOptionHint"
+ :show-add-action="showAddAction"
+ :add-permission-code="addPermissionCode"
@collapse="collapse"
@expand="expand"
@update:selected-company-id="emit('update:selectedCompanyId', $event)"
@select="emit('select', $event)"
+ @add-for-company="emit('addForCompany', $event)"
/>
diff --git a/apps/web/apps/web-antd/src/views/company/components/CompanySidebarList.vue b/apps/web/apps/web-antd/src/views/company/components/CompanySidebarList.vue
index 8ba73dab..28248223 100644
--- a/apps/web/apps/web-antd/src/views/company/components/CompanySidebarList.vue
+++ b/apps/web/apps/web-antd/src/views/company/components/CompanySidebarList.vue
@@ -18,12 +18,14 @@ import {
} from 'ant-design-vue';
import { getCompanyPageApi } from '#/api/company';
+import { PermissionGate } from '#/components/permission';
import CompanyLogoAvatar from '#/views/company/components/CompanyLogoAvatar.vue';
defineOptions({ name: 'CompanySidebarList' });
const props = withDefaults(
defineProps<{
+ /** undefined = 未选 / 全部(需 showAllOption) */
selectedCompanyId?: number;
/** 填满父容器宽度(ColPage 左栏);默认固定 320px */
fluid?: boolean;
@@ -31,23 +33,39 @@ const props = withDefaults(
showCollapseAction?: boolean;
/** 窄栏模式:仅展示 logo 列表(ColPage 收起态) */
collapsed?: boolean;
+ /** 展示「全部」筛选项(如账户页) */
+ showAllOption?: boolean;
+ allOptionLabel?: string;
+ allOptionHint?: string;
+ /** 行内「添加」快捷按钮 */
+ showAddAction?: boolean;
+ /** 添加按钮权限码;不传则仅看 showAddAction */
+ addPermissionCode?: string;
}>(),
{
selectedCompanyId: undefined,
fluid: false,
showCollapseAction: false,
collapsed: false,
+ showAllOption: false,
+ allOptionLabel: '全部公司',
+ allOptionHint: '全部记录',
+ showAddAction: false,
+ addPermissionCode: undefined,
},
);
const emit = defineEmits<{
'update:selectedCompanyId': [id: number | undefined];
- select: [company: CompanyVO.CompanyInfoVO];
+ /** 选中公司;null 表示「全部」 */
+ select: [company: CompanyVO.CompanyInfoVO | null];
+ addForCompany: [company: CompanyVO.CompanyInfoVO];
collapse: [];
expand: [];
}>();
const BuildingIcon = createIconifyIcon('lucide:building-2');
+const PlusIcon = createIconifyIcon('lucide:plus');
const PanelCloseIcon = createIconifyIcon('lucide:panel-left-close');
const PanelOpenIcon = createIconifyIcon('lucide:panel-left-open');
const ChevronUpIcon = createIconifyIcon('lucide:chevron-up');
@@ -67,6 +85,10 @@ const companyTotalPages = computed(() => {
return Math.max(1, Math.ceil(total / pageSize) || 1);
});
+const allSelected = computed(
+ () => props.showAllOption && props.selectedCompanyId === undefined,
+);
+
async function searchCompanies(resetPage = false) {
if (resetPage) {
companyPagination.value.current = 1;
@@ -103,11 +125,22 @@ function goCompanyPage(page: number) {
void searchCompanies();
}
+function selectAll() {
+ emit('update:selectedCompanyId', undefined);
+ emit('select', null);
+}
+
function selectCompany(company: CompanyVO.CompanyInfoVO) {
emit('update:selectedCompanyId', company.id);
emit('select', company);
}
+function onAddForCompany(company: CompanyVO.CompanyInfoVO, event: Event) {
+ event.stopPropagation();
+ selectCompany(company);
+ emit('addForCompany', company);
+}
+
onMounted(() => {
void searchCompanies();
});
@@ -127,13 +160,36 @@ onMounted(() => {
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+ {{ allOptionLabel }}
+
+
+ {{ allOptionHint }}
+
+
+
+
+
+
+
-
+
-
+
{{ company.name }}
-
- {{ company.status === 1 ? '启用' : '禁用' }}
-
+
+
+ {{ company.status === 1 ? '启用' : '禁用' }}
+
+
+
+
+
+
+
+
-
+
@@ -332,4 +450,12 @@ onMounted(() => {
align-items: center;
overflow: visible;
}
+
+:deep(.company-sidebar-list-spin),
+:deep(.company-sidebar-list-spin .ant-spin-container) {
+ display: flex;
+ width: 100%;
+ min-width: 0;
+ flex-direction: column;
+}
diff --git a/apps/web/apps/web-antd/src/views/company/menu/index.vue b/apps/web/apps/web-antd/src/views/company/menu/index.vue
index 946ba8ea..ac8f09f9 100644
--- a/apps/web/apps/web-antd/src/views/company/menu/index.vue
+++ b/apps/web/apps/web-antd/src/views/company/menu/index.vue
@@ -67,7 +67,8 @@ const stats = computed(() => ({
changed: selectedMenuIds.value.length !== companyMenuIds.value.length,
}));
-function onCompanySelect(company: CompanyVO.CompanyInfoVO) {
+function onCompanySelect(company: CompanyVO.CompanyInfoVO | null) {
+ if (!company) return;
currentCompany.value = company;
selectedCompanyId.value = company.id;
void loadCompanyMenus();
diff --git a/apps/web/apps/web-antd/src/views/company/permission/index.vue b/apps/web/apps/web-antd/src/views/company/permission/index.vue
index 2afba69b..055c14bb 100644
--- a/apps/web/apps/web-antd/src/views/company/permission/index.vue
+++ b/apps/web/apps/web-antd/src/views/company/permission/index.vue
@@ -102,7 +102,8 @@ function collectExpandableKeys(nodes: PermissionVO.PermissionInfoVO[]): number[]
return keys;
}
-function onCompanySelect(company: CompanyVO.CompanyInfoVO) {
+function onCompanySelect(company: CompanyVO.CompanyInfoVO | null) {
+ if (!company) return;
currentCompany.value = company;
selectedCompanyId.value = company.id;
void loadCompanyPermissions();
diff --git a/apps/web/apps/web-antd/src/views/sys/account/index.vue b/apps/web/apps/web-antd/src/views/sys/account/index.vue
index 57e08b1a..1be6e153 100644
--- a/apps/web/apps/web-antd/src/views/sys/account/index.vue
+++ b/apps/web/apps/web-antd/src/views/sys/account/index.vue
@@ -7,65 +7,43 @@ import type {
} from '#/api/sys/account';
import type { PageQueryDTO } from '#/types/common';
-import { computed, onMounted, ref, watch } from 'vue';
+import { computed, ref, watch } from 'vue';
-import { Page } from '@vben/common-ui';
import { createIconifyIcon } from '@vben/icons';
import {
Button,
Card,
- Empty,
- Flex,
Input,
message,
- Pagination,
Popconfirm,
Select,
Space,
- Spin,
Tag,
} from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
-import { getCompanyPageApi } from '#/api/company';
import {
super_deleteAccountApi,
super_getAccountPageApi,
} from '#/api/sys/account';
-
-import AccountFormModal from './components/AccountFormModal.vue';
import { PermissionGate } from '#/components/permission';
import {
syncVxeGridColumns,
useActionColumnVisible,
} from '#/composables/use-vxe-action-column';
-import {
- SIDEBAR_LIST_SHELL_CLASS,
- sidebarListRowClass,
-} from '#/utils/sidebar-list-styles';
+import CompanyColPage from '#/views/company/components/CompanyColPage.vue';
+
+import AccountFormModal from './components/AccountFormModal.vue';
defineOptions({ name: 'SysAccountManagement' });
const PlusIcon = createIconifyIcon('lucide:plus');
-const BuildingIcon = createIconifyIcon('lucide:building-2');
const loading = ref(false);
const accountFormModalRef = ref();
-const companySearchForm = ref({
- name: '',
- status: undefined as number | undefined,
-});
-
-const companyList = ref([]);
-const companyLoading = ref(false);
-const companyPagination = ref({
- current: 1,
- pageSize: 20,
- total: 0,
-});
-
+const selectedCompanyId = ref(undefined);
const currentCompany = ref(null);
const searchForm = ref({
@@ -246,44 +224,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
syncVxeGridColumns(gridApi, accountTableColumns);
-async function searchCompanies() {
- companyLoading.value = true;
- try {
- const result = await getCompanyPageApi({
- page: companyPagination.value.current,
- pageSize: companyPagination.value.pageSize,
- filters: {
- name: companySearchForm.value.name || undefined,
- status: companySearchForm.value.status,
- },
- });
- companyList.value = result.records;
- companyPagination.value.total = result.total;
- } catch (error: any) {
- message.error(error?.message || '获取公司列表失败');
- } finally {
- companyLoading.value = false;
- }
-}
-
-function resetCompanySearch() {
- companySearchForm.value = { name: '', status: undefined };
- companyPagination.value.current = 1;
- searchCompanies();
-}
-
-function handleCompanyPageChange(page: number, pageSize: number) {
- companyPagination.value.current = page;
- companyPagination.value.pageSize = pageSize;
- searchCompanies();
-}
-
-function selectCompanyAll() {
- currentCompany.value = null;
-}
-
-function selectCompany(company: CompanyVO.CompanyInfoVO) {
+function onCompanySelect(company: CompanyVO.CompanyInfoVO | null) {
currentCompany.value = company;
+ selectedCompanyId.value = company?.id;
}
function refreshTable() {
@@ -299,7 +242,8 @@ function handleAdd() {
}
function handleAddForCompany(company: CompanyVO.CompanyInfoVO) {
- selectCompany(company);
+ currentCompany.value = company;
+ selectedCompanyId.value = company.id;
accountFormModalRef.value?.open(undefined, company);
}
@@ -339,251 +283,125 @@ function getStatusColor(status: number) {
return colorMap[status] || 'default';
}
-function companyRowClass(id: number | 'all') {
- const active =
- id === 'all'
- ? currentCompany.value === null
- : currentCompany.value?.id === id;
- const layout =
- id === 'all'
- ? 'mb-1.5 flex w-full cursor-pointer items-center gap-2 text-left'
- : 'group flex w-full cursor-pointer items-center gap-2';
- return sidebarListRowClass(active, layout);
-}
-
watch(currentCompany, () => {
gridApi.reload();
});
-
-onMounted(() => {
- searchCompanies();
-});
-
-
-
- 左侧选择公司筛选右侧账户;首项「全部账户」展示所有账户,可在公司行快捷新增。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 公司
-
-
-
-
+
+
+
+ 账户列表
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 账户列表
-
-
-
-
-
-
-
-
-
+ 当前:{{ selectedCompanyLabel }}
+
+
+ {{ currentCompany.status === 1 ? '启用' : '禁用' }}
+
+
-
- 当前:{{ selectedCompanyLabel }}
-
-
- {{ currentCompany.status === 1 ? '启用' : '禁用' }}
+
+
+
+
+ 左侧筛选公司;表格在区域内滚动
+
+
+
+
+
+ {{ getStatusText(row.status) }}
-
-
-
-
-
- 使用上方筛选条件查询;表格在区域内滚动
-
-
-
-
-
- {{ getStatusText(row.status) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+