Merge remote-tracking branch 'yudao/dev' into dev

This commit is contained in:
jason
2025-08-05 23:01:03 +08:00
732 changed files with 45651 additions and 1151 deletions

View File

@@ -74,7 +74,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
} as VxeTableGridOptions<BpmCategoryApi.Category>,

View File

@@ -109,7 +109,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
cellConfig: {

View File

@@ -85,7 +85,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
} as VxeTableGridOptions<BpmUserGroupApi.UserGroup>,

View File

@@ -76,7 +76,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
},
} as VxeTableGridOptions,
});

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

@@ -220,6 +220,9 @@ function initData() {
if (modelData.value.taskAfterTriggerSetting) {
taskAfterTriggerEnable.value = true;
}
if (modelData.value.allowWithdrawTask === undefined) {
modelData.value.allowWithdrawTask = false;
}
}
/** 监听表单 ID 变化,加载表单数据 */
@@ -272,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

@@ -38,7 +38,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
} as VxeTableGridOptions<BpmOALeaveApi.Leave>,

View File

@@ -77,7 +77,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
} as VxeTableGridOptions<BpmProcessExpressionApi.ProcessExpression>,

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
},
);
@@ -183,6 +183,9 @@ function handleUserSelectConfirm(userList: any[]) {
/** 跳转子流程 */
function handleChildProcess(activity: any) {
if (!activity.processInstanceId) {
return;
}
push({
name: 'BpmProcessInstanceDetail',
query: {
@@ -197,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))
);
}
@@ -225,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>
@@ -291,6 +309,7 @@ function handleUserSelectCancel() {
ghost
size="small"
@click="handleChildProcess(activity)"
:disabled="!activity.processInstanceId"
>
查看子流程
</Button>

View File

@@ -90,7 +90,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
cellConfig: {

View File

@@ -99,7 +99,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
} as VxeTableGridOptions<BpmProcessInstanceApi.ProcessInstance>,

View File

@@ -115,7 +115,7 @@ const createGrid = () => {
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
proxyConfig: {

View File

@@ -77,7 +77,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
} as VxeTableGridOptions<BpmProcessListenerApi.ProcessListener>,

View File

@@ -48,7 +48,7 @@ const [Grid] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
cellConfig: {

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(),
},
@@ -46,13 +56,13 @@ const [Grid] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
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

@@ -45,7 +45,7 @@ const [Grid] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
cellConfig: {

View File

@@ -47,7 +47,7 @@ const [Grid] = useVbenVxeGrid({
keyField: 'id',
},
toolbarConfig: {
refresh: { code: 'query' },
refresh: true,
search: true,
},
cellConfig: {