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

feat: 【bpm】bpmn设计器: 业务表单流程添加重新发起功能
pull/845/head
芋道源码 2025-12-09 23:26:30 +08:00 committed by GitHub
commit cbab7ad79d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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) // 12
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 }
})
}
}
//
await router.push({
name: 'BpmProcessInstanceCreate',
query: { processInstanceId: row?.id }
})
}
/** 查看详情 */