feat:【antd】【bpm】processInstance/detail 代码评审

pull/239/head
YunaiV 2025-10-24 00:01:38 +08:00
parent cbb65ffff3
commit bbd32a274e
26 changed files with 227 additions and 299 deletions

View File

@ -11,6 +11,12 @@ import {
BpmTaskStatusEnum,
DICT_TYPE,
} from '@vben/constants';
import {
SvgBpmApproveIcon,
SvgBpmCancelIcon,
SvgBpmRejectIcon,
SvgBpmRunningIcon,
} from '@vben/icons';
import { formatDateTime } from '@vben/utils';
import { Avatar, Card, Col, message, Row, TabPane, Tabs } from 'ant-design-vue';
@ -23,12 +29,6 @@ import { getSimpleUserList } from '#/api/system/user';
import DictTag from '#/components/dict-tag/dict-tag.vue';
import { setConfAndFields2 } from '#/components/form-create';
import { registerComponent } from '#/utils';
import {
SvgBpmApproveIcon,
SvgBpmCancelIcon,
SvgBpmRejectIcon,
SvgBpmRunningIcon,
} from '#/views/bpm/processInstance/detail/modules/icons';
import ProcessInstanceBpmnViewer from './modules/bpm-viewer.vue';
import ProcessInstanceOperationButton from './modules/operation-button.vue';
@ -44,22 +44,11 @@ const props = defineProps<{
taskId?: string; //
}>();
// TODO @jason使 FieldPermissionTypeexport enum FieldPermissionType {
enum FieldPermissionType {
/**
* 隐藏
*/
// eslint-disable-next-line no-unused-vars
NONE = '3',
/**
* 只读
*/
// eslint-disable-next-line no-unused-vars
READ = '1',
/**
* 编辑
*/
// eslint-disable-next-line no-unused-vars
WRITE = '2',
NONE = '3', //
READ = '1', //
WRITE = '2', //
}
const processInstanceLoading = ref(false); //
@ -67,6 +56,8 @@ const processInstance = ref<BpmProcessInstanceApi.ProcessInstance>(); // 流程
const processDefinition = ref<any>({}); //
const processModelView = ref<any>({}); //
const operationButtonRef = ref(); // ref
const activeTab = ref('form');
const taskListRef = ref();
const auditIconsMap: {
[key: string]:
| typeof SvgBpmApproveIcon
@ -82,29 +73,28 @@ const auditIconsMap: {
[BpmTaskStatusEnum.RETURN]: SvgBpmRejectIcon,
[BpmTaskStatusEnum.WAIT]: SvgBpmRunningIcon,
};
const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); //
const userOptions = ref<SystemUserApi.User[]>([]); //
// ========== ==========
const fApi = ref<any>(); //
const fApi = ref<any>();
const detailForm = ref({
rule: [],
option: {},
value: {},
}); //
const writableFields: Array<string> = []; //
/** 加载流程实例 */
const BusinessFormComponent = shallowRef<any>(null); //
const BusinessFormComponent = shallowRef<any>(null); // (
/** 获取详情 */
async function getDetail() {
//
getApprovalDetail();
await getApprovalDetail();
//
getProcessModelView();
await getProcessModelView();
}
/** 获得审批详情 */
async function getApprovalDetail() {
processInstanceLoading.value = true;
try {
@ -114,11 +104,9 @@ async function getApprovalDetail() {
taskId: props.taskId,
};
const data = await getApprovalDetailApi(param);
if (!data) {
message.error('查询不到审批详情信息!');
}
if (!data.processDefinition || !data.processInstance) {
message.error('查询不到流程信息!');
}
@ -143,6 +131,7 @@ async function getApprovalDetail() {
processInstance.value.formVariables,
);
}
// TODO @jason await
nextTick().then(() => {
fApi.value?.btn.show(false);
fApi.value?.resetBtn.show(false);
@ -187,11 +176,7 @@ async function getProcessModelView() {
}
}
//
const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]);
/**
* 设置表单权限
*/
/** 设置表单权限 */
function setFieldPermission(field: string, permission: string) {
if (permission === FieldPermissionType.READ) {
fApi.value?.disabled(true, field);
@ -206,6 +191,7 @@ function setFieldPermission(field: string, permission: string) {
}
}
// TODO @jason
/**
* 操作成功后刷新
*/
@ -214,16 +200,13 @@ function setFieldPermission(field: string, permission: string) {
// getDetail();
// };
/** 当前的Tab */
const activeTab = ref('form');
const taskListRef = ref();
/** 监听 Tab 切换,当切换到 "record" 标签时刷新任务列表 */
watch(
() => activeTab.value,
(newVal) => {
if (newVal === 'record') {
//
// TODO @jasonawait nextTick
nextTick(() => {
taskListRef.value?.refresh();
});
@ -232,7 +215,6 @@ watch(
);
/** 初始化 */
const userOptions = ref<SystemUserApi.User[]>([]); //
onMounted(async () => {
await getDetail();
//
@ -281,9 +263,9 @@ onMounted(async () => {
>
{{ processInstance?.startUser?.nickname.substring(0, 1) }}
</Avatar>
<span class="text-sm">{{
processInstance?.startUser?.nickname
}}</span>
<span class="text-sm">
{{ processInstance?.startUser?.nickname }}
</span>
</div>
<div class="text-gray-500">
{{ formatDateTime(processInstance?.startTime) }} 提交
@ -324,9 +306,8 @@ onMounted(async () => {
:rule="detailForm.rule"
/>
</div>
<div
v-if="
v-else-if="
processDefinition?.formType === BpmModelFormType.CUSTOM
"
class="h-full"
@ -341,7 +322,6 @@ onMounted(async () => {
</Col>
</Row>
</TabPane>
<TabPane
tab="流程图"
key="diagram"
@ -367,7 +347,6 @@ onMounted(async () => {
/>
</div>
</TabPane>
<TabPane tab="流转记录" key="record" class="tab-pane-content">
<div class="h-full">
<BpmProcessInstanceTaskList
@ -377,7 +356,6 @@ onMounted(async () => {
/>
</div>
</TabPane>
<!-- TODO 待开发 -->
<TabPane
tab="流转评论"
@ -410,6 +388,7 @@ onMounted(async () => {
</template>
<style lang="scss" scoped>
// @jason tailwindcss
.ant-tabs-content {
height: 100%;
}

View File

@ -3,7 +3,7 @@ defineOptions({ name: 'ProcessInstanceBpmnViewer' });
</script>
<template>
<!-- TODO @ziye可以后续找下 antd 有没可以直接用的组件哈 -->
<!-- TODO @jason这里 BPMN 图的接入 -->
<div>
<h1>BPMN Viewer</h1>
</div>

View File

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

View File

@ -1,4 +1,5 @@
<script lang="ts" setup>
// TODO @jason
import type { FormInstance } from 'ant-design-vue';
import type { Rule } from 'ant-design-vue/es/form';
@ -51,8 +52,6 @@ import ProcessInstanceTimeline from './time-line.vue';
defineOptions({ name: 'ProcessInstanceBtnContainer' });
// success
const props = defineProps<{
normalForm: any; // formCreate
normalFormApi: any; // formCreate Api
@ -68,11 +67,6 @@ const [SignatureModal, signatureModalApi] = useVbenModal({
destroyOnClose: true,
});
/** 创建流程表达式 */
function openSignatureModal() {
signatureModalApi.setData(null).open();
}
const router = useRouter();
const userStore = useUserStore();
const userId = userStore.userInfo?.id;
@ -90,15 +84,19 @@ const popOverVisible: any = ref({
}); //
const returnList = ref([] as any); // 退
/** 创建流程表达式 */
function openSignatureModal() {
signatureModalApi.setData(null).open();
}
// ========== ==========
const runningTask = ref<any>(); //
const approveForm = ref<any>({}); //
const approveFormFApi = ref<any>({}); // approveForms fAPi
const nodeTypeName = ref('审批'); //
//
const reasonRequire = ref();
const approveFormRef = ref<FormInstance>();
const approveFormRef = ref<FormInstance>(); //
const approveSignFormRef = ref();
const nextAssigneesActivityNode = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>(
[],
@ -127,11 +125,10 @@ const approveReasonRule: Record<string, any> = computed(() => {
};
});
//
const rejectFormRef = ref<FormInstance>();
const rejectReasonForm = reactive({
reason: '',
});
}); //
const rejectReasonRule: any = computed(() => {
return {
reason: [
@ -144,8 +141,7 @@ const rejectReasonRule: any = computed(() => {
} as Record<string, Rule[]>;
});
//
const copyFormRef = ref<FormInstance>();
const copyFormRef = ref<FormInstance>(); //
const copyForm = reactive({
copyUserIds: [],
copyReason: '',
@ -156,8 +152,7 @@ const copyFormRule: Record<string, Rule[]> = reactive({
],
});
//
const transferFormRef = ref<FormInstance>();
const transferFormRef = ref<FormInstance>(); //
const transferForm = reactive({
assigneeUserId: undefined,
reason: '',
@ -169,8 +164,7 @@ const transferFormRule: Record<string, Rule[]> = reactive({
reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
});
//
const delegateFormRef = ref<FormInstance>();
const delegateFormRef = ref<FormInstance>(); //
const delegateForm = reactive({
delegateUserId: undefined,
reason: '',
@ -182,8 +176,7 @@ const delegateFormRule: Record<string, Rule[]> = reactive({
reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
});
//
const addSignFormRef = ref<FormInstance>();
const addSignFormRef = ref<FormInstance>(); //
const addSignForm = reactive({
addSignUserIds: undefined,
reason: '',
@ -195,8 +188,7 @@ const addSignFormRule: Record<string, Rule[]> = reactive({
reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
});
//
const deleteSignFormRef = ref<FormInstance>();
const deleteSignFormRef = ref<FormInstance>(); //
const deleteSignForm = reactive({
deleteSignTaskId: undefined,
reason: '',
@ -208,8 +200,7 @@ const deleteSignFormRule: Record<string, Rule[]> = reactive({
reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
});
// 退
const returnFormRef = ref<FormInstance>();
const returnFormRef = ref<FormInstance>(); // 退
const returnForm = reactive({
targetTaskDefinitionKey: undefined,
returnReason: '',
@ -223,9 +214,7 @@ const returnFormRule: Record<string, Rule[]> = reactive({
],
});
//
const cancelFormRef = ref<FormInstance>();
const cancelFormRef = ref<FormInstance>(); //
const cancelForm = reactive({
cancelReason: '',
});
@ -256,7 +245,7 @@ async function openPopover(type: string) {
message.warning('表单校验不通过,请先完善表单!!');
return;
}
initNextAssigneesFormField();
await initNextAssigneesFormField();
}
if (type === 'return') {
// 退
@ -269,6 +258,7 @@ async function openPopover(type: string) {
Object.keys(popOverVisible.value).forEach((item) => {
if (popOverVisible.value[item]) popOverVisible.value[item] = item === type;
});
// TODO @jason 2
// await nextTick()
// formRef.value.resetFields()
}
@ -333,6 +323,7 @@ async function initNextAssigneesFormField() {
function selectNextAssigneesConfirm(id: string, userList: any[]) {
approveReasonForm.nextAssignees[id] = userList?.map((item: any) => item.id);
}
/** 审批通过时,校验每个自选审批人的节点是否都已配置了审批人 */
function validateNextAssignees() {
if (Object.keys(nextAssigneesActivityNode.value).length === 0) {
@ -438,7 +429,9 @@ async function handleTransfer() {
formLoading.value = true;
try {
// 1.1
if (!transferFormRef.value) return;
if (!transferFormRef.value) {
return;
}
await transferFormRef.value.validate();
// 1.2
const data = {
@ -470,7 +463,6 @@ async function handleDelegate() {
reason: delegateForm.reason,
delegateUserId: delegateForm.delegateUserId,
};
await TaskApi.delegateTask(data);
popOverVisible.value.delegate = false;
delegateFormRef.value.resetFields();
@ -520,7 +512,6 @@ async function handleReturn() {
reason: returnForm.returnReason,
targetTaskDefinitionKey: returnForm.targetTaskDefinitionKey,
};
await TaskApi.returnTask(data);
popOverVisible.value.return = false;
returnFormRef.value.resetFields();
@ -557,11 +548,11 @@ async function handleCancel() {
/** 处理再次提交 */
async function handleReCreate() {
//
// TODO @jason push name path
await router.push({
path: '/bpm/task/create',
query: { processInstanceId: props.processInstance?.id },
});
// router.push('/bpm/task/my');
}
/** 获取减签人员标签 */
@ -570,6 +561,7 @@ function getDeleteSignUserLabel(task: any): string {
const nickname = task?.assigneeUser?.nickname || task?.ownerUser?.nickname;
return `${nickname} ( 所属部门:${deptName} )`;
}
/** 处理减签 */
async function handlerDeleteSign() {
formLoading.value = true;
@ -592,6 +584,7 @@ async function handlerDeleteSign() {
formLoading.value = false;
}
}
/** 重新加载数据 */
function reload() {
emit('success');
@ -643,6 +636,7 @@ function getButtonDisplayName(btnType: BpmTaskOperationButtonTypeEnum) {
return displayName;
}
/** 加载待办任务 */
function loadTodoTask(task: any) {
approveForm.value = {};
runningTask.value = task;
@ -650,7 +644,7 @@ function loadTodoTask(task: any) {
reasonRequire.value = task?.reasonRequire ?? false;
nodeTypeName.value =
task?.nodeType === BpmNodeTypeEnum.TRANSACTOR_NODE ? '办理' : '审批';
// approve .
// approve
if (task && task.formId && task.formConf) {
const tempApproveForm = {};
setConfAndFields2(
@ -707,6 +701,7 @@ defineExpose({ loadTodoTask });
</script>
<template>
<div class="flex items-center">
<!-- TODO @jason这里要删除么 -->
<!-- <div>是否处理中 {{ !!isHandleTaskStatus() }}</div> -->
<!-- 通过按钮 -->
@ -777,7 +772,6 @@ defineExpose({ loadTodoTask });
<Button @click="openSignatureModal" type="primary">
{{ approveReasonForm.signPicUrl ? '重新签名' : '点击签名' }}
</Button>
<div class="mt-2">
<Image
class="float-left h-40 w-80"
@ -786,7 +780,6 @@ defineExpose({ loadTodoTask });
/>
</div>
</FormItem>
<FormItem :label="`${nodeTypeName}意见`" name="reason">
<Textarea
v-model:value="approveReasonForm.reason"
@ -794,7 +787,6 @@ defineExpose({ loadTodoTask });
:rows="4"
/>
</FormItem>
<FormItem>
<Space>
<Button
@ -902,6 +894,7 @@ defineExpose({ loadTodoTask });
label-width="100px"
>
<FormItem label="抄送人" name="copyUserIds">
<!-- TODO @jason看看是不是用 看看能不能通过 tailwindcss 简化下 style -->
<Select
v-model:value="copyForm.copyUserIds"
:allow-clear="true"

View File

@ -6,7 +6,6 @@ import { IconifyIcon } from '@vben/icons';
import { base64ToFile } from '@vben/utils';
import { Button, message, Space, Tooltip } from 'ant-design-vue';
// TODO @ziye element-plus
import Vue3Signature from 'vue3-signature';
import { uploadFile } from '#/api/infra/file';
@ -20,28 +19,29 @@ const emits = defineEmits(['success']);
const signature = ref<InstanceType<typeof Vue3Signature>>();
const [Modal, modalApi] = useVbenModal({
title: '流程签名',
onOpenChange(visible) {
if (!visible) {
modalApi.close();
}
},
async onConfirm() {
// TODO @jason使 modalApi.lock()
message.success({
content: '签名上传中请稍等。。。',
content: '签名上传中,请稍等...',
});
const signFileUrl = await uploadFile({
file: base64ToFile(signature?.value?.save('image/jpeg') || '', '签名'),
});
emits('success', signFileUrl);
// TODO @ziyeps ide
modalApi.close();
// TODO @jason close
await modalApi.close();
},
// TODO @jason
onOpenChange(visible) {
if (!visible) {
modalApi.close();
}
},
});
</script>
<template>
<Modal class="h-2/5 w-3/5">
<Modal title="流程签名" class="h-2/5 w-3/5">
<div class="mb-2 flex justify-end">
<Space>
<Tooltip title="撤销上一步操作">
@ -52,7 +52,6 @@ const [Modal, modalApi] = useVbenModal({
撤销
</Button>
</Tooltip>
<Tooltip title="清空画布">
<Button @click="signature?.clear()">
<template #icon>

View File

@ -23,10 +23,8 @@ const props = withDefaults(
);
const simpleModel = ref<any>({});
//
const tasks = ref([]);
//
const processInstance = ref();
const tasks = ref([]); //
const processInstance = ref(); //
/** 监控模型视图 包括任务列表、进行中的活动节点编号等 */
watch(
@ -69,6 +67,7 @@ watch(
}
},
);
const setSimpleModelNodeTaskStatus = (
simpleModel: SimpleFlowNode | undefined,
processStatus: number,
@ -102,7 +101,7 @@ const setSimpleModelNodeTaskStatus = (
} else if (finishedActivityIds.includes(simpleModel.id)) {
simpleModel.activityStatus = BpmTaskStatusEnum.APPROVE;
}
// TODO cancel
// TODO cancel @jason
}
//
if (simpleModel.type === BpmNodeTypeEnum.COPY_TASK_NODE) {
@ -177,5 +176,3 @@ const setSimpleModelNodeTaskStatus = (
/>
</div>
</template>
<style lang="scss" scoped></style>

View File

@ -1,10 +1,10 @@
<script setup lang="ts">
<script lang="ts" setup>
import type { formCreate } from '@form-create/antd-designer';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { BpmTaskApi } from '#/api/bpm/task';
import { nextTick, onMounted, ref, shallowRef } from 'vue';
import { nextTick, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { DICT_TYPE } from '@vben/constants';
@ -25,64 +25,119 @@ const props = defineProps<{
loading: boolean;
}>();
// 使 shallowRef
const columns = shallowRef([
{
field: 'name',
title: '审批节点',
minWidth: 150,
},
{
field: 'approver',
title: '审批人',
slots: {
default: ({ row }: { row: BpmTaskApi.TaskManager }) => {
return row.assigneeUser?.nickname || row.ownerUser?.nickname;
/** 表单类型定义 */
interface TaskForm {
rule: any[];
option: Record<string, any>;
value: Record<string, any>;
}
/** 获取表格列配置 */
function useGridColumns(): VxeTableGridOptions['columns'] {
return [
{
field: 'name',
title: '审批节点',
minWidth: 150,
},
{
field: 'approver',
title: '审批人',
slots: {
default: ({ row }: { row: BpmTaskApi.TaskManager }) => {
return row.assigneeUser?.nickname || row.ownerUser?.nickname;
},
},
minWidth: 180,
},
{
field: 'createTime',
title: '开始时间',
formatter: 'formatDateTime',
minWidth: 180,
},
{
field: 'endTime',
title: '结束时间',
formatter: 'formatDateTime',
minWidth: 180,
},
{
field: 'status',
title: '审批状态',
minWidth: 150,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.BPM_TASK_STATUS },
},
},
minWidth: 180,
},
{
field: 'createTime',
title: '开始时间',
formatter: 'formatDateTime',
minWidth: 180,
},
{
field: 'endTime',
title: '结束时间',
formatter: 'formatDateTime',
minWidth: 180,
},
{
field: 'status',
title: '审批状态',
minWidth: 150,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.BPM_TASK_STATUS },
{
field: 'reason',
title: '审批建议',
slots: {
default: 'slot-reason',
},
minWidth: 200,
},
},
{
field: 'reason',
title: '审批建议',
slots: {
default: 'slot-reason',
{
field: 'durationInMillis',
title: '耗时',
minWidth: 180,
formatter: 'formatPast2',
},
minWidth: 200,
},
{
field: 'durationInMillis',
title: '耗时',
minWidth: 180,
formatter: 'formatPast2',
},
]);
];
}
const formRef = ref<formCreate>();
const taskForm = ref<TaskForm>({
rule: [],
option: {},
value: {},
});
const [Modal, modalApi] = useVbenModal({
title: '查看表单',
footer: false,
});
/** 刷新表格 */
function handleRefresh() {
gridApi.query();
}
/** 显示表单详情 */
async function handleShowFormDetail(row: BpmTaskApi.TaskManager) {
//
taskForm.value = {
rule: [],
option: {},
value: row,
};
setConfAndFields2(
taskForm,
row.formConf,
row.formFields || [],
row.formVariables || {},
);
//
modalApi.open();
//
await nextTick();
// API
const formApi = formRef.value?.fapi;
if (!formApi) {
return;
}
//
formApi.btn.show(false);
formApi.resetBtn.show(false);
formApi.disabled(true);
}
// GridAPI
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions: {
columns: columns.value,
columns: useGridColumns(),
keepSource: true,
showFooter: true,
border: true,
@ -96,6 +151,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
rowConfig: {
keyField: 'id',
isHover: true,
},
pagerConfig: {
enabled: false,
@ -103,84 +159,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
toolbarConfig: {
enabled: false,
},
cellConfig: {
height: 60,
},
} as VxeTableGridOptions<BpmTaskApi.Task>,
} as VxeTableGridOptions<BpmTaskApi.TaskManager>,
});
/**
* 刷新表格数据
*/
function refresh() {
gridApi.query();
}
//
interface TaskForm {
rule: any[];
option: Record<string, any>;
value: Record<string, any>;
}
//
// 使
const formRef = ref<formCreate>();
const taskForm = ref<TaskForm>({
rule: [],
option: {},
value: {},
});
/**
* 显示表单详情
* @param row 任务数据
*/
async function showFormDetail(row: BpmTaskApi.TaskManager): Promise<void> {
//
taskForm.value = {
rule: [],
option: {},
value: row,
};
setConfAndFields2(
taskForm,
row.formConf,
row.formFields || [],
row.formVariables || {},
);
//
modalApi.open();
//
await nextTick();
// API
const formApi = formRef.value?.fapi;
if (!formApi) return;
//
formApi.btn.show(false);
formApi.resetBtn.show(false);
formApi.disabled(true);
}
//
const [Modal, modalApi] = useVbenModal({
title: '查看表单',
footer: false,
});
onMounted(() => {
refresh();
});
//
defineExpose({
refresh,
refresh: handleRefresh,
});
</script>
@ -191,14 +174,13 @@ defineExpose({
<div class="flex flex-wrap items-center justify-center">
<span v-if="row.reason">{{ row.reason }}</span>
<span v-else>-</span>
<Button
v-if="row.formId > 0"
type="primary"
@click="showFormDetail(row)"
size="small"
ghost
class="ml-1"
@click="handleShowFormDetail(row)"
>
<IconifyIcon icon="lucide:file-text" />
<span class="!ml-0.5 text-xs">查看表单</span>

View File

@ -38,34 +38,21 @@ const emit = defineEmits<{
const { push } = useRouter();
//
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' },
//
'0': { color: '#ff943e', icon: 'mdi:loading', animation: 'animate-spin' },
//
'1': { color: '#448ef7', icon: 'mdi:loading', animation: 'animate-spin' },
//
'2': { color: '#00b32a', icon: 'mdi:check' },
//
'3': { color: '#f46b6c', icon: 'mdi:close' },
//
'4': { color: '#cccccc', icon: 'mdi:trash-can-outline' },
// 退
'5': { color: '#f46b6c', icon: 'mdi:arrow-left' },
//
'6': { color: '#448ef7', icon: 'mdi:clock-outline' },
//
'7': { color: '#00b32a', icon: 'mdi:check' },
};
//
'-2': { color: '#909398', icon: 'mdi:skip-forward-outline' }, //
'-1': { color: '#909398', icon: 'mdi:clock-outline' }, //
'0': { color: '#ff943e', icon: 'mdi:loading', animation: 'animate-spin' }, //
'1': { color: '#448ef7', icon: 'mdi:loading', animation: 'animate-spin' }, //
'2': { color: '#00b32a', icon: 'mdi:check' }, //
'3': { color: '#f46b6c', icon: 'mdi:close' }, //
'4': { color: '#cccccc', icon: 'mdi:trash-can-outline' }, //
'5': { color: '#f46b6c', icon: 'mdi:arrow-left' }, // 退
'6': { color: '#448ef7', icon: 'mdi:clock-outline' }, //
'7': { color: '#00b32a', icon: 'mdi:check' }, //
}; //
const nodeTypeSvgMap = {
//
[BpmNodeTypeEnum.END_EVENT_NODE]: {
@ -107,40 +94,39 @@ const nodeTypeSvgMap = {
color: '#14bb83',
icon: 'icon-park-outline:tree-diagram',
},
} as Record<BpmNodeTypeEnum, { color: string; icon: string }>;
} as Record<BpmNodeTypeEnum, { color: string; icon: string }>; //
const onlyStatusIconShow = [-1, 0, 1]; // -101 icon
// -101 icon
const onlyStatusIconShow = [-1, 0, 1];
//
/** 获取审批节点类型图标 */
function getApprovalNodeTypeIcon(nodeType: BpmNodeTypeEnum) {
return nodeTypeSvgMap[nodeType]?.icon;
}
//
/** 获取审批节点图标 */
function getApprovalNodeIcon(taskStatus: number, nodeType: BpmNodeTypeEnum) {
if (taskStatus === BpmTaskStatusEnum.NOT_START) {
return statusIconMap[taskStatus]?.icon || 'mdi:clock-outline';
}
if (
nodeType === BpmNodeTypeEnum.START_USER_NODE ||
nodeType === BpmNodeTypeEnum.USER_TASK_NODE ||
nodeType === BpmNodeTypeEnum.TRANSACTOR_NODE ||
nodeType === BpmNodeTypeEnum.CHILD_PROCESS_NODE ||
nodeType === BpmNodeTypeEnum.END_EVENT_NODE
[
BpmNodeTypeEnum.START_USER_NODE,
BpmNodeTypeEnum.USER_TASK_NODE,
BpmNodeTypeEnum.TRANSACTOR_NODE,
BpmNodeTypeEnum.CHILD_PROCESS_NODE,
BpmNodeTypeEnum.END_EVENT_NODE,
].includes(nodeType)
) {
return statusIconMap[taskStatus]?.icon || 'mdi:clock-outline';
}
return 'mdi:clock-outline';
}
//
/** 获取审批节点颜色 */
function getApprovalNodeColor(taskStatus: number) {
return statusIconMap[taskStatus]?.color;
}
//
/** 获取审批节点时间 */
function getApprovalNodeTime(node: BpmProcessInstanceApi.ApprovalNodeInfo) {
if (node.nodeType === BpmNodeTypeEnum.START_USER_NODE && node.startTime) {
return formatDateTime(node.startTime);
@ -154,7 +140,6 @@ function getApprovalNodeTime(node: BpmProcessInstanceApi.ApprovalNodeInfo) {
return '';
}
//
const [UserSelectModalComp, userSelectModalApi] = useVbenModal({
connectedComponent: UserSelectModal,
destroyOnClose: true,
@ -162,7 +147,7 @@ const [UserSelectModalComp, userSelectModalApi] = useVbenModal({
const selectedActivityNodeId = ref<string>();
const customApproveUsers = ref<Record<string, any[]>>({}); // keyactivityIdvalue
//
/** 打开选择用户弹窗 */
const handleSelectUser = (activityId: string, selectedList: any[]) => {
selectedActivityNodeId.value = activityId;
userSelectModalApi
@ -170,7 +155,7 @@ const handleSelectUser = (activityId: string, selectedList: any[]) => {
.open();
};
//
/** 选择用户完成 */
const selectedUsers = ref<number[]>([]);
function handleUserSelectConfirm(userList: any[]) {
if (!selectedActivityNodeId.value) {
@ -194,7 +179,7 @@ function handleChildProcess(activity: any) {
});
}
//
/** 判断是否需要显示自定义选择审批人 */
function shouldShowCustomUserSelect(
activity: BpmProcessInstanceApi.ApprovalNodeInfo,
) {
@ -209,7 +194,7 @@ function shouldShowCustomUserSelect(
);
}
//
/** 判断是否需要显示审批意见 */
function shouldShowApprovalReason(task: any, nodeType: BpmNodeTypeEnum) {
return (
task.reason &&
@ -219,12 +204,12 @@ function shouldShowApprovalReason(task: any, nodeType: BpmNodeTypeEnum) {
);
}
//
/** 用户选择弹窗关闭 */
function handleUserSelectClosed() {
selectedUsers.value = [];
}
//
/** 用户选择弹窗取消 */
function handleUserSelectCancel() {
selectedUsers.value = [];
}
@ -241,7 +226,6 @@ const batchSetCustomApproveUsers = (data: Record<string, any[]>) => {
});
};
//
defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
</script>
@ -264,10 +248,9 @@ defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
class="size-6 text-white"
/>
</div>
<div
v-if="showStatusIcon"
class="absolute right--2.5 top-4 flex size-5 items-center rounded-full border-2 border-solid border-white p-0.5"
class="absolute left-4 top-4 flex size-4 items-center rounded-full border-2 border-solid border-white p-0.5"
:style="{
backgroundColor: getApprovalNodeColor(activity.status),
}"
@ -409,14 +392,14 @@ defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
v-if="
showStatusIcon && onlyStatusIconShow.includes(task.status)
"
class="absolute left-6 top-5 flex items-center rounded-full border-2 border-solid border-white p-1"
class="absolute left-5 top-5 flex items-center rounded-full border-2 border-solid border-white p-1"
:style="{
backgroundColor: statusIconMap[task.status]?.color,
}"
>
<IconifyIcon
:icon="statusIconMap[task.status]?.icon || 'lucide:clock'"
class="size-2 text-white"
class="size-1.5 text-white"
:class="[statusIconMap[task.status]?.animation]"
/>
</div>

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 939 B

After

Width:  |  Height:  |  Size: 939 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -34,6 +34,12 @@ const SvgWxBarIcon = createIconifyIcon('svg:wx-bar');
const SvgWalletIcon = createIconifyIcon('svg:wallet');
const SvgMockIcon = createIconifyIcon('svg:mock');
/** BPM */
const SvgBpmRunningIcon = createIconifyIcon('svg:bpm-running');
const SvgBpmApproveIcon = createIconifyIcon('svg:bpm-approve');
const SvgBpmRejectIcon = createIconifyIcon('svg:bpm-reject');
const SvgBpmCancelIcon = createIconifyIcon('svg:bpm-cancel');
export {
SvgAlipayAppIcon,
SvgAlipayBarIcon,
@ -46,6 +52,10 @@ export {
SvgAvatar3Icon,
SvgAvatar4Icon,
SvgBellIcon,
SvgBpmApproveIcon,
SvgBpmCancelIcon,
SvgBpmRejectIcon,
SvgBpmRunningIcon,
SvgCakeIcon,
SvgCardIcon,
SvgDingDingIcon,