diff --git a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
index bd787a00..4cbe2c55 100644
--- a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
@@ -109,6 +109,26 @@
/>
+
+
+
+
+
import {
CANDIDATE_STRATEGY,
- CandidateStrategy
+ CandidateStrategy,
+ FieldPermissionType
} from '@/components/SimpleProcessDesignerV2/src/consts'
import { defaultProps, handleTree } from '@/utils/tree'
import * as RoleApi from '@/api/system/role'
@@ -143,6 +164,7 @@ import * as UserApi from '@/api/system/user'
import * as UserGroupApi from '@/api/bpm/userGroup'
import ProcessExpressionDialog from './ProcessExpressionDialog.vue'
import { ProcessExpressionVO } from '@/api/bpm/processExpression'
+import { useFormFieldsPermission } from '@/components/SimpleProcessDesignerV2/src/node'
defineOptions({ name: 'UserTask' })
const props = defineProps({
@@ -162,6 +184,14 @@ const deptTreeOptions = ref() // 部门树
const postOptions = ref([]) // 岗位列表
const userOptions = ref([]) // 用户列表
const userGroupOptions = ref([]) // 用户组列表
+
+// 表单内用户字段
+const { formFieldOptions } = useFormFieldsPermission(FieldPermissionType.READ)
+// 表单内用户字段选项, 必须是必填和用户选择器
+const userFieldOnFormOptions = computed(() => {
+ return formFieldOptions.filter((item) => item.type === 'UserSelect')
+})
+
const otherExtensions = ref()
const resetTaskForm = () => {
@@ -223,6 +253,12 @@ const resetTaskForm = () => {
/** 更新 candidateStrategy 字段时,需要清空 candidateParam,并触发 bpmn 图更新 */
const changeCandidateStrategy = () => {
userTaskForm.value.candidateParam = []
+ if (userTaskForm.value.candidateStrategy === CandidateStrategy.FORM_USER) {
+ // 特殊处理表单内用户字段,当只有发起人选项时应选中发起人
+ if (!userFieldOnFormOptions.value || userFieldOnFormOptions.value.length <= 1) {
+ userTaskForm.value.candidateStrategy = CandidateStrategy.START_USER
+ }
+ }
updateElementTask()
}
@@ -235,7 +271,10 @@ const updateElementTask = () => {
value: userTaskForm.value.candidateStrategy
}),
bpmnInstances().moddle.create(`${prefix}:CandidateParam`, {
- value: userTaskForm.value.candidateParam.join(',')
+ value:
+ userTaskForm.value.candidateParam instanceof Array
+ ? userTaskForm.value.candidateParam.join(',')
+ : userTaskForm.value.candidateParam
})
]
})
@@ -261,6 +300,14 @@ const selectProcessExpression = (expression: ProcessExpressionVO) => {
updateElementTask()
}
+const handleFormUserChange = (e) => {
+ if (e === 'PROCESS_START_USER_ID') {
+ userTaskForm.value.candidateParam = []
+ userTaskForm.value.candidateStrategy = CandidateStrategy.START_USER
+ }
+ updateElementTask()
+}
+
watch(
() => props.id,
() => {