diff --git a/superpowers/plans/2026-06-07-sysapp-management-plan.md b/superpowers/plans/2026-06-07-sysapp-management-plan.md new file mode 100644 index 0000000..1b445db --- /dev/null +++ b/superpowers/plans/2026-06-07-sysapp-management-plan.md @@ -0,0 +1,961 @@ +# SysApp(第三方应用集成)管理界面实施计划 + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers-subagent-driven-development (recommended) or superpowers-executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** 在 admin-ui 后台实现 SysApp(第三方应用集成)管理模块,提供对微信/支付宝/Stripe 等第三方平台应用凭证信息的统一管理能力。 + +**Architecture:** 完全照搬现有 `oauth2-client` 模块的 CRUD 模式 —— `BaseService` 13 行极简继承 + `RuiTable` 列表页 + `FormDialog` 弹窗(el-tabs 4 Tab)。**不引入新依赖**。 + +**Tech Stack:** Vue 3, TypeScript, Element Plus, Vite, Pinia + +--- + +## 文件变更清单 + +| # | 文件 | 变更类型 | 说明 | +|---|------|---------|------| +| 1 | `admin-ui/src/service/system/sysAppService.ts` | 新建 | Service(继承 BaseService) | +| 2 | `admin-ui/src/service/system/index.ts` | 修改 | 追加导出 sysAppService | +| 3 | `admin-ui/src/locales/zh-CN.ts` | 修改 | 加 `systemApp: '应用集成'` | +| 4 | `admin-ui/src/locales/en-US.ts` | 修改 | 加 `systemApp: 'App Integration'` | +| 5 | `admin-ui/src/router/modules/system.ts` | 修改 | 注册 `/system/app` 路由 | +| 6 | `admin-ui/src/views/system/app/Index.vue` | 新建 | 列表页(RuiTable) | +| 7 | `admin-ui/src/views/system/app/SysAppFormDialog.vue` | 新建 | 表单弹窗(4 Tab) | + +**合计:新建 3 个文件 + 修改 4 个文件 = 7 个文件** + +--- + +## 任务依赖图 + +``` +Task 1 (Service) ──┬── Task 2 (Service Index) + │ + ├── Task 5 (列表页) ──┐ + │ │ + └── Task 6 (表单) ────┴── Task 7 (端到端验证) + +Task 3 (i18n) ──┐ +Task 4 (Router) ┴── Task 5 (列表页) +``` + +--- + +## Task 1: 创建 SysApp Service + +**Files:** +- Create: `admin-ui/src/service/system/sysAppService.ts` + +- [ ] **Step 1: 写入 Service 文件** + +在 `admin-ui/src/service/system/sysAppService.ts` 创建: + +```typescript +import { BaseService } from '../BaseService' + +/** + * SysApp(第三方应用集成)服务 + * + *
负责与后端 /system/admin/app 接口的通信,继承 BaseService 获得标准 CRUD 能力。
+ * + *后续升级路径:后端文件上传接口(rui/rui-framework#4)就绪后,可在此文件追加 + * `uploadCertificate(file: File)` 方法,并将表单中 certificates 字段从 JSON textarea + * 升级为文件上传组件。
+ */ +class SysAppService extends BaseService { + constructor() { + super('/system/admin/app') + } +} + +/** SysApp 服务单例 */ +export const sysAppService = new SysAppService() +``` + +- [ ] **Step 2: 验证类型检查** + +Run: +```bash +cd admin-ui && npx vue-tsc --noEmit --skipLibCheck src/service/system/sysAppService.ts +``` +Expected: 无错误输出 + +- [ ] **Step 3: Commit** + +```bash +git add admin-ui/src/service/system/sysAppService.ts +git commit -m "feat(sysApp): add sysAppService extending BaseService for /system/admin/app" +``` + +--- + +## Task 2: 在 Service 统一入口导出 sysAppService + +**Files:** +- Modify: `admin-ui/src/service/system/index.ts` + +- [ ] **Step 1: 追加导出语句** + +在文件末尾追加: + +```typescript +export { sysAppService } from './sysAppService' +``` + +- [ ] **Step 2: 验证导入** + +Run: +```bash +cd admin-ui && npx vue-tsc --noEmit --skipLibCheck src/service/system/index.ts +``` +Expected: 无错误输出 + +- [ ] **Step 3: Commit** + +```bash +git add admin-ui/src/service/system/index.ts +git commit -m "feat(sysApp): export sysAppService from system service index" +``` + +--- + +## Task 3: 配置国际化(中英文) + +**Files:** +- Modify: `admin-ui/src/locales/zh-CN.ts` +- Modify: `admin-ui/src/locales/en-US.ts` + +- [ ] **Step 1: 在 zh-CN.ts 添加中文** + +定位到 `systemOAuth2Client: 'OAuth2客户端',` 这一行,在其后添加: + +```typescript + systemApp: '应用集成', +``` + +(注意缩进:与 systemOAuth2Client 保持一致的 4 空格) + +- [ ] **Step 2: 在 en-US.ts 添加英文** + +定位到 `systemOAuth2Client: 'OAuth2 Client',`(或对应位置),在其后添加: + +```typescript + systemApp: 'App Integration', +``` + +(如果 en-US.ts 没有 systemOAuth2Client 这一行,则加在 system 块的合理位置,参考 systemOAuth2Client 的就近位置) + +- [ ] **Step 3: 验证** + +Run: +```bash +grep -n "systemApp" admin-ui/src/locales/zh-CN.ts admin-ui/src/locales/en-US.ts +``` +Expected: 两个文件各有一行匹配 + +- [ ] **Step 4: Commit** + +```bash +git add admin-ui/src/locales/zh-CN.ts admin-ui/src/locales/en-US.ts +git commit -m "feat(sysApp): add systemApp i18n key (zh-CN: '应用集成', en-US: 'App Integration')" +``` + +--- + +## Task 4: 注册路由 + +**Files:** +- Modify: `admin-ui/src/router/modules/system.ts` + +- [ ] **Step 1: 在 M 常量加键** + +定位到 `systemOAuth2Client: 'menu.systemOAuth2Client',` 这一行,在其后添加: + +```typescript + systemApp: 'menu.systemApp', +``` + +- [ ] **Step 2: 在 systemRoutes 数组加路由** + +定位到 `system/oauth2-client` 路由条目,在其后添加: + +```typescript + { path: 'system/app', name: 'SystemApp', component: () => import('@/views/system/app/Index.vue'), meta: { i18n: M.systemApp } }, +``` + +- [ ] **Step 3: 验证** + +Run: +```bash +grep -n "systemApp\|system/app" admin-ui/src/router/modules/system.ts +``` +Expected: 至少 2 行匹配(一个 M 常量,一个 systemRoutes 数组) + +- [ ] **Step 4: Commit** + +```bash +git add admin-ui/src/router/modules/system.ts +git commit -m "feat(sysApp): register /system/app route in system router" +``` + +--- + +## Task 5: 创建列表页 + +**Files:** +- Create: `admin-ui/src/views/system/app/Index.vue` + +> **依赖**:Task 1(Service)、Task 3(i18n)、Task 4(Router)必须先完成。 + +- [ ] **Step 1: 创建目录** + +```bash +mkdir -p admin-ui/src/views/system/app +``` + +- [ ] **Step 2: 写入列表页** + +创建 `admin-ui/src/views/system/app/Index.vue`,内容如下: + +```vue + + + +