From 2e7bc80a11a34a21634916067398038c7ec550ab Mon Sep 17 00:00:00 2001 From: lq Date: Mon, 20 Jul 2026 15:05:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=92=89=E9=92=89=E3=80=81=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1webbook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cursor/rules/Code-Standards.mdc | 229 +++++- apps/web-antd/src/adapter/component/index.ts | 1 + .../form/components/gallery-pick-link.vue | 7 + .../form/components/image-gallery-picker.vue | 45 +- .../oa-template-card-editor/BlockLibrary.vue | 135 ++++ .../oa-template-card-editor/Canvas.vue | 337 +++++++++ .../oa-template-card-editor/JsonPreview.vue | 118 +++ .../oa-template-card-editor/PropertyPanel.vue | 372 +++++++++ .../oa-template-card-editor/index.vue | 538 +++++++++++++ .../oa-template-card-editor/types.ts | 99 +++ .../views/system/admin/_shared/admin-page.vue | 23 + .../_shared/components/oa-account-modal.vue | 233 ++++++ .../system/admin/_shared/oa-account/api.ts | 23 + .../src/views/system/notice/config/form.ts | 2 +- .../src/views/system/oa-chat/api/index.ts | 62 ++ .../views/system/oa-chat/components/modal.vue | 99 +++ .../src/views/system/oa-chat/config/form.ts | 85 +++ .../src/views/system/oa-chat/config/search.ts | 52 ++ .../src/views/system/oa-chat/config/table.ts | 89 +++ .../src/views/system/oa-chat/index.vue | 168 +++++ .../views/system/oa-notify-log/api/index.ts | 21 + .../system/oa-notify-log/config/search.ts | 61 ++ .../system/oa-notify-log/config/table.ts | 78 ++ .../src/views/system/oa-notify-log/index.vue | 144 ++++ .../src/views/system/oa-platform/api/index.ts | 24 + .../src/views/system/oa-robot/api/index.ts | 88 +++ .../oa-robot/components/chat-bind-modal.vue | 190 +++++ .../system/oa-robot/components/modal.vue | 449 +++++++++++ .../oa-robot/components/test-result-modal.vue | 291 +++++++ .../oa-robot/components/test-send-modal.vue | 260 +++++++ .../oa-robot/components/webhook-modal.vue | 348 +++++++++ .../views/system/oa-robot/config/constants.ts | 33 + .../src/views/system/oa-robot/config/form.ts | 128 ++++ .../views/system/oa-robot/config/search.ts | 47 ++ .../src/views/system/oa-robot/config/table.ts | 76 ++ .../src/views/system/oa-robot/index.vue | 281 +++++++ .../src/views/system/oa-scene/api/index.ts | 52 ++ .../system/oa-scene/components/modal.vue | 709 ++++++++++++++++++ .../components/template-card-form.vue | 313 ++++++++ .../views/system/oa-scene/config/constants.ts | 15 + .../src/views/system/oa-scene/config/form.ts | 77 ++ .../views/system/oa-scene/config/search.ts | 47 ++ .../src/views/system/oa-scene/config/table.ts | 69 ++ .../src/views/system/oa-scene/index.vue | 146 ++++ .../components/oa-notify-config-panel.vue | 188 +++++ .../src/views/system/system-config/index.vue | 7 +- 46 files changed, 6852 insertions(+), 7 deletions(-) create mode 100644 apps/web-antd/src/components/oa-template-card-editor/BlockLibrary.vue create mode 100644 apps/web-antd/src/components/oa-template-card-editor/Canvas.vue create mode 100644 apps/web-antd/src/components/oa-template-card-editor/JsonPreview.vue create mode 100644 apps/web-antd/src/components/oa-template-card-editor/PropertyPanel.vue create mode 100644 apps/web-antd/src/components/oa-template-card-editor/index.vue create mode 100644 apps/web-antd/src/components/oa-template-card-editor/types.ts create mode 100644 apps/web-antd/src/views/system/admin/_shared/components/oa-account-modal.vue create mode 100644 apps/web-antd/src/views/system/admin/_shared/oa-account/api.ts create mode 100644 apps/web-antd/src/views/system/oa-chat/api/index.ts create mode 100644 apps/web-antd/src/views/system/oa-chat/components/modal.vue create mode 100644 apps/web-antd/src/views/system/oa-chat/config/form.ts create mode 100644 apps/web-antd/src/views/system/oa-chat/config/search.ts create mode 100644 apps/web-antd/src/views/system/oa-chat/config/table.ts create mode 100644 apps/web-antd/src/views/system/oa-chat/index.vue create mode 100644 apps/web-antd/src/views/system/oa-notify-log/api/index.ts create mode 100644 apps/web-antd/src/views/system/oa-notify-log/config/search.ts create mode 100644 apps/web-antd/src/views/system/oa-notify-log/config/table.ts create mode 100644 apps/web-antd/src/views/system/oa-notify-log/index.vue create mode 100644 apps/web-antd/src/views/system/oa-platform/api/index.ts create mode 100644 apps/web-antd/src/views/system/oa-robot/api/index.ts create mode 100644 apps/web-antd/src/views/system/oa-robot/components/chat-bind-modal.vue create mode 100644 apps/web-antd/src/views/system/oa-robot/components/modal.vue create mode 100644 apps/web-antd/src/views/system/oa-robot/components/test-result-modal.vue create mode 100644 apps/web-antd/src/views/system/oa-robot/components/test-send-modal.vue create mode 100644 apps/web-antd/src/views/system/oa-robot/components/webhook-modal.vue create mode 100644 apps/web-antd/src/views/system/oa-robot/config/constants.ts create mode 100644 apps/web-antd/src/views/system/oa-robot/config/form.ts create mode 100644 apps/web-antd/src/views/system/oa-robot/config/search.ts create mode 100644 apps/web-antd/src/views/system/oa-robot/config/table.ts create mode 100644 apps/web-antd/src/views/system/oa-robot/index.vue create mode 100644 apps/web-antd/src/views/system/oa-scene/api/index.ts create mode 100644 apps/web-antd/src/views/system/oa-scene/components/modal.vue create mode 100644 apps/web-antd/src/views/system/oa-scene/components/template-card-form.vue create mode 100644 apps/web-antd/src/views/system/oa-scene/config/constants.ts create mode 100644 apps/web-antd/src/views/system/oa-scene/config/form.ts create mode 100644 apps/web-antd/src/views/system/oa-scene/config/search.ts create mode 100644 apps/web-antd/src/views/system/oa-scene/config/table.ts create mode 100644 apps/web-antd/src/views/system/oa-scene/index.vue create mode 100644 apps/web-antd/src/views/system/system-config/components/oa-notify-config-panel.vue diff --git a/.cursor/rules/Code-Standards.mdc b/.cursor/rules/Code-Standards.mdc index 9e5c2433..ce8a1e98 100644 --- a/.cursor/rules/Code-Standards.mdc +++ b/.cursor/rules/Code-Standards.mdc @@ -1,10 +1,233 @@ --- -description: +description: 萧康云医管理后台(Vben Admin v5 + Vue 3 + TS + Ant Design Vue)代码规范 alwaysApply: true --- +# 基础规范(所有项目通用) + 1. 写代码的时候要补充详细的中文注释(每个方法是干嘛的,为什么要这样写),如果是工作区,则所有项目都适用该规则 -2. 注意不要生成太多的空行,上一部分代码和下一部分代码中间的空行不要大于2行 +2. 注意不要生成太多的空行,上一部分代码和下一部分代码中间的空行不要大于 2 行 3. 有封装好的方法、组件需要复用,不要重复造轮子 -4. 小程序端的抽屉全部需要用page-container来防止用户意外退出页面(记得使用v-if而不是v-show) +4. 小程序端的抽屉全部需要用 page-container 来防止用户意外退出页面(记得使用 v-if 而不是 v-show) 5. 数据库的(created_at、updated_at、deleted_at)统一使用时间戳,不要使用字符串,并且我在查询器中一级格式化成字符串了,无需再次格式化 + +# 全局架构规范 + +## 目录结构规范 + +- 业务页面统一放在 `apps/web-antd/src/views/<端>/<模块>/`(端:system / business / doctor 等) +- 标准 CRUD 模块目录结构: + + ``` + views/<端>/<模块>/ + ├── index.vue # 列表页(Page + Grid + Modal) + ├── api/index.ts # 本模块 API(CRUD) + ├── config/ + │ ├── table.ts # vxe-grid 列定义 + proxyConfig + │ ├── search.ts # 顶部搜索表单 schema + │ └── form.ts # 新增/编辑弹窗 form schema + ├── components/ + │ └── modal.vue # 新增/编辑弹窗 + └── utils/ # 模块工具(可选) + ``` + +- 全局复用组件放 `apps/web-antd/src/components/` +- 表单内可用组件放 `apps/web-antd/src/components/form/components/`,文件名 kebab-case,自动注册为 schema 的 `component` 名(PascalCase 引用) + +## 强制复用封装(禁止重复造轮子) + +- 表格统一用 `useVbenVxeGrid`(来自 `#/adapter/vxe-table`),**不要直接 new VxeGrid** +- 表单统一用 `useVbenForm`(来自 `#/adapter/form`),**不要直接写 `
` + 手动校验** +- 弹窗统一用 `useVbenModal`(来自 `@vben/common-ui`),**不要用原生 ``** +- 页面外壳统一用 `` 组件(来自 `@vben/common-ui`) +- HTTP 请求统一用 `requestClient`(来自 `#/api/request`),**禁止直接 axios / fetch** +- 行操作和工具栏按钮统一用 `` 组件(来自 `#/components/table-action`) +- 业务选择器(员工、医生、门店、推广员、地区等)必须复用 `#/components/form/components/*-picker.vue`,不要重写 + +## API 层规范 + +- API 文件统一放在 `<模块>/api/index.ts` +- 函数命名约定:`get{Entity}List` / `get{Entity}Option` / `get{Entity}Info` / `create{Entity}` / `update{Entity}` / `delete{Entity}` +- URL 使用 kebab-case,统一前缀变量 `const prefix = 'xxx/'`,**URL 末尾不补 `/`** +- GET 用 `params`,POST 用 `data`,例如: + + ```ts + import { requestClient } from '#/api/request'; + const prefix = 'oa-robot/'; + export async function getOaRobotList(data: any) { + return requestClient.get(`${prefix}list`, { params: data }); + } + ``` + +## 字段命名对齐后端 + +- 数据库字段在前端 schema 的 `field` / `fieldName` 中保持 snake_case(如 `created_at`、`store_id`、`platform_code`),**不要转换为 camelCase** +- 时间戳字段(`created_at` 等)后端查询器已格式化为字符串,前端**无需再次格式化** +- TS 变量用 camelCase,常量用 UPPER_SNAKE_CASE,类型用 PascalCase + +## 表单校验 + +- 必填用字符串规则 `rules: 'required'`(选择项用 `'selectRequired'`),规则定义在 `#/adapter/form.ts` 的 `defineRules` +- 校验调用统一用 `formApi.validate().then(e => { if (e.valid) {...} })` +- 必填字段在 schema 中加 `rules: 'required'`,禁止散落 `validator` 写法 + +## 字典/枚举管理 + +- 模块内建 `config/constants.ts`,导出 `{ label, value }[]` 数组,禁止在 schema 中散落字面量 +- 例如: + + ```ts + export const OA_MESSAGE_TYPE_OPTIONS = [ + { label: '文本', value: 'text' }, + { label: 'Markdown', value: 'markdown' }, + ]; + ``` + +## 路由规范 + +- 业务路由通过后端动态菜单驱动(`xk_menu` 表),**不要在前端 `router/routes/modules/` 静态注册业务路由** +- `defineOptions({ name: 'PascalCaseName' })` 必须与 `xk_menu.name` 字段一致 + +## Tab 用法 + +- 统一用 antd 原生 `Tabs` + `Tabs.TabPane`,**不要找 Vben 自封装的 Tabs** +- Tab 选中状态持久化走 `localStorage`(参考 `system-config/index.vue` 的 `TAB_STORAGE_KEY` 模式) + +## 抽屉用法(小程序端,admin 不涉及) + +- 小程序端的抽屉用 `page-container` + `v-if`(不是 `v-show`)防止用户意外退出页面 + +## 中文注释 + +- 每个 ` + + + + diff --git a/apps/web-antd/src/components/oa-template-card-editor/Canvas.vue b/apps/web-antd/src/components/oa-template-card-editor/Canvas.vue new file mode 100644 index 00000000..eb27ab54 --- /dev/null +++ b/apps/web-antd/src/components/oa-template-card-editor/Canvas.vue @@ -0,0 +1,337 @@ + + + + + diff --git a/apps/web-antd/src/components/oa-template-card-editor/JsonPreview.vue b/apps/web-antd/src/components/oa-template-card-editor/JsonPreview.vue new file mode 100644 index 00000000..2df675c7 --- /dev/null +++ b/apps/web-antd/src/components/oa-template-card-editor/JsonPreview.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/apps/web-antd/src/components/oa-template-card-editor/PropertyPanel.vue b/apps/web-antd/src/components/oa-template-card-editor/PropertyPanel.vue new file mode 100644 index 00000000..1415a3bb --- /dev/null +++ b/apps/web-antd/src/components/oa-template-card-editor/PropertyPanel.vue @@ -0,0 +1,372 @@ + + +