diff --git a/src/components/UserSelectForm/index.vue b/src/components/UserSelectForm/index.vue index d4cf6f2b..2ba2a7ff 100644 --- a/src/components/UserSelectForm/index.vue +++ b/src/components/UserSelectForm/index.vue @@ -16,6 +16,7 @@ 确 定 + 确 定 + 取 消 @@ -44,48 +46,60 @@ const emit = defineEmits<{ confirm: [id: any, userList: any[]] }>() const { t } = useI18n() // 国际 +const message = useMessage() // 消息弹窗 + const deptList = ref([]) // 部门树形结构化 const userList: any = ref([]) // 用户列表 -const message = useMessage() // 消息弹窗 const selectedUserIdList: any = ref([]) // 选中的用户列表 const dialogVisible = ref(false) // 弹窗的是否展示 const formLoading = ref(false) // 表单的加载中 -const activityId = ref() // 主键id +const activityId = ref() // 关联的主键编号 TODO @goldenzqqq:这个 activityId 有没可能不传递。在使用 @submitForm="xxx()" 时,传递的参数。目的是,更加解耦一些。 /** 打开弹窗 */ -const open = async (id, selectedList?) => { +const open = async (id: number, selectedList?: any[]) => { activityId.value = id + // 重置表单 resetForm() + + // 加载相关数据 deptList.value = handleTree(await DeptApi.getSimpleDeptList()) await getUserList() - selectedUserIdList.value = selectedList?.map((item) => item.id) - // 修改时,设置数据 + // 设置选中的用户列表 + selectedUserIdList.value = selectedList?.map((item: any) => item.id) + + // 设置可见 dialogVisible.value = true } -/* 获取用户列表 */ -const getUserList = async (deptId?) => { +/** 获取用户列表 */ +const getUserList = async (deptId?: number) => { try { // @ts-ignore + // TODO @芋艿:替换到 simple List const data = await UserApi.getUserPage({ pageSize: 100, pageNo: 1, deptId }) userList.value = data.list } finally { } } +/** 提交选择 */ const submitForm = async () => { // 提交请求 formLoading.value = true try { message.success(t('common.updateSuccess')) dialogVisible.value = false - const emitUserList = userList.value.filter((user) => selectedUserIdList.value.includes(user.id)) + const emitUserList = userList.value.filter((user: any) => + selectedUserIdList.value.includes(user.id) + ) // 发送操作成功的事件 emit('confirm', activityId.value, emitUserList) } finally { formLoading.value = false } } + +/** 重置表单 */ const resetForm = () => { deptList.value = [] userList.value = [] @@ -93,8 +107,9 @@ const resetForm = () => { } /** 处理部门被点击 */ -const handleNodeClick = async (row: { [key: string]: any }) => { +const handleNodeClick = (row: { [key: string]: any }) => { getUserList(row.id) } + defineExpose({ open }) // 提供 open 方法,用于打开弹窗 diff --git a/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue b/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue index bdd8e3f0..70aad873 100644 --- a/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue +++ b/src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue @@ -24,6 +24,7 @@ + () +const emit = defineEmits(['cancel']) + const { push, currentRoute } = useRouter() // 路由 const message = useMessage() // 消息弹窗 const { delView } = useTagsViewStore() // 视图操作 @@ -103,12 +106,10 @@ const fApi = ref() const startUserSelectTasks: any = ref([]) // 发起人需要选择审批人的用户任务列表 const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据 const bpmnXML: any = ref(null) // BPMN 数据 -const simpleJson = ref() // Simple 设计器数据 json 格式 -/** 当前的Tab */ -const activeTab = ref('form') -const emit = defineEmits(['cancel']) -// 审批节点信息 -const activityNodes = ref([]) +const simpleJson = ref() // Simple 设计器数据 json 格式 + +const activeTab = ref('form') // 当前的 Tab +const activityNodes = ref([]) // 审批节点信息 /** 设置表单信息、获取流程图数据 **/ const initProcessInfo = async (row: any, formVariables?: any) => { diff --git a/src/views/bpm/processInstance/create/index.vue b/src/views/bpm/processInstance/create/index.vue index 3d863c61..92d68bf1 100644 --- a/src/views/bpm/processInstance/create/index.vue +++ b/src/views/bpm/processInstance/create/index.vue @@ -2,7 +2,7 @@