|
38 | 38 | import ProcessNodeTree from './ProcessNodeTree.vue'
|
39 | 39 | import { updateBpmSimpleModel, getBpmSimpleModel } from '@/api/bpm/simple'
|
40 | 40 | 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' |
42 | 49 | defineOptions({
|
43 | 50 | name: 'SimpleProcessDesigner'
|
44 | 51 | })
|
45 |
| -
|
46 | 52 | const router = useRouter() // 路由
|
47 | 53 | const props = defineProps({
|
48 |
| - modelId: String |
| 54 | + modelId: { |
| 55 | + type: String, |
| 56 | + required: true |
| 57 | + } |
49 | 58 | })
|
| 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 | +
|
50 | 77 | const message = useMessage() // 国际化
|
51 | 78 | const processNodeTree = ref<SimpleFlowNode | undefined>()
|
52 |
| -
|
53 | 79 | const errorDialogVisible = ref(false)
|
54 | 80 | let errorNodes: SimpleFlowNode[] = []
|
55 | 81 | const saveSimpleFlowModel = async () => {
|
@@ -137,6 +163,29 @@ const zoomIn = () => {
|
137 | 163 | }
|
138 | 164 |
|
139 | 165 | 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 设计器模型 |
140 | 189 | const result = await getBpmSimpleModel(props.modelId)
|
141 | 190 | if (result) {
|
142 | 191 | processNodeTree.value = result
|
|
0 commit comments