Merge pull request #210 from zhanglc0618/feature-oa-recreate

feat: 【bpm】bpmn设计器: 业务表单流程添加重新发起功能
This commit is contained in:
芋道源码
2025-12-09 23:26:30 +08:00
committed by GitHub
4 changed files with 59 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ export type ProcessDefinitionVO = {
deploymentTIme: string
suspensionState: number
formType?: number
formCustomCreatePath?: string
}
export type ModelVO = {

View File

@@ -79,6 +79,7 @@ defineOptions({ name: 'BpmOALeaveCreate' })
const message = useMessage() // 消息弹窗
const { delView } = useTagsViewStore() // 视图操作
const { push, currentRoute } = useRouter() // 路由
const { query } = useRoute() // 查询参数
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formData = ref({
@@ -190,6 +191,26 @@ const daysDifference = () => {
return Math.floor(diffTime / oneDay)
}
/** 获取请假数据,用于重新发起时自动填充 */
const getLeaveData = async (id: number) => {
try {
formLoading.value = true
const data = await LeaveApi.getLeave(id)
if (!data) {
message.error('重新发起请假失败,原因:请假数据不存在')
return
}
formData.value = {
type: data.type,
reason: data.reason,
startTime: data.startTime,
endTime: data.endTime
}
} finally {
formLoading.value = false
}
}
/** 初始化 */
onMounted(async () => {
// TODO @小北:这里可以简化,统一通过 getApprovalDetail 处理么?
@@ -205,6 +226,11 @@ onMounted(async () => {
processDefinitionId.value = processDefinitionDetail.id
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
// 如果有业务编号,说明是重新发起,需要加载原有数据
if (query.id) {
await getLeaveData(Number(query.id))
}
// 审批相关:加载最新的审批详情,主要用于节点预测
await getApprovalDetail()
})

View File

@@ -140,6 +140,15 @@
>
取消
</el-button>
<el-button
v-if="scope.row.status !== 1"
v-hasPermi="['bpm:oa-leave:create']"
link
type="primary"
@click="handleReCreate(scope.row)"
>
重新发起
</el-button>
</template>
</el-table-column>
</el-table>
@@ -206,6 +215,16 @@ const handleCreate = () => {
router.push({ name: 'OALeaveCreate' })
}
/** 重新发起操作 */
const handleReCreate = (row: LeaveApi.LeaveVO) => {
router.push({
name: 'OALeaveCreate',
query: {
id: row.id
}
})
}
/** 详情操作 */
const handleDetail = (row: LeaveApi.LeaveVO) => {
router.push({

View File

@@ -275,21 +275,26 @@ const resetQuery = () => {
/** 发起流程操作 **/
const handleCreate = async (row?: ProcessInstanceVO) => {
// 如果是【业务表单】,不支持重新发起
if (row?.id) {
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(
row.processDefinitionId
)
//如果是【业务表单】,跳转到对应的发起界面
if (processDefinitionDetail.formType === 20) {
message.error('重新发起流程失败,原因:该流程使用业务表单,不支持重新发起')
return
await router.push({
path: processDefinitionDetail.formCustomCreatePath,
query: {
id: row.businessKey
}
}
// 跳转发起流程界面
})
} else if (processDefinitionDetail.formType === 10) {
//如果是【流程表单】,跳转到流程发起界面
await router.push({
name: 'BpmProcessInstanceCreate',
query: { processInstanceId: row?.id }
query: { processInstanceId: row.id }
})
}
}
}
/** 查看详情 */