【功能优化】发起流程时候,表单字段权限设置

pull/624/MERGE
jason 2024-12-18 23:23:07 +08:00
parent 0ae9acdfd6
commit ea97abc0af
1 changed files with 34 additions and 3 deletions

View File

@ -75,7 +75,7 @@
<script lang="ts" setup>
import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
import { BpmModelType } from '@/utils/constants'
import { CandidateStrategy } from '@/components/SimpleProcessDesignerV2/src/consts'
import { CandidateStrategy, NodeId, FieldPermissionType } from '@/components/SimpleProcessDesignerV2/src/consts'
import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
import ProcessInstanceSimpleViewer from '../detail/ProcessInstanceSimpleViewer.vue'
import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
@ -129,8 +129,10 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
}
}
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables)
await nextTick()
await nextTick();
fApi.value?.btn.show(false) //
//
await getApprovalDetail(row)
@ -152,7 +154,9 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
/** 获取审批详情 */
const getApprovalDetail = async (row: any) => {
try {
const data = await ProcessInstanceApi.getApprovalDetail({ processDefinitionId: row.id })
// activityId Simple
const data = await ProcessInstanceApi.getApprovalDetail({ processDefinitionId: row.id, activityId : NodeId.START_USER_NODE_ID })
if (!data) {
message.error('查询不到审批详情信息!')
return
@ -170,10 +174,37 @@ const getApprovalDetail = async (row: any) => {
// Timeline
activityNodes.value = data.activityNodes
//
const formFieldsPermission = data.formFieldsPermission
//
if (formFieldsPermission) {
Object.keys(formFieldsPermission).forEach((item) => {
setFieldPermission(item, formFieldsPermission[item])
})
}
} finally {
}
}
/**
* 设置表单权限
*/
const setFieldPermission = (field: string, permission: string) => {
if (permission === FieldPermissionType.READ) {
//@ts-ignore
fApi.value?.disabled(true, field)
}
if (permission === FieldPermissionType.WRITE) {
//@ts-ignore
fApi.value?.disabled(false, field)
}
if (permission === FieldPermissionType.NONE) {
//@ts-ignore
fApi.value?.hidden(true, field)
}
}
/** 提交按钮 */
const submitForm = async () => {
if (!fApi.value || !props.selectProcessDefinition) {