bpm:流程详情的初始加载

This commit is contained in:
YunaiV 2023-01-24 08:03:08 +08:00
parent f6e0360452
commit 2774671a88
5 changed files with 59 additions and 24 deletions

View File

@ -1,5 +1,24 @@
import request from '@/config/axios'
export type Task = {
id: string
name: string
}
export type ProcessInstanceVO = {
id: number
name: string
processDefinitionId: string
category: string
result: number
tasks: Task[]
fields: string[]
status: number
remark: string
businessKey: string
createTime: string
endTime: string
}
export const getMyProcessInstancePageApi = async (params) => {
return await request.get({ url: '/bpm/process-instance/my-page', params })
}

View File

@ -1,18 +0,0 @@
export type task = {
id: string
name: string
}
export type ProcessInstanceVO = {
id: number
name: string
processDefinitionId: string
category: string
result: number
tasks: task[]
fields: string[]
status: number
remark: string
businessKey: string
createTime: string
endTime: string
}

View File

@ -37,9 +37,18 @@ export const setConfAndFields = (designerRef: object, conf: string, fields: stri
}
// 设置表单的 Conf 和 Fields
export const setConfAndFields2 = (detailPreview: object, conf: string, fields: string) => {
export const setConfAndFields2 = (
detailPreview: object,
conf: string,
fields: string,
value: object
) => {
// @ts-ignore
detailPreview.value.option = JSON.parse(conf)
// @ts-ignore
detailPreview.value.rule = decodeFields(fields)
if (value) {
// @ts-ignore
detailPreview.value.value = value
}
}

View File

@ -9,9 +9,12 @@
</template>
<!-- 情况一流程表单 -->
<el-col v-if="processInstance?.processDefinition?.formType === 10" :span="16" :offset="6">
<div>
<parser :key="new Date().getTime()" :form-conf="detailForm" />
</div>
<form-create
:rule="detailForm.rule"
v-model:api="fApi"
:option="detailForm.option"
v-model="detailForm.value"
/>
</el-col>
<!-- 情况二流程表单 -->
<div v-if="processInstance?.processDefinition?.formType === 20">
@ -40,6 +43,15 @@ const processInstanceLoading = ref(false) // 流程实例的加载中
const processInstance = ref({}) //
// ========== ==========
import { setConfAndFields2 } from '@/utils/formCreate'
import { ApiAttrs } from '@form-create/element-ui/types/config'
const fApi = ref<ApiAttrs>()
//
const detailForm = ref({
rule: [],
option: {},
value: {}
})
// ========== ==========
onMounted(() => {
@ -53,7 +65,20 @@ onMounted(() => {
}
processInstance.value = data
// TODO
//
const processDefinition = data.processDefinition
if (processDefinition.formType === 10) {
setConfAndFields2(
detailForm,
processDefinition.formConf,
processDefinition.formFields,
data.formVariables
)
nextTick().then(() => {
fApi.value.btn.show(false)
fApi.value.resetBtn.show(false)
})
}
// TODO

View File

@ -67,7 +67,7 @@ const handleDetail = (row) => {
router.push({
name: 'BpmProcessInstanceDetail',
query: {
id: row.processInstanceId
id: row.id
}
})
}