diff --git a/apps/web-antd/src/api/bpm/form/index.ts b/apps/web-antd/src/api/bpm/form/index.ts new file mode 100644 index 00000000..27191230 --- /dev/null +++ b/apps/web-antd/src/api/bpm/form/index.ts @@ -0,0 +1,48 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace BpmFormApi { + export interface FormVO { + id?: number | undefined; + name: string; + conf: string; + fields: string[]; + status: number; + remark: string; + createTime: string; + + } +} + +/** 获取表单分页列表 */ +export async function getFormPage(params: PageParam) { + return requestClient.get>('/bpm/form/page', { + params, + }); +} + +/** 获取表单详情 */ +export async function getFormDetail(id: number) { + return requestClient.get(`/bpm/form/get?id=${id}`); +} + +/** 创建表单 */ +export async function createForm(data: BpmFormApi.FormVO) { + return requestClient.post('/bpm/form/create', data); +} + +/** 更新表单 */ +export async function updateForm(data: BpmFormApi.FormVO) { + return requestClient.put('/bpm/form/update', data); +} + +/** 删除表单 */ +export async function deleteForm(id: number) { + return requestClient.delete(`/bpm/form/delete?id=${id}`); +} + +/** 获取表单简单列表 */ +export async function getFormSimpleList() { + return requestClient.get('/bpm/form/simple-list'); +} diff --git a/apps/web-antd/src/router/routes/modules/bpm.ts b/apps/web-antd/src/router/routes/modules/bpm.ts index 734e7c43..cf15a454 100644 --- a/apps/web-antd/src/router/routes/modules/bpm.ts +++ b/apps/web-antd/src/router/routes/modules/bpm.ts @@ -47,6 +47,24 @@ const routes: RouteRecordRaw[] = [ }; }, }, + + /** 编辑流程表单 */ + { + path: '/bpm/manager/form/edit', + name: 'BpmFormEditor', + component: () => import('#/views/bpm/form/editor.vue'), + meta: { + title: '编辑流程表单', + activePath: '/bpm/manager/form', + }, + props: (route) => { + return { + id: route.query.id, + type: route.query.type, + copyId: route.query.copyId, + }; + }, + }, ], }, ]; diff --git a/apps/web-antd/src/views/bpm/form/data.ts b/apps/web-antd/src/views/bpm/form/data.ts new file mode 100644 index 00000000..53620885 --- /dev/null +++ b/apps/web-antd/src/views/bpm/form/data.ts @@ -0,0 +1,146 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { BpmFormApi } from '#/api/bpm/form'; + +import { useAccess } from '@vben/access'; +import { $t } from '@vben/locales'; + +import { z } from '#/adapter/form'; +import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; + +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: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '表单名称', + component: 'Input', + componentProps: { + placeholder: '请输入表单名称', + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'name', + title: '表单名称', + minWidth: 200, + }, + { + field: 'status', + title: '状态', + minWidth: 200, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + + { + field: 'remark', + title: '备注', + minWidth: 200, + }, + + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + + { + field: 'operation', + title: '操作', + minWidth: 150, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'name', + nameTitle: '流程名称', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + { + code: 'copy', + text: $t('ui.actionTitle.copy'), + show: hasAccessByCodes(['bpm:form:update']), + }, + { + code: 'edit', + text: $t('ui.actionTitle.edit'), + show: hasAccessByCodes(['bpm:form:update']), + }, + { + code: 'detail', + text: $t('ui.actionTitle.detail'), + show: hasAccessByCodes(['bpm:form:query']), + }, + { + code: 'delete', + text: $t('ui.actionTitle.delete'), + show: hasAccessByCodes(['bpm:form:delete']), + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/bpm/form/editor.vue b/apps/web-antd/src/views/bpm/form/editor.vue new file mode 100644 index 00000000..c4fba895 --- /dev/null +++ b/apps/web-antd/src/views/bpm/form/editor.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/apps/web-antd/src/views/bpm/form/index.vue b/apps/web-antd/src/views/bpm/form/index.vue index e4b8d579..433f0a54 100644 --- a/apps/web-antd/src/views/bpm/form/index.vue +++ b/apps/web-antd/src/views/bpm/form/index.vue @@ -1,34 +1,215 @@ diff --git a/apps/web-antd/src/views/bpm/form/modules/form.vue b/apps/web-antd/src/views/bpm/form/modules/form.vue new file mode 100644 index 00000000..4a395ec2 --- /dev/null +++ b/apps/web-antd/src/views/bpm/form/modules/form.vue @@ -0,0 +1,107 @@ + + + diff --git a/packages/locales/src/langs/en-US/ui.json b/packages/locales/src/langs/en-US/ui.json index a9fa1717..143fa631 100644 --- a/packages/locales/src/langs/en-US/ui.json +++ b/packages/locales/src/langs/en-US/ui.json @@ -11,6 +11,7 @@ "mobile": "Please input a valid {0}" }, "actionTitle": { + "copy": "Copy {0}", "cancel": "Cancel {0}", "edit": "Modify {0}", "create": "Create {0}", diff --git a/packages/locales/src/langs/zh-CN/ui.json b/packages/locales/src/langs/zh-CN/ui.json index 446cfe75..5afc1072 100644 --- a/packages/locales/src/langs/zh-CN/ui.json +++ b/packages/locales/src/langs/zh-CN/ui.json @@ -11,6 +11,7 @@ "mobile": "请输入正确的{0}" }, "actionTitle": { + "copy": "复制{0}", "cancel": "取消{0}", "edit": "修改{0}", "create": "新增{0}",