!700 fix: 修复流程预测功能

Merge pull request !700 from SamllNorth_Lee/fix/bpm
This commit is contained in:
芋道源码 2025-02-19 05:15:38 +00:00 committed by Gitee
commit 0d7d2cd1c3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 58 additions and 15 deletions

View File

@ -90,7 +90,7 @@ export const getProcessInstanceCopyPage = async (params: any) => {
// 获取审批详情
export const getApprovalDetail = async (params: any) => {
return await request.get({ url: 'bpm/process-instance/get-approval-detail', params })
return await request.get({ url: '/bpm/process-instance/get-approval-detail', params })
}
// 获取表单字段权限

View File

@ -532,6 +532,7 @@ export const CANDIDATE_STRATEGY: DictDataVO[] = [
{ label: '部门负责人', value: CandidateStrategy.DEPT_LEADER },
{ label: '连续多级部门负责人', value: CandidateStrategy.MULTI_LEVEL_DEPT_LEADER },
{ label: '指定岗位', value: CandidateStrategy.MULTI_LEVEL_DEPT_LEADER },
{ label: '发起人自选', value: CandidateStrategy.START_USER_SELECT },
{ label: '发起人本人', value: CandidateStrategy.START_USER },
{ label: '发起人部门负责人', value: CandidateStrategy.START_USER_DEPT_LEADER },
{ label: '发起人连续部门负责人', value: CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER },

View File

@ -188,12 +188,8 @@
:scroll="true"
max-height="600px"
>
<!-- append-to-body -->
<div v-highlight>
<code class="hljs">
<!-- 高亮代码块 -->
{{ previewResult }}
</code>
<div>
<pre><code v-dompurify-html="highlightedCode(previewResult)" class="hljs"></code></pre>
</div>
</Dialog>
</div>
@ -237,6 +233,8 @@ import { XmlNode, XmlNodeType, parseXmlString } from 'steady-xml'
// const eventName = reactive({
// name: ''
// })
import hljs from 'highlight.js' //
import 'highlight.js/styles/github.css' //
defineOptions({ name: 'MyProcessDesigner' })
@ -308,6 +306,18 @@ const props = defineProps({
}
})
/**
* 代码高亮
*/
const highlightedCode = (code: string) => {
//
if (previewType.value === 'json') {
code = JSON.stringify(code, null, 2)
}
const result = hljs.highlight(code, { language: previewType.value, ignoreIllegals: true })
return result.value || '&nbsp;'
}
provide('configGlobal', props)
let bpmnModeler: any = null
const defaultZoom = ref(1)

View File

@ -123,7 +123,7 @@
</div>
<el-divider content-position="left">字段权限</el-divider>
<div class="field-setting-pane" v-if="formType === 10">
<div class="field-setting-pane" v-if="formType === BpmModelFormType.NORMAL">
<div class="field-permit-title">
<div class="setting-title-label first-title"> 字段名称 </div>
<div class="other-titles">

View File

@ -74,7 +74,7 @@
</template>
<script lang="ts" setup>
import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
import { BpmModelType } from '@/utils/constants'
import { BpmModelType, BpmModelFormType } from '@/utils/constants'
import {
CandidateStrategy,
NodeId,
@ -108,6 +108,7 @@ const fApi = ref<ApiAttrs>()
//
const startUserSelectTasks: any = ref([]) //
const startUserSelectAssignees = ref({}) //
const hisStartUserSelectAssignees = ref({}) //
const bpmnXML: any = ref(null) // BPMN
const simpleJson = ref<string | undefined>() // Simple json
@ -121,7 +122,7 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
startUserSelectAssignees.value = {}
//
if (row.formType == 10) {
if (row.formType == BpmModelFormType.NORMAL) {
//
// formVariables row.formFields
// formVariables
@ -155,32 +156,57 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
}
}
//
watch(
detailForm.value,
(newValue) => {
if (newValue && Object.keys(newValue.value).length > 0) {
//
hisStartUserSelectAssignees.value = startUserSelectAssignees.value
startUserSelectAssignees.value = {}
getApprovalDetail({
id: props.selectProcessDefinition.id,
processVariablesStr: newValue.value
})
}
},
{
immediate: true
}
)
/** 获取审批详情 */
const getApprovalDetail = async (row: any) => {
try {
// TODO activityId Simple
const data = await ProcessInstanceApi.getApprovalDetail({
processDefinitionId: row.id,
activityId: NodeId.START_USER_NODE_ID
activityId: NodeId.START_USER_NODE_ID,
processVariablesStr: JSON.stringify(row.processVariablesStr)
})
if (!data) {
message.error('查询不到审批详情信息!')
return
}
// Timeline
activityNodes.value = data.activityNodes
//
startUserSelectTasks.value = data.activityNodes?.filter(
(node: ApprovalNodeInfo) => CandidateStrategy.START_USER_SELECT === node.candidateStrategy
)
if (startUserSelectTasks.value?.length > 0) {
for (const node of startUserSelectTasks.value) {
if (hisStartUserSelectAssignees.value[node.id] && hisStartUserSelectAssignees.value[node.id].length > 0) {
startUserSelectAssignees.value[node.id] = hisStartUserSelectAssignees.value[node.id]
} else {
startUserSelectAssignees.value[node.id] = []
}
}
}
// Timeline
activityNodes.value = data.activityNodes
//
const formFieldsPermission = data.formFieldsPermission
//

View File

@ -703,6 +703,12 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
//
if (!formRef) return
await formRef.validate()
//
const valid = await validateNormalForm()
if (!valid) {
message.warning('表单校验不通过,请先完善表单!!')
return
}
if (pass) {
// ,
const variables = getUpdatedProcessInstanceVariables()