mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vue3.git
synced 2025-12-30 09:32:26 +00:00
feat: 【bpm】bpmn设计器: 业务表单流程添加重新发起功能
This commit is contained in:
@@ -6,6 +6,7 @@ export type ProcessDefinitionVO = {
|
||||
deploymentTIme: string
|
||||
suspensionState: number
|
||||
formType?: number
|
||||
formCustomCreatePath?: string
|
||||
}
|
||||
|
||||
export type ModelVO = {
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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 }
|
||||
})
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
|
||||
Reference in New Issue
Block a user