From bd38076d402f259650e1b9a8ce6887d075446332 Mon Sep 17 00:00:00 2001 From: ziye <278898052@qq.com> Date: Tue, 6 May 2025 21:07:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=86=E7=BB=84=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/bpm/userGroup/index.ts | 53 ++++++ apps/web-antd/src/views/bpm/group/data.ts | 171 ++++++++++++++++++ apps/web-antd/src/views/bpm/group/index.vue | 159 +++++++++++++--- .../src/views/bpm/group/modules/form.vue | 91 ++++++++++ 4 files changed, 451 insertions(+), 23 deletions(-) create mode 100644 apps/web-antd/src/api/bpm/userGroup/index.ts create mode 100644 apps/web-antd/src/views/bpm/group/data.ts create mode 100644 apps/web-antd/src/views/bpm/group/modules/form.vue diff --git a/apps/web-antd/src/api/bpm/userGroup/index.ts b/apps/web-antd/src/api/bpm/userGroup/index.ts new file mode 100644 index 00000000..f4c50f8b --- /dev/null +++ b/apps/web-antd/src/api/bpm/userGroup/index.ts @@ -0,0 +1,53 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace BpmUserGroupApi { + /** BPM 用户组 VO */ + export interface UserGroupVO { + id: number; + name: string; + description: string; + userIds: number[]; + status: number; + remark: string; + createTime: string; + } +} + +/** 查询用户组分页 */ +export async function getUserGroupPage(params: PageParam) { + return requestClient.get>( + '/bpm/user-group/page', + { params }, + ); +} + +/** 查询用户组详情 */ +export async function getUserGroup(id: number) { + return requestClient.get( + `/bpm/user-group/get?id=${id}`, + ); +} + +/** 新增用户组 */ +export async function createUserGroup(data: BpmUserGroupApi.UserGroupVO) { + return requestClient.post('/bpm/user-group/create', data); +} + +/** 修改用户组 */ +export async function updateUserGroup(data: BpmUserGroupApi.UserGroupVO) { + return requestClient.put('/bpm/user-group/update', data); +} + +/** 删除用户组 */ +export async function deleteUserGroup(id: number) { + return requestClient.delete(`/bpm/user-group/delete?id=${id}`); +} + +/** 查询用户组列表 */ +export async function getUserGroupSimpleList() { + return requestClient.get( + `/bpm/user-group/simple-list`, + ); +} diff --git a/apps/web-antd/src/views/bpm/group/data.ts b/apps/web-antd/src/views/bpm/group/data.ts new file mode 100644 index 00000000..58c0b928 --- /dev/null +++ b/apps/web-antd/src/views/bpm/group/data.ts @@ -0,0 +1,171 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { BpmCategoryApi } from '#/api/bpm/category'; + +import { useAccess } from '@vben/access'; + +import { z } from '#/adapter/form'; +import { getSimpleUserList } from '#/api/system/user'; +import { CommonStatusEnum } from '#/utils/constants'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +const { hasAccessByCodes } = useAccess(); +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'name', + label: '组名', + component: 'Input', + componentProps: { + placeholder: '请输入组名', + }, + rules: 'required', + }, + { + fieldName: 'description', + label: '描述', + component: 'Textarea', + componentProps: { + placeholder: '请输入描述', + }, + }, + { + fieldName: 'userIds', + label: '成员', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择成员', + api: getSimpleUserList, + labelField: 'nickname', + valueField: 'id', + mode: 'tags', + }, + rules: z.array(z.number()).min(1, '请选择成员').default([]), + }, + { + 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', + componentProps: { + placeholder: '请输入组名', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + allowClear: true, + }, + }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '分类编号', + minWidth: 100, + }, + { + field: 'name', + title: '组名', + minWidth: 200, + }, + { + field: 'description', + title: '描述', + minWidth: 200, + }, + { + field: 'userIds', + title: '成员', + minWidth: 200, + slots: { + default: 'userIds-cell', + }, + }, + { + field: 'status', + title: '状态', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'operation', + title: '操作', + minWidth: 180, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'name', + nameTitle: '用户分组', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + { + code: 'edit', + show: hasAccessByCodes(['bpm:user-group:update']), + }, + { + code: 'delete', + show: hasAccessByCodes(['bpm:user-group:delete']), + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/bpm/group/index.vue b/apps/web-antd/src/views/bpm/group/index.vue index 98675eed..85d63697 100644 --- a/apps/web-antd/src/views/bpm/group/index.vue +++ b/apps/web-antd/src/views/bpm/group/index.vue @@ -1,31 +1,144 @@ diff --git a/apps/web-antd/src/views/bpm/group/modules/form.vue b/apps/web-antd/src/views/bpm/group/modules/form.vue new file mode 100644 index 00000000..374d43ef --- /dev/null +++ b/apps/web-antd/src/views/bpm/group/modules/form.vue @@ -0,0 +1,91 @@ + + + From 413ed3526d968567029410c844d7005c9c4052c4 Mon Sep 17 00:00:00 2001 From: ziye <278898052@qq.com> Date: Tue, 6 May 2025 21:15:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E7=BC=96=E5=8F=B7=E6=A0=87=E9=A2=98=E4=B8=BA=E2=80=9C?= =?UTF-8?q?=E7=BC=96=E5=8F=B7=E2=80=9D=E4=BB=A5=E6=8F=90=E5=8D=87=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/bpm/group/data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web-antd/src/views/bpm/group/data.ts b/apps/web-antd/src/views/bpm/group/data.ts index 58c0b928..58da1944 100644 --- a/apps/web-antd/src/views/bpm/group/data.ts +++ b/apps/web-antd/src/views/bpm/group/data.ts @@ -106,7 +106,7 @@ export function useGridColumns( return [ { field: 'id', - title: '分类编号', + title: '编号', minWidth: 100, }, {