change(dms): 润滑工单列表添加工作流启动功能,工单实例界面由我的待办跳转。只处理当前流程,处理完关闭页面

- 在润滑工单列表中添加启动工单按钮
- 实现启动工作流的逻辑,包括确认对话框、工单状态更新和任务变量准备
- 添加工作流处理组件,用于处理第一个节点的审批
master
zch 4 weeks ago
parent 3283a60be2
commit 28781b5b61

@ -68,6 +68,12 @@ export interface DmsBillsLubeInstanceVO {
*
*/
planLubeCode: string;
/**
* ID
*/
wfDefinitionId: string | number;
}
export interface DmsBillsLubeInstanceForm extends BaseEntity {
@ -150,6 +156,10 @@ export interface DmsBillsLubeInstanceForm extends BaseEntity {
createTime?: string;
/**
* ID
*/
wfDefinitionId?: string | number;
}
@ -228,6 +238,12 @@ export interface DmsBillsLubeInstanceQuery extends PageQuery {
createBy?: string;
createTime?: string;
/**
* ID
*/
wfDefinitionId?: string | number;
}

@ -139,21 +139,36 @@
<el-table-column label="备注" align="center" prop="remark" v-if="columns[12].visible"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<!-- 启动工单按钮 -->
<el-tooltip content="启动工单" placement="top"v-if="!scope.row.wfDefinitionId" >
<el-button link type="success" icon="View" @click="handleStartWorkflow(scope.row)">
</el-button>
</el-tooltip>
<!-- <el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['dms:dmsBillsLubeInstance:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['dms:dmsBillsLubeInstance:remove']"></el-button>
</el-tooltip>-->
<el-tooltip content="详情" placement="top">
<!-- <el-tooltip content="详情" placement="top">
<el-button link type="primary" icon="View" @click="handleShowDetail(scope.row)" v-hasPermi="['dms:dmsBillsLubeInstance:edit']"></el-button>
</el-tooltip>
</el-tooltip> -->
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 工作流处理组件 -->
<submitVerify
ref="submitVerifyRef"
:task-variables="taskVariables"
@submit-callback="submitCallback" />
<!-- 添加或修改润滑工单对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="dmsBillsLubeInstanceFormRef" :model="form" :rules="rules" label-width="160px">
@ -251,6 +266,8 @@
import { listDmsBillsLubeInstance, getDmsBillsLubeInstance, delDmsBillsLubeInstance, addDmsBillsLubeInstance, updateDmsBillsLubeInstance } from '@/api/dms/dmsBillsLubeInstance';
import { DmsBillsLubeInstanceVO, DmsBillsLubeInstanceQuery, DmsBillsLubeInstanceForm } from '@/api/dms/dmsBillsLubeInstance/types';
import { useRouter } from 'vue-router';
import { startWorkFlow } from '@/api/workflow/task'
import SubmitVerify from '@/components/Process/submitVerify.vue'
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { active_flag, lube_level, lube_status } = toRefs<any>(proxy?.useDict('active_flag', 'lube_level', 'lube_status'));
@ -430,11 +447,92 @@ const handleExport = () => {
}, `dmsBillsLubeInstance_${new Date().getTime()}.xlsx`)
}
/** 详情按钮 */
const router = useRouter();
const handleShowDetail = (row: DmsBillsLubeInstanceVO) => {
router.push('/dms/dmsBillsLubeInstanceActivity/index/' + row.lubeInstanceId)
}
//
const handleStartWorkflow = async (row: DmsBillsLubeInstanceVO) => {
try {
const confirmResult = await proxy?.$modal.confirm(
`确认启动润滑工单"${row.billsLubeCode}"的工作流?`
);
if (confirmResult) {
buttonLoading.value = true;
//
const workflowData = {
businessId: row.lubeInstanceId,
flowCode: 'Lube01',
variables: {
lubeInstanceId: row.lubeInstanceId,
billsLubeCode: row.billsLubeCode,
lubeLevel: row.lubeLevel
}
};
const workflowRes = await startWorkFlow(workflowData);
// ID
await updateDmsBillsLubeInstance({
...row,
wfDefinitionId: workflowRes.data.taskId,
status: 'waiting'
});
//
taskVariables.value = {
entity: {
lubeInstanceId: row.lubeInstanceId,
lubeLevel: row.lubeLevel,
lubeGroup: row.lubeGroup,
lubeSupervisor: row.lubeSupervisor,
processStepOrder: 1
}
};
proxy?.$modal.msgSuccess('工单工作流启动成功');
//
if (submitVerifyRef.value && workflowRes.data.taskId) {
submitVerifyRef.value.openDialog(workflowRes.data.taskId);
}
}
} catch (error) {
console.error('启动工作流失败:', error);
proxy?.$modal.msgError('启动工作流失败');
} finally {
buttonLoading.value = false;
}
};
//
const handleWorkflowProgress = (row: DmsBillsLubeInstanceVO) => {
//
router.push({
path: '/workflow/process/record',
query: { businessId: row.lubeInstanceId }
});
};
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
const taskVariables = ref<any>({});
// -
const submitCallback = async () => {
try {
//
await getList();
proxy?.$modal.msgSuccess('工单创建节点处理完成,工作流已流转到下一步');
} catch (error) {
console.error('刷新列表失败:', error);
proxy?.$modal.msgError('刷新列表失败');
}
};
onMounted(() => {
getList();
});

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save