Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ujia
/
uj-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f3cd7821
authored
Nov 11, 2026
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新转换系统规范
1 parent
6f7a6bfc
Pipeline
#402
for
f3cd7821
failed
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
docs/PORT_CONVERSION.md
docs/PORT_CONVERSION.md
View file @
f3cd782
...
@@ -208,6 +208,87 @@ pnpm build # 构建(turbo 3/3 已实测可过)
...
@@ -208,6 +208,87 @@ pnpm build # 构建(turbo 3/3 已实测可过)
---
---
## 13. 已接入域:usedcar(二手车管理)· 路由与页面真源
> 本节是 `apps/web/subapps/usedcar` 的**事实快照**,供转换 AI 在搬 `apps/mp/usedcar`(微信小程序旧系统)业务时逐条核对。
> 与 points 同为子应用骨架,但 usedcar 当前是**纯脚手架**:12 个页面全是占位、API 层刻意留空、权限闸门未接。
> 真源优先级:`scripts/usedcar-menu-complete.sql`(菜单/权限唯一真源)> `src/routes.ts` / `src/App.tsx` / `src/permissions/codes.ts`(子应用侧镜像)> 本节的转述。
### 13.1 子应用落点事实
-
位置:
`apps/web/subapps/usedcar`
,包名
`@uj/web-usedcar`
(
`package.json`
)。
-
`package.json.uj.route = "usedcar"`
,dev 端口
`5177`
(
`system 5174 / store 5175 / points 5176`
已占,工厂
`strictPort`
)。
-
**红线对齐**
:
`uj.route`
的值必须 = 菜单 SQL 的
`route`
首段(
`/usedcar/...`
)。不一致 → 菜单点进去 404,且构建期子应用注册表(
`apps/web/shell/src/subapps.ts`
)直接撞车报错。
-
图标约束:12 个页面图标 + 一级目录
`CarOutlined`
共 13 个,必须「是真实
`@ant-design/icons`
名称
**且**
登记在
`apps/web/shell/src/layouts/BasicLayout.tsx`
的
`iconMap`
」。SQL 注释已确认 13 个全登记;新加页面图标若漏登记会静默回落(dev 告警一次)。
-
共享别名:
`@/components`
**不是本地目录**
,它解析到
`packages/biz/src/components`
(points/store/system 同款约定),
`PageShell`
即来自
`@uj/biz`
。子应用本地没有
`src/components`
。
### 13.2 路由机制(照搬 points,无 switch)
-
`src/routes.ts`
:
`RouteDef { path, Page }`
+
`matchRoute(routes, subPath)`
。
**按段匹配**
:段数不等直接跳过,逐段比对,
`:name`
抽成
`params`
(
`decodeURIComponent`
)。
`subPath`
为空(主壳菜单只配到
`/usedcar`
)→ 落
`routes[0]`
(dashboard)。
-
`src/App.tsx`
:
`ROUTES`
共
**12 条**
,顺序严格沿用菜单
`sort`
1..12;
`subPath`
由主壳经 bus
`<name>:navigate`
下发,
`<name>:logout`
清空。
-
未知页名 → 渲染
`UEmpty`
「没有匹配「xxx」的页面,请从菜单进入」,
**不静默渲染**
一个看起来正常的页。
-
握手:
`bus.$emit(events.ready)`
通知主壳就绪;
`BrowserRouter`
只挂 context,不做分发(同 §9)。
### 13.3 12 个页面(与 SQL `menu_type=2` 逐字段对应)
| sort | 菜单名 |
`ROUTES.path`
| menu_code |
`:view`
权限码 | 图标 |
|---|---|---|---|---|---|
| 1 | 数据看板 |
`dashboard`
| 1002601 |
`usedcar:dashboard:view`
| FundProjectionScreenOutlined |
| 2 | 线索管理 |
`leads`
| 1002602 |
`usedcar:lead:view`
| AimOutlined |
| 3 | 评估管理 |
`assessment`
| 1002603 |
`usedcar:assess:view`
| ExperimentOutlined |
| 4 | 运营管理 |
`operation`
| 1002604 |
`usedcar:operation:view`
| ControlOutlined |
| 5 | 车辆管理 |
`vehicles`
| 1002605 |
`usedcar:vehicle:view`
| ToolOutlined |
| 6 | 交付单管理 |
`delivery`
| 1002606 |
`usedcar:delivery:view`
| SendOutlined |
| 7 | 车辆台账 |
`ledger`
| 1002607 |
`usedcar:ledger:view`
| ReconciliationOutlined |
| 8 | 离职继承 |
`handover`
| 1002608 |
`usedcar:handover:view`
| UserSwitchOutlined |
| 9 | 报告管理 |
`reports`
| 1002609 |
`usedcar:report:view`
| FileTextOutlined |
| 10 | 车况信息 |
`condition`
| 1002610 |
`usedcar:condition:view`
| SafetyCertificateOutlined |
| 11 | 一客一群(预生成) |
`customer-group`
| 1002611 |
`usedcar:group:view`
| WechatOutlined |
| 12 | 付款管理 |
`payment`
| 1002612 |
`usedcar:payment:view`
| PayCircleOutlined |
**易错点**
:第 11 项菜单名是「一客一群(预生成)」,但
`route`
末段是
`customer-group`
(不是
`group`
);
`ROUTES.path`
必须写
`customer-group`
才与 SQL 的
`/usedcar/customer-group`
对齐。其权限码前缀却是
`group:`
/
`dealer:`
(见 13.4)。
### 13.4 权限码(`src/permissions/codes.ts`,`UC` 对象)—— 共 55 码
-
12 个页面
`:view`
+
**43 个动作按钮**
(SQL
`menu_type=3`
),逐字来自 SQL
`perm_code`
列,域前缀
`usedcar:`
。
-
资源前缀分布(转换时搬按钮按这个前缀挂
`rowActions.permission`
):
| 资源前缀 | 覆盖页面 | 动作码(节选) |
|---|---|---|
|
`dashboard`
| 数据看板 | (无按钮,看数据即 view) |
|
`lead`
| 线索管理 |
`export`
/
`detail`
|
|
`assess`
| 评估管理 |
`export`
/
`detail`
/
`evaluate`
/
`price-audit`
/
`image-download`
|
|
`contract`
| 运营管理·合同 tab |
`export`
/
`import`
/
`detail`
/
`download`
|
|
`incentive`
| 运营管理·阳光激励 tab |
`export`
/
`create`
/
`update`
/
`detail`
/
`delete`
|
|
`vehicle`
| 车辆管理 |
`export`
/
`detail`
/
`status`
/
`image-download`
|
|
`delivery`
| 交付单管理 |
`export`
/
`detail`
|
|
`ledger`
| 车辆台账·车辆 tab |
`export`
;财务 tab 单独
`export-finance`
|
|
`handover`
| 离职继承 |
`create`
/
`detail`
|
|
`report`
| 报告管理 |
`export`
/
`detail`
(H5 跳转) |
|
`condition`
| 车况信息 |
`edit`
/
`assess-order`
/
`ai-report`
(H5) |
|
`group`
/
`dealer`
| 一客一群·群 tab / 4S店配置 tab |
`create`
/
`update`
/
`delete`
/
`batch-delete`
/
`download`
(群);
`create`
/
`update`
/
`delete`
(dealer) |
|
`payment`
| 付款管理 |
`export`
/
`batch-repay`
/
`detail`
/
`receipt`
|
-
**tab 落地规则(关键)**
:运营(合同/激励)、台账(车辆/财务)、一客一群(群/4S店配置)在菜单树上都是
**同一个 `menu_type=2` 页面节点**
,tab 差异
**只体现在按钮 `perm_code` 前缀**
,不在路由上。所以转换时是【单路由 + 页内
`UTabs`
】,不是多路由页。
-
权限判定
**当前未接闸门**
:
`codes.ts`
注释明确「页面内容按要求留空,暂不接权限闸门」。接闸门时照 points 的
`adapter/perms.ts`
三态
`matchPermission`
(未下发本域码则放行),
`UC`
码表已齐,直接用。
### 13.5 当前状态(转换开工前必须知道)
-
**12 个页面全是占位**
:每个
`src/pages/<Name>/index.tsx`
只
`return <RoutePlaceholder title=... route="/usedcar/xxx" />`
,渲染
`PageShell`
+
`UCard`
+
`UEmpty`
「当前路由:/usedcar/xxx」。
`RoutePlaceholder`
的
`route`
取 SQL 登记的完整后台路径常量,
**不读子应用自身 `window.location`**
(wujie 下页面由主壳经
`props.page`
+ bus 决定)。
-
**API 层刻意留空**
:
`src/api/index.ts`
=
`export {}`
;
`src/api/core/client.ts`
仅
`export { RemoteApiClient as ApiClient } from '@uj/platform-sdk'`
(占位桥接,
**未注册任何网关、无业务模块、无 `rpc(gateway,method,params)`**
)。这是有意不为 SQL 里没有的接口臆造出口。
-
对照 points:points 用的是自有
`RpcApiClient`
(
`apps/web/subapps/points/src/api/core/rpc-client.ts`
)+
`@uj/api-core`
`createClient`
+
`adapter/gateways`
登记网关。usedcar 接接口时
**必须按 points 范式替换**
`client.ts`
并登记 usedcar 的老网关,不能直接用现有
`RemoteApiClient`
占位。
### 13.6 转换开工清单(在 §10 基础上针对 usedcar)
1.
搬页面:把
`apps/mp/usedcar`
对应业务页填进
`src/pages/<Name>/index.tsx`
,替换
`RoutePlaceholder`
;
`PageShell`
+
`SearchForm`
+
`DataTable`
+
`U*`
同 §6/§7。
2.
接接口:按 points 范式在
`src/api/`
建业务模块(继承
`RpcApiClient`
),在
`adapter/gateways`
登记 usedcar 老网关;把
`client.ts`
的
`RemoteApiClient`
占位换成 points 的
`createClient`
桥接。
3.
接权限:复用
`UC`
码表(55 码已全),照
`matchPermission`
三态闸门挂到
`rowActions.permission`
/
`useXxxAccess().can()`
。
4.
加页/加按钮:新页面 =
`ROUTES`
加一行 + 建页目录 + SQL 加
`menu_type=2`
(route 末段 =
`ROUTES.path`
);新按钮 = SQL 加
`menu_type=3`
(
`route=NULL`
,只当权限载体,不进侧边栏)+ 在
`UC`
补码。
5.
详情/编辑/H5:报告详情、AI 收车报告是 H5 跳转(不在本子应用内);其余详情/编辑按 §9 走
`UDrawer`
/
`UModal`
,不为每个详情开新路由页。
6.
校验:
`pnpm verify`
全过(含
`check-boundaries`
——注意 usedcar 当前未引 axios/fetch,接接口时继续守住 §1.1)。
---
## 附:可直接作为「转换 AI 系统提示词」的精简版
## 附:可直接作为「转换 AI 系统提示词」的精简版
> 你是把外部技术栈后台系统转成本系统(uj-admin:React19+Vite6+antd6+wujie monorepo)的 AI。铁律:
> 你是把外部技术栈后台系统转成本系统(uj-admin:React19+Vite6+antd6+wujie monorepo)的 AI。铁律:
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment