Skip to content

Commit 4a2a7b7

Browse files
committed
【问题修复】仿钉钉设计器,条件节点,表单字段不显示
1 parent fb19dd2 commit 4a2a7b7

File tree

2 files changed

+55
-52
lines changed

2 files changed

+55
-52
lines changed

src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,44 @@
3838
import ProcessNodeTree from './ProcessNodeTree.vue'
3939
import { updateBpmSimpleModel, getBpmSimpleModel } from '@/api/bpm/simple'
4040
import { SimpleFlowNode, NodeType, NodeId, NODE_DEFAULT_TEXT } from './consts'
41-
41+
import { getModel } from '@/api/bpm/model'
42+
import { getForm, FormVO } from '@/api/bpm/form'
43+
import { handleTree } from '@/utils/tree'
44+
import * as RoleApi from '@/api/system/role'
45+
import * as DeptApi from '@/api/system/dept'
46+
import * as PostApi from '@/api/system/post'
47+
import * as UserApi from '@/api/system/user'
48+
import * as UserGroupApi from '@/api/bpm/userGroup'
4249
defineOptions({
4350
name: 'SimpleProcessDesigner'
4451
})
45-
4652
const router = useRouter() // 路由
4753
const props = defineProps({
48-
modelId: String
54+
modelId: {
55+
type: String,
56+
required: true
57+
}
4958
})
59+
60+
const formFields = ref<string[]>([])
61+
const formType = ref(20)
62+
const roleOptions = ref<RoleApi.RoleVO[]>([]) // 角色列表
63+
const postOptions = ref<PostApi.PostVO[]>([]) // 岗位列表
64+
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
65+
const deptOptions = ref<DeptApi.DeptVO[]>([]) // 部门列表
66+
const deptTreeOptions = ref()
67+
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) // 用户组列表
68+
provide('formFields', formFields)
69+
provide('formType', formType)
70+
provide('roleList', roleOptions)
71+
provide('postList', postOptions)
72+
provide('userList', userOptions)
73+
provide('deptList', deptOptions)
74+
provide('userGroupList', userGroupOptions)
75+
provide('deptTree', deptTreeOptions)
76+
5077
const message = useMessage() // 国际化
5178
const processNodeTree = ref<SimpleFlowNode | undefined>()
52-
5379
const errorDialogVisible = ref(false)
5480
let errorNodes: SimpleFlowNode[] = []
5581
const saveSimpleFlowModel = async () => {
@@ -137,6 +163,29 @@ const zoomIn = () => {
137163
}
138164
139165
onMounted(async () => {
166+
// 获取表单字段
167+
const bpmnModel = await getModel(props.modelId)
168+
if (bpmnModel) {
169+
formType.value = bpmnModel.formType
170+
if (formType.value === 10) {
171+
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
172+
formFields.value = bpmnForm?.fields
173+
}
174+
}
175+
// 获得角色列表
176+
roleOptions.value = await RoleApi.getSimpleRoleList()
177+
// 获得岗位列表
178+
postOptions.value = await PostApi.getSimplePostList()
179+
// 获得用户列表
180+
userOptions.value = await UserApi.getSimpleUserList()
181+
// 获得部门列表
182+
deptOptions.value = await DeptApi.getSimpleDeptList()
183+
184+
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id')
185+
// 获取用户组列表
186+
userGroupOptions.value = await UserGroupApi.getUserGroupSimpleList()
187+
188+
// 获取 SIMPLE 设计器模型
140189
const result = await getBpmSimpleModel(props.modelId)
141190
if (result) {
142191
processNodeTree.value = result

src/views/bpm/simpleWorkflow/index.vue

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,11 @@
33
</template>
44
<script setup lang="ts">
55
import { SimpleProcessDesigner } from '@/components/SimpleProcessDesignerV2/src/'
6-
import { getModel } from '@/api/bpm/model'
7-
import { getForm, FormVO } from '@/api/bpm/form'
8-
import { handleTree } from '@/utils/tree'
9-
import * as RoleApi from '@/api/system/role'
10-
import * as DeptApi from '@/api/system/dept'
11-
import * as PostApi from '@/api/system/post'
12-
import * as UserApi from '@/api/system/user'
13-
import * as UserGroupApi from '@/api/bpm/userGroup'
6+
147
defineOptions({
158
name: 'SimpleWorkflowDesignEditor'
169
})
1710
const { query } = useRoute() // 路由的查询
18-
const modelId: string | undefined = query.modelId as string
19-
const formFields = ref<string[]>([])
20-
const formType = ref(20)
21-
const roleOptions = ref<RoleApi.RoleVO[]>([]) // 角色列表
22-
const postOptions = ref<PostApi.PostVO[]>([]) // 岗位列表
23-
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
24-
const deptOptions = ref<DeptApi.DeptVO[]>([]) // 部门列表
25-
const deptTreeOptions = ref()
26-
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) // 用户组列表
27-
provide('formFields', formFields)
28-
provide('formType', formType)
29-
provide('roleList', roleOptions)
30-
provide('postList', postOptions)
31-
provide('userList', userOptions)
32-
provide('deptList', deptOptions)
33-
provide('userGroupList', userGroupOptions)
34-
provide('deptTree', deptTreeOptions)
35-
onMounted(async () => {
36-
const bpmnModel = await getModel(modelId)
37-
if (bpmnModel) {
38-
formType.value = bpmnModel.formType
39-
if (formType.value === 10) {
40-
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
41-
formFields.value = bpmnForm?.fields
42-
}
43-
}
44-
// 获得角色列表
45-
roleOptions.value = await RoleApi.getSimpleRoleList()
46-
// 获得岗位列表
47-
postOptions.value = await PostApi.getSimplePostList()
48-
// 获得用户列表
49-
userOptions.value = await UserApi.getSimpleUserList()
50-
// 获得部门列表
51-
deptOptions.value = await DeptApi.getSimpleDeptList()
52-
53-
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id')
54-
55-
// 用户组列表
56-
userGroupOptions.value = await UserGroupApi.getUserGroupSimpleList()
57-
})
11+
const modelId = query.modelId as string
5812
</script>
5913
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)