feat: initialize ERP base platform (extracted from HMS)

- Stripped 11 business crates (health, ai, dialysis, plugins)
- Cleaned AppState, AppConfig, main.rs from business coupling
- Reduced migrations from 169 to 53 (base-only)
- Removed health_provider trait from erp-core
- Removed business integration tests
- Removed gateway rate limiting middleware
- Base capabilities: auth, RBAC, JWT, config, workflow, message, plugin, audit, crypto, RLS, multi-tenant

Cargo check: OK
Cargo test: OK
This commit is contained in:
iven
2026-05-31 20:35:57 +08:00
commit 59856ac2fc
639 changed files with 124710 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test';
test.describe('登录流程', () => {
test('显示登录页面', async ({ page }) => {
await page.goto('/#/login');
await expect(page.locator('.ant-card, .ant-form')).toBeVisible();
});
test('空表单提交显示验证错误', async ({ page }) => {
await page.goto('/#/login');
await page.click('button[type="submit"]');
// Ant Design 应显示验证错误
await expect(page.locator('.ant-form-item-explain-error')).toHaveCount(2); // 用户名 + 密码
});
});

View File

@@ -0,0 +1,24 @@
import { test, expect } from '../fixtures/auth.fixture';
test.describe('插件管理', () => {
test('插件管理页面加载', async ({ page }) => {
await page.goto('/#/');
// 侧边栏显示"扩展管理插件管理"
await page.locator('text=扩展管理').first().click();
await page.waitForLoadState('networkidle');
// 页面不崩溃
await expect(page.locator('main')).toBeVisible();
});
test('刷新按钮可点击', async ({ page }) => {
await page.goto('/#/');
await page.locator('text=扩展管理').first().click();
await page.waitForLoadState('networkidle');
const refreshBtn = page.locator('button:has-text("刷新")');
if (await refreshBtn.isVisible().catch(() => false)) {
await expect(refreshBtn).toBeEnabled();
await refreshBtn.click();
await expect(page.locator('main')).toBeVisible();
}
});
});

View File

@@ -0,0 +1,39 @@
import { test, expect } from '../fixtures/auth.fixture';
test.describe('多租户隔离', () => {
test('侧边栏按模块分组显示', async ({ page }) => {
await page.goto('/#/');
await page.waitForLoadState('networkidle');
// 验证侧边栏模块分组
await expect(page.locator('text=基础模块').first()).toBeVisible({ timeout: 10000 });
await expect(page.locator('text=业务模块').first()).toBeVisible();
await expect(page.locator('text=系统').first()).toBeVisible();
// 验证关键菜单项
await expect(page.locator('text=工作台').first()).toBeVisible();
await expect(page.locator('text=用户管理').first()).toBeVisible();
});
test('顶部导航栏显示用户信息', async ({ page }) => {
await page.goto('/#/');
await page.waitForLoadState('networkidle');
// 验证顶部导航栏显示管理员信息
await expect(page.locator('text=系统管理员').first()).toBeVisible({ timeout: 10000 });
});
test('页面间导航正常工作', async ({ page }) => {
await page.goto('/#/');
await page.waitForLoadState('networkidle');
// 点击侧边栏的用户管理(精确匹配侧边栏区域)
const sidebar = page.locator('complementary, [class*=sider], [class*=menu], nav').first();
await sidebar.locator('text=用户管理').first().click();
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
// 点击工作台返回
await sidebar.locator('text=工作台').first().click();
await expect(page).toHaveURL(/#\/$/, { timeout: 10000 });
});
});

View File

@@ -0,0 +1,48 @@
import { test, expect } from '../fixtures/auth.fixture';
test.describe('用户管理', () => {
test('用户列表页面加载并显示表格', async ({ page }) => {
await page.goto('/#/');
// 通过侧边栏导航到用户管理
await page.locator('text=用户管理').first().click();
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
// 标题
await expect(page.locator('h4')).toContainText('用户管理');
// 新建用户按钮
await expect(page.locator('button:has-text("新建用户")')).toBeVisible();
// 搜索框
await expect(page.locator('input[placeholder*="搜索"]')).toBeVisible();
// 表格列头
await expect(page.locator('text=用户').first()).toBeVisible();
await expect(page.locator('text=状态').first()).toBeVisible();
});
test('新建用户弹窗表单验证', async ({ page }) => {
await page.goto('/#/');
await page.locator('text=用户管理').first().click();
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
// 点击新建
await page.click('button:has-text("新建用户")');
// 弹窗出现
await expect(page.locator('.ant-modal')).toBeVisible();
// 直接提交应显示验证错误(点击 modal 内最后一个 button 即确认按钮)
const modalButtons = page.locator('.ant-modal .ant-modal-footer button');
await modalButtons.last().click();
// Ant Design 应显示验证错误(用户名 + 密码必填)
await expect(page.locator('.ant-form-item-explain-error')).toHaveCount(2);
// 关闭弹窗(点击第一个按钮即取消)
await modalButtons.first().click();
});
test('搜索框可输入', async ({ page }) => {
await page.goto('/#/');
await page.locator('text=用户管理').first().click();
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
const searchInput = page.locator('input[placeholder*="搜索"]');
await searchInput.fill('admin');
await expect(searchInput).toHaveValue('admin');
});
});