.cursor/skills/ncp-admin-frontend/SKILL.md
Follows Vben Admin patterns when developing Ncp.Admin frontend (Vue 3 + Vite + TypeScript + Ant Design Vue). Use when adding or modifying views, API modules, routes, locales, or components in src/frontend/apps/admin-antd.
npx skillsauth add zhouda1fu/Ncp.Admin ncp-admin-frontendInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
路径与常用约定摘要见 .cursor/rules/frontend-vben.mdc。下文为易错点、权限/菜单检查清单、表单抽屉与路由高亮的完整说明(以本技能为准)。
namespace 定义类型;requestClient 发请求;函数命名:getXxxList、getXxx、createXxx、updateXxx、deleteXxx;文件末尾集中 export { ... }。带表单的抽屉必须与主题一致,统一使用 useVbenDrawer + useVbenForm,不要使用 Ant Design Vue 的 Drawer 组件 + 手写表单项。
useVbenDrawer(来自 @vben/common-ui),提供标题、关闭、底部取消/确定、提交中 lock 等,与其它抽屉样式一致。useVbenForm + 在 data.ts 中定义的 表单 schema(与主表单一样用 VbenFormSchema、z 校验、formItemClass 等),保证标签、间距、栅格与主题表单一致。drawerApi.setData({ ... }).open(),在 onOpenChange(isOpen) 里根据 drawerApi.getData() 给 formApi.setValues(...);确定时在 onConfirm 里 formApi.validate() → formApi.getValues() → 调接口或写本地状态,成功后 drawerApi.close(),提交中用 drawerApi.lock(true/false)。src/views/contract/form-page.vue 中的新增/编辑发票抽屉、src/views/customer/modules/contact-drawer.vue、src/views/leave/balances/modules/form.vue。VbenFormSchema[],z 校验,$t() 文案;表单项 componentProps 建议加 class: 'w-full'。componentProps 必须包含 class: 'w-full',否则搜索栏多列或操作列后出现空白列。CellOperation。必须有一列不设 width(如备注列或占位列 field: '_flex', title: '')作为弹性列,否则操作列右侧多出空白(参考 views/system/dept/data.ts);操作列建议 width: 200,attrs 提供 nameField/nameTitle。Page、useVbenVxeGrid、useVbenModal;弹窗用 modules/form.vue 作 connectedComponent;onActionClick 与 CellOperation 联动。useVbenForm、formModalApi.getData<T>() / formModalApi.setData();提交后 emit('success')。"当前选中项"由 route.meta?.activePath || route.path 决定。若新增的是 hideInMenu 的子路由(如新建/编辑页),且希望进入后左侧仍高亮父级菜单,在该子路由 meta 中设置 activePath 为父级列表 path:
meta: {
activePath: '/customer/list', // 进入此页时左侧高亮「客户列表」
hideInMenu: true,
title: $t('customer.create'),
},
新增带权限控制的功能时,除路由 authority 外,必须同步:
src/constants/permission-codes.ts,与后端 PermissionCodes.cs 一致。src/utils/permission-tree.ts 的 buildPermissionTree() 中增加与后端层级一致的节点;不加则角色管理里无法勾选、菜单可能不显示。authority 写成数组,包含父权限码和所有子权限码,这样拥有任一子权限即可看到父菜单。children 中增加一条路由(path、name、meta、component),并配套 views/api/locales;只加权限不加子路由,侧边栏不会出现该菜单。后端需同步:PermissionCodes、PermissionDefinitionContext、PermissionMapper、端点 Permissions()、必要时 Seed(见 .cursor/rules/project-conventions.mdc 中「新增需权限的接口时(后端 5 处)」表格)。api/system/ 或相应目录添加 API 与类型views/{module}/{feature}/ 创建 data.ts、list.vue、modules/form.vuerouter/routes/modules/ 添加路由(含 meta.authority)locales/langs/ 补充 zh-CN、en-USpermission-codes.ts 新增,并在 permission-tree.ts 的 buildPermissionTree() 中增加树节点@vben/common-ui:Page、useVbenModal@vben/plugins/vxe-table:useVbenVxeGrid#/adapter/form:useVbenForm、VbenFormSchema、z#/adapter/vxe-table:useVbenVxeGrid、OnActionClickParams$t(),键放在 locales/langs/{zh-CN,en-US}/*.jsonresearch
需求澄清与拆解,识别干系人并将需求条目标注所属对象与业务实体;仅产出结构化需求描述,不做建模定义,可作为后续建模输入
development
基于 cleanddd-requirements-analysis 结果,输出符合 CleanDDD 的聚合、命令、事件、查询、API 端点(Endpoints)、定时任务模型;用于从已拆解的需求快速得到建模蓝图
development
在 CleanDDD 项目中落地已建模的需求(聚合/命令/查询/API 端点(Endpoints)/事件/仓储/配置/测试)的编码指南;用于编写或修改业务功能、端点与数据访问时
tools
交互式 CleanDDD 教练技能,循序讲解并与用户互动练习 CleanDDD 核心原则与方法;包含微课、测验与检查清单,可承接到需求分析/建模/代码实现技能