review:【BPM 工作流】流程、任务相关的逻辑

pull/104/MERGE
YunaiV 2025-05-14 23:08:31 +08:00
parent 99c848a39d
commit 769cb87035
15 changed files with 18 additions and 52 deletions

View File

@ -3,6 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request'; import { requestClient } from '#/api/request';
export namespace BpmFormApi { export namespace BpmFormApi {
// TODO @siye注释加一个。。嘿嘿
export interface FormVO { export interface FormVO {
id?: number | undefined; id?: number | undefined;
name: string; name: string;
@ -11,7 +12,6 @@ export namespace BpmFormApi {
status: number; status: number;
remark: string; remark: string;
createTime: string; createTime: string;
} }
} }

View File

@ -27,7 +27,6 @@ const routes: RouteRecordRaw[] = [
}, },
], ],
}, },
{ {
path: 'process-instance/detail', path: 'process-instance/detail',
component: () => import('#/views/bpm/processInstance/detail/index.vue'), component: () => import('#/views/bpm/processInstance/detail/index.vue'),
@ -47,8 +46,6 @@ const routes: RouteRecordRaw[] = [
}; };
}, },
}, },
/** 编辑流程表单 */
{ {
path: '/bpm/manager/form/edit', path: '/bpm/manager/form/edit',
name: 'BpmFormEditor', name: 'BpmFormEditor',

View File

@ -91,20 +91,17 @@ export function useGridColumns<T = BpmFormApi.FormVO>(
props: { type: DICT_TYPE.COMMON_STATUS }, props: { type: DICT_TYPE.COMMON_STATUS },
}, },
}, },
{ {
field: 'remark', field: 'remark',
title: '备注', title: '备注',
minWidth: 200, minWidth: 200,
}, },
{ {
field: 'createTime', field: 'createTime',
title: '创建时间', title: '创建时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'operation', field: 'operation',
title: '操作', title: '操作',

View File

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
// TODO @siyeeditor form/designer
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
@ -16,6 +17,7 @@ import Form from './modules/form.vue';
defineOptions({ name: 'BpmFormEditor' }); defineOptions({ name: 'BpmFormEditor' });
// TODO @siye lint
const props = defineProps<Props>(); const props = defineProps<Props>();
interface Props { interface Props {
@ -119,6 +121,7 @@ function handleSave() {
.open(); .open();
} }
// TODO @siye
function onBack() { function onBack() {
router.push({ router.push({
path: '/bpm/manager/form', path: '/bpm/manager/form',

View File

@ -179,6 +179,7 @@ watch(
</template> </template>
<!-- 摘要 --> <!-- 摘要 -->
<!-- TODO @siye这个是不是不应该有呀 -->
<template #slot-summary="{ row }"> <template #slot-summary="{ row }">
<div <div
class="flex flex-col py-2" class="flex flex-col py-2"

View File

@ -39,6 +39,7 @@ const [Form, formApi] = useVbenForm({
const [Modal, modalApi] = useVbenModal({ const [Modal, modalApi] = useVbenModal({
async onConfirm() { async onConfirm() {
// TODO @siye= =
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) return; if (!valid) return;
@ -49,6 +50,7 @@ const [Modal, modalApi] = useVbenModal({
data.conf = encodeConf(designerComponent); data.conf = encodeConf(designerComponent);
data.fields = encodeFields(designerComponent); data.fields = encodeFields(designerComponent);
// TODO @siye
const saveForm = async () => { const saveForm = async () => {
if (!formData.value?.id) { if (!formData.value?.id) {
return createForm(data); return createForm(data);
@ -74,6 +76,7 @@ const [Modal, modalApi] = useVbenModal({
return; return;
} }
// TODO @siye= =
const data = modalApi.getData<any>(); const data = modalApi.getData<any>();
if (!data) return; if (!data) return;

View File

@ -43,11 +43,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
}); });
}, },
querySuccess: (params) => { querySuccess: (params) => {
// TODO @siyegetLeaderName?: (userId: number) => string | undefined,
const { list } = params.response; const { list } = params.response;
const userMap = new Map( const userMap = new Map(
userList.value.map((user) => [user.id, user.nickname]), userList.value.map((user) => [user.id, user.nickname]),
); );
list.forEach( list.forEach(
(item: BpmUserGroupApi.UserGroupVO & { nicknames?: string }) => { (item: BpmUserGroupApi.UserGroupVO & { nicknames?: string }) => {
item.nicknames = item.userIds item.nicknames = item.userIds

View File

@ -1,6 +1,7 @@
import { createIconifyIcon } from '@vben/icons'; import { createIconifyIcon } from '@vben/icons';
// bpm 图标 // bpm 图标
// TODO @siye可以新建出一个 bpm 目录哇icons/bpm
const SvgBpmRunningIcon = createIconifyIcon('svg:bpm-running'); const SvgBpmRunningIcon = createIconifyIcon('svg:bpm-running');
const SvgBpmApproveIcon = createIconifyIcon('svg:bpm-approve'); const SvgBpmApproveIcon = createIconifyIcon('svg:bpm-approve');
const SvgBpmRejectIcon = createIconifyIcon('svg:bpm-reject'); const SvgBpmRejectIcon = createIconifyIcon('svg:bpm-reject');

View File

@ -20,7 +20,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true, allowClear: true,
}, },
}, },
{ {
fieldName: 'createTime', fieldName: 'createTime',
label: '抄送时间', label: '抄送时间',
@ -51,26 +50,22 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
default: 'slot-summary', default: 'slot-summary',
}, },
}, },
{ {
field: 'startUser.nickname', field: 'startUser.nickname',
title: '流程发起人', title: '流程发起人',
minWidth: 120, minWidth: 120,
}, },
{ {
field: 'processInstanceStartTime', field: 'processInstanceStartTime',
title: '流程发起时间', title: '流程发起时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'activityName', field: 'activityName',
title: '抄送节点', title: '抄送节点',
minWidth: 180, minWidth: 180,
}, },
{ {
field: 'createUser.nickname', field: 'createUser.nickname',
title: '抄送人', title: '抄送人',
@ -84,14 +79,12 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
title: '抄送意见', title: '抄送意见',
minWidth: 180, minWidth: 180,
}, },
{ {
field: 'createTime', field: 'createTime',
title: '抄送时间', title: '抄送时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'operation', field: 'operation',
title: '操作', title: '操作',

View File

@ -63,11 +63,11 @@ function onActionClick({
/** 办理任务 */ /** 办理任务 */
function onDetail(row: BpmProcessInstanceApi.ProcessInstanceVO) { function onDetail(row: BpmProcessInstanceApi.ProcessInstanceVO) {
// TODO @siyerow copyvo
const query = { const query = {
id: row.processInstanceId, id: row.processInstanceId,
...(row.activityId && { activityId: row.activityId }), ...(row.activityId && { activityId: row.activityId }),
}; };
router.push({ router.push({
name: 'BpmProcessInstanceDetail', name: 'BpmProcessInstanceDetail',
query, query,
@ -82,10 +82,12 @@ function onRefresh() {
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<!-- TODO @siye应该用 <template #doc>这样高度可以被用进去哈 -->
<DocAlert <DocAlert
title="审批转办、委派、抄送" title="审批转办、委派、抄送"
url="https://doc.iocoder.cn/bpm/task-delegation-and-cc/" url="https://doc.iocoder.cn/bpm/task-delegation-and-cc/"
/> />
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<!-- 摘要 --> <!-- 摘要 -->
@ -102,7 +104,6 @@ function onRefresh() {
</div> </div>
<div v-else>-</div> <div v-else>-</div>
</template> </template>
<!-- 抄送人 --> <!-- 抄送人 -->
<template #slot-createUser="{ row }"> <template #slot-createUser="{ row }">
<span class="text-gray-500"> <span class="text-gray-500">

View File

@ -12,6 +12,7 @@ import {
getRangePickerDefaultProps, getRangePickerDefaultProps,
} from '#/utils'; } from '#/utils';
// TODO @siye这个要去掉么没用到
const { hasAccessByCodes } = useAccess(); const { hasAccessByCodes } = useAccess();
/** 列表的搜索表单 */ /** 列表的搜索表单 */
@ -35,7 +36,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true, allowClear: true,
}, },
}, },
// 流程分类
{ {
fieldName: 'category', fieldName: 'category',
label: '流程分类', label: '流程分类',
@ -48,7 +48,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
valueField: 'code', valueField: 'code',
}, },
}, },
// 流程状态
{ {
fieldName: 'status', fieldName: 'status',
label: '流程状态', label: '流程状态',
@ -93,7 +92,6 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
default: 'slot-summary', default: 'slot-summary',
}, },
}, },
{ {
field: 'processInstance.startUser.nickname', field: 'processInstance.startUser.nickname',
title: '发起人', title: '发起人',
@ -110,21 +108,18 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
title: '当前任务', title: '当前任务',
minWidth: 180, minWidth: 180,
}, },
{ {
field: 'createTime', field: 'createTime',
title: '任务开始时间', title: '任务开始时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'endTime', field: 'endTime',
title: '任务结束时间', title: '任务结束时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'status', field: 'status',
title: '审批状态', title: '审批状态',
@ -134,14 +129,11 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
props: { type: DICT_TYPE.BPM_TASK_STATUS }, props: { type: DICT_TYPE.BPM_TASK_STATUS },
}, },
}, },
{ {
field: 'reason', field: 'reason',
title: '审批建议', title: '审批建议',
minWidth: 180, minWidth: 180,
}, },
// 耗时
{ {
field: 'durationInMillis', field: 'durationInMillis',
title: '耗时', title: '耗时',
@ -150,19 +142,16 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
return `${formatPast2(row.durationInMillis)}`; return `${formatPast2(row.durationInMillis)}`;
}, },
}, },
{ {
field: 'processInstanceId', field: 'processInstanceId',
title: '流程编号', title: '流程编号',
minWidth: 280, minWidth: 280,
}, },
{ {
field: 'id', field: 'id',
title: '任务编号', title: '任务编号',
minWidth: 280, minWidth: 280,
}, },
{ {
field: 'operation', field: 'operation',
title: '操作', title: '操作',

View File

@ -16,7 +16,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true, allowClear: true,
}, },
}, },
{ {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
@ -47,7 +46,6 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
default: 'slot-summary', default: 'slot-summary',
}, },
}, },
{ {
field: 'processInstance.startUser.nickname', field: 'processInstance.startUser.nickname',
title: '发起人', title: '发起人',
@ -64,28 +62,23 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
title: '当前任务', title: '当前任务',
minWidth: 180, minWidth: 180,
}, },
{ {
field: 'createTime', field: 'createTime',
title: '任务开始时间', title: '任务开始时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'endTime', field: 'endTime',
title: '任务结束时间', title: '任务结束时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
// 审批人
{ {
field: 'assigneeUser.nickname', field: 'assigneeUser.nickname',
title: '审批人', title: '审批人',
minWidth: 180, minWidth: 180,
}, },
{ {
field: 'status', field: 'status',
title: '审批状态', title: '审批状态',
@ -95,14 +88,11 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
props: { type: DICT_TYPE.BPM_TASK_STATUS }, props: { type: DICT_TYPE.BPM_TASK_STATUS },
}, },
}, },
{ {
field: 'reason', field: 'reason',
title: '审批建议', title: '审批建议',
minWidth: 180, minWidth: 180,
}, },
// 耗时
{ {
field: 'durationInMillis', field: 'durationInMillis',
title: '耗时', title: '耗时',
@ -111,19 +101,16 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
return `${formatPast2(row.durationInMillis)}`; return `${formatPast2(row.durationInMillis)}`;
}, },
}, },
{ {
field: 'processInstanceId', field: 'processInstanceId',
title: '流程编号', title: '流程编号',
minWidth: 280, minWidth: 280,
}, },
{ {
field: 'id', field: 'id',
title: '任务编号', title: '任务编号',
minWidth: 280, minWidth: 280,
}, },
{ {
field: 'operation', field: 'operation',
title: '操作', title: '操作',

View File

@ -64,6 +64,7 @@ function onHistory(row: BpmTaskApi.TaskVO) {
router.push({ router.push({
name: 'BpmProcessInstanceDetail', name: 'BpmProcessInstanceDetail',
query: { query: {
// TODO @siye
id: row.processInstance.id, id: row.processInstance.id,
}, },
}); });
@ -78,9 +79,11 @@ function onRefresh() {
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<DocAlert title="工作流手册" url="https://doc.iocoder.cn/bpm/" /> <DocAlert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<!-- 摘要 --> <!-- 摘要 -->
<!-- TODO siye这个要不要也放到 data.ts 处理掉 -->
<template #slot-summary="{ row }"> <template #slot-summary="{ row }">
<div <div
class="flex flex-col py-2" class="flex flex-col py-2"

View File

@ -30,7 +30,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true, allowClear: true,
}, },
}, },
// 流程分类
{ {
fieldName: 'category', fieldName: 'category',
label: '流程分类', label: '流程分类',
@ -43,7 +42,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
valueField: 'code', valueField: 'code',
}, },
}, },
// 流程状态
{ {
fieldName: 'status', fieldName: 'status',
label: '流程状态', label: '流程状态',
@ -57,7 +55,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
allowClear: true, allowClear: true,
}, },
}, },
// 发起时间
{ {
fieldName: 'createTime', fieldName: 'createTime',
label: '发起时间', label: '发起时间',
@ -88,45 +85,38 @@ export function useGridColumns<T = BpmTaskApi.TaskVO>(
default: 'slot-summary', default: 'slot-summary',
}, },
}, },
{ {
field: 'processInstance.startUser.nickname', field: 'processInstance.startUser.nickname',
title: '发起人', title: '发起人',
minWidth: 120, minWidth: 120,
}, },
{ {
field: 'createTime', field: 'createTime',
title: '发起时间', title: '发起时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'name', field: 'name',
title: '当前任务', title: '当前任务',
minWidth: 180, minWidth: 180,
}, },
{ {
field: 'createTime', field: 'createTime',
title: '任务时间', title: '任务时间',
minWidth: 180, minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'processInstanceId', field: 'processInstanceId',
title: '流程编号', title: '流程编号',
minWidth: 280, minWidth: 280,
}, },
{ {
field: 'id', field: 'id',
title: '任务编号', title: '任务编号',
minWidth: 280, minWidth: 280,
}, },
{ {
field: 'operation', field: 'operation',
title: '操作', title: '操作',

View File

@ -92,6 +92,7 @@ function onRefresh() {
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<!-- 摘要 --> <!-- 摘要 -->
<!-- TODO siye这个要不要也放到 data.ts 处理掉 -->
<template #slot-summary="{ row }"> <template #slot-summary="{ row }">
<div <div
class="flex flex-col py-2" class="flex flex-col py-2"