Compare commits

...

151 Commits

Author SHA1 Message Date
YunaiV 06ea290306 (〃'▽'〃) v2025.09 发布:新增 AI 支持联网搜索、推理、文件/图片、MCP 等功能,完善 IoT 场景联动 2025-08-31 11:38:45 +08:00
xingyu 8e4f52c8aa
!207 fix: bugs
Merge pull request !207 from xingyu/dev
2025-08-26 09:14:39 +00:00
xingyu4j 433d12ed35 fix: bugs 2025-08-26 17:13:27 +08:00
xingyu4j f317508d39 fix: build bugs 2025-08-26 17:07:27 +08:00
xingyu4j b55c291af1 Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev 2025-08-26 16:57:32 +08:00
jason 9301962e12 fix: 去掉 console 打印 2025-08-26 08:50:24 +00:00
jason 367a5b9924 fix: [BPM 工作流] 流程表单字段解析调整为使用库解析 2025-08-26 08:50:24 +00:00
XuZhiqiang bc2b71baa3 !205 feat(@vben/web-antd): erp 模块除去收款单和付款单功能基本完成
* fix(@vben/web-antd): erp 解决冲突
* fix(@vben/web-antd): erp 更新采购和销售退货表单,修复关联订单选择功能不统一详细可编辑的问题,统一文件名称格式
* feat(@vben/web-antd): erp-finance-account 新增结算账户管理功能,包括表单、列表及相关操作
* feat(@vben/web-antd): erp-sale-return 新增销售退货管理功能,包括退货列表、表单及相关操作
* feat(@vben/web-antd): erp-sale-out 新增销售出库管理功能,包括出库列表、表单及相关操作
* feat(@vben/web-antd): erp-sale-order 新增销售订单管理功能,包括订单列表、表单及相关操作
* feat(@vben/web-antd): erp-sale-customer 新增客户管理功能,包括客户表单、列表及相关操作
* feat(@vben/web-antd): erp-purchase-return 新增采购退货管理功能,包括表单、列表及相关操作
* feat(@vben/web-antd): erp-purchase-in 新增采购入库管理功能,包括表单、列表及相关操作
* feat(@vben/web-antd): erp-stock-check 新增库存盘点单管理功能,包括表单、列表及相关操作
* feat(@vben/web-antd): erp-stock-move 新增库存调拨单管理功能,包括表单、列表及相关操作
* feat(@vben/web-antd): erp-stock-out 新增其它出库单管理功能,包括表单、列表及相关操作
* fix(@vben/web-antd): erp-stock-in 修复提交表单时清空产品项 ID,确保请求成功不报row_xxx报错
2025-08-26 08:40:01 +00:00
Ken Hai b0d7b177be
fix: 角色管理,授权的树形组件,取消勾选叶子节点,父级节点状态错误 (#6680)
Co-authored-by: haiyinlong <haiyinlong@uhigame.com>
2025-08-25 21:32:01 +08:00
LinaBell 566d3bdf7c
fix: appendToMain warning (#6684) 2025-08-25 21:25:29 +08:00
螃蟹 adbf793e79
fix(@vben/web-ele): the main color tone for switching between dark and light themes has been reset (#6678) 2025-08-25 11:03:54 +08:00
LinaBell cf6c4c9aae
fix: cannot read properties of null (reading 'nextSibling') (#6667) 2025-08-21 22:26:10 +08:00
Ken Hai ffaf85c8f3
fix: 修复角色修改时VbenTree组件没有回显选中 (#6662)
* fix: 修复角色修改时VbenTree组件没有回显选中

* chore: use nextTick

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: merge

* chore: 更新

---------

Co-authored-by: haiyinlong <haiyinlong@uhigame.com>
Co-authored-by: Jin Mao <50581550+jinmao88@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-08-21 15:30:58 +08:00
panda7 2cc78f925f
fix: the bug in the lock method of the vbenModal component (#6648) 2025-08-21 15:17:55 +08:00
ming4762 93f0eea4e7
fix: fix the issue of excessive line spacing in vbenForm (#6653)
* gap-2和 pb-4/2 重叠导致间距过宽,gap-x只保留列间距
2025-08-21 12:41:04 +08:00
xingyu 4af5931e92
!203 增加表单就绪状态,让表单数据先于form-create渲染,解决发起流程时表单事件不触发问题
Merge pull request !203 from 崔什么/master
2025-08-21 02:10:28 +00:00
yu.cui 80e0d05f4e 增加表单就绪状态,让表单数据先于form-create渲染,解决发起流程时表单事件不触发问题 2025-08-20 17:39:01 +08:00
YunaiV 8e372fa7da feat:【system 系统管理】租户管理时,支持填写多个域名 websites 2025-08-19 23:00:50 +08:00
YunaiV 3b2b0d5438 feat:【system 系统管理】租户管理时,支持填写多个域名 websites 2025-08-19 22:59:07 +08:00
xingyu fb8179fef2
!202 docs: update deps
Merge pull request !202 from xingyu/dev
2025-08-19 09:47:11 +00:00
xingyu4j ebac48524d docs: update deps 2025-08-19 17:46:25 +08:00
xingyu 807451bf2a
!201 update vben 5.5.9
Merge pull request !201 from xingyu/dev
2025-08-19 09:45:44 +00:00
xingyu4j 8fdbbfad22 Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev 2025-08-19 17:41:16 +08:00
xingyu4j 1d5bfaac5a Merge branch 'master' of https://gitee.com/yudaocode/yudao-ui-admin-vben into dev 2025-08-19 17:34:00 +08:00
xingyu f5d9d7596a
!200 fix: 修改Api日志界面打开后关不掉的问题
Merge pull request !200 from 痴货/master
2025-08-19 09:28:21 +00:00
谦元吉 58e3941810
chore(docs): update the component import of the form adapter description in the document (#6656) 2025-08-19 16:48:10 +08:00
Svend 3ad433a50b
fix: 修复在 hash 路由模式下无法在新窗口打开路由的问题 (#6652)
此问题是由于 PR #6583 中新增的 `resolveHref` 函数导致的。其在 hash 路由模式下,得到的 URL 会包含 #/ 前缀。在经过 openRouteInNewWindow 的逻辑后就会出现两次 /# 前缀
2025-08-19 16:47:45 +08:00
ming4762 8ac2db5b7c
fix: fix the issue of `VbenForm` `compact` reactive failure (#6654) 2025-08-19 16:46:14 +08:00
Elm1992 a441dcebae fix: meta.link invalid issue 2025-08-19 16:40:16 +08:00
吃货 b546ea8720 refactor(infra): 调整 API 错误日志页面组件导入顺序
- 将 Textarea 组件的导入顺序提前- 优化组件导入的组织结构
2025-08-19 11:01:33 +08:00
吃货 90895db1e7 fix: 修改Api日志界面打开后关不掉的问题
BUG连接:https://gitee.com/yudaocode/yudao-ui-admin-vben/issues/ICT6PI
2025-08-19 10:56:37 +08:00
YunaiV 2dfa34d096 feat:【infra 基础设施】文件配置时,增加“公开访问” 2025-08-18 00:00:04 +08:00
Vben ff4704d5ea
chore: Upgrade vite to version 7.x (#6645) 2025-08-16 22:50:31 +08:00
菠萝吹雪 6ddfbd84b0
chore: modify the contributor showcase in the README (#6636) 2025-08-16 22:47:08 +08:00
ming4762 1e6417f95b
feat: vBenForm add layout: inline (#6644) 2025-08-16 22:41:08 +08:00
vben e147a9d2fd chore: release 5.5.9 2025-08-16 22:16:02 +08:00
XuZhiqiang cb1b441f7b !199 feat(@vben/web-antd): erp-stock-out 新增其它出库单管理功能,包括表单、列表及相关操作
* feat(@vben/web-antd): erp-stock-out 新增其它出库单管理功能,包括表单、列表及相关操作
* fix(@vben/web-antd): erp-stock-in 修复提交表单时清空产品项 ID,确保请求成功不报row_xxx报错
2025-08-16 13:14:38 +00:00
芋道源码 43c8ce2d7d
!194 refactor: (web-ele)优化移动端组件代码结构
Merge pull request !194 from 痴货/master
2025-08-16 13:12:10 +00:00
YunaiV 271546a98b feat:【framework 框架】增加 api 加解密能力(默认登录先不加密,避免大家不理解) 2025-08-16 17:20:59 +08:00
YunaiV 4be6d26375 feat:【framework 框架】增加 api 加解密能力(优化代码) 2025-08-16 17:20:45 +08:00
YunaiV 2920dabb99 feat:【framework 框架】增加 api 加解密能力 2025-08-16 17:09:08 +08:00
xingyu 5b50a91529
!198 feat(@vben/web-antd): erp-product 新增产品管理功能,包括表单、列表及相关操作
Merge pull request !198 from XuZhiqiang/feat-erp
2025-08-15 10:47:54 +00:00
xingyu f0e09f78e8
!195 feat:Tinyflow因大小写导致的引用问题
Merge pull request !195 from Codingendless/master
2025-08-15 10:46:38 +00:00
xuzhiqiang 133f90f34e fix(@vben/web-antd): erp-purchase-order修复新增采购订单时的报错,清除项的 ID 2025-08-15 09:40:34 +08:00
谦元吉 4efebb8c0b
fix:update (#6635) 2025-08-14 22:01:12 +08:00
gxc685 9ce0df88ae
fix: 修复mock里面eventHandler重复导致无法启动 (#6631) 2025-08-14 22:00:54 +08:00
xuzhiqiang 5076e3ff72 feat(@vben/web-antd): erp-product 新增产品管理功能,包括表单、列表及相关操作 2025-08-14 16:17:05 +08:00
xuzhiqiang 7fb9f6e064 feat(@vben/web-antd): erp-product-unit 新增产品单位管理功能,包括表单、列表及相关操作 2025-08-14 16:16:34 +08:00
xuzhiqiang 2a655a04c9 fix(@vben/web-antd): erp-product-category移除erp产品分类未使用的复选框处理逻辑,简化代码 2025-08-14 14:56:39 +08:00
xuzhiqiang 5eaeab0cff feat(@vben/web-antd): 新增产品分类表单和列表功能,优化产品分类接口 2025-08-14 14:33:42 +08:00
谦元吉 3cf0c0eb04
fix(@vben/backend-mock): go back to the last modification (#6634)
* fix(@vben/backend-mock): the version went back to the last submission, and the latest submission was completely useless.

* fix: resolve conflicts
2025-08-14 12:06:41 +08:00
Codingendless 0c371a78dc feat:Tinyflow因大小写导致的引用问题 2025-08-14 00:02:39 +08:00
谦元吉 ab7e363279
fix(@vben/backend-mock): fix all ts type errors in this module (#6613)
* fix(@vben/backend-mock): 修复所有 ts 类型报错

* fix(@vben/backend-mock): 修复该模块所有 ts 类型报错

* fix(@vben/backend-mock): 解决 coderabbitai

* fix(@vben/backend-mock): 解决 coderabbitai

* fix(@vben/backend-mock): 解决 coderabbitai
2025-08-12 17:23:39 +08:00
吃货 218f28f35c refactor: (web-ele)优化移动端组件代码结构
-调整组件内元素的排列顺序
- 修复部分组件的样式问题
- 优化代码结构,提高可维护性
2025-08-10 21:18:00 +08:00
吃货 b8c66b23f9 refactor: (ele,diy-editor)重构组件库结构和功能
- 新增 ComponentContainer、ComponentContainerProperty、ComponentLibrary 组件
- 优化导航栏单元格属性组件,更名为 CellProperty
- 更新优惠券相关组件导出方式
- 删除旧版 ComponentContainer 组件
2025-08-10 21:17:03 +08:00
吃货 d7397f28a0 Merge branch 'masterApiTreeSelect' 2025-08-10 16:42:57 +08:00
芋道源码 9cac5a2937
!193 修复批量删除后 checkedIds 未重置的问题
Merge pull request !193 from puhui999/dev
2025-08-09 07:15:42 +00:00
puhui999 8eae74879b fix(@vben/web-ele): 修复批量删除后 checkedIds 未重置的问题 2025-08-09 12:14:19 +08:00
puhui999 ccf9c3fd53 fix(@vben/web-antd): 修复批量删除后 checkedIds 未重置的问题 2025-08-09 12:10:10 +08:00
xingyu 6c425b4dbc
!192 feat: BUG[Bug]: ele 版本 ApiTreeSelect 无法选择非末级 https://gitee.com/yudaoco
Merge pull request !192 from 痴货/masterApiTreeSelect
2025-08-08 05:49:03 +00:00
xueyang 9fc594434f
perf: 优化useVbenForm样式 (#6611)
* perf(style): 优化useVbenForm垂直布局 actions 样式

* perf(style): 优化useVbenForm actions 布局样式

- 操作按钮组显示位置
```
actionPosition?: 'center' | 'left' | 'right';
```
- 操作按钮组的样式
```
actionType?: 'block' | 'inline'
inline: 行类显示,block: 新一行单独显示
```

* perf: 优化useVbenForm actions 布局样式

删除 actionType
增加 actionLayout
- actionLayout?: 'inline' | 'newLine' | 'rowEnd';
- newLine: 在新行显示。rowEnd: 在行内显示,靠右对齐(默认)。inline: 使用grid默认样式
- 删除无用代码 queryFormStyle

* perf: 优化useVbenForm使用案例

* perf: 优化form组件样式

去掉padding,改为gap

* docs: update vben-form.md

* fix: 修复FormMessage位置

* perf: Avoid direct mutation of props object.

-  props.actionLayout = props.actionLayout || 'rowEnd';
-  props.actionPosition = props.actionPosition || 'right';
+  const actionLayout = props.actionLayout || 'rowEnd';
+  const actionPosition = props.actionPosition || 'right';

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: 修复 wrapperClass 权重

* fix: 全局搜索结果不匹配 #6603

* fix: 避免FormMessage溢出

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-08-07 23:48:34 +08:00
吃货 63ce6f5669 feat: BUG[Bug]: ele 版本 ApiTreeSelect 无法选择非末级 https://gitee.com/yudaocode/yudao-ui-admin-vben/issues/ICGUVV
在菜单数据配置中添加 checkStrictly 属性,设置为 true,可以选择任何节点数据。
2025-08-07 21:10:39 +08:00
xingyu4j 9ef75f4fbe fix: JsonViewer 2025-08-06 15:36:02 +08:00
xingyu ce1f3735ad
!191 Merge remote-tracking branch 'yudao/dev' into dev
Merge pull request !191 from Jason/dev
2025-08-06 03:30:54 +00:00
jason 07d15f5c88 Merge remote-tracking branch 'yudao/dev' into dev 2025-08-05 23:01:03 +08:00
jason 849f2becd8 feat: [BPM 工作流] Simple 模型新增跳过表达式 2025-08-05 22:58:11 +08:00
YunaiV d48b78a462 feat:【system 系统功能】邮箱增加抄送、密送,支持多个 2025-08-05 22:23:29 +08:00
jason 8e4ea3ca44 fix: [BPM 工作流] 更多设置表单选项问题修复 2025-08-05 22:11:21 +08:00
YunaiV 55061b73de feat:【system 系统功能】邮箱增加抄送、密送,支持多个 2025-08-05 21:45:23 +08:00
lrl 73bddd119e style: (web-ele)优化多个组件的样式和布局
-调整图像上传组件的样式,优化上传区域和处理按钮的布局
- 改进魔方编辑器组件的样式,统一边框和对齐方式
-统一垂直按钮组组件的样式,修复按钮圆角问题
2025-08-05 15:34:25 +08:00
lrl e7fc44715b feat: (web-ele)新增颜色输入框组件并优化图片上传组件
- 新增 ColorInput 组件用于颜色选择
- 重构 ImageUpload 组件,增加编辑和删除功能
- 更新 DIY 编辑器相关组件,优化用户体验
- 添加商城 H5 预览地址配置
- 优化导航栏单元格属性配置
2025-08-05 15:32:12 +08:00
YunaiV 6d99bf3a46 review:【erp 系统】purchase/order 的管理 2025-08-04 22:42:59 +08:00
xingyu 02f1bd3251
!190 fix: 优化角色菜单表单加载逻辑,移除重复的菜单列表加载调用,确保在打开模态框时正确加载菜单数据。
Merge pull request !190 from xingyu/dev
2025-08-04 11:23:08 +00:00
xingyu4j 9a305e6cbd fix: 优化角色菜单表单加载逻辑,移除重复的菜单列表加载调用,确保在打开模态框时正确加载菜单数据。 2025-08-04 19:12:51 +08:00
xingyu4j 990ae4463a fix: types 2025-08-04 18:43:33 +08:00
xingyu 3f1c3a283f
!189 !188 feat(@vben/web-antd): vxe-table) 其他入库模块、简单验证样式
Merge pull request !189 from xingyu/dev
2025-08-04 10:30:33 +00:00
xingyu 229a6f017a
!187 update apps/web-ele/src/views/system/user/data.ts.
Merge pull request !187 from 青木/N/A
2025-08-04 09:58:23 +00:00
xingyu 93290bf441
!188 feat(@vben/web-antd): vxe-table) 其他入库模块、简单验证样式
Merge pull request !188 from 陈賝/dev
2025-08-04 09:57:54 +00:00
nehc c64be886b4 feat(@vben/web-antd): vxe-table)新增表单验证功能
- 在 vxe-table.ts 中添加 createRequiredValidation函数
- 在 data.ts 中使用 createRequiredValidation 替代原有的 className 函数
- 在 vxe-table 插件中添加 validation 相关的工具函数
- 优化表格列的验证逻辑,提高代码复用性和可维护性
2025-08-04 09:22:51 +08:00
nehc 5f56b14733 feat(@vben/web-antd): 验证样式
- 添加 isValidating 状态管理,用于控制验证过程
- 在表格列定义中增加验证错误样式
- 实现必填字段错误提示功能
- 优化表格渲染逻辑,确保验证错误及时显示
- 新增相关 CSS 样式,定义验证错误的视觉效果
2025-08-04 09:22:51 +08:00
nehc 9d80b9fc71 feat(@vben/web-antd): erp-stock-in 优化入库单产品清单组件 2025-08-04 09:22:51 +08:00
nehc 1433a0980d feat(@vben/web-antd): erp-stock-in 优化入库单产品清单组件
- 移除了 totalCount 和 totalPrice 的计算逻辑
- 调整了添加产品的按钮位置
- 为表格底部的单元格添加了自定义样式
- 简化了组件的 props 接口
2025-08-04 09:22:51 +08:00
nehc 3afd957713 feat(@vben/web-antd): erp-stock-in 优化库存入库模块
- 为表格列设置 minWidth 以优化布局
- 使用 Popconfirm组件替代 Modal 确认框
- 通过 message 组件展示操作结果
- 优化删除和审核操作的处理流程
- 引入 useVbenModal 优化表单弹窗
2025-08-04 09:22:51 +08:00
nehc 510ec12582 feat(@vben/web-antd): erp-stock-in 添加其它入库单功能
- 新增其它入库单列表页面
- 实现其它入库单的创建、编辑和删除功能
- 添加产品清单管理功能
- 集成供应商、产品和仓库的选择接口
- 优化表格展示和搜索功能
2025-08-04 09:22:51 +08:00
nehc 2e6575f368 feat(@vben/web-antd): erp-stock-record 添加产品库存明细管理功能
- 实现了产品库存明细的查询、导出功能
- 添加了搜索表单和列表展示
- 集成了仓库和产品选择器
- 使用了 VxeTable 组件
2025-08-04 09:22:51 +08:00
nehc 8d660404dc feat(@vben/web-antd): erp-stock-stock 实现产品库存管理功能
- 新增产品库存管理页面,包括库存列表和搜索功能
- 添加导出库存数据功能
- 集成 API 接口和数据处理逻辑
- 优化页面布局和组件使用
2025-08-04 09:22:50 +08:00
lrl 1f155fa7c5 feat: (web-ele)创建 DIY编辑器组件
- 新增 DIY 编辑器组件主入口文件
- 创建移动端组件索引文件
2025-08-04 09:11:58 +08:00
lrl 2166ce3e4e feat: 新增多个组件并优化优惠券相关功能
- 新增 AppLinkSelectDialog 组件,用于选择 APP 链接- 新增 NavigationBarCellProperty组件,用于导航栏单元格属性设置
- 新增 CombinationShowcase 和 CombinationTableSelect 组件,用于拼团活动展示和选择- 优化优惠券相关组件,导出所有优惠券相关组件
- 新增 ComponentContainer 组件,用于包裹和样式化 DIY 组件
2025-08-04 09:09:39 +08:00
青木 ec14751aeb
update apps/web-ele/src/views/system/user/data.ts.
对应ele的 vxe-table的activeValue: 1,inactiveValue: 0

Signed-off-by: 青木 <720227+9mgps@user.noreply.gitee.com>
2025-08-03 13:28:05 +00:00
芋道源码 aa6639a108
!185 refactor: (web-ele)优化多个组件的删除操作和确认逻辑
Merge pull request !185 from 痴货/master
2025-08-03 12:12:53 +00:00
YunaiV 32ee1b11ec feat:【bpm 工作流】审批人自选时,相同节点共享数据 2025-08-02 22:25:30 +08:00
YunaiV 2c687266b2 feat:【BPM 工作流】增加审批人撤销的能力 2025-08-02 16:25:06 +08:00
lrl 38daaa2934 refactor: (web-ele)优化多个组件的删除操作和确认逻辑
- 将 ElMessageBox 替换为自定义 confirm 函数- 添加全局 loading 功能
- 优化错误处理和消息提示- 调整部分组件属性和样式
2025-08-01 13:56:55 +08:00
xingyu 5a31e80c2d
!184 feat(@vben/web-antd): erp-stock-warehouse 仓库列表管理
Merge pull request !184 from 陈賝/dev
2025-07-31 07:04:35 +00:00
xingyu ff62e4c368
!183 feat(@vben/web-antd): erp-purchase-supplier-优化采购订单导出功能并添加供应商管理权限控制
Merge pull request !183 from 陈賝/dev
2025-07-31 02:47:33 +00:00
nehc 8d17d8d915 feat(@vben/web-antd): erp-stock-warehouse 修复仓库列表的状态切换功能
- 将默认状态切换逻辑从组件模板移到单独的函数中
- 使用 confirm 对话框替代 message.confirm
- 优化了默认状态切换的用户体验和错误处理
- 引入了 Promise 机制,允许异步操作
2025-07-30 17:42:50 +08:00
nehc 787f5168ad feat(@vben/web-antd): erp-stock-warehouse 新增仓库管理功能
- 添加仓库管理相关的数据结构和 API 接口
- 实现仓库列表展示、搜索、添加、编辑和删除功能
- 添加仓库默认状态切换和导出功能
- 优化表格展示效果,固定操作列
- 移除不必要的按钮和链接
2025-07-30 16:48:52 +08:00
nehc 423bfffbea feat(@vben/web-antd): erp-purchase-supplier-优化采购订单导出功能并添加供应商管理权限控制
- 在供应商管理页面添加权限控制:
  - 创建供应商
  - 导出供应商信息
  - 编辑供应商
  - 删除供应商
2025-07-30 15:40:34 +08:00
nehc 33cec7caee feat(@vben/web-antd): erp-purchase-supplier-供应商管理页面
- 移除状态字段,增加联系电话字段
- 调整供应商列表的展示逻辑
- 优化搜索和导出功能
- 使用 useVbenVxeGrid 替代原有的表格实现
- 用 downloadFileFromBlobPart 处理文件下载
2025-07-30 15:40:33 +08:00
nehc 93c0d9e486 feat(@vben/web-antd): erp-purchase-supplier-添加供应商管理功能
- 新增供应商管理页面,包括搜索、列表、新增、编辑和删除功能
- 实现供应商数据的分页查询、导出功能
- 使用 Vben Form 和 Vxe Table 组件构建表单和表格
- 添加国际化支持
2025-07-30 15:40:33 +08:00
xingyu4j 8b89a32813 Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev 2025-07-29 15:21:32 +08:00
leo b93e22c45a
fix(@vben/layouts): respect base URL when opening route in new window (#6583)
Previously, the generated URL for opening routes in a new window did not include the router base,
which led to incorrect paths when the app was deployed under a subdirectory (e.g., /admin/).
This change ensures that the resolved path includes the configured base by using
router.resolve(path).href.
2025-07-29 13:46:05 +08:00
xingyu 0694eb2b29
!181 feat(@vben/web-antd): erp-优化采购订单功能
Merge pull request !181 from 陈賝/dev
2025-07-28 10:04:42 +00:00
Jin Mao 193f5b6512
Merge branch 'main' into 2025072604 2025-07-28 15:53:04 +08:00
Jin Mao cb3f96683f fix: 修复双列布局模式下,路由为hideInMenu时,空白右列 2025-07-28 15:50:21 +08:00
nehc b3942bb8ff feat(@vben/web-antd): erp-移除重复接口
-移除了 stock API 中的 getStockCountByProductId 函数
-将 getStockCount 函数的使用范围从 product 模块扩展到 purchase 模块
- 更新了 PurchaseOrderItemForm 组件中的库存查询逻辑
2025-07-28 14:45:47 +08:00
nehc b3a2d29a3b feat(@vben/web-antd): erp-优化采购订单功能
- 移除采购订单明细项表单配置
- 调整采购订单表格列定义
- 优化采购订单删除操作,增加加载提示和错误处理
- 添加采购订单详情页面
- 重新计算采购订单项的价格字段
- 调整采购订单状态更新和删除的交互方式,增加二次确认
2025-07-28 14:04:00 +08:00
nehc f242f1c37d feat(@vben/web-antd): erp-优化上传附件及验证
- 修改订单时间格式为 timestamp
- 限制文件上传数量为 1
- 调整表格列宽和显示逻辑
- 优化子表单验证和提交逻辑
- 修复文件上传组件的兼容性问题
- 优化产品清单的初始化和验证
2025-07-26 17:36:59 +08:00
zhongming4762 06ffdf164a feat: add dingding login 2025-07-25 22:02:55 +08:00
ming4762 5b75e5e917
perf: perf the control logic of `VbenModal` full screen and header (#6566)
* resolve the issue of header=false and full screen button display but not operable
2025-07-25 21:45:45 +08:00
aonoa fad0b49841
fix: adding roles does not automatically refresh (#6548)
* fix: adding roles does not automatically refresh

* style: fix code style err
2025-07-25 21:35:57 +08:00
Jin Mao 260e45cd7b
Merge branch 'main' into feat/add-vben-modal-animation 2025-07-25 21:33:11 +08:00
nehc 8a7239ce24 feat(@vben/web-antd): erp-采购订单表单逻辑
- 使用 handleValuesChange
- 优化 discountPrice 和 totalPrice 的计算逻辑
- 改进子表单的验证和数据处理
- 统一数值格式化处理
- 优化表格数据的更新方式
2025-07-25 19:21:33 +08:00
nehc e319888240 feat(@vben/web-antd): erp-优化采购订单表单布局和功能
- 添加订单单号字段并设置为只读
- 将附件上传组件替换为 FileUpload
- 新增产品清单字段
- 调整表单项的布局和样式
- 优化订单产品清单的展示方式
2025-07-25 19:21:32 +08:00
nehc 83010b6590 style(@vben/web-antd): erp-优化采购订单表单样式
- 更新 Tab 卡片样式,使用 border 和 bg-card 类
- 修改合计行样式,使用 rounded、border、bg-muted 和 text-muted-foreground 类
- 调整字体颜色,使用 text-foreground 类
2025-07-25 19:21:32 +08:00
nehc a24f08cbb0 feat(@vben/web-antd): erp-采购订单明细表
- 使用 useVbenVxeGrid 重构
2025-07-25 19:21:31 +08:00
nehc f9407ca8bc feat(@vben/web-antd): erp-采购订单明细表
- 优化了产品变更、价格计算和表单验证逻辑
- 更新了表格列定义和单元格模板
- 删除了冗余的组件挂载逻辑
2025-07-25 19:21:31 +08:00
nehc 7c2c249e5d feat(@vben/web-antd): erp-重构采购订单模块
- 更新表单组件,使用已有的 VbenForm 组件
- 优化表单字段定义,使用 useFormSchema 函数统一管理
- 重构表格组件,使用 VxeTable
- 优化数据处理逻辑,提高代码复用性和可维护性
- 调整界面布局和样式,提升用户体验
2025-07-25 19:21:31 +08:00
nehc 1cad71f3bf feat(@vben/web-antd): erp-区分采购对象
- 修改命名空间 PurchaseOrderApi 为 ErpPurchaseOrderApi
- 为接口属性添加注释,明确其含义和单位
- 更新相关视图和组件中的导入和使用
2025-07-25 19:21:31 +08:00
nehc 0b47648650 feat(@vben/web-antd): erp-添加采购订单功能
- 新增采购订单列表页面
- 添加采购订单表单和子表单组件
- 实现采购订单的查询、创建、编辑和删除功能
- 优化采购订单的审批和反审批操作- 增加采购订单的导出功能
2025-07-25 19:21:30 +08:00
YunaiV f14954f7e2 fix:【BPM 工作流】流程预测时,“查看子流程”按钮不支持点击 2025-07-25 06:13:35 +00:00
nehc 7526ff5b87 refactor(@vben/web-antd): 移除 CardTitle 组件
移除了 CardTitle 组件及相关样式,直接使用 <span> 标签展示标题。
受影响的主要文件:
- 删除了 card-title.vue 文件
- 更新了 SummaryCard 组件的标题展示方式
- 修改了 TimeSummaryChart组件,用 <span> 替代 CardTitle 组件
2025-07-25 06:13:35 +00:00
nehc b41ac68e06 refactor(@vben/web-antd): ERP 首页适配已有组件
- 移除不必要的 API 调用和数据处理逻辑
- 使用 AnalysisOverview 组件替换自定义统计卡片
- 优化 TimeSummaryChart组件,支持不同类型的数据展示
- 简化页面结构,提高组件的可复用性和可维护性
2025-07-25 06:13:35 +00:00
nehc dcffb9bbe3 feat(@vben/web-antd): 新增 CardTitle组件并优化 TimeSummaryChart
- 新增 CardTitle 组件用于统一卡片标题样式
- 在 TimeSummaryChart 中使用 CardTitle 组件替代原生标题
- 调整 EchartsUI 组件的 height 属性单位
2025-07-25 06:13:35 +00:00
nehc f763ad2855 feat(@vben/web-antd): 新增 ERP API 接口并符合 Vben 项目标准
- 将所有 ERP API 文件从旧的 axios 配置迁移到新的 requestClient
- 使用 namespace 组织接口类型定义,提高代码可维护性
- 将对象方法改为独立的导出函数,符合现代 JavaScript 最佳实践
- 为所有 API 函数添加完整的 TypeScript 类型定义
- 统一分页查询参数和状态更新参数的接口定义
- 涵盖财务、采购、销售、库存等所有 ERP 业务模块
2025-07-25 06:13:35 +00:00
YunaiV 7b7402b986 review:【BPM 工作流】模型分类内,排序不正确的问题 2025-07-25 06:13:35 +00:00
YunaiV 7b06bd27b3 fix:【BPM 工作流】工作流模型维护时,key 缺少参数校验 2025-07-25 06:13:35 +00:00
YunaiV e6f4cf5660 review:【ANTD】相关的代码 2025-07-25 06:13:35 +00:00
xingyu c447145d62
!180 refactor: 重构authLogin代码逻辑
Merge pull request !180 from 痴货/master
2025-07-23 07:41:44 +00:00
芋道源码 27ad777c2c
!179 fix: 删除china2相关的地图json
Merge pull request !179 from 痴货/master
2025-07-23 05:08:38 +00:00
lrl 347f0ab852 refactor: 重构authLogin代码逻辑 2025-07-23 11:23:00 +08:00
lrl df3215fef1 fix: 删除china2相关的地图json 2025-07-23 11:07:19 +08:00
lrl 992f0bd2f0 refactor: 重构商场首页和统计页面组件
- 新等组件
- 优化 Work增 AnalysisOverview、AnalysisOverviewIconbenchQuickDataShow 组件的使用
- 更新图标使用方式,移除自定义 SVG 图标
-提升页面视觉效果 调整布局和样式,
2025-07-23 10:51:13 +08:00
xingyu 4797791935
!177 fix: (system): 修复VbenTree加载顺序问题
Merge pull request !177 from 简佳/master
2025-07-21 10:34:08 +00:00
7031dbebe6 fix: (system): 修复VbenTree加载顺序问题
- 调整了数据权限分配和菜单分配表单中的加载顺序
- 确保在设置表单值之前完成树形结构数据的加载
2025-07-21 14:27:34 +08:00
vben 1575619d53 chore: release v5.5.8 2025-07-19 22:19:50 +08:00
lrl 27a7e84def feat: 添加交易状况组件并优化统计数据展示,支持环比增长率显示 2025-07-18 15:06:27 +08:00
panda7 fc9ea347ca
Merge branch 'main' into feat/add-vben-modal-animation 2025-07-18 00:38:54 +08:00
panda7 1a9b0509d5 feat: add animation effects to VbenModal component 2025-07-18 00:15:40 +08:00
lrl a442eab9ea feat: 更新组件类型和统计数据展示
- 在组件类型中新增 'ApiCascader' 以支持更多业务需求
- 在商品统计概览中为多个统计项添加 tooltip,提供更清晰的数据解释
- 优化交易统计页面,重构数据加载逻辑,提升用户体验
2025-07-17 10:35:33 +08:00
lrl d2a2227c4c Merge remote-tracking branch 'remote/master'
# Conflicts:
#	packages/effects/plugins/src/echarts/use-echarts.ts
2025-07-17 10:09:54 +08:00
lrl 2cccbc949f fix: 修正商品统计数据赋值逻辑
- 更新商品统计组件中的数据赋值方式,确保正确映射到统计卡片
- 修复了浏览量、访客数、支付件数等多个统计项的数据来源,提升数据准确性
2025-07-17 09:55:11 +08:00
lrl 4620ede9b9 feat: 新增商品统计组件和优化数据处理逻辑
- 引入商品排行和商品概况组件,展示商品相关统计信息
- 更新商品统计 API,支持时间范围查询和数据格式化
- 优化数据加载逻辑,提升用户体验
- 添加日期范围选择器,增强统计数据的灵活性
2025-07-17 09:53:04 +08:00
lrl 73a73ac312 fix: 修复性别统计图表数据赋值逻辑
- 修正了性别统计卡片组件中性别统计数据的赋值方式
- 确保数据正确映射到图表选项中,提升数据展示的准确性
2025-07-16 16:15:26 +08:00
lrl b480eb54c1 feat: 新增会员统计组件和优化数据展示
- 在会员统计页面中新增会员地域分布和性别分布组件
- 更新会员统计 API,支持获取会员汇总和地区统计数据
- 优化数据加载逻辑,提升用户体验
- 引入分析概览组件以展示关键统计信息
2025-07-16 16:14:01 +08:00
lrl 380a24358c style: 更新会员漏斗卡片组件的样式
- 为 trapezoid 类添加 z-index 属性,确保层级关系正确
- 保持 margin-left 设置不变,优化了组件的视觉效果
2025-07-16 11:52:04 +08:00
lrl ff53153782 style: 优化会员漏斗卡片组件的样式和布局
- 调整了会员漏斗卡片组件的样式,简化了宽度设置
- 更新了 trapezoid 类的样式,移除了多余的 margin 和 font-size 设置
- 改善了组件的可读性和视觉效果
2025-07-16 11:49:27 +08:00
lrl 8c2f982ab6 feat: 更新日期格式化方法,新增多个统计卡片组件
- 将日期格式化方法从 formatDate 更新为 formatDate2,提升日期处理的灵活性
- 新增会员概览、用户统计、会员终端和交易量趋势等统计卡片组件
- 在商城首页引入新组件以展示关键会员和交易数据
- 优化数据获取逻辑,提升用户体验
2025-07-16 11:01:27 +08:00
lrl 5edccd3efe feat: 新增运营数据展示组件,优化商城首页数据处理逻辑
- 在商城首页引入 WorkbenchQuickDataShow 组件,展示关键运营数据
- 增加数据获取方法,包括订单、商品和钱包充值数据
- 更新 AnalysisOverview 组件以支持双向绑定
- 优化数据加载逻辑,提升用户体验
2025-07-15 15:49:48 +08:00
lrl e88c17f7e2 style: 格式化样式 2025-07-15 13:25:44 +08:00
lrl 6ce1363dea feat: 更新组件和API,优化数据处理逻辑
- 将 TreeSelect 组件的 fieldNames 属性更改为 props
- 更新商品分类API的请求路径
- 在多个模块中引入 ElMessageBox 以增强用户交互体验
- 新增售后管理和订单管理的详细视图组件
- 优化了多个表单组件的逻辑,提升了用户体验
2025-07-15 13:23:20 +08:00
551 changed files with 41497 additions and 4783 deletions

1
.gitignore vendored
View File

@ -49,3 +49,4 @@ vite.config.ts.*
*.sln
*.sw?
.history
.cursor

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -21,7 +21,8 @@
// CSS
"vunguyentuan.vscode-css-variables",
// package.json PNPM catalog
"antfu.pnpm-catalog-lens"
"antfu.pnpm-catalog-lens",
"augment.vscode-augment"
],
"unwantedRecommendations": [
// volar

View File

@ -41,24 +41,24 @@
| 框架 | 说明 | 版本 |
| --- | --- | --- |
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.13 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 6.2.5 |
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.17 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 7.1.2 |
| [Ant Design Vue](https://www.antdv.com/) | Ant Design Vue | 4.2.6 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.9.7 |
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.41.0 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.10.2 |
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.42.0 |
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 超集 | 5.8.3 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库替代 vuex5 | 2.3.1 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 12.8.2 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.1.3 |
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.5.0 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库替代 vuex5 | 3.0.3 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 13.4.0 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.1.7 |
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.5.1 |
| [Tailwind CSS](https://tailwindcss.com/) | 原子 CSS | 3.4.17 |
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.324 |
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.354 |
| [TinyMCE](https://www.tiny.cloud/) | 富文本编辑器 | 6.1.0 |
| [Echarts](https://echarts.apache.org/) | 图表库 | 5.6.0 |
| [axios](https://axios-http.com/) | http客户端 | 1.8.4 |
| [axios](https://axios-http.com/) | http客户端 | 1.10.0 |
| [dayjs](https://day.js.org/) | 日期处理库 | 1.11.13 |
| [vee-validate](https://vee-validate.logaretm.com/) | 表单验证 | 4.15.0 |
| [zod](https://zod.dev/) | 数据验证 | 3.24.2 |
| [vee-validate](https://vee-validate.logaretm.com/) | 表单验证 | 4.15.1 |
| [zod](https://zod.dev/) | 数据验证 | 3.25.67 |
## 🔥 后端架构

View File

@ -1,5 +1,7 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse } from '~/utils/response';
import { MOCK_CODES } from '~/utils/mock-data';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
export default eventHandler((event) => {
const userinfo = verifyAccessToken(event);

View File

@ -1,9 +1,15 @@
import { defineEventHandler, readBody, setResponseStatus } from 'h3';
import {
clearRefreshTokenCookie,
setRefreshTokenCookie,
} from '~/utils/cookie-utils';
import { generateAccessToken, generateRefreshToken } from '~/utils/jwt-utils';
import { forbiddenResponse } from '~/utils/response';
import { MOCK_USERS } from '~/utils/mock-data';
import {
forbiddenResponse,
useResponseError,
useResponseSuccess,
} from '~/utils/response';
export default defineEventHandler(async (event) => {
const { password, username } = await readBody(event);

View File

@ -1,7 +1,9 @@
import { defineEventHandler } from 'h3';
import {
clearRefreshTokenCookie,
getRefreshTokenFromCookie,
} from '~/utils/cookie-utils';
import { useResponseSuccess } from '~/utils/response';
export default defineEventHandler(async (event) => {
const refreshToken = getRefreshTokenFromCookie(event);

View File

@ -1,9 +1,11 @@
import { defineEventHandler } from 'h3';
import {
clearRefreshTokenCookie,
getRefreshTokenFromCookie,
setRefreshTokenCookie,
} from '~/utils/cookie-utils';
import { verifyRefreshToken } from '~/utils/jwt-utils';
import { generateAccessToken, verifyRefreshToken } from '~/utils/jwt-utils';
import { MOCK_USERS } from '~/utils/mock-data';
import { forbiddenResponse } from '~/utils/response';
export default defineEventHandler(async (event) => {

View File

@ -1,3 +1,7 @@
import { eventHandler, setHeader } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse } from '~/utils/response';
export default eventHandler(async (event) => {
const userinfo = verifyAccessToken(event);
if (!userinfo) {

View File

@ -1,5 +1,7 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse } from '~/utils/response';
import { MOCK_MENUS } from '~/utils/mock-data';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
export default eventHandler(async (event) => {
const userinfo = verifyAccessToken(event);

View File

@ -1,3 +1,6 @@
import { eventHandler, getQuery, setResponseStatus } from 'h3';
import { useResponseError } from '~/utils/response';
export default eventHandler((event) => {
const { status } = getQuery(event);
setResponseStatus(event, Number(status));

View File

@ -1,3 +1,4 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import {
sleep,

View File

@ -1,3 +1,4 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import {
sleep,

View File

@ -1,3 +1,4 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import {
sleep,

View File

@ -1,4 +1,5 @@
import { faker } from '@faker-js/faker';
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';

View File

@ -1,3 +1,4 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { MOCK_MENU_LIST } from '~/utils/mock-data';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';

View File

@ -1,6 +1,7 @@
import { eventHandler, getQuery } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { MOCK_MENU_LIST } from '~/utils/mock-data';
import { unAuthorizedResponse } from '~/utils/response';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
const namesMap: Record<string, any> = {};

View File

@ -1,6 +1,7 @@
import { eventHandler, getQuery } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { MOCK_MENU_LIST } from '~/utils/mock-data';
import { unAuthorizedResponse } from '~/utils/response';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
const pathMap: Record<string, any> = { '/': 0 };

View File

@ -1,4 +1,5 @@
import { faker } from '@faker-js/faker';
import { eventHandler, getQuery } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { getMenuIds, MOCK_MENU_LIST } from '~/utils/mock-data';
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';

View File

@ -1,6 +1,11 @@
import { faker } from '@faker-js/faker';
import { eventHandler, getQuery } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
import {
sleep,
unAuthorizedResponse,
usePageResponseSuccess,
} from '~/utils/response';
function generateMockDataList(count: number) {
const dataList = [];
@ -44,30 +49,69 @@ export default eventHandler(async (event) => {
await sleep(600);
const { page, pageSize, sortBy, sortOrder } = getQuery(event);
// 规范化分页参数,处理 string[]
const pageRaw = Array.isArray(page) ? page[0] : page;
const pageSizeRaw = Array.isArray(pageSize) ? pageSize[0] : pageSize;
const pageNumber = Math.max(
1,
Number.parseInt(String(pageRaw ?? '1'), 10) || 1,
);
const pageSizeNumber = Math.min(
100,
Math.max(1, Number.parseInt(String(pageSizeRaw ?? '10'), 10) || 10),
);
const listData = structuredClone(mockData);
if (sortBy && Reflect.has(listData[0], sortBy as string)) {
// 规范化 query 入参,兼容 string[]
const sortKeyRaw = Array.isArray(sortBy) ? sortBy[0] : sortBy;
const sortOrderRaw = Array.isArray(sortOrder) ? sortOrder[0] : sortOrder;
// 检查 sortBy 是否是 listData 元素的合法属性键
if (
typeof sortKeyRaw === 'string' &&
listData[0] &&
Object.prototype.hasOwnProperty.call(listData[0], sortKeyRaw)
) {
// 定义数组元素的类型
type ItemType = (typeof listData)[0];
const sortKey = sortKeyRaw as keyof ItemType; // 将 sortBy 断言为合法键
const isDesc = sortOrderRaw === 'desc';
listData.sort((a, b) => {
if (sortOrder === 'asc') {
if (sortBy === 'price') {
return (
Number.parseFloat(a[sortBy as string]) -
Number.parseFloat(b[sortBy as string])
);
const aValue = a[sortKey] as unknown;
const bValue = b[sortKey] as unknown;
let result = 0;
if (typeof aValue === 'number' && typeof bValue === 'number') {
result = aValue - bValue;
} else if (aValue instanceof Date && bValue instanceof Date) {
result = aValue.getTime() - bValue.getTime();
} else if (typeof aValue === 'boolean' && typeof bValue === 'boolean') {
if (aValue === bValue) {
result = 0;
} else {
return a[sortBy as string] > b[sortBy as string] ? 1 : -1;
result = aValue ? 1 : -1;
}
} else {
if (sortBy === 'price') {
return (
Number.parseFloat(b[sortBy as string]) -
Number.parseFloat(a[sortBy as string])
);
} else {
return a[sortBy as string] < b[sortBy as string] ? 1 : -1;
}
const aStr = String(aValue);
const bStr = String(bValue);
const aNum = Number(aStr);
const bNum = Number(bStr);
result =
Number.isFinite(aNum) && Number.isFinite(bNum)
? aNum - bNum
: aStr.localeCompare(bStr, undefined, {
numeric: true,
sensitivity: 'base',
});
}
return isDesc ? -result : result;
});
}
return usePageResponseSuccess(page as string, pageSize as string, listData);
return usePageResponseSuccess(
String(pageNumber),
String(pageSizeNumber),
listData,
);
});

View File

@ -1 +1,3 @@
import { defineEventHandler } from 'h3';
export default defineEventHandler(() => 'Test get handler');

View File

@ -1 +1,3 @@
import { defineEventHandler } from 'h3';
export default defineEventHandler(() => 'Test post handler');

View File

@ -1,5 +1,6 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse } from '~/utils/response';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
export default eventHandler((event) => {
const userinfo = verifyAccessToken(event);

View File

@ -1,5 +1,6 @@
import { eventHandler } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse } from '~/utils/response';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
export default eventHandler((event) => {
const userinfo = verifyAccessToken(event);

View File

@ -1,3 +1,4 @@
import { defineEventHandler } from 'h3';
import { forbiddenResponse, sleep } from '~/utils/response';
export default defineEventHandler(async (event) => {

View File

@ -1,3 +1,5 @@
import { defineEventHandler } from 'h3';
export default defineEventHandler(() => {
return `
<h1>Hello Vben Admin</h1>

View File

@ -1,5 +1,7 @@
import type { EventHandlerRequest, H3Event } from 'h3';
import { deleteCookie, getCookie, setCookie } from 'h3';
export function clearRefreshTokenCookie(event: H3Event<EventHandlerRequest>) {
deleteCookie(event, 'jwt', {
httpOnly: true,

View File

@ -1,8 +1,11 @@
import type { EventHandlerRequest, H3Event } from 'h3';
import type { UserInfo } from './mock-data';
import { getHeader } from 'h3';
import jwt from 'jsonwebtoken';
import { UserInfo } from './mock-data';
import { MOCK_USERS } from './mock-data';
// TODO: Replace with your own secret key
const ACCESS_TOKEN_SECRET = 'access_token_secret';
@ -31,12 +34,22 @@ export function verifyAccessToken(
return null;
}
const token = authHeader.split(' ')[1];
const tokenParts = authHeader.split(' ');
if (tokenParts.length !== 2) {
return null;
}
const token = tokenParts[1] as string;
try {
const decoded = jwt.verify(token, ACCESS_TOKEN_SECRET) as UserPayload;
const decoded = jwt.verify(
token,
ACCESS_TOKEN_SECRET,
) as unknown as UserPayload;
const username = decoded.username;
const user = MOCK_USERS.find((item) => item.username === username);
if (!user) {
return null;
}
const { password: _pwd, ...userinfo } = user;
return userinfo;
} catch {
@ -50,7 +63,12 @@ export function verifyRefreshToken(
try {
const decoded = jwt.verify(token, REFRESH_TOKEN_SECRET) as UserPayload;
const username = decoded.username;
const user = MOCK_USERS.find((item) => item.username === username);
const user = MOCK_USERS.find(
(item) => item.username === username,
) as UserInfo;
if (!user) {
return null;
}
const { password: _pwd, ...userinfo } = user;
return userinfo;
} catch {

View File

@ -1,5 +1,7 @@
import type { EventHandlerRequest, H3Event } from 'h3';
import { setResponseStatus } from 'h3';
export function useResponseSuccess<T = any>(data: T) {
return {
code: 0,

View File

@ -24,3 +24,12 @@ VITE_APP_BAIDU_CODE = e98f2eab6ceb8688bc6d8fc5332ff093
# GoView域名
VITE_GOVIEW_URL='http://127.0.0.1:3000'
# API 加解密
VITE_APP_API_ENCRYPT_ENABLE = true
VITE_APP_API_ENCRYPT_HEADER = X-Api-Encrypt
VITE_APP_API_ENCRYPT_ALGORITHM = AES
VITE_APP_API_ENCRYPT_REQUEST_KEY = 52549111389893486934626385991395
VITE_APP_API_ENCRYPT_RESPONSE_KEY = 96103715984234343991809655248883
# VITE_APP_API_ENCRYPT_REQUEST_KEY = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCls2rIpnGdYnLFgz1XU13GbNQ5DloyPpvW00FPGjqn5Z6JpK+kDtVlnkhwR87iRrE5Vf2WNqRX6vzbLSgveIQY8e8oqGCb829myjf1MuI+ZzN4ghf/7tEYhZJGPI9AbfxFqBUzm+kR3/HByAI22GLT96WM26QiMK8n3tIP/yiLswIDAQAB
# VITE_APP_API_ENCRYPT_RESPONSE_KEY = MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOH8IfIFxL/MR9XIg1UDv5z1fGXQI93E8wrU4iPFovL/sEt9uSgSkjyidC2O7N+m7EKtoN6b1u7cEwXSkwf3kfK0jdWLSQaNpX5YshqXCBzbDfugDaxuyYrNA4/tIMs7mzZAk0APuRXB35Dmupou7Yw7TFW/7QhQmGfzeEKULQvnAgMBAAECgYAw8LqlQGyQoPv5p3gRxEMOCfgL0JzD3XBJKztiRd35RDh40Nx1ejgjW4dPioFwGiVWd2W8cAGHLzALdcQT2KDJh+T/tsd4SPmI6uSBBK6Ff2DkO+kFFcuYvfclQQKqxma5CaZOSqhgenacmgTMFeg2eKlY3symV6JlFNu/IKU42QJBAOhxAK/Eq3e61aYQV2JSguhMR3b8NXJJRroRs/QHEanksJtl+M+2qhkC9nQVXBmBkndnkU/l2tYcHfSBlAyFySMCQQD445tgm/J2b6qMQmuUGQAYDN8FIkHjeKmha+l/fv0igWm8NDlBAem91lNDIPBUzHL1X1+pcts5bjmq99YdOnhtAkAg2J8dN3B3idpZDiQbC8fd5bGPmdI/pSUudAP27uzLEjr2qrE/QPPGdwm2m7IZFJtK7kK1hKio6u48t/bg0iL7AkEAuUUs94h+v702Fnym+jJ2CHEkXvz2US8UDs52nWrZYiM1o1y4tfSHm8H8bv8JCAa9GHyriEawfBraILOmllFdLQJAQSRZy4wmlaG48MhVXodB85X+VZ9krGXZ2TLhz7kz9iuToy53l9jTkESt6L5BfBDCVdIwcXLYgK+8KFdHN5W7HQ==

View File

@ -1,6 +1,6 @@
{
"name": "@vben/web-antd",
"version": "5.5.7",
"version": "5.5.9",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
@ -47,7 +47,6 @@
"@vueuse/integrations": "catalog:",
"ant-design-vue": "catalog:",
"cropperjs": "catalog:",
"crypto-js": "catalog:",
"dayjs": "catalog:",
"highlight.js": "catalog:",
"pinia": "catalog:",

View File

@ -7,6 +7,7 @@ import { IconifyIcon } from '@vben/icons';
import { $te } from '@vben/locales';
import {
AsyncComponents,
createRequiredValidation,
setupVbenVxeTable,
useVbenVxeGrid,
} from '@vben/plugins/vxe-table';
@ -354,7 +355,7 @@ setupVbenVxeTable({
useVbenForm,
});
export { useVbenVxeGrid };
export { createRequiredValidation, useVbenVxeGrid };
const [VxeTable, VxeColumn, VxeToolbar] = AsyncComponents;
export { VxeColumn, VxeTable, VxeToolbar };

View File

@ -40,6 +40,7 @@ export namespace BpmProcessInstanceApi {
nodeType: BpmNodeTypeEnum;
startTime?: Date;
status: number;
processInstanceId?: string;
tasks: ApprovalTaskInfo[];
}

View File

@ -130,3 +130,8 @@ export const getChildrenTaskList = async (id: string) => {
`/bpm/task/list-by-parent-task-id?parentTaskId=${id}`,
);
};
// 撤回任务
export const withdrawTask = async (taskId: string) => {
return await requestClient.put('/bpm/task/withdraw', null, { params: { taskId } });
};

View File

@ -64,7 +64,11 @@ export namespace AuthApi {
/** 登录 */
export async function loginApi(data: AuthApi.LoginParams) {
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data);
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data, {
headers: {
isEncrypt: false,
},
});
}
/** 刷新 accessToken */

View File

@ -0,0 +1,68 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpAccountApi {
/** ERP 结算账户信息 */
export interface Account {
id?: number; // 结算账户编号
no: string; // 账户编码
remark: string; // 备注
status: number; // 开启状态
sort: number; // 排序
defaultStatus: boolean; // 是否默认
name: string; // 账户名称
}
/** 结算账户分页查询参数 */
export interface AccountPageParam extends PageParam {
name?: string;
no?: string;
status?: number;
}
}
/** 查询结算账户分页 */
export function getAccountPage(params: ErpAccountApi.AccountPageParam) {
return requestClient.get<PageResult<ErpAccountApi.Account>>(
'/erp/account/page',
{ params },
);
}
/** 查询结算账户精简列表 */
export function getAccountSimpleList() {
return requestClient.get<ErpAccountApi.Account[]>('/erp/account/simple-list');
}
/** 查询结算账户详情 */
export function getAccount(id: number) {
return requestClient.get<ErpAccountApi.Account>(`/erp/account/get?id=${id}`);
}
/** 新增结算账户 */
export function createAccount(data: ErpAccountApi.Account) {
return requestClient.post('/erp/account/create', data);
}
/** 修改结算账户 */
export function updateAccount(data: ErpAccountApi.Account) {
return requestClient.put('/erp/account/update', data);
}
/** 修改结算账户默认状态 */
export function updateAccountDefaultStatus(id: number, defaultStatus: boolean) {
return requestClient.put('/erp/account/update-default-status', null, {
params: { id, defaultStatus },
});
}
/** 删除结算账户 */
export function deleteAccount(id: number) {
return requestClient.delete(`/erp/account/delete?id=${id}`);
}
/** 导出结算账户 Excel */
export function exportAccount(params: any) {
return requestClient.download('/erp/account/export-excel', { params });
}

View File

@ -0,0 +1,103 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
namespace ErpFinancePaymentApi {
/** 付款单信息 */
export interface FinancePayment {
id?: number; // 付款单编号
no: string; // 付款单号
supplierId: number; // 供应商编号
paymentTime: Date; // 付款时间
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
}
/** 付款单分页查询参数 */
export interface FinancePaymentPageParams extends PageParam {
no?: string;
supplierId?: number;
status?: number;
}
/** 付款单状态更新参数 */
export interface FinancePaymentStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getFinancePaymentPage(
params: ErpFinancePaymentApi.FinancePaymentPageParams,
) {
return requestClient.get<PageResult<ErpFinancePaymentApi.FinancePayment>>(
'/erp/finance-payment/page',
{
params,
},
);
}
/**
*
*/
export function getFinancePayment(id: number) {
return requestClient.get<ErpFinancePaymentApi.FinancePayment>(
`/erp/finance-payment/get?id=${id}`,
);
}
/**
*
*/
export function createFinancePayment(
data: ErpFinancePaymentApi.FinancePayment,
) {
return requestClient.post('/erp/finance-payment/create', data);
}
/**
*
*/
export function updateFinancePayment(
data: ErpFinancePaymentApi.FinancePayment,
) {
return requestClient.put('/erp/finance-payment/update', data);
}
/**
*
*/
export function updateFinancePaymentStatus(
params: ErpFinancePaymentApi.FinancePaymentStatusParams,
) {
return requestClient.put('/erp/finance-payment/update-status', null, {
params,
});
}
/**
*
*/
export function deleteFinancePayment(ids: number[]) {
return requestClient.delete('/erp/finance-payment/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportFinancePayment(
params: ErpFinancePaymentApi.FinancePaymentPageParams,
) {
return requestClient.download('/erp/finance-payment/export-excel', {
params,
});
}

View File

@ -0,0 +1,103 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
namespace ErpFinanceReceiptApi {
/** 收款单信息 */
export interface FinanceReceipt {
id?: number; // 收款单编号
no: string; // 收款单号
customerId: number; // 客户编号
receiptTime: Date; // 收款时间
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
}
/** 收款单分页查询参数 */
export interface FinanceReceiptPageParams extends PageParam {
no?: string;
customerId?: number;
status?: number;
}
/** 收款单状态更新参数 */
export interface FinanceReceiptStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getFinanceReceiptPage(
params: ErpFinanceReceiptApi.FinanceReceiptPageParams,
) {
return requestClient.get<PageResult<ErpFinanceReceiptApi.FinanceReceipt>>(
'/erp/finance-receipt/page',
{
params,
},
);
}
/**
*
*/
export function getFinanceReceipt(id: number) {
return requestClient.get<ErpFinanceReceiptApi.FinanceReceipt>(
`/erp/finance-receipt/get?id=${id}`,
);
}
/**
*
*/
export function createFinanceReceipt(
data: ErpFinanceReceiptApi.FinanceReceipt,
) {
return requestClient.post('/erp/finance-receipt/create', data);
}
/**
*
*/
export function updateFinanceReceipt(
data: ErpFinanceReceiptApi.FinanceReceipt,
) {
return requestClient.put('/erp/finance-receipt/update', data);
}
/**
*
*/
export function updateFinanceReceiptStatus(
params: ErpFinanceReceiptApi.FinanceReceiptStatusParams,
) {
return requestClient.put('/erp/finance-receipt/update-status', null, {
params,
});
}
/**
*
*/
export function deleteFinanceReceipt(ids: number[]) {
return requestClient.delete('/erp/finance-receipt/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportFinanceReceipt(
params: ErpFinanceReceiptApi.FinanceReceiptPageParams,
) {
return requestClient.download('/erp/finance-receipt/export-excel', {
params,
});
}

View File

@ -0,0 +1,61 @@
import { requestClient } from '#/api/request';
export namespace ErpProductCategoryApi {
/** ERP 产品分类信息 */
export interface ProductCategory {
id?: number; // 分类编号
parentId?: number; // 父分类编号
name: string; // 分类名称
code?: string; // 分类编码
sort?: number; // 分类排序
status?: number; // 开启状态
children?: ProductCategory[]; // 子分类
}
}
/** 查询产品分类列表 */
export function getProductCategoryList() {
return requestClient.get<ErpProductCategoryApi.ProductCategory[]>(
'/erp/product-category/list',
);
}
/** 查询产品分类精简列表 */
export function getProductCategorySimpleList() {
return requestClient.get<ErpProductCategoryApi.ProductCategory[]>(
'/erp/product-category/simple-list',
);
}
/** 查询产品分类详情 */
export function getProductCategory(id: number) {
return requestClient.get<ErpProductCategoryApi.ProductCategory>(
`/erp/product-category/get?id=${id}`,
);
}
/** 新增产品分类 */
export function createProductCategory(
data: ErpProductCategoryApi.ProductCategory,
) {
return requestClient.post('/erp/product-category/create', data);
}
/** 修改产品分类 */
export function updateProductCategory(
data: ErpProductCategoryApi.ProductCategory,
) {
return requestClient.put('/erp/product-category/update', data);
}
/** 删除产品分类 */
export function deleteProductCategory(id: number) {
return requestClient.delete(`/erp/product-category/delete?id=${id}`);
}
/** 导出产品分类 Excel */
export function exportProductCategory(params: any) {
return requestClient.download('/erp/product-category/export-excel', {
params,
});
}

View File

@ -0,0 +1,61 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpProductApi {
/** ERP 产品信息 */
export interface Product {
id?: number; // 产品编号
name: string; // 产品名称
barCode: string; // 产品条码
categoryId: number; // 产品类型编号
unitId: number; // 单位编号
unitName?: string; // 单位名字
status: number; // 产品状态
standard: string; // 产品规格
remark: string; // 产品备注
expiryDay: number; // 保质期天数
weight: number; // 重量kg
purchasePrice: number; // 采购价格,单位:元
salePrice: number; // 销售价格,单位:元
minPrice: number; // 最低价格,单位:元
}
}
/** 查询产品分页 */
export function getProductPage(params: PageParam) {
return requestClient.get<PageResult<ErpProductApi.Product>>(
'/erp/product/page',
{ params },
);
}
/** 查询产品精简列表 */
export function getProductSimpleList() {
return requestClient.get<ErpProductApi.Product[]>('/erp/product/simple-list');
}
/** 查询产品详情 */
export function getProduct(id: number) {
return requestClient.get<ErpProductApi.Product>(`/erp/product/get?id=${id}`);
}
/** 新增产品 */
export function createProduct(data: ErpProductApi.Product) {
return requestClient.post('/erp/product/create', data);
}
/** 修改产品 */
export function updateProduct(data: ErpProductApi.Product) {
return requestClient.put('/erp/product/update', data);
}
/** 删除产品 */
export function deleteProduct(id: number) {
return requestClient.delete(`/erp/product/delete?id=${id}`);
}
/** 导出产品 Excel */
export function exportProduct(params: any) {
return requestClient.download('/erp/product/export-excel', { params });
}

View File

@ -0,0 +1,62 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpProductUnitApi {
/** ERP 产品单位信息 */
export interface ProductUnit {
id?: number; // 单位编号
name: string; // 单位名字
status: number; // 单位状态
}
/** 产品单位分页查询参数 */
export interface ProductUnitPageParam extends PageParam {
name?: string;
status?: number;
}
}
/** 查询产品单位分页 */
export function getProductUnitPage(
params: ErpProductUnitApi.ProductUnitPageParam,
) {
return requestClient.get<PageResult<ErpProductUnitApi.ProductUnit>>(
'/erp/product-unit/page',
{ params },
);
}
/** 查询产品单位精简列表 */
export function getProductUnitSimpleList() {
return requestClient.get<ErpProductUnitApi.ProductUnit[]>(
'/erp/product-unit/simple-list',
);
}
/** 查询产品单位详情 */
export function getProductUnit(id: number) {
return requestClient.get<ErpProductUnitApi.ProductUnit>(
`/erp/product-unit/get?id=${id}`,
);
}
/** 新增产品单位 */
export function createProductUnit(data: ErpProductUnitApi.ProductUnit) {
return requestClient.post('/erp/product-unit/create', data);
}
/** 修改产品单位 */
export function updateProductUnit(data: ErpProductUnitApi.ProductUnit) {
return requestClient.put('/erp/product-unit/update', data);
}
/** 删除产品单位 */
export function deleteProductUnit(id: number) {
return requestClient.delete(`/erp/product-unit/delete?id=${id}`);
}
/** 导出产品单位 Excel */
export function exportProductUnit(params: any) {
return requestClient.download('/erp/product-unit/export-excel', { params });
}

View File

@ -0,0 +1,129 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpPurchaseInApi {
/** 采购入库信息 */
export interface PurchaseIn {
id?: number; // 入库工单编号
no?: string; // 采购入库号
supplierId?: number; // 供应商编号
inTime?: Date; // 入库时间
totalCount?: number; // 合计数量
totalPrice?: number; // 合计金额,单位:元
status?: number; // 状态
remark?: string; // 备注
outCount?: number; // 采购出库数量
returnCount?: number; // 采购退货数量
discountPercent?: number; // 折扣百分比
discountPrice?: number; // 折扣金额
paymentPrice?: number; // 实际支付金额
otherPrice?: number; // 其他费用
totalProductPrice?: number; // 合计商品金额
taxPrice?: number; // 合计税额
items?: PurchaseInItem[]; // 采购入库明细
}
export interface PurchaseInItem {
count?: number;
id?: number;
orderItemId?: number;
productBarCode?: string;
productId?: number;
productName: string;
productPrice: number;
productUnitId?: number;
productUnitName?: string;
totalProductPrice?: number;
remark: string;
stockCount?: number;
taxPercent?: number;
taxPrice?: number;
totalPrice?: number;
warehouseId?: number;
inCount?: number;
}
/** 采购入库分页查询参数 */
export interface PurchaseInPageParams extends PageParam {
no?: string;
supplierId?: number;
status?: number;
}
/** 采购入库状态更新参数 */
export interface PurchaseInStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getPurchaseInPage(
params: ErpPurchaseInApi.PurchaseInPageParams,
) {
return requestClient.get<PageResult<ErpPurchaseInApi.PurchaseIn>>(
'/erp/purchase-in/page',
{
params,
},
);
}
/**
*
*/
export function getPurchaseIn(id: number) {
return requestClient.get<ErpPurchaseInApi.PurchaseIn>(
`/erp/purchase-in/get?id=${id}`,
);
}
/**
*
*/
export function createPurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
return requestClient.post('/erp/purchase-in/create', data);
}
/**
*
*/
export function updatePurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
return requestClient.put('/erp/purchase-in/update', data);
}
/**
*
*/
export function updatePurchaseInStatus(id: number, status: number) {
return requestClient.put('/erp/purchase-in/update-status', null, {
params: {
id,
status,
},
});
}
/**
*
*/
export function deletePurchaseIn(ids: number[]) {
return requestClient.delete('/erp/purchase-in/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportPurchaseIn(
params: ErpPurchaseInApi.PurchaseInPageParams,
) {
return requestClient.download('/erp/purchase-in/export-excel', {
params,
});
}

View File

@ -0,0 +1,117 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpPurchaseOrderApi {
/** ERP 采购订单项信息 */
export interface PurchaseOrderItem {
id?: number; // 订单项编号
orderId?: number; // 采购订单编号
productId?: number; // 产品编号
productName?: string; // 产品名称
productBarCode?: string; // 产品条码
productUnitId?: number; // 产品单位编号
productUnitName?: string; // 产品单位名称
productPrice?: number; // 产品单价,单位:元
totalProductPrice?: number; // 产品总价,单位:元
count?: number; // 数量
totalPrice?: number; // 总价,单位:元
taxPercent?: number; // 税率,百分比
taxPrice?: number; // 税额,单位:元
totalTaxPrice?: number; // 含税总价,单位:元
remark?: string; // 备注
stockCount?: number; // 库存数量(显示字段)
}
/** ERP 采购订单信息 */
export interface PurchaseOrder {
id?: number; // 订单工单编号
no?: string; // 采购订单号
supplierId?: number; // 供应商编号
supplierName?: string; // 供应商名称
orderTime?: Date | string; // 订单时间
totalCount?: number; // 合计数量
totalPrice?: number; // 合计金额,单位:元
totalProductPrice?: number; // 产品金额,单位:元
discountPercent?: number; // 优惠率,百分比
discountPrice?: number; // 优惠金额,单位:元
depositPrice?: number; // 定金金额,单位:元
accountId?: number; // 结算账户编号
status?: number; // 状态
remark?: string; // 备注
fileUrl?: string; // 附件地址
inCount?: number; // 采购入库数量
count?: number; // 数量
returnCount?: number; // 采购退货数量
inStatus?: number; // 入库状态
returnStatus?: number; // 退货状态
productNames?: string; // 产品名称列表
creatorName?: string; // 创建人名称
createTime?: Date; // 创建时间
items?: PurchaseOrderItem[]; // 订单项列表
}
/** 采购订单分页查询参数 */
export interface PurchaseOrderPageParam extends PageParam {
no?: string;
supplierId?: number;
productId?: number;
orderTime?: string[];
status?: number;
remark?: string;
creator?: string;
inStatus?: number;
returnStatus?: number;
}
}
/** 查询采购订单分页 */
export function getPurchaseOrderPage(
params: ErpPurchaseOrderApi.PurchaseOrderPageParam,
) {
return requestClient.get<PageResult<ErpPurchaseOrderApi.PurchaseOrder>>(
'/erp/purchase-order/page',
{ params },
);
}
/** 查询采购订单详情 */
export function getPurchaseOrder(id: number) {
return requestClient.get<ErpPurchaseOrderApi.PurchaseOrder>(
`/erp/purchase-order/get?id=${id}`,
);
}
/** 新增采购订单 */
export function createPurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
return requestClient.post('/erp/purchase-order/create', data);
}
/** 修改采购订单 */
export function updatePurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
return requestClient.put('/erp/purchase-order/update', data);
}
/** 更新采购订单的状态 */
export function updatePurchaseOrderStatus(id: number, status: number) {
return requestClient.put('/erp/purchase-order/update-status', null, {
params: { id, status },
});
}
/** 删除采购订单 */
export function deletePurchaseOrder(id: number) {
return requestClient.delete(`/erp/purchase-order/delete?id=${id}`);
}
/** 批量删除采购订单 */
export function deletePurchaseOrderList(ids: number[]) {
return requestClient.delete('/erp/purchase-order/delete', {
params: { ids: ids.join(',') },
});
}
/** 导出采购订单 Excel */
export function exportPurchaseOrder(params: any) {
return requestClient.download('/erp/purchase-order/export-excel', { params });
}

View File

@ -0,0 +1,127 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpPurchaseReturnApi {
/** 采购退货信息 */
export interface PurchaseReturn {
id?: number; // 采购退货编号
no?: string; // 采购退货号
supplierId?: number; // 供应商编号
returnTime?: Date; // 退货时间
totalCount?: number; // 合计数量
totalPrice: number; // 合计金额,单位:元
discountPercent?: number; // 折扣百分比
discountPrice?: number; // 折扣金额
status?: number; // 状态
remark?: string; // 备注
totalTaxPrice?: number; // 合计税额
otherPrice?: number; // 其他费用
items?: PurchaseReturnItem[];
}
export interface PurchaseReturnItem {
count?: number;
id?: number;
orderItemId?: number;
productBarCode?: string;
productId?: number;
productName: string;
productPrice: number;
productUnitId?: number;
productUnitName?: string;
totalProductPrice?: number;
remark: string;
stockCount?: number;
taxPercent?: number;
taxPrice?: number;
totalPrice?: number;
warehouseId?: number;
}
/** 采购退货分页查询参数 */
export interface PurchaseReturnPageParams extends PageParam {
no?: string;
supplierId?: number;
status?: number;
}
/** 采购退货状态更新参数 */
export interface PurchaseReturnStatusParams {
id: number;
status: number;
}
}
/**
* 退
*/
export function getPurchaseReturnPage(
params: ErpPurchaseReturnApi.PurchaseReturnPageParams,
) {
return requestClient.get<PageResult<ErpPurchaseReturnApi.PurchaseReturn>>(
'/erp/purchase-return/page',
{
params,
},
);
}
/**
* 退
*/
export function getPurchaseReturn(id: number) {
return requestClient.get<ErpPurchaseReturnApi.PurchaseReturn>(
`/erp/purchase-return/get?id=${id}`,
);
}
/**
* 退
*/
export function createPurchaseReturn(
data: ErpPurchaseReturnApi.PurchaseReturn,
) {
return requestClient.post('/erp/purchase-return/create', data);
}
/**
* 退
*/
export function updatePurchaseReturn(
data: ErpPurchaseReturnApi.PurchaseReturn,
) {
return requestClient.put('/erp/purchase-return/update', data);
}
/**
* 退
*/
export function updatePurchaseReturnStatus(
params: ErpPurchaseReturnApi.PurchaseReturnStatusParams,
) {
return requestClient.put('/erp/purchase-return/update-status', null, {
params,
});
}
/**
* 退
*/
export function deletePurchaseReturn(ids: number[]) {
return requestClient.delete('/erp/purchase-return/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* 退 Excel
*/
export function exportPurchaseReturn(
params: ErpPurchaseReturnApi.PurchaseReturnPageParams,
) {
return requestClient.download('/erp/purchase-return/export-excel', {
params,
});
}

View File

@ -0,0 +1,73 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpSupplierApi {
/** ERP 供应商信息 */
export interface Supplier {
id?: number; // 供应商编号
name: string; // 供应商名称
contact: string; // 联系人
mobile: string; // 手机号码
telephone: string; // 联系电话
email: string; // 电子邮箱
fax: string; // 传真
remark: string; // 备注
status: number; // 开启状态
sort: number; // 排序
taxNo: string; // 纳税人识别号
taxPercent: number; // 税率
bankName: string; // 开户行
bankAccount: string; // 开户账号
bankAddress: string; // 开户地址
}
/** 供应商分页查询参数 */
export interface SupplierPageParam extends PageParam {
name?: string;
mobile?: string;
status?: number;
}
}
/** 查询供应商分页 */
export function getSupplierPage(params: ErpSupplierApi.SupplierPageParam) {
return requestClient.get<PageResult<ErpSupplierApi.Supplier>>(
'/erp/supplier/page',
{ params },
);
}
/** 获得供应商精简列表 */
export function getSupplierSimpleList() {
return requestClient.get<ErpSupplierApi.Supplier[]>(
'/erp/supplier/simple-list',
);
}
/** 查询供应商详情 */
export function getSupplier(id: number) {
return requestClient.get<ErpSupplierApi.Supplier>(
`/erp/supplier/get?id=${id}`,
);
}
/** 新增供应商 */
export function createSupplier(data: ErpSupplierApi.Supplier) {
return requestClient.post('/erp/supplier/create', data);
}
/** 修改供应商 */
export function updateSupplier(data: ErpSupplierApi.Supplier) {
return requestClient.put('/erp/supplier/update', data);
}
/** 删除供应商 */
export function deleteSupplier(id: number) {
return requestClient.delete(`/erp/supplier/delete?id=${id}`);
}
/** 导出供应商 Excel */
export function exportSupplier(params: any) {
return requestClient.download('/erp/supplier/export-excel', { params });
}

View File

@ -0,0 +1,73 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpCustomerApi {
/** ERP 客户信息 */
export interface Customer {
id?: number; // 客户编号
name: string; // 客户名称
contact: string; // 联系人
mobile: string; // 手机号码
telephone: string; // 联系电话
email: string; // 电子邮箱
fax: string; // 传真
remark: string; // 备注
status: number; // 开启状态
sort: number; // 排序
taxNo: string; // 纳税人识别号
taxPercent: number; // 税率
bankName: string; // 开户行
bankAccount: string; // 开户账号
bankAddress: string; // 开户地址
}
/** 客户分页查询参数 */
export interface CustomerPageParam extends PageParam {
name?: string;
mobile?: string;
status?: number;
}
}
/** 查询客户分页 */
export function getCustomerPage(params: ErpCustomerApi.CustomerPageParam) {
return requestClient.get<PageResult<ErpCustomerApi.Customer>>(
'/erp/customer/page',
{ params },
);
}
/** 查询客户精简列表 */
export function getCustomerSimpleList() {
return requestClient.get<ErpCustomerApi.Customer[]>(
'/erp/customer/simple-list',
);
}
/** 查询客户详情 */
export function getCustomer(id: number) {
return requestClient.get<ErpCustomerApi.Customer>(
`/erp/customer/get?id=${id}`,
);
}
/** 新增客户 */
export function createCustomer(data: ErpCustomerApi.Customer) {
return requestClient.post('/erp/customer/create', data);
}
/** 修改客户 */
export function updateCustomer(data: ErpCustomerApi.Customer) {
return requestClient.put('/erp/customer/update', data);
}
/** 删除客户 */
export function deleteCustomer(id: number) {
return requestClient.delete(`/erp/customer/delete?id=${id}`);
}
/** 导出客户 Excel */
export function exportCustomer(params: any) {
return requestClient.download('/erp/customer/export-excel', { params });
}

View File

@ -0,0 +1,97 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpSaleOrderApi {
/** ERP 销售订单信息 */
export interface SaleOrder {
id?: number; // 订单工单编号
no: string; // 销售订单号
customerId: number; // 客户编号
accountId?: number; // 收款账户编号
orderTime: Date; // 订单时间
totalCount: number; // 合计数量
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
outCount: number; // 销售出库数量
fileUrl?: string; // 附件地址
inCount?: number; // 采购入库数量
returnCount: number; // 销售退货数量
totalProductPrice?: number; // 产品金额,单位:元
discountPercent?: number; // 优惠率,百分比
discountPrice?: number; // 优惠金额,单位:元
depositPrice?: number; // 定金金额,单位:元
items?: SaleOrderItem[]; // 销售订单产品明细列表
}
/** ERP 销售订单产品明细 */
export interface SaleOrderItem {
id?: number; // 订单项编号
orderId?: number; // 采购订单编号
productId?: number; // 产品编号
productName?: string; // 产品名称
productBarCode?: string; // 产品条码
productUnitId?: number; // 产品单位编号
productUnitName?: string; // 产品单位名称
productPrice?: number; // 产品单价,单位:元
totalProductPrice?: number; // 产品总价,单位:元
count?: number; // 数量
totalPrice?: number; // 总价,单位:元
taxPercent?: number; // 税率,百分比
taxPrice?: number; // 税额,单位:元
totalTaxPrice?: number; // 含税总价,单位:元
remark?: string; // 备注
stockCount?: number; // 库存数量(显示字段)
}
/** 销售订单分页查询参数 */
export interface SaleOrderPageParam extends PageParam {
no?: string;
customerId?: number;
status?: number;
}
}
/** 查询销售订单分页 */
export function getSaleOrderPage(params: ErpSaleOrderApi.SaleOrderPageParam) {
return requestClient.get<PageResult<ErpSaleOrderApi.SaleOrder>>(
'/erp/sale-order/page',
{ params },
);
}
/** 查询销售订单详情 */
export function getSaleOrder(id: number) {
return requestClient.get<ErpSaleOrderApi.SaleOrder>(
`/erp/sale-order/get?id=${id}`,
);
}
/** 新增销售订单 */
export function createSaleOrder(data: ErpSaleOrderApi.SaleOrder) {
return requestClient.post('/erp/sale-order/create', data);
}
/** 修改销售订单 */
export function updateSaleOrder(data: ErpSaleOrderApi.SaleOrder) {
return requestClient.put('/erp/sale-order/update', data);
}
/** 更新销售订单的状态 */
export function updateSaleOrderStatus(id: number, status: number) {
return requestClient.put('/erp/sale-order/update-status', null, {
params: { id, status },
});
}
/** 删除销售订单 */
export function deleteSaleOrder(ids: number[]) {
return requestClient.delete('/erp/sale-order/delete', {
params: { ids: ids.join(',') },
});
}
/** 导出销售订单 Excel */
export function exportSaleOrder(params: any) {
return requestClient.download('/erp/sale-order/export-excel', { params });
}

View File

@ -0,0 +1,120 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpSaleOutApi {
/** 销售出库信息 */
export interface SaleOut {
id?: number; // 销售出库编号
no?: string; // 销售出库号
customerId?: number; // 客户编号
saleUserId?: number; // 客户编号
outTime?: Date; // 出库时间
totalCount?: number; // 合计数量
totalPrice?: number; // 合计金额,单位:元
status?: number; // 状态
remark?: string; // 备注
discountPercent?: number; // 折扣百分比
discountPrice?: number; // 折扣金额
otherPrice?: number; // 其他费用
totalProductPrice?: number; // 合计商品金额
taxPrice?: number; // 合计税额
totalTaxPrice?: number; // 合计税额
fileUrl?: string; // 附件地址
items?: SaleOutItem[];
}
export interface SaleOutItem {
count?: number;
id?: number;
orderItemId?: number;
productBarCode?: string;
productId?: number;
productName: string;
productPrice: number;
productUnitId?: number;
productUnitName?: string;
totalProductPrice?: number;
remark: string;
stockCount?: number;
taxPercent?: number;
taxPrice?: number;
totalPrice?: number;
warehouseId?: number;
outCount?: number;
}
/** 销售出库分页查询参数 */
export interface SaleOutPageParams extends PageParam {
no?: string;
customerId?: number;
status?: number;
}
/** 销售出库状态更新参数 */
export interface SaleOutStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getSaleOutPage(params: ErpSaleOutApi.SaleOutPageParams) {
return requestClient.get<PageResult<ErpSaleOutApi.SaleOut>>(
'/erp/sale-out/page',
{
params,
},
);
}
/**
*
*/
export function getSaleOut(id: number) {
return requestClient.get<ErpSaleOutApi.SaleOut>(`/erp/sale-out/get?id=${id}`);
}
/**
*
*/
export function createSaleOut(data: ErpSaleOutApi.SaleOut) {
return requestClient.post('/erp/sale-out/create', data);
}
/**
*
*/
export function updateSaleOut(data: ErpSaleOutApi.SaleOut) {
return requestClient.put('/erp/sale-out/update', data);
}
/**
*
*/
export function updateSaleOutStatus(params: ErpSaleOutApi.SaleOutStatusParams) {
return requestClient.put('/erp/sale-out/update-status', null, {
params,
});
}
/**
*
*/
export function deleteSaleOut(ids: number[]) {
return requestClient.delete('/erp/sale-out/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportSaleOut(params: ErpSaleOutApi.SaleOutPageParams) {
return requestClient.download('/erp/sale-out/export-excel', {
params,
});
}

View File

@ -0,0 +1,127 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpSaleReturnApi {
/** 销售退货信息 */
export interface SaleReturn {
id?: number; // 销售退货编号
no?: string; // 销售退货号
customerId?: number; // 客户编号
returnTime?: Date; // 退货时间
totalCount?: number; // 合计数量
totalPrice?: number; // 合计金额,单位:元
status?: number; // 状态
remark?: string; // 备注
discountPercent?: number; // 折扣百分比
discountPrice?: number; // 折扣金额
otherPrice?: number; // 其他费用
totalProductPrice?: number; // 合计商品金额
taxPrice?: number; // 合计税额
totalTaxPrice?: number; // 合计税额
fileUrl?: string; // 附件地址
items?: SaleReturnItem[];
}
export interface SaleReturnItem {
count?: number;
id?: number;
orderItemId?: number;
productBarCode?: string;
productId?: number;
productName: string;
productPrice: number;
productUnitId?: number;
productUnitName?: string;
totalProductPrice?: number;
remark: string;
stockCount?: number;
taxPercent?: number;
taxPrice?: number;
totalPrice?: number;
warehouseId?: number;
returnCount?: number;
}
/** 销售退货分页查询参数 */
export interface SaleReturnPageParams extends PageParam {
no?: string;
customerId?: number;
status?: number;
}
/** 销售退货状态更新参数 */
export interface SaleReturnStatusParams {
id: number;
status: number;
}
}
/**
* 退
*/
export function getSaleReturnPage(
params: ErpSaleReturnApi.SaleReturnPageParams,
) {
return requestClient.get<PageResult<ErpSaleReturnApi.SaleReturn>>(
'/erp/sale-return/page',
{
params,
},
);
}
/**
* 退
*/
export function getSaleReturn(id: number) {
return requestClient.get<ErpSaleReturnApi.SaleReturn>(
`/erp/sale-return/get?id=${id}`,
);
}
/**
* 退
*/
export function createSaleReturn(data: ErpSaleReturnApi.SaleReturn) {
return requestClient.post('/erp/sale-return/create', data);
}
/**
* 退
*/
export function updateSaleReturn(data: ErpSaleReturnApi.SaleReturn) {
return requestClient.put('/erp/sale-return/update', data);
}
/**
* 退
*/
export function updateSaleReturnStatus(
params: ErpSaleReturnApi.SaleReturnStatusParams,
) {
return requestClient.put('/erp/sale-return/update-status', null, {
params,
});
}
/**
* 退
*/
export function deleteSaleReturn(ids: number[]) {
return requestClient.delete('/erp/sale-return/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* 退 Excel
*/
export function exportSaleReturn(
params: ErpSaleReturnApi.SaleReturnPageParams,
) {
return requestClient.download('/erp/sale-return/export-excel', {
params,
});
}

View File

@ -0,0 +1,31 @@
import { requestClient } from '#/api/request';
export namespace ErpPurchaseStatisticsApi {
/** ERP 采购全局统计 */
export interface PurchaseSummary {
todayPrice: number; // 今日采购金额
yesterdayPrice: number; // 昨日采购金额
monthPrice: number; // 本月采购金额
yearPrice: number; // 今年采购金额
}
/** ERP 采购时间段统计 */
export interface PurchaseTimeSummary {
time: string; // 时间
price: number; // 采购金额
}
}
/** 获得采购统计 */
export function getPurchaseSummary() {
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseSummary>(
'/erp/purchase-statistics/summary',
);
}
/** 获得采购时间段统计 */
export function getPurchaseTimeSummary() {
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseTimeSummary[]>(
'/erp/purchase-statistics/time-summary',
);
}

View File

@ -0,0 +1,31 @@
import { requestClient } from '#/api/request';
export namespace ErpSaleStatisticsApi {
/** ERP 销售全局统计 */
export interface SaleSummary {
todayPrice: number; // 今日销售金额
yesterdayPrice: number; // 昨日销售金额
monthPrice: number; // 本月销售金额
yearPrice: number; // 今年销售金额
}
/** ERP 销售时间段统计 */
export interface SaleTimeSummary {
time: string; // 时间
price: number; // 销售金额
}
}
/** 获得销售统计 */
export function getSaleSummary() {
return requestClient.get<ErpSaleStatisticsApi.SaleSummary>(
'/erp/sale-statistics/summary',
);
}
/** 获得销售时间段统计 */
export function getSaleTimeSummary() {
return requestClient.get<ErpSaleStatisticsApi.SaleTimeSummary[]>(
'/erp/sale-statistics/time-summary',
);
}

View File

@ -0,0 +1,117 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpStockCheckApi {
/** 库存盘点单信息 */
export interface StockCheck {
id?: number; // 盘点编号
no: string; // 盘点单号
checkTime: Date; // 盘点时间
totalCount: number; // 合计数量
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
fileUrl?: string; // 附件
productNames?: string; // 产品信息
creatorName?: string; // 创建人
items?: StockCheckItem[]; // 盘点产品清单
}
// 库存盘点单产品信息
export interface StockCheckItem {
id?: number; // 编号
warehouseId?: number; // 仓库编号
productId?: number; // 产品编号
productName?: string; // 产品名称
productUnitId?: number; // 产品单位编号
productUnitName?: string; // 产品单位名称
productBarCode?: string; // 产品条码
count?: number; // 盈亏数量
actualCount?: number; // 实际库存
productPrice?: number; // 产品单价
totalPrice?: number; // 总价
stockCount?: number; // 账面库存
remark?: string; // 备注
}
/** 库存盘点单分页查询参数 */
export interface StockCheckPageParams extends PageParam {
no?: string;
status?: number;
}
/** 库存盘点单状态更新参数 */
export interface StockCheckStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getStockCheckPage(
params: ErpStockCheckApi.StockCheckPageParams,
) {
return requestClient.get<PageResult<ErpStockCheckApi.StockCheck>>(
'/erp/stock-check/page',
{
params,
},
);
}
/**
*
*/
export function getStockCheck(id: number) {
return requestClient.get<ErpStockCheckApi.StockCheck>(
`/erp/stock-check/get?id=${id}`,
);
}
/**
*
*/
export function createStockCheck(data: ErpStockCheckApi.StockCheck) {
return requestClient.post('/erp/stock-check/create', data);
}
/**
*
*/
export function updateStockCheck(data: ErpStockCheckApi.StockCheck) {
return requestClient.put('/erp/stock-check/update', data);
}
/**
*
*/
export function updateStockCheckStatus(
params: ErpStockCheckApi.StockCheckStatusParams,
) {
return requestClient.put('/erp/stock-check/update-status', null, {
params,
});
}
/**
*
*/
export function deleteStockCheck(ids: number[]) {
return requestClient.delete('/erp/stock-check/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportStockCheck(
params: ErpStockCheckApi.StockCheckPageParams,
) {
return requestClient.download('/erp/stock-check/export-excel', {
params,
});
}

View File

@ -0,0 +1,113 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpStockInApi {
/** 其它入库单信息 */
export interface StockIn {
id?: number; // 入库编号
no: string; // 入库单号
supplierId: number; // 供应商编号
supplierName?: string; // 供应商名称
inTime: Date; // 入库时间
totalCount: number; // 合计数量
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
fileUrl?: string; // 附件
productNames?: string; // 产品信息
creatorName?: string; // 创建人
items?: StockInItem[]; // 入库产品清单
}
/** 其它入库单产品信息 */
export interface StockInItem {
id?: number; // 编号
warehouseId: number; // 仓库编号
productId: number; // 产品编号
productName?: string; // 产品名称
productUnitId?: number; // 产品单位编号
productUnitName?: string; // 产品单位名称
productBarCode?: string; // 产品条码
count: number; // 数量
productPrice: number; // 产品单价
totalPrice: number; // 总价
stockCount?: number; // 库存数量
remark?: string; // 备注
}
/** 其它入库单分页查询参数 */
export interface StockInPageParams extends PageParam {
no?: string;
supplierId?: number;
status?: number;
}
/** 其它入库单状态更新参数 */
export interface StockInStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getStockInPage(params: ErpStockInApi.StockInPageParams) {
return requestClient.get<PageResult<ErpStockInApi.StockIn>>(
'/erp/stock-in/page',
{
params,
},
);
}
/**
*
*/
export function getStockIn(id: number) {
return requestClient.get<ErpStockInApi.StockIn>(`/erp/stock-in/get?id=${id}`);
}
/**
*
*/
export function createStockIn(data: ErpStockInApi.StockIn) {
return requestClient.post('/erp/stock-in/create', data);
}
/**
*
*/
export function updateStockIn(data: ErpStockInApi.StockIn) {
return requestClient.put('/erp/stock-in/update', data);
}
/**
*
*/
export function updateStockInStatus(params: ErpStockInApi.StockInStatusParams) {
return requestClient.put('/erp/stock-in/update-status', null, {
params,
});
}
/**
*
*/
export function deleteStockIn(ids: number[]) {
return requestClient.delete('/erp/stock-in/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportStockIn(params: ErpStockInApi.StockInPageParams) {
return requestClient.download('/erp/stock-in/export-excel', {
params,
});
}

View File

@ -0,0 +1,117 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpStockMoveApi {
/** 库存调拨单信息 */
export interface StockMove {
id?: number; // 调拨编号
no: string; // 调拨单号
outTime: Date; // 调拨时间
totalCount: number; // 合计数量
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
fileUrl?: string; // 附件
fromWarehouseId?: number; // 来源仓库编号
createTime: Date; // 创建时间
creator: string; // 创建人
creatorName: string; // 创建人名称
productNames: string; // 产品名称
items?: StockMoveItem[]; // 子表信息
}
/** 库存调拨单子表信息 */
export interface StockMoveItem {
count: number; // 数量
fromWarehouseId?: number; // 来源仓库ID
id?: number; // ID
productBarCode: string; // 产品条形码
productId?: number; // 产品ID
productName?: string; // 产品名称
productPrice: number; // 产品单价
productUnitName?: string; // 产品单位
remark?: string; // 备注
stockCount: number; // 库存数量
toWarehouseId?: number; // 目标仓库ID
totalPrice?: number; // 总价
}
/** 库存调拨单分页查询参数 */
export interface StockMovePageParams extends PageParam {
no?: string;
status?: number;
}
/** 库存调拨单状态更新参数 */
export interface StockMoveStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getStockMovePage(params: ErpStockMoveApi.StockMovePageParams) {
return requestClient.get<PageResult<ErpStockMoveApi.StockMove>>(
'/erp/stock-move/page',
{
params,
},
);
}
/**
*
*/
export function getStockMove(id: number) {
return requestClient.get<ErpStockMoveApi.StockMove>(
`/erp/stock-move/get?id=${id}`,
);
}
/**
*
*/
export function createStockMove(data: ErpStockMoveApi.StockMove) {
return requestClient.post('/erp/stock-move/create', data);
}
/**
*
*/
export function updateStockMove(data: ErpStockMoveApi.StockMove) {
return requestClient.put('/erp/stock-move/update', data);
}
/**
*
*/
export function updateStockMoveStatus(
params: ErpStockMoveApi.StockMoveStatusParams,
) {
return requestClient.put('/erp/stock-move/update-status', null, {
params,
});
}
/**
*
*/
export function deleteStockMove(ids: number[]) {
return requestClient.delete('/erp/stock-move/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportStockMove(params: ErpStockMoveApi.StockMovePageParams) {
return requestClient.download('/erp/stock-move/export-excel', {
params,
});
}

View File

@ -0,0 +1,114 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpStockOutApi {
/** 其它出库单信息 */
export interface StockOut {
id?: number; // 出库编号
no: string; // 出库单号
customerId: number; // 客户编号
outTime: Date; // 出库时间
totalCount: number; // 合计数量
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
fileUrl?: string; // 附件
items?: StockOutItem[]; // 出库产品清单
}
/** 其它出库单产品信息 */
export interface StockOutItem {
id?: number; // 编号
warehouseId?: number; // 仓库编号
productId?: number; // 产品编号
productName?: string; // 产品名称
productUnitId?: number; // 产品单位编号
productUnitName?: string; // 产品单位名称
productBarCode?: string; // 产品条码
count: number; // 数量
productPrice: number; // 产品单价
totalPrice: number; // 总价
stockCount?: number; // 库存数量
remark?: string; // 备注
}
/** 其它出库单分页查询参数 */
export interface StockOutPageParams extends PageParam {
no?: string;
customerId?: number;
status?: number;
}
/** 其它出库单状态更新参数 */
export interface StockOutStatusParams {
id: number;
status: number;
}
}
/**
*
*/
export function getStockOutPage(params: ErpStockOutApi.StockOutPageParams) {
return requestClient.get<PageResult<ErpStockOutApi.StockOut>>(
'/erp/stock-out/page',
{
params,
},
);
}
/**
*
*/
export function getStockOut(id: number) {
return requestClient.get<ErpStockOutApi.StockOut>(
`/erp/stock-out/get?id=${id}`,
);
}
/**
*
*/
export function createStockOut(data: ErpStockOutApi.StockOut) {
return requestClient.post('/erp/stock-out/create', data);
}
/**
*
*/
export function updateStockOut(data: ErpStockOutApi.StockOut) {
return requestClient.put('/erp/stock-out/update', data);
}
/**
*
*/
export function updateStockOutStatus(
params: ErpStockOutApi.StockOutStatusParams,
) {
return requestClient.put('/erp/stock-out/update-status', null, {
params,
});
}
/**
*
*/
export function deleteStockOut(ids: number[]) {
return requestClient.delete('/erp/stock-out/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* Excel
*/
export function exportStockOut(params: ErpStockOutApi.StockOutPageParams) {
return requestClient.download('/erp/stock-out/export-excel', {
params,
});
}

View File

@ -0,0 +1,47 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpStockRecordApi {
/** ERP 产品库存明细 */
export interface StockRecord {
id?: number; // 编号
productId: number; // 产品编号
warehouseId: number; // 仓库编号
count: number; // 出入库数量
totalCount: number; // 总库存量
bizType: number; // 业务类型
bizId: number; // 业务编号
bizItemId: number; // 业务项编号
bizNo: string; // 业务单号
}
/** 库存记录分页查询参数 */
export interface StockRecordPageParam extends PageParam {
productId?: number;
warehouseId?: number;
bizType?: number;
}
}
/** 查询产品库存明细分页 */
export function getStockRecordPage(
params: ErpStockRecordApi.StockRecordPageParam,
) {
return requestClient.get<PageResult<ErpStockRecordApi.StockRecord>>(
'/erp/stock-record/page',
{ params },
);
}
/** 查询产品库存明细详情 */
export function getStockRecord(id: number) {
return requestClient.get<ErpStockRecordApi.StockRecord>(
`/erp/stock-record/get?id=${id}`,
);
}
/** 导出产品库存明细 Excel */
export function exportStockRecord(params: any) {
return requestClient.download('/erp/stock-record/export-excel', { params });
}

View File

@ -0,0 +1,83 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpStockApi {
/** 产品库存信息 */
export interface Stock {
id?: number; // 编号
productId: number; // 产品编号
warehouseId: number; // 仓库编号
count: number; // 库存数量
}
/** 产品库存分页查询参数 */
export interface StockPageParams extends PageParam {
productId?: number;
warehouseId?: number;
}
/** 产品库存查询参数 */
export interface StockQueryParams {
productId: number;
warehouseId: number;
}
}
/**
*
*/
export function getStockPage(params: ErpStockApi.StockPageParams) {
return requestClient.get<PageResult<ErpStockApi.Stock>>('/erp/stock/page', {
params,
});
}
/**
*
*/
export function getStock(id: number) {
return requestClient.get<ErpStockApi.Stock>(`/erp/stock/get?id=${id}`);
}
/**
*
*/
export function getStockByProductAndWarehouse(
params: ErpStockApi.StockQueryParams,
) {
return requestClient.get<ErpStockApi.Stock>('/erp/stock/get', {
params,
});
}
/**
*
*/
export function getStockCount(productId: number, warehouseId?: number) {
const params: any = { productId };
if (warehouseId !== undefined) {
params.warehouseId = warehouseId;
}
return requestClient.get<number>('/erp/stock/get-count', {
params,
});
}
/**
* Excel
*/
export function exportStock(params: ErpStockApi.StockPageParams) {
return requestClient.download('/erp/stock/export-excel', {
params,
});
}
/**
*
*/
export function getWarehouseStockCount(params: ErpStockApi.StockQueryParams) {
return requestClient.get<number>('/erp/stock/get-count', {
params,
});
}

View File

@ -0,0 +1,77 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace ErpWarehouseApi {
/** ERP 仓库信息 */
export interface Warehouse {
id?: number; // 仓库编号
name: string; // 仓库名称
address: string; // 仓库地址
sort: number; // 排序
remark: string; // 备注
principal: string; // 负责人
warehousePrice: number; // 仓储费,单位:元
truckagePrice: number; // 搬运费,单位:元
status: number; // 开启状态
defaultStatus: boolean; // 是否默认
}
/** 仓库分页查询参数 */
export interface WarehousePageParam extends PageParam {
name?: string;
status?: number;
}
}
/** 查询仓库分页 */
export function getWarehousePage(params: ErpWarehouseApi.WarehousePageParam) {
return requestClient.get<PageResult<ErpWarehouseApi.Warehouse>>(
'/erp/warehouse/page',
{ params },
);
}
/** 查询仓库精简列表 */
export function getWarehouseSimpleList() {
return requestClient.get<ErpWarehouseApi.Warehouse[]>(
'/erp/warehouse/simple-list',
);
}
/** 查询仓库详情 */
export function getWarehouse(id: number) {
return requestClient.get<ErpWarehouseApi.Warehouse>(
`/erp/warehouse/get?id=${id}`,
);
}
/** 新增仓库 */
export function createWarehouse(data: ErpWarehouseApi.Warehouse) {
return requestClient.post('/erp/warehouse/create', data);
}
/** 修改仓库 */
export function updateWarehouse(data: ErpWarehouseApi.Warehouse) {
return requestClient.put('/erp/warehouse/update', data);
}
/** 修改仓库默认状态 */
export function updateWarehouseDefaultStatus(
id: number,
defaultStatus: boolean,
) {
return requestClient.put('/erp/warehouse/update-default-status', null, {
params: { id, defaultStatus },
});
}
/** 删除仓库 */
export function deleteWarehouse(id: number) {
return requestClient.delete(`/erp/warehouse/delete?id=${id}`);
}
/** 导出仓库 Excel */
export function exportWarehouse(params: any) {
return requestClient.download('/erp/warehouse/export-excel', { params });
}

View File

@ -16,6 +16,7 @@ export namespace InfraFileConfigApi {
accessKey?: string;
accessSecret?: string;
pathStyle?: boolean;
enablePublicAccess?: boolean;
domain: string;
}

View File

@ -12,6 +12,7 @@ import {
RequestClient,
} from '@vben/request';
import { useAccessStore } from '@vben/stores';
import { createApiEncrypt } from '@vben/utils';
import { message } from 'ant-design-vue';
@ -21,6 +22,7 @@ import { refreshTokenApi } from './core';
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
const tenantEnable = isTenantEnable();
const apiEncrypt = createApiEncrypt(import.meta.env);
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
const client = new RequestClient({
@ -84,10 +86,46 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
config.headers['visit-tenant-id'] = tenantEnable
? accessStore.visitTenantId
: undefined;
// 是否 API 加密
if ((config.headers || {}).isEncrypt) {
try {
// 加密请求数据
if (config.data) {
config.data = apiEncrypt.encryptRequest(config.data);
// 设置加密标识头
config.headers[apiEncrypt.getEncryptHeader()] = 'true';
}
} catch (error) {
console.error('请求数据加密失败:', error);
throw error;
}
}
return config;
},
});
// API 解密响应拦截器
client.addResponseInterceptor({
fulfilled: (response) => {
// 检查是否需要解密响应数据
const encryptHeader = apiEncrypt.getEncryptHeader();
const isEncryptResponse =
response.headers[encryptHeader] === 'true' ||
response.headers[encryptHeader.toLowerCase()] === 'true';
if (isEncryptResponse && typeof response.data === 'string') {
try {
// 解密响应数据
response.data = apiEncrypt.decryptResponse(response.data);
} catch (error) {
console.error('响应数据解密失败:', error);
throw new Error(`响应数据解密失败: ${(error as Error).message}`);
}
}
return response;
},
});
// 处理返回的响应数据格式
client.addResponseInterceptor(
defaultResponseInterceptor({

View File

@ -8,7 +8,9 @@ export namespace SystemMailLogApi {
id: number;
userId: number;
userType: number;
toMail: string;
toMails: string[];
ccMails?: string[];
bccMails?: string[];
accountId: number;
fromMail: string;
templateId: number;
@ -32,15 +34,3 @@ export function getMailLogPage(params: PageParam) {
{ params },
);
}
/** 查询邮件日志详情 */
export function getMailLog(id: number) {
return requestClient.get<SystemMailLogApi.MailLog>(
`/system/mail-log/get?id=${id}`,
);
}
/** 重新发送邮件 */
export function resendMail(id: number) {
return requestClient.put(`/system/mail-log/resend?id=${id}`);
}

View File

@ -20,7 +20,9 @@ export namespace SystemMailTemplateApi {
/** 邮件发送信息 */
export interface MailSendReq {
mail: string;
toMails: string[];
ccMails?: string[];
bccMails?: string[];
templateCode: string;
templateParams: Record<string, any>;
}

View File

@ -12,7 +12,7 @@ export namespace SystemTenantApi {
contactMobile: string;
accountCount: number;
expireTime: Date;
website: string;
websites: string[];
status: number;
}
}

View File

@ -1,2 +1,3 @@
export { default as Tinyflow } from './tinyflow.vue';
export * from './ui/typing';

View File

@ -359,7 +359,8 @@ async function saveConfig() {
currentNode.value.signEnable = configForm.value.signEnable;
//
currentNode.value.reasonRequire = configForm.value.reasonRequire;
//
currentNode.value.skipExpression = configForm.value.skipExpression;
currentNode.value.showText = getShowText();
drawerApi.close();
return true;
@ -443,7 +444,8 @@ function showUserTaskNodeConfig(node: SimpleFlowNode) {
configForm.value.signEnable = node?.signEnable ?? false;
// 7.
configForm.value.reasonRequire = node?.reasonRequire ?? false;
// 8.
configForm.value.skipExpression = node?.skipExpression ?? '';
drawerApi.open();
}
@ -850,7 +852,7 @@ onMounted(() => {
label="流程表达式"
name="expression"
>
<Textarea v-model:value="configForm.expression" clearable />
<Textarea v-model:value="configForm.expression" allow-clear />
</FormItem>
<!-- 多人审批/办理 方式 -->
<FormItem :label="`多人${nodeTypeName}方式`" name="approveMethod">
@ -1117,6 +1119,16 @@ onMounted(() => {
/>
</FormItem>
</div>
<div>
<Divider content-position="left">跳过表达式</Divider>
<FormItem prop="skipExpression">
<Textarea
v-model:value="configForm.skipExpression"
allow-clear
:rows="2"
/>
</FormItem>
</div>
</Form>
</div>
</TabPane>

View File

@ -602,6 +602,8 @@ export interface SimpleFlowNode {
signEnable?: boolean;
// 审批意见
reasonRequire?: boolean;
// 跳过表达式
skipExpression?: string;
// 触发器设置
triggerSetting?: TriggerSetting;
// 子流程

View File

@ -214,6 +214,7 @@ export type UserTaskFormType = {
returnNodeId?: string;
roleIds?: number[]; // 角色
signEnable: boolean;
skipExpression?: string; // 跳过表达式
taskAssignListener?: {
body: HttpRequestParam[];
header: HttpRequestParam[];

View File

@ -137,7 +137,7 @@ function handleButtonClick(action: ActionItem) {
}
}
// props
/** 监听props变化强制重新计算 */
watch(
() => [props.actions, props.dropDownActions],
() => {

View File

@ -979,11 +979,11 @@ export enum BpmTaskStatusEnum {
*
*/
APPROVE = 2,
/**
*
*/
APPROVING = 7,
/**
*
*/
@ -992,7 +992,6 @@ export enum BpmTaskStatusEnum {
*
*/
NOT_START = -1,
/**
*
*/
@ -1002,10 +1001,15 @@ export enum BpmTaskStatusEnum {
* 退
*/
RETURN = 5,
/**
*
*/
RUNNING = 1,
/**
*
*/
SKIP = -2,
/**
*
*/

View File

@ -4,6 +4,7 @@
// TODO @芋艿:后续这些 form-create 的优化;另外需要使用 form-create-helper 会好点
import { isRef } from 'vue';
import formCreate from '@form-create/ant-design-vue';
// 编码表单 Conf
export const encodeConf = (designerRef: any) => {
return JSON.stringify(designerRef.value.getOption());
@ -23,7 +24,7 @@ export const encodeFields = (designerRef: any) => {
export const decodeFields = (fields: string[]) => {
const rule: object[] = [];
fields.forEach((item) => {
rule.push(JSON.parse(item));
rule.push(formCreate.parseJson(item));
});
return rule;
};
@ -34,7 +35,7 @@ export const setConfAndFields = (
conf: string,
fields: string | string[],
) => {
designerRef.value.setOption(JSON.parse(conf));
designerRef.value.setOption(formCreate.parseJson(conf));
// 处理 fields 参数类型,确保传入 decodeFields 的是 string[] 类型
const fieldsArray = Array.isArray(fields) ? fields : [fields];
designerRef.value.setRule(decodeFields(fieldsArray));
@ -50,7 +51,7 @@ export const setConfAndFields2 = (
if (isRef(detailPreview)) {
detailPreview = detailPreview.value;
}
detailPreview.option = JSON.parse(conf);
detailPreview.option = formCreate.parseJson(conf);
detailPreview.rule = decodeFields(fields);
if (value) {
detailPreview.value = value;

View File

@ -1,4 +1,5 @@
<script lang="ts" setup>
// TODO @gjdhttps://t.zsxq.com/pmNb1 AI
import type { AiChatConversationApi } from '#/api/ai/chat/conversation';
import type { AiChatMessageApi } from '#/api/ai/chat/message';
@ -23,6 +24,7 @@ import MessageList from './components/message/MessageList.vue';
import MessageListEmpty from './components/message/MessageListEmpty.vue';
import MessageLoading from './components/message/MessageLoading.vue';
import MessageNewConversation from './components/message/MessageNewConversation.vue';
/** AI 聊天对话 列表 */
defineOptions({ name: 'AiChat' });

View File

@ -104,7 +104,10 @@ onMounted(async () => {
</template>
<template #userId="{ row }">
<span>
{{ userList.find((item) => item.id === row.userId)?.nickname }}
{{
userList.find((item: SystemUserApi.User) => item.id === row.userId)
?.nickname
}}
</span>
</template>
<template #publicStatus="{ row }">

View File

@ -108,7 +108,10 @@ onMounted(async () => {
</template>
<template #userId="{ row }">
<span>
{{ userList.find((item) => item.id === row.userId)?.nickname }}
{{
userList.find((item: SystemUserApi.User) => item.id === row.userId)
?.nickname
}}
</span>
</template>
<template #actions="{ row }">

View File

@ -112,7 +112,11 @@ onMounted(async () => {
</template>
<template #keyId="{ row }">
<span>
{{ apiKeyList.find((item) => item.id === row.keyId)?.name }}
{{
apiKeyList.find(
(item: AiModelApiKeyApi.ApiKey) => item.id === row.keyId,
)?.name
}}
</span>
</template>
<template #actions="{ row }">

View File

@ -123,6 +123,7 @@ const formData: any = ref({
enable: false,
summary: [],
},
allowWithdrawTask: false,
});
//
@ -178,6 +179,16 @@ async function initData() {
//
if (route.params.type === 'copy') {
delete formData.value.id;
if (formData.value.bpmnXml) {
formData.value.bpmnXml = formData.value.bpmnXml.replaceAll(
formData.value.name,
`${formData.value.name}副本`,
);
formData.value.bpmnXml = formData.value.bpmnXml.replaceAll(
formData.value.key,
`${formData.value.key}_copy`,
);
}
formData.value.name += '副本';
formData.value.key += '_copy';
}

View File

@ -69,7 +69,27 @@ const selectedUsers = ref<number[]>();
const rules: Record<string, Rule[]> = {
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }],
key: [{ required: true, message: '流程标识不能为空', trigger: 'blur' }],
key: [
{ required: true, message: '流程标识不能为空', trigger: 'blur' },
{
validator: (_rule: any, value: string, callback: any) => {
if (!value) {
callback();
return;
}
if (!/^[a-z_][\-\w.$]*$/i.test(value)) {
callback(
new Error(
'只能包含字母、数字、下划线、连字符和点号,且必须以字母或下划线开头',
),
);
return;
}
callback();
},
trigger: 'blur',
},
],
category: [{ required: true, message: '流程分类不能为空', trigger: 'blur' }],
type: [{ required: true, message: '流程类型不能为空', trigger: 'blur' }],
visible: [{ required: true, message: '是否可见不能为空', trigger: 'blur' }],

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { computed, provide, ref, watch } from 'vue';
import { CircleHelp } from '@vben/icons';
@ -146,7 +146,7 @@ function handleTaskAfterTriggerEnableChange(val: boolean | number | string) {
: null;
}
/** 表单选项 */
/** 表单字段 */
const formField = ref<Array<{ field: string; title: string }>>([]);
const formFieldOptions4Title = computed(() => {
const cloneFormField = formField.value.map((item) => {
@ -178,6 +178,9 @@ const formFieldOptions4Summary = computed(() => {
};
});
});
const unParsedFormFields = ref<string[]>([]); //
// HttpRequestSetting 使
provide('formFields', unParsedFormFields);
/** 兼容以前未配置更多设置的流程 */
function initData() {
@ -217,6 +220,9 @@ function initData() {
if (modelData.value.taskAfterTriggerSetting) {
taskAfterTriggerEnable.value = true;
}
if (modelData.value.allowWithdrawTask === undefined) {
modelData.value.allowWithdrawTask = false;
}
}
/** 监听表单 ID 变化,加载表单数据 */
@ -227,6 +233,7 @@ watch(
const data = await FormApi.getFormDetail(newFormId);
const result: Array<{ field: string; title: string }> = [];
if (data.fields) {
unParsedFormFields.value = data.fields;
data.fields.forEach((fieldStr: string) => {
parseFormFields(JSON.parse(fieldStr), result);
});
@ -234,6 +241,7 @@ watch(
formField.value = result;
} else {
formField.value = [];
unParsedFormFields.value = [];
}
},
{ immediate: true },
@ -267,6 +275,18 @@ defineExpose({ initData, validate });
</div>
</div>
</FormItem>
<FormItem class="mb-5" label="审批人权限">
<div class="mt-1 flex flex-col">
<Checkbox v-model:checked="modelData.allowWithdrawTask">
允许审批人撤回任务
</Checkbox>
<div class="ml-6">
<TypographyText type="secondary">
审批人可撤回正在审批节点的前一节点
</TypographyText>
</div>
</div>
</FormItem>
<FormItem v-if="modelData.processIdRule" class="mb-5" label="流程编码">
<Row :gutter="8" align="middle">
<Col :span="1">

View File

@ -415,6 +415,7 @@ const handleRenameSuccess = () => {
>
<div class="flex h-12 items-center">
<!-- 头部分类名 -->
<!-- TODO @jason1无法拖动排序2拖动后直接请求排序不用有个保存排序模型分类和排序分类里的模型交互有点不同哈 -->
<div class="flex items-center">
<Tooltip v-if="isCategorySorting" title="拖动排序">
<span

View File

@ -7,6 +7,7 @@ import { computed, nextTick, ref, watch } from 'vue';
import { useTabs } from '@vben/hooks';
import { IconifyIcon } from '@vben/icons';
import formCreate from '@form-create/ant-design-vue';
import { Button, Card, Col, message, Row, Space, Tabs } from 'ant-design-vue';
import { getProcessDefinition } from '#/api/bpm/definition';
@ -50,6 +51,9 @@ const props = defineProps({
const emit = defineEmits(['cancel']);
// form-create
const isFormReady = ref(false);
const { closeCurrentTab } = useTabs();
const getTitle = computed(() => {
@ -126,16 +130,18 @@ async function initProcessInfo(row: any, formVariables?: any) {
// formVariables row.formFields
// formVariables
//
const allowedFields = new Set(
decodeFields(row.formFields).map((fieldObj: any) => fieldObj.field),
);
const formApi = formCreate.create(decodeFields(row.formFields));
const allowedFields = formApi.fields();
for (const key in formVariables) {
if (!allowedFields.has(key)) {
if (!allowedFields.includes(key)) {
delete formVariables[key];
}
}
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables);
//
isFormReady.value = true;
await nextTick();
fApi.value?.btn.show(false); //
@ -292,6 +298,7 @@ defineExpose({ initProcessInfo });
class="flex-1 overflow-auto"
>
<form-create
v-if="isFormReady"
:rule="detailForm.rule"
v-model:api="fApi"
v-model="detailForm.value"

View File

@ -2,6 +2,8 @@
import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
import type { SystemUserApi } from '#/api/system/user';
// TODO @jason https://t.zsxq.com/eif2e
import { nextTick, onMounted, ref, shallowRef, watch } from 'vue';
import { Page } from '@vben/common-ui';

View File

@ -4,7 +4,7 @@ import type { Rule } from 'ant-design-vue/es/form';
import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
import { computed, reactive, ref, watch } from 'vue';
import { computed, nextTick, reactive, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { useVbenModal } from '@vben/common-ui';
@ -102,6 +102,7 @@ const approveSignFormRef = ref();
const nextAssigneesActivityNode = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>(
[],
); //
const nextAssigneesTimelineRef = ref(); // 线
const approveReasonForm: any = reactive({
reason: '',
signPicUrl: '',
@ -278,6 +279,10 @@ function closePopover(type: string, formRef: any | FormInstance) {
}
if (popOverVisible.value[type]) popOverVisible.value[type] = false;
nextAssigneesActivityNode.value = [];
// Timeline
if (nextAssigneesTimelineRef.value) {
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers({});
}
}
/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
@ -290,6 +295,7 @@ async function initNextAssigneesFormField() {
processVariablesStr: JSON.stringify(variables),
});
if (data && data.length > 0) {
const customApproveUsersData: Record<string, any[]> = {}; // Timeline
data.forEach((node: BpmProcessInstanceApi.ApprovalNodeInfo) => {
if (
//
@ -302,7 +308,23 @@ async function initNextAssigneesFormField() {
) {
nextAssigneesActivityNode.value.push(node);
}
// candidateUsers customApproveUsers
if (node.candidateUsers && node.candidateUsers.length > 0) {
customApproveUsersData[node.id] = node.candidateUsers;
}
});
// candidateUsers Timeline
await nextTick(); // tick Timeline
if (
nextAssigneesTimelineRef.value &&
Object.keys(customApproveUsersData).length > 0
) {
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers(
customApproveUsersData,
);
}
}
}
@ -364,6 +386,10 @@ async function handleAudit(pass: boolean, formRef: FormInstance | undefined) {
await TaskApi.approveTask(data);
popOverVisible.value.approve = false;
nextAssigneesActivityNode.value = [];
// Timeline
if (nextAssigneesTimelineRef.value) {
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers({});
}
message.success('审批通过成功');
} else {
//
@ -733,9 +759,10 @@ defineExpose({ loadTodoTask });
>
<div class="-mb-8 -mt-3.5 ml-2.5">
<ProcessInstanceTimeline
ref="nextAssigneesTimelineRef"
:activity-nodes="nextAssigneesActivityNode"
:show-status-icon="false"
:use-next-assignees="true"
:enable-approve-user-select="true"
@select-user-confirm="selectNextAssigneesConfirm"
/>
</div>

View File

@ -23,12 +23,12 @@ defineOptions({ name: 'BpmProcessInstanceTimeline' });
const props = withDefaults(
defineProps<{
activityNodes: BpmProcessInstanceApi.ApprovalNodeInfo[]; //
enableApproveUserSelect?: boolean; //
showStatusIcon?: boolean; //
useNextAssignees?: boolean; //
}>(),
{
showStatusIcon: true, // true
useNextAssignees: false, // false
enableApproveUserSelect: false, // false
},
);
@ -43,6 +43,8 @@ const statusIconMap: Record<
string,
{ animation?: string; color: string; icon: string }
> = {
//
'-2': { color: '#909398', icon: 'mdi:skip-forward-outline' },
//
'-1': { color: '#909398', icon: 'mdi:clock-outline' },
//
@ -181,6 +183,9 @@ function handleUserSelectConfirm(userList: any[]) {
/** 跳转子流程 */
function handleChildProcess(activity: any) {
if (!activity.processInstanceId) {
return;
}
push({
name: 'BpmProcessInstanceDetail',
query: {
@ -195,12 +200,12 @@ function shouldShowCustomUserSelect(
) {
return (
isEmpty(activity.tasks) &&
isEmpty(activity.candidateUsers) &&
(BpmCandidateStrategyEnum.START_USER_SELECT ===
activity.candidateStrategy ||
(BpmCandidateStrategyEnum.APPROVE_USER_SELECT ===
activity.candidateStrategy &&
props.useNextAssignees))
((BpmCandidateStrategyEnum.START_USER_SELECT ===
activity.candidateStrategy &&
isEmpty(activity.candidateUsers)) ||
(props.enableApproveUserSelect &&
BpmCandidateStrategyEnum.APPROVE_USER_SELECT ===
activity.candidateStrategy))
);
}
@ -223,6 +228,21 @@ function handleUserSelectClosed() {
function handleUserSelectCancel() {
selectedUsers.value = [];
}
/** 设置自定义审批人 */
const setCustomApproveUsers = (activityId: string, users: any[]) => {
customApproveUsers.value[activityId] = users || [];
};
/** 批量设置多个节点的自定义审批人 */
const batchSetCustomApproveUsers = (data: Record<string, any[]>) => {
Object.keys(data).forEach((activityId) => {
customApproveUsers.value[activityId] = data[activityId] || [];
});
};
//
defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
</script>
<template>
@ -267,7 +287,12 @@ function handleUserSelectCancel() {
>
<!-- 第一行节点名称时间 -->
<div class="flex w-full">
<div class="font-bold">{{ activity.name }}</div>
<div class="font-bold">
{{ activity.name }}
<span v-if="activity.status === BpmTaskStatusEnum.SKIP">
跳过
</span>
</div>
<!-- 信息时间 -->
<div
v-if="activity.status !== BpmTaskStatusEnum.NOT_START"
@ -284,6 +309,7 @@ function handleUserSelectCancel() {
ghost
size="small"
@click="handleChildProcess(activity)"
:disabled="!activity.processInstanceId"
>
查看子流程
</Button>

View File

@ -4,8 +4,10 @@ import type { BpmTaskApi } from '#/api/bpm/task';
import { DocAlert, Page } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getTaskDonePage } from '#/api/bpm/task';
import { getTaskDonePage, withdrawTask } from '#/api/bpm/task';
import { router } from '#/router';
import { useGridColumns, useGridFormSchema } from './data';
@ -23,7 +25,15 @@ function handleHistory(row: BpmTaskApi.TaskManager) {
});
}
const [Grid] = useVbenVxeGrid({
/** 撤回任务 */
async function handleWithdraw(row: BpmTaskApi.TaskManager) {
await withdrawTask(row.id);
message.success('撤回成功');
//
await gridApi.query();
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
@ -52,7 +62,7 @@ const [Grid] = useVbenVxeGrid({
cellConfig: {
height: 64,
},
} as VxeTableGridOptions<BpmTaskApi.Task>,
} as VxeTableGridOptions<BpmTaskApi.TaskManager>,
});
</script>
@ -75,6 +85,13 @@ const [Grid] = useVbenVxeGrid({
<template #actions="{ row }">
<TableAction
:actions="[
{
label: '撤回',
type: 'link',
icon: ACTION_ICON.EDIT,
color: 'warning',
onClick: handleWithdraw.bind(null, row),
},
{
label: '历史',
type: 'link',

View File

@ -66,7 +66,7 @@ function handleUpdateValue(row: any) {
} else {
tableData.value[index] = row;
}
emit('update:products', tableData.value);
emit('update:products', [...tableData.value]);
}
/** 表格配置 */

View File

@ -0,0 +1,167 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { z } from '#/adapter/form';
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'id',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
component: 'Input',
fieldName: 'name',
label: '名称',
rules: 'required',
componentProps: {
placeholder: '请输入名称',
},
},
{
fieldName: 'status',
label: '状态',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
buttonStyle: 'solid',
optionType: 'button',
},
rules: z.number().default(CommonStatusEnum.ENABLE),
},
{
fieldName: 'sort',
label: '排序',
component: 'InputNumber',
componentProps: {
placeholder: '请输入排序',
precision: 0,
class: 'w-full',
},
rules: 'required',
defaultValue: 0,
},
{
fieldName: 'defaultStatus',
label: '是否默认',
component: 'RadioGroup',
componentProps: {
options: [
{
label: '是',
value: true,
},
{
label: '否',
value: false,
},
],
buttonStyle: 'solid',
optionType: 'button',
},
rules: z.boolean().default(false).optional(),
},
{
fieldName: 'no',
label: '编码',
component: 'Input',
componentProps: {
placeholder: '请输入编码',
},
},
{
fieldName: 'remark',
label: '备注',
component: 'Textarea',
},
];
}
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'name',
label: '名称',
component: 'Input',
},
{
fieldName: 'no',
label: '编码',
component: 'Input',
},
{
fieldName: 'remark',
label: '备注',
component: 'Input',
},
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
return [
{
field: 'name',
title: '名称',
},
{
field: 'no',
title: '编码',
},
{
field: 'remark',
title: '备注',
},
{
field: 'sort',
title: '排序',
},
{
field: 'status',
title: '状态',
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
},
},
{
field: 'defaultStatus',
title: '是否默认',
slots: {
default: ({ row }) => {
return h(
Tag,
{
class: 'mr-1',
color: row.defaultStatus ? 'blue' : 'red',
},
() => (row.defaultStatus ? '是' : '否'),
);
},
},
},
{
field: 'createTime',
title: '创建时间',
formatter: 'formatDateTime',
},
{
title: '操作',
width: 130,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@ -1,34 +1,152 @@
<script lang="ts" setup>
import { DocAlert, Page } from '@vben/common-ui';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpAccountApi } from '#/api/erp/finance/account';
import { Button } from 'ant-design-vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteAccount,
exportAccount,
getAccountPage,
} from '#/api/erp/finance/account';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
/** 刷新表格 */
function onRefresh() {
gridApi.query();
}
/** 导出表格 */
async function handleExport() {
const data = await exportAccount(await gridApi.formApi.getValues());
downloadFileFromBlobPart({ fileName: '结算账户信息.xls', source: data });
}
/** 创建结算账户 */
function handleCreate() {
formModalApi.setData(null).open();
}
/** 编辑结算账户 */
function handleEdit(row: ErpAccountApi.Account) {
formModalApi.setData(row).open();
}
/** 删除结算账户 */
async function handleDelete(row: ErpAccountApi.Account) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
key: 'action_key_msg',
});
try {
await deleteAccount(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
key: 'action_key_msg',
});
onRefresh();
} finally {
hideLoading();
}
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
height: 'auto',
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getAccountPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<ErpAccountApi.Account>,
});
</script>
<template>
<Page>
<Page auto-content-height>
<template #doc>
<DocAlert
title="【财务】采购付款、销售收款"
url="https://doc.iocoder.cn/sale/finance-payment-receipt/"
/>
</template>
<Button
danger
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
>
该功能支持 Vue3 + element-plus 版本
</Button>
<br />
<Button
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/finance/account/index"
>
可参考
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/finance/account/index
代码pull request 贡献给我们
</Button>
<FormModal @success="onRefresh" />
<Grid table-title="">
<template #toolbar-tools>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', ['结算账户']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['erp:account:create'],
onClick: handleCreate,
},
{
label: $t('ui.actionTitle.export'),
type: 'primary',
icon: ACTION_ICON.DOWNLOAD,
auth: ['erp:account:export'],
onClick: handleExport,
},
]"
/>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.edit'),
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['erp:account:update'],
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['erp:account:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@ -0,0 +1,86 @@
<script lang="ts" setup>
import type { ErpAccountApi } from '#/api/erp/finance/account';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
createAccount,
getAccount,
updateAccount,
} from '#/api/erp/finance/account';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<ErpAccountApi.Account>();
const getTitle = computed(() => {
return formData.value?.id
? $t('ui.actionTitle.edit', ['结算产品'])
: $t('ui.actionTitle.create', ['结算产品']);
});
const [Form, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
},
},
// 2
wrapperClass: 'grid-cols-1',
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
modalApi.lock();
//
const data = (await formApi.getValues()) as ErpAccountApi.Account;
try {
await (formData.value?.id ? updateAccount(data) : createAccount(data));
//
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
return;
}
//
const data = modalApi.getData<ErpAccountApi.Account>();
if (!data || !data.id) {
return;
}
modalApi.lock();
try {
formData.value = await getAccount(data.id as number);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
},
});
</script>
<template>
<Modal class="w-2/5" :title="getTitle">
<Form class="mx-4" />
</Modal>
</template>

View File

@ -0,0 +1,70 @@
<script lang="ts" setup>
import type { AnalysisOverviewItem } from '@vben/common-ui';
import { computed } from 'vue';
import { AnalysisOverview } from '@vben/common-ui';
import {
SvgBellIcon,
SvgCakeIcon,
SvgCardIcon,
SvgDownloadIcon,
} from '@vben/icons';
interface Props {
saleSummary?: {
monthPrice?: number;
todayPrice?: number;
yearPrice?: number;
yesterdayPrice?: number;
};
purchaseSummary?: {
monthPrice?: number;
todayPrice?: number;
yearPrice?: number;
yesterdayPrice?: number;
};
}
const props = withDefaults(defineProps<Props>(), {
saleSummary: () => ({}),
purchaseSummary: () => ({}),
});
/** 概览数据 */
// TODO @nehc 8 4
const overviewItems = computed<AnalysisOverviewItem[]>(() => [
{
icon: SvgCardIcon,
title: '今日销售',
totalTitle: '今日采购',
totalValue: props.purchaseSummary?.todayPrice || 0,
value: props.saleSummary?.todayPrice || 0,
},
{
icon: SvgCakeIcon,
title: '昨日销售',
totalTitle: '昨日采购',
totalValue: props.purchaseSummary?.yesterdayPrice || 0,
value: props.saleSummary?.yesterdayPrice || 0,
},
{
icon: SvgDownloadIcon,
title: '本月销售',
totalTitle: '本月采购',
totalValue: props.purchaseSummary?.monthPrice || 0,
value: props.saleSummary?.monthPrice || 0,
},
{
icon: SvgBellIcon,
title: '今年销售',
totalTitle: '今年采购',
totalValue: props.purchaseSummary?.yearPrice || 0,
value: props.saleSummary?.yearPrice || 0,
},
]);
</script>
<template>
<AnalysisOverview :items="overviewItems" />
</template>

View File

@ -0,0 +1,174 @@
<script lang="ts" setup>
import type { EChartsOption } from 'echarts';
import type { EchartsUIType } from '@vben/plugins/echarts';
import type { ErpPurchaseStatisticsApi } from '#/api/erp/statistics/purchase';
import type { ErpSaleStatisticsApi } from '#/api/erp/statistics/sale';
import { onMounted, ref, watch } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { Card } from 'ant-design-vue';
import {
getPurchaseSummary,
getPurchaseTimeSummary,
} from '#/api/erp/statistics/purchase';
import { getSaleSummary, getSaleTimeSummary } from '#/api/erp/statistics/sale';
interface Props {
title: string;
type?: 'purchase' | 'sale';
}
const props = withDefaults(defineProps<Props>(), {
type: 'sale',
});
/** 销售统计数据 */
const saleSummary = ref<ErpSaleStatisticsApi.SaleSummary>(); //
const saleTimeSummaryList = ref<ErpSaleStatisticsApi.SaleTimeSummary[]>(); //
const getSaleStatistics = async () => {
saleSummary.value = await getSaleSummary();
saleTimeSummaryList.value = await getSaleTimeSummary();
};
/** 采购统计数据 */
const purchaseSummary = ref<ErpPurchaseStatisticsApi.PurchaseSummary>(); //
const purchaseTimeSummaryList =
ref<ErpPurchaseStatisticsApi.PurchaseTimeSummary[]>(); //
const getPurchaseStatistics = async () => {
purchaseSummary.value = await getPurchaseSummary();
purchaseTimeSummaryList.value = await getPurchaseTimeSummary();
};
/** 获取当前类型的时段数据 */
const currentTimeSummaryList = ref<Array<{ price: number; time: string }>>();
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);
/** 折线图配置 */
const lineChartOptions: EChartsOption = {
grid: {
left: 20,
right: 20,
bottom: 20,
top: 80,
containLabel: true,
},
legend: {
top: 50,
},
series: [
{
name: '金额',
type: 'line',
smooth: true,
areaStyle: {},
data: [],
},
],
toolbox: {
feature: {
dataZoom: {
yAxisIndex: false,
},
brush: {
type: ['lineX', 'clear'],
},
saveAsImage: {
show: true,
name: props.title,
},
},
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
},
padding: [5, 10],
},
xAxis: {
type: 'category',
boundaryGap: false,
axisTick: {
show: false,
},
data: [],
},
yAxis: {
axisTick: {
show: false,
},
},
};
/** 初始化数据 */
const initData = async () => {
if (props.type === 'sale') {
await getSaleStatistics();
currentTimeSummaryList.value = saleTimeSummaryList.value;
} else {
await getPurchaseStatistics();
currentTimeSummaryList.value = purchaseTimeSummaryList.value;
}
};
/** 监听数据变化并更新图表 */
watch(
() => currentTimeSummaryList.value,
(val) => {
if (!val || val.length === 0) {
return;
}
//
const xAxisData = val.map((item) => item.time);
const seriesData = val.map((item) => item.price);
const options = {
...lineChartOptions,
xAxis: {
...lineChartOptions.xAxis,
data: xAxisData,
},
series: [
{
...lineChartOptions.series![0],
data: seriesData,
},
],
};
renderEcharts(options);
},
{ immediate: true },
);
/** 组件挂载时初始化数据 */
onMounted(() => {
initData();
});
/** 暴露数据给父组件使用 */
defineExpose({
saleSummary,
purchaseSummary,
saleTimeSummaryList,
purchaseTimeSummaryList,
});
</script>
<template>
<Card>
<template #title>
<span>{{ title }}</span>
</template>
<!-- 折线图 -->
<EchartsUI ref="chartRef" />
</Card>
</template>

View File

@ -1,7 +1,21 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { DocAlert, Page } from '@vben/common-ui';
import { Button } from 'ant-design-vue';
import { Col, Row, Spin } from 'ant-design-vue';
import SummaryCard from './components/SummaryCard.vue';
import TimeSummaryChart from './components/TimeSummaryChart.vue';
/** ERP首页 */
defineOptions({ name: 'ErpHome' });
const loading = ref(false); //
/** 图表组件引用 */
const saleChartRef = ref();
const purchaseChartRef = ref();
</script>
<template>
@ -12,23 +26,28 @@ import { Button } from 'ant-design-vue';
url="https://doc.iocoder.cn/erp/build/"
/>
</template>
<Button
danger
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
>
该功能支持 Vue3 + element-plus 版本
</Button>
<br />
<Button
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/home/index.vue"
>
可参考
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/home/index.vue
代码pull request 贡献给我们
</Button>
<Spin :spinning="loading">
<div class="flex flex-col gap-4">
<!-- 销售/采购的全局统计 -->
<SummaryCard />
<!-- 销售/采购的时段统计 -->
<Row :gutter="16">
<!-- 销售统计 -->
<Col :md="12" :sm="12" :xs="24">
<TimeSummaryChart ref="saleChartRef" title="销售统计" type="sale" />
</Col>
<!-- 采购统计 -->
<Col :md="12" :sm="12" :xs="24">
<TimeSummaryChart
ref="purchaseChartRef"
title="采购统计"
type="purchase"
/>
</Col>
</Row>
</div>
</Spin>
</Page>
</template>

View File

@ -0,0 +1,125 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpProductCategoryApi } from '#/api/erp/product/category';
import { handleTree } from '@vben/utils';
import { z } from '#/adapter/form';
import { getProductCategoryList } from '#/api/erp/product/category';
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'id',
component: 'Input',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
fieldName: 'parentId',
label: '上级分类',
component: 'ApiTreeSelect',
componentProps: {
allowClear: true,
api: async () => {
const data = await getProductCategoryList();
data.unshift({
id: 0,
name: '顶级分类',
});
return handleTree(data);
},
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择上级分类',
treeDefaultExpandAll: true,
},
rules: 'selectRequired',
},
{
fieldName: 'name',
label: '分类名称',
component: 'Input',
componentProps: {
placeholder: '请输入分类名称',
},
rules: 'required',
},
{
fieldName: 'code',
label: '分类编码',
component: 'Input',
componentProps: {
placeholder: '请输入分类编码',
},
rules: z.string().regex(/^[A-Z]+$/, '分类编码必须为大写字母'),
},
{
fieldName: 'sort',
label: '显示顺序',
component: 'InputNumber',
componentProps: {
min: 0,
controlsPosition: 'right',
placeholder: '请输入显示顺序',
},
rules: 'required',
},
{
fieldName: 'status',
label: '状态',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
buttonStyle: 'solid',
optionType: 'button',
},
rules: z.number().default(CommonStatusEnum.ENABLE),
},
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<ErpProductCategoryApi.ProductCategory>['columns'] {
return [
{
field: 'name',
title: '分类名称',
align: 'left',
treeNode: true,
},
{
field: 'code',
title: '分类编码',
},
{
field: 'sort',
title: '显示顺序',
},
{
field: 'status',
title: '分类状态',
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
},
},
{
field: 'createTime',
title: '创建时间',
formatter: 'formatDateTime',
},
{
title: '操作',
width: 220,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@ -1,34 +1,166 @@
<script lang="ts" setup>
import { DocAlert, Page } from '@vben/common-ui';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpProductCategoryApi } from '#/api/erp/product/category';
import { Button } from 'ant-design-vue';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteProductCategory,
getProductCategoryList,
} from '#/api/erp/product/category';
import { $t } from '#/locales';
import { useGridColumns } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
/** 刷新表格 */
function onRefresh() {
gridApi.query();
}
/** 切换树形展开/收缩状态 */
const isExpanded = ref(true);
function toggleExpand() {
isExpanded.value = !isExpanded.value;
gridApi.grid.setAllTreeExpand(isExpanded.value);
}
/** 创建分类 */
function handleCreate() {
formModalApi.setData(null).open();
}
/** 添加下级分类 */
function handleAppend(row: ErpProductCategoryApi.ProductCategory) {
formModalApi.setData({ parentId: row.id }).open();
}
/** 编辑分类 */
function handleEdit(row: ErpProductCategoryApi.ProductCategory) {
formModalApi.setData(row).open();
}
/** 删除分类 */
async function handleDelete(row: ErpProductCategoryApi.ProductCategory) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
key: 'action_key_msg',
});
try {
await deleteProductCategory(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
key: 'action_key_msg',
});
onRefresh();
} finally {
hideLoading();
}
}
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions: {
columns: useGridColumns(),
height: 'auto',
proxyConfig: {
ajax: {
query: async () => {
return await getProductCategoryList();
},
},
},
pagerConfig: {
enabled: false,
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
treeConfig: {
transform: true,
rowField: 'id',
parentField: 'parentId',
expandAll: true,
accordion: false,
},
} as VxeTableGridOptions<ErpProductCategoryApi.ProductCategory>,
});
</script>
<template>
<Page>
<Page auto-content-height>
<template #doc>
<DocAlert
title="【产品】产品信息、分类、单位"
url="https://doc.iocoder.cn/erp/product/"
/>
</template>
<Button
danger
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
>
该功能支持 Vue3 + element-plus 版本
</Button>
<br />
<Button
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/category/index"
>
可参考
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/category/index
代码pull request 贡献给我们
</Button>
<FormModal @success="onRefresh" />
<Grid table-title="">
<template #toolbar-tools>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', ['产品分类']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['erp:product-category:create'],
onClick: handleCreate,
},
{
label: isExpanded ? '收缩' : '展开',
type: 'primary',
onClick: toggleExpand,
},
]"
/>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: '新增下级',
type: 'link',
icon: ACTION_ICON.ADD,
auth: ['erp:product-category:create'],
onClick: handleAppend.bind(null, row),
},
{
label: $t('common.edit'),
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['erp:product-category:update'],
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['erp:product-category:delete'],
ifShow: !(row.children && row.children.length > 0),
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@ -0,0 +1,92 @@
<script lang="ts" setup>
import type { ErpProductCategoryApi } from '#/api/erp/product/category';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
createProductCategory,
getProductCategory,
updateProductCategory,
} from '#/api/erp/product/category';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<ErpProductCategoryApi.ProductCategory>();
const getTitle = computed(() => {
return formData.value?.id
? $t('ui.actionTitle.edit', ['分类'])
: $t('ui.actionTitle.create', ['分类']);
});
const [Form, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
},
formItemClass: 'col-span-2',
labelWidth: 80,
},
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
modalApi.lock();
//
const data =
(await formApi.getValues()) as ErpProductCategoryApi.ProductCategory;
try {
await (formData.value?.id
? updateProductCategory(data)
: createProductCategory(data));
//
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
return;
}
//
let data = modalApi.getData<ErpProductCategoryApi.ProductCategory>();
if (!data) {
return;
}
if (data.id) {
modalApi.lock();
try {
data = await getProductCategory(data.id);
} finally {
modalApi.unlock();
}
}
// values
formData.value = data;
await formApi.setValues(formData.value);
},
});
</script>
<template>
<Modal :title="getTitle">
<Form class="mx-4" />
</Modal>
</template>

View File

@ -0,0 +1,220 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { handleTree } from '@vben/utils';
import { z } from '#/adapter/form';
import { getProductCategorySimpleList } from '#/api/erp/product/category';
import { getProductUnitSimpleList } from '#/api/erp/product/unit';
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'id',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
component: 'Input',
fieldName: 'name',
label: '名称',
rules: 'required',
componentProps: {
placeholder: '请输入名称',
},
},
{
fieldName: 'barCode',
label: '条码',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '请输入条码',
},
},
{
fieldName: 'categoryId',
label: '分类',
component: 'ApiTreeSelect',
componentProps: {
api: async () => {
const data = await getProductCategorySimpleList();
return handleTree(data);
},
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择分类',
treeDefaultExpandAll: true,
},
rules: 'required',
},
{
fieldName: 'unitId',
label: '单位',
component: 'ApiSelect',
componentProps: {
api: getProductUnitSimpleList,
labelField: 'name',
valueField: 'id',
placeholder: '请选择单位',
},
rules: 'required',
},
{
fieldName: 'status',
label: '状态',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
buttonStyle: 'solid',
optionType: 'button',
},
rules: z.number().default(CommonStatusEnum.ENABLE),
},
{
fieldName: 'standard',
label: '规格',
component: 'Input',
componentProps: {
placeholder: '请输入规格',
},
},
{
fieldName: 'expiryDay',
label: '保质期天数',
component: 'InputNumber',
componentProps: {
placeholder: '请输入保质期天数',
},
},
{
fieldName: 'weight',
label: '重量kg',
component: 'InputNumber',
componentProps: {
placeholder: '请输入重量kg',
},
},
{
fieldName: 'purchasePrice',
label: '采购价格',
component: 'InputNumber',
componentProps: {
placeholder: '请输入采购价格,单位:元',
},
},
{
fieldName: 'salePrice',
label: '销售价格',
component: 'InputNumber',
componentProps: {
placeholder: '请输入销售价格,单位:元',
},
},
{
fieldName: 'minPrice',
label: '最低价格',
component: 'InputNumber',
componentProps: {
placeholder: '请输入最低价格,单位:元',
},
},
{
fieldName: 'remark',
label: '备注',
component: 'Textarea',
},
];
}
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'name',
label: '名称',
component: 'Input',
},
{
fieldName: 'categoryId',
label: '分类',
component: 'ApiTreeSelect',
componentProps: {
api: async () => {
const data = await getProductCategorySimpleList();
return handleTree(data);
},
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择分类',
treeDefaultExpandAll: true,
},
},
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
return [
{
field: 'barCode',
title: '条码',
},
{
field: 'name',
title: '名称',
},
{
field: 'standard',
title: '规格',
},
{
field: 'categoryName',
title: '分类',
},
{
field: 'unitName',
title: '单位',
},
{
field: 'purchasePrice',
title: '采购价格',
},
{
field: 'salePrice',
title: '销售价格',
},
{
field: 'minPrice',
title: '最低价格',
},
{
field: 'status',
title: '状态',
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
},
},
{
field: 'createTime',
title: '创建时间',
formatter: 'formatDateTime',
},
{
title: '操作',
width: 130,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@ -1,34 +1,152 @@
<script lang="ts" setup>
import { DocAlert, Page } from '@vben/common-ui';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpProductApi } from '#/api/erp/product/product';
import { Button } from 'ant-design-vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteProduct,
exportProduct,
getProductPage,
} from '#/api/erp/product/product';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
/** 刷新表格 */
function onRefresh() {
gridApi.query();
}
/** 导出表格 */
async function handleExport() {
const data = await exportProduct(await gridApi.formApi.getValues());
downloadFileFromBlobPart({ fileName: '产品信息.xls', source: data });
}
/** 创建产品 */
function handleCreate() {
formModalApi.setData(null).open();
}
/** 编辑产品 */
function handleEdit(row: ErpProductApi.Product) {
formModalApi.setData(row).open();
}
/** 删除产品 */
async function handleDelete(row: ErpProductApi.Product) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
key: 'action_key_msg',
});
try {
await deleteProduct(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
key: 'action_key_msg',
});
onRefresh();
} finally {
hideLoading();
}
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
height: 'auto',
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getProductPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<ErpProductApi.Product>,
});
</script>
<template>
<Page>
<Page auto-content-height>
<template #doc>
<DocAlert
title="【产品】产品信息、分类、单位"
url="https://doc.iocoder.cn/erp/product/"
/>
</template>
<Button
danger
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
>
该功能支持 Vue3 + element-plus 版本
</Button>
<br />
<Button
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/product/index"
>
可参考
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/product/index
代码pull request 贡献给我们
</Button>
<FormModal @success="onRefresh" />
<Grid table-title="">
<template #toolbar-tools>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', ['产品']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['erp:product:create'],
onClick: handleCreate,
},
{
label: $t('ui.actionTitle.export'),
type: 'primary',
icon: ACTION_ICON.DOWNLOAD,
auth: ['erp:product:export'],
onClick: handleExport,
},
]"
/>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.edit'),
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['erp:product:update'],
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['erp:product:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@ -0,0 +1,86 @@
<script lang="ts" setup>
import type { ErpProductApi } from '#/api/erp/product/product';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
createProduct,
getProduct,
updateProduct,
} from '#/api/erp/product/product';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<ErpProductApi.Product>();
const getTitle = computed(() => {
return formData.value?.id
? $t('ui.actionTitle.edit', ['产品'])
: $t('ui.actionTitle.create', ['产品']);
});
const [Form, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
},
},
// 2
wrapperClass: 'grid-cols-2',
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
modalApi.lock();
//
const data = (await formApi.getValues()) as ErpProductApi.Product;
try {
await (formData.value?.id ? updateProduct(data) : createProduct(data));
//
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
return;
}
//
const data = modalApi.getData<ErpProductApi.Product>();
if (!data || !data.id) {
return;
}
modalApi.lock();
try {
formData.value = await getProduct(data.id as number);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
},
});
</script>
<template>
<Modal class="w-2/5" :title="getTitle">
<Form class="mx-4" />
</Modal>
</template>

View File

@ -0,0 +1,89 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { z } from '#/adapter/form';
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'id',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
component: 'Input',
fieldName: 'name',
label: '单位名称',
rules: 'required',
},
{
fieldName: 'status',
label: '单位状态',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
buttonStyle: 'solid',
optionType: 'button',
},
rules: z.number().default(CommonStatusEnum.ENABLE),
},
];
}
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'name',
label: '单位名称',
component: 'Input',
},
{
fieldName: 'status',
label: '单位状态',
component: 'Select',
componentProps: {
allowClear: true,
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
},
},
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
return [
{
field: 'id',
title: '单位编号',
},
{
field: 'name',
title: '单位名称',
},
{
field: 'status',
title: '单位状态',
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
},
},
{
field: 'createTime',
title: '创建时间',
formatter: 'formatDateTime',
},
{
title: '操作',
width: 130,
fixed: 'right',
slots: { default: 'actions' },
},
];
}

View File

@ -1,34 +1,152 @@
<script lang="ts" setup>
import { DocAlert, Page } from '@vben/common-ui';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpProductUnitApi } from '#/api/erp/product/unit';
import { Button } from 'ant-design-vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteProductUnit,
exportProductUnit,
getProductUnitPage,
} from '#/api/erp/product/unit';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
/** 刷新表格 */
function onRefresh() {
gridApi.query();
}
/** 导出表格 */
async function handleExport() {
const data = await exportProductUnit(await gridApi.formApi.getValues());
downloadFileFromBlobPart({ fileName: '产品单位.xls', source: data });
}
/** 创建产品单位 */
function handleCreate() {
formModalApi.setData(null).open();
}
/** 编辑产品单位 */
function handleEdit(row: ErpProductUnitApi.ProductUnit) {
formModalApi.setData(row).open();
}
/** 删除产品单位 */
async function handleDelete(row: ErpProductUnitApi.ProductUnit) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
key: 'action_key_msg',
});
try {
await deleteProductUnit(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
key: 'action_key_msg',
});
onRefresh();
} finally {
hideLoading();
}
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
height: 'auto',
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getProductUnitPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<ErpProductUnitApi.ProductUnit>,
});
</script>
<template>
<Page>
<Page auto-content-height>
<template #doc>
<DocAlert
title="【产品】产品信息、分类、单位"
url="https://doc.iocoder.cn/erp/product/"
/>
</template>
<Button
danger
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
>
该功能支持 Vue3 + element-plus 版本
</Button>
<br />
<Button
type="link"
target="_blank"
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/unit/index"
>
可参考
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/unit/index
代码pull request 贡献给我们
</Button>
<FormModal @success="onRefresh" />
<Grid table-title="">
<template #toolbar-tools>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', ['产品单位']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['erp:product-unit:create'],
onClick: handleCreate,
},
{
label: $t('ui.actionTitle.export'),
type: 'primary',
icon: ACTION_ICON.DOWNLOAD,
auth: ['erp:product-unit:export'],
onClick: handleExport,
},
]"
/>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.edit'),
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['erp:product-unit:update'],
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['erp:product-unit:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@ -0,0 +1,88 @@
<script lang="ts" setup>
import type { ErpProductUnitApi } from '#/api/erp/product/unit';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
createProductUnit,
getProductUnit,
updateProductUnit,
} from '#/api/erp/product/unit';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<ErpProductUnitApi.ProductUnit>();
const getTitle = computed(() => {
return formData.value?.id
? $t('ui.actionTitle.edit', ['产品单位'])
: $t('ui.actionTitle.create', ['产品单位']);
});
const [Form, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
},
formItemClass: 'col-span-2',
labelWidth: 80,
},
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
modalApi.lock();
//
const data = (await formApi.getValues()) as ErpProductUnitApi.ProductUnit;
try {
await (formData.value?.id
? updateProductUnit(data)
: createProductUnit(data));
//
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
return;
}
//
const data = modalApi.getData<ErpProductUnitApi.ProductUnit>();
if (!data || !data.id) {
return;
}
modalApi.lock();
try {
formData.value = await getProductUnit(data.id as number);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
},
});
</script>
<template>
<Modal class="w-2/5" :title="getTitle">
<Form class="mx-4" />
</Modal>
</template>

View File

@ -0,0 +1,586 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { erpPriceInputFormatter } from '@vben/utils';
import { z } from '#/adapter/form';
import { getAccountSimpleList } from '#/api/erp/finance/account';
import { getProductSimpleList } from '#/api/erp/product/product';
import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
import { getSimpleUserList } from '#/api/system/user';
import { DICT_TYPE, getDictOptions } from '#/utils';
/** 表单的配置项 */
export function useFormSchema(formType: string): VbenFormSchema[] {
return [
{
component: 'Input',
componentProps: {
style: { display: 'none' },
},
fieldName: 'id',
label: 'ID',
hideLabel: true,
formItemClass: 'hidden',
},
{
component: 'Input',
componentProps: {
placeholder: '系统自动生成',
disabled: true,
},
fieldName: 'no',
label: '入库单号',
},
{
component: 'ApiSelect',
componentProps: {
disabled: true,
placeholder: '请选择供应商',
allowClear: true,
showSearch: true,
api: getSupplierSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
},
fieldName: 'supplierId',
label: '供应商',
rules: 'required',
},
{
fieldName: 'orderNo',
label: '关联订单',
component: 'Input',
formItemClass: 'col-span-1',
componentProps: {
disabled: formType === 'detail',
placeholder: '请选择关联订单',
},
rules: 'required',
},
{
component: 'DatePicker',
componentProps: {
disabled: formType === 'detail',
placeholder: '选择订单时间',
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
style: { width: '100%' },
},
fieldName: 'inTime',
label: '入库时间',
rules: 'required',
},
{
component: 'Textarea',
componentProps: {
placeholder: '请输入备注',
disabled: formType === 'detail',
autoSize: { minRows: 1, maxRows: 1 },
class: 'w-full',
},
fieldName: 'remark',
label: '备注',
formItemClass: 'col-span-2',
},
{
component: 'FileUpload',
componentProps: {
disabled: formType === 'detail',
maxNumber: 1,
maxSize: 10,
accept: [
'pdf',
'doc',
'docx',
'xls',
'xlsx',
'txt',
'jpg',
'jpeg',
'png',
],
showDescription: true,
},
fieldName: 'fileUrl',
label: '附件',
formItemClass: 'col-span-3',
},
{
fieldName: 'product',
label: '产品清单',
component: 'Input',
formItemClass: 'col-span-3',
},
{
component: 'InputNumber',
fieldName: 'discountPercent',
componentProps: {
placeholder: '优惠率',
min: 0,
max: 100,
disabled: true,
precision: 2,
style: { width: '100%' },
},
label: '优惠率(%)',
},
{
component: 'InputNumber',
componentProps: {
placeholder: '付款优惠',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
style: { width: '100%' },
},
fieldName: 'discountPrice',
label: '付款优惠',
},
{
component: 'InputNumber',
componentProps: {
placeholder: '优惠后金额',
precision: 2,
formatter: erpPriceInputFormatter,
disabled: true,
style: { width: '100%' },
},
fieldName: 'discountedPrice',
label: '优惠后金额',
},
{
component: 'InputNumber',
componentProps: {
disabled: formType === 'detail',
placeholder: '请输入其他费用',
precision: 2,
formatter: erpPriceInputFormatter,
style: { width: '100%' },
},
fieldName: 'otherPrice',
label: '其他费用',
},
{
component: 'ApiSelect',
componentProps: {
placeholder: '请选择结算账户',
disabled: true,
allowClear: true,
showSearch: true,
api: getAccountSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
},
fieldName: 'accountId',
label: '结算账户',
},
{
component: 'InputNumber',
componentProps: {
precision: 2,
style: { width: '100%' },
disabled: true,
min: 0,
},
fieldName: 'totalPrice',
label: '应付金额',
rules: z.number().min(0).optional(),
},
];
}
/** 采购订单项表格列定义 */
export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] {
return [
{ type: 'seq', title: '序号', minWidth: 50, fixed: 'left' },
{
field: 'warehouseId',
title: '仓库名称',
minWidth: 200,
slots: { default: 'warehouseId' },
},
{
field: 'productId',
title: '产品名称',
minWidth: 200,
slots: { default: 'productId' },
},
{
field: 'stockCount',
title: '仓库库存',
minWidth: 80,
},
{
field: 'productBarCode',
title: '条码',
minWidth: 120,
},
{
field: 'productUnitName',
title: '单位',
minWidth: 80,
},
{
field: 'totalCount',
title: '原数量',
minWidth: 120,
},
{
field: 'inCount',
title: '已入库数量',
minWidth: 120,
},
{
field: 'count',
title: '数量',
minWidth: 120,
fixed: 'right',
slots: { default: 'count' },
},
{
field: 'productPrice',
title: '产品单价',
fixed: 'right',
minWidth: 120,
slots: { default: 'productPrice' },
},
{
field: 'totalProductPrice',
fixed: 'right',
title: '产品金额',
minWidth: 120,
formatter: 'formatAmount2',
},
{
fixed: 'right',
field: 'taxPercent',
title: '税率(%)',
minWidth: 100,
},
{
fixed: 'right',
field: 'taxPrice',
title: '税额',
minWidth: 120,
formatter: 'formatAmount2',
},
{
field: 'totalPrice',
fixed: 'right',
title: '合计金额',
minWidth: 120,
formatter: 'formatAmount2',
},
];
}
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'no',
label: '入库单号',
component: 'Input',
componentProps: {
placeholder: '请输入入库单号',
allowClear: true,
},
},
{
fieldName: 'productId',
label: '产品',
component: 'ApiSelect',
componentProps: {
placeholder: '请选择产品',
allowClear: true,
showSearch: true,
api: getProductSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
},
},
{
fieldName: 'inTime',
label: '入库时间',
component: 'RangePicker',
componentProps: {
placeholder: ['开始时间', '结束时间'],
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
fieldName: 'supplierId',
label: '供应商',
component: 'ApiSelect',
componentProps: {
placeholder: '请选择供应商',
allowClear: true,
showSearch: true,
api: getSupplierSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
},
},
{
fieldName: 'warehouseId',
label: '仓库',
component: 'ApiSelect',
componentProps: {
placeholder: '请选择仓库',
allowClear: true,
showSearch: true,
api: getWarehouseSimpleList,
labelField: 'name',
valueField: 'id',
filterOption: false,
},
},
{
fieldName: 'creator',
label: '创建人',
component: 'ApiSelect',
componentProps: {
placeholder: '请选择创建人',
allowClear: true,
showSearch: true,
api: getSimpleUserList,
fieldNames: {
label: 'nickname',
value: 'id',
},
},
},
{
fieldName: 'orderNo',
label: '关联订单',
component: 'Input',
componentProps: {
placeholder: '请输入关联订单号',
allowClear: true,
},
},
{
fieldName: 'paymentStatus',
label: '付款状态',
component: 'Select',
componentProps: {
options: [
{ label: '未付款', value: 0 },
{ label: '部分付款', value: 1 },
{ label: '全部付款', value: 2 },
],
placeholder: '请选择退货状态',
allowClear: true,
},
},
{
fieldName: 'status',
label: '状态',
component: 'Select',
componentProps: {
placeholder: '请选择状态',
allowClear: true,
options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'),
},
},
{
fieldName: 'remark',
label: '备注',
component: 'Input',
componentProps: {
placeholder: '请输入备注',
allowClear: true,
},
},
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
return [
{
type: 'checkbox',
width: 50,
fixed: 'left',
},
{
field: 'no',
title: '入库单号',
width: 200,
fixed: 'left',
},
{
field: 'productNames',
title: '产品信息',
showOverflow: 'tooltip',
minWidth: 120,
},
{
field: 'supplierName',
title: '供应商',
minWidth: 120,
},
{
field: 'inTime',
title: '入库时间',
width: 160,
formatter: 'formatDateTime',
},
{
field: 'creatorName',
title: '创建人',
minWidth: 120,
},
{
field: 'totalCount',
title: '总数量',
minWidth: 120,
},
{
field: 'totalPrice',
title: '应付金额',
formatter: 'formatNumber',
minWidth: 120,
},
{
field: 'paymentPrice',
title: '已付金额',
formatter: 'formatNumber',
minWidth: 120,
},
{
field: 'status',
title: '状态',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.ERP_AUDIT_STATUS },
},
},
{
title: '操作',
minWidth: 250,
fixed: 'right',
slots: { default: 'actions' },
},
];
}
/** 列表的搜索表单 */
export function useOrderGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'no',
label: '订单单号',
component: 'Input',
componentProps: {
placeholder: '请输入订单单号',
allowClear: true,
disabled: true,
},
},
{
fieldName: 'productId',
label: '产品',
component: 'ApiSelect',
componentProps: {
placeholder: '请选择产品',
allowClear: true,
showSearch: true,
api: getProductSimpleList,
fieldNames: {
label: 'name',
value: 'id',
},
},
},
{
fieldName: 'orderTime',
label: '订单时间',
component: 'RangePicker',
componentProps: {
placeholder: ['开始时间', '结束时间'],
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
];
}
/** 列表的字段 */
export function useOrderGridColumns(): VxeTableGridOptions['columns'] {
return [
{
type: 'radio',
width: 50,
fixed: 'left',
},
{
field: 'no',
title: '订单单号',
width: 200,
fixed: 'left',
},
{
field: 'productNames',
title: '产品信息',
showOverflow: 'tooltip',
minWidth: 120,
},
{
field: 'supplierName',
title: '供应商',
minWidth: 120,
},
{
field: 'orderTime',
title: '订单时间',
width: 160,
formatter: 'formatDate',
},
{
field: 'creatorName',
title: '创建人',
minWidth: 120,
},
{
field: 'totalCount',
title: '总数量',
minWidth: 120,
},
{
field: 'inCount',
title: '入库数量',
minWidth: 120,
},
{
field: 'totalProductPrice',
title: '金额合计',
formatter: 'formatNumber',
minWidth: 120,
},
{
field: 'totalPrice',
title: '含税金额',
formatter: 'formatNumber',
minWidth: 120,
},
];
}

Some files were not shown because too many files have changed in this diff Show More