流程业务表单1:n配置

This commit is contained in:
pch 2024-11-26 10:50:56 +08:00
parent 20358ba86b
commit 99afcd44d5
5 changed files with 45 additions and 26 deletions

View File

@ -54,4 +54,12 @@ export const FormProcessMappingApi = {
selectProcessKey: async (fullpath: string) => {
return await request.get({ url: `/bpm/form-process-mapping/get-process-key?fullpath=` + fullpath })
},
// 通过流程的formCustomCreatePath得到formCustomViewPath
getFormCustomViewPath: async (fullpath: string) => {
return await request.get({ url: `/bpm/form-process-mapping/get-form-custom-view-path?formCustomCreatePath=` + fullpath })
},
// 通过流程的key得到frommapping的List
getListByProcessKey: async (key: string) => {
return await request.get({ url: `/bpm/form-process-mapping/get-by-process-key?processKey=` + key })
},
}

View File

@ -25,7 +25,10 @@ export const ProcessInstanceTodoApi = {
getProcessInstanceTodo: async (id: number) => {
return await request.get({ url: `/bpm/process-instance-todo/get?id=` + id })
},
//通过流程实例的id得到流程业务表单
getProcessInstanceFormCreatePath: async (processInstanceId: number) => {
return await request.get({ url: `/bpm/process-instance-todo/get-form-custom-create-path?processInstanceId=` + processInstanceId })
},
// 新增BPM 流程实例信息
createProcessInstanceTodo: async (data: ProcessInstanceTodoVO) => {
return await request.post({ url: `/bpm/process-instance-todo/create`, data })
@ -45,4 +48,4 @@ export const ProcessInstanceTodoApi = {
exportProcessInstanceTodo: async (params) => {
return await request.download({ url: `/bpm/process-instance-todo/export-excel`, params })
}
}
}

View File

@ -169,6 +169,9 @@ const submitForm = async () => {
}
const curFullPath = currentRoute.value.fullPath
if( curFullPath ) {
data.curfullpath = curFullPath
}
const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath )
if ( processKey) {
data.processDefinitionKey = processKey

View File

@ -227,14 +227,18 @@ const handleSelect = async (row, formVariables) => {
})
// Tab
} else {
//console.log(row.key,"row.key")
console.log(row.key,"row.key")
const process_key = row.key
const formCustomCreatePath = await FormProcessMappingApi.getFormCreatePath(process_key)
// console.log(formCustomCreatePath,"formCustomCreatePath")
if (formCustomCreatePath != "") {
console.log(formCustomCreatePath.length,"formCustomCreatePath.length")
if (formCustomCreatePath.length == 1) {
await push({
path: formCustomCreatePath
path: formCustomCreatePath[0]
})
}else {
console.log("else..............")
const formMappingList = await FormProcessMappingApi.getListByProcessKey(process_key)
console.log(formMappingList,"formMappingList")
}
}
}

View File

@ -24,7 +24,7 @@
</el-tab-pane>
<el-tab-pane label="流程图" name="flowChart">
<!-- 高亮流程图 -->
<ProcessInstanceBpmnViewerNoHeader
<ProcessInstanceBpmnViewer
:id="`${id}`"
:bpmn-xml="bpmnXml"
:loading="processInstanceLoading"
@ -131,13 +131,13 @@
</el-tab-pane>
</el-tabs>
<!-- 弹窗转派审批人 -->
<TaskTransferForm ref="taskTransferFormRef" @success="getDetail" @back-view="backView" />
<TaskTransferForm ref="taskTransferFormRef" @success="getDetail" />
<!-- 弹窗回退节点 -->
<TaskReturnForm ref="taskReturnFormRef" @success="getDetail" @back-view="backView" />
<TaskReturnForm ref="taskReturnFormRef" @success="getDetail" />
<!-- 弹窗委派将任务委派给别人处理处理完成后会重新回到原审批人手中-->
<TaskDelegateForm ref="taskDelegateForm" @success="getDetail" @back-view="backView" />
<TaskDelegateForm ref="taskDelegateForm" @success="getDetail" />
<!-- 弹窗加签当前任务审批人为A向前加签选了一个C则需要C先审批然后再是A审批向后加签BA审批完需要B再审批完才算完成这个任务节点 -->
<TaskSignCreateForm ref="taskSignCreateFormRef" @success="getDetail" @back-view="backView" />
<TaskSignCreateForm ref="taskSignCreateFormRef" @success="getDetail" />
</ContentWrap>
</template>
<script lang="ts" setup>
@ -147,7 +147,7 @@ import type { ApiAttrs } from '@form-create/element-ui/types/config'
import * as DefinitionApi from '@/api/bpm/definition'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import * as TaskApi from '@/api/bpm/task'
import ProcessInstanceBpmnViewerNoHeader from './ProcessInstanceBpmnViewerNoHeader.vue'
import ProcessInstanceBpmnViewer from './ProcessInstanceBpmnViewer.vue'
import ProcessInstanceTaskList from './ProcessInstanceTaskList.vue'
import TaskReturnForm from './dialog/TaskReturnForm.vue'
import TaskDelegateForm from './dialog/TaskDelegateForm.vue'
@ -158,7 +158,7 @@ import { isEmpty } from '@/utils/is'
import * as UserApi from '@/api/system/user'
import {TabsPaneContext} from "element-plus";
import { FormProcessMappingApi} from '@/api/bpm/formprocessmapping'
import {useTagsViewStore} from "@/store/modules/tagsView";
import { ProcessInstanceTodoApi, ProcessInstanceTodoVO } from '@/api/bpm/processinstancetodo'
defineOptions({ name: 'BpmProcessInstanceDetail' })
@ -166,8 +166,6 @@ const { query } = useRoute() // 查询参数
const message = useMessage() //
const { proxy } = getCurrentInstance() as any
const { delView } = useTagsViewStore()//
const { currentRoute, back } = useRouter()
const userId = useUserStore().getUser.id //
const id = query.id as unknown as string //
const processInstanceLoading = ref(false) //
@ -245,13 +243,6 @@ const handleAudit = async (task, pass) => {
}
// 2.2
getDetail()
delView(unref(currentRoute))
back()
}
//
const backView = ()=>{
delView(unref(currentRoute))
back()
}
/** 转派审批人 */
@ -291,7 +282,7 @@ const BusinessFormComponent = ref(null) // 异步组件
const getProcessInstance = async () => {
try {
processInstanceLoading.value = true
console.log(id,"getProcessInstance_id")
//console.log(id,"getProcessInstance_id")
const data = await ProcessInstanceApi.getProcessInstance(id)
if (!data) {
message.error('查询不到流程信息!')
@ -316,11 +307,21 @@ const getProcessInstance = async () => {
})
} else {
// data.processDefinition.formCustomViewPath /crm/contract/detail/index.vue
//console.log(data.processDefinition.formCustomViewPath,"formCustomViewPath")
if ( data.processDefinition.formCustomViewPath == "") {
const process_key = data.processDefinition.key
const formCustomViewPath = await FormProcessMappingApi.getFormViewPath(process_key)
BusinessFormComponent.value = registerComponent(formCustomViewPath)
if ( formCustomViewPath.length == 1) {
BusinessFormComponent.value = registerComponent(formCustomViewPath[0])
} else{
const formCreatePath = await ProcessInstanceTodoApi.getProcessInstanceFormCreatePath( id )
if ( formCreatePath ) {
const formCustomViewPaht = await FormProcessMappingApi.getFormCustomViewPath( formCreatePath )
if ( formCustomViewPaht ) {
BusinessFormComponent.value = registerComponent(formCustomViewPaht)
}
}
}
} else {
BusinessFormComponent.value = registerComponent(data.processDefinition.formCustomViewPath)
}
@ -411,7 +412,7 @@ const loadRunningTask = (tasks) => {
/** 初始化 */
const userOptions = ref<UserApi.UserVO[]>([]) //
onMounted(async () => {
getDetail()
getDetail()
//
userOptions.value = await UserApi.getSimpleUserList()
})