diff --git a/src/assets/svgs/bpm/add-user.svg b/src/assets/svgs/bpm/add-user.svg
new file mode 100644
index 00000000..bc7bdbff
--- /dev/null
+++ b/src/assets/svgs/bpm/add-user.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/assets/svgs/bpm/audit2.svg b/src/assets/svgs/bpm/approve.svg
similarity index 100%
rename from src/assets/svgs/bpm/audit2.svg
rename to src/assets/svgs/bpm/approve.svg
diff --git a/src/assets/svgs/bpm/audit4.svg b/src/assets/svgs/bpm/cancel.svg
similarity index 100%
rename from src/assets/svgs/bpm/audit4.svg
rename to src/assets/svgs/bpm/cancel.svg
diff --git a/src/assets/svgs/bpm/audit3.svg b/src/assets/svgs/bpm/reject.svg
similarity index 100%
rename from src/assets/svgs/bpm/audit3.svg
rename to src/assets/svgs/bpm/reject.svg
diff --git a/src/assets/svgs/bpm/audit1.svg b/src/assets/svgs/bpm/running.svg
similarity index 100%
rename from src/assets/svgs/bpm/audit1.svg
rename to src/assets/svgs/bpm/running.svg
diff --git a/src/components/UserSelectForm/index.vue b/src/components/UserSelectForm/index.vue
index 2ba2a7ff..d2537e1e 100644
--- a/src/components/UserSelectForm/index.vue
+++ b/src/components/UserSelectForm/index.vue
@@ -1,25 +1,27 @@
-
-
+
+
-
+
+
+
-
+
@@ -47,62 +49,87 @@ const emit = defineEmits<{
}>()
const { t } = useI18n() // 国际
const message = useMessage() // 消息弹窗
-
const deptList = ref([]) // 部门树形结构化
-const userList: any = ref([]) // 用户列表
+const allUserList = ref([]) // 所有用户列表
+const filteredUserList = ref([]) // 当前部门过滤后的用户列表
const selectedUserIdList: any = ref([]) // 选中的用户列表
const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // 表单的加载中
-const activityId = ref() // 关联的主键编号 TODO @goldenzqqq:这个 activityId 有没可能不传递。在使用 @submitForm="xxx()" 时,传递的参数。目的是,更加解耦一些。
+const activityId = ref()
+
+// 计算属性:合并已选择的用户和当前部门过滤后的用户
+const transferUserList = computed(() => {
+ // 获取所有已选择的用户
+ const selectedUsers = allUserList.value.filter((user: any) =>
+ selectedUserIdList.value.includes(user.id)
+ )
+
+ // 获取当前部门过滤后的未选择用户
+ const filteredUnselectedUsers = filteredUserList.value.filter(
+ (user: any) => !selectedUserIdList.value.includes(user.id)
+ )
+
+ // 合并并去重
+ return [...selectedUsers, ...filteredUnselectedUsers]
+})
/** 打开弹窗 */
const open = async (id: number, selectedList?: any[]) => {
activityId.value = id
- // 重置表单
resetForm()
- // 加载相关数据
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
- await getUserList()
- // 设置选中的用户列表
- selectedUserIdList.value = selectedList?.map((item: any) => item.id)
-
- // 设置可见
+ // 初始加载所有用户
+ await getAllUserList()
+ // 初始状态下,过滤列表等于所有用户列表
+ filteredUserList.value = [...allUserList.value]
+ selectedUserIdList.value = selectedList?.map((item: any) => item.id) || []
dialogVisible.value = true
}
-
-/** 获取用户列表 */
-const getUserList = async (deptId?: number) => {
+/** 获取所有用户列表 */
+const getAllUserList = async () => {
try {
// @ts-ignore
- // TODO @芋艿:替换到 simple List
- const data = await UserApi.getUserPage({ pageSize: 100, pageNo: 1, deptId })
- userList.value = data.list
+ const data = await UserApi.getSimpleUserList()
+ allUserList.value = data
} finally {
}
}
+/** 获取部门过滤后的用户列表 */
+const getUserList = async (deptId?: number) => {
+ formLoading.value = true
+ try {
+ // @ts-ignore
+ // TODO @芋艿:替换到 simple List 暂不支持 deptId 过滤
+ const data = await UserApi.getUserPage({ pageSize: 100, pageNo: 1, deptId })
+ // 更新过滤后的用户列表
+ filteredUserList.value = data.list
+ } finally {
+ formLoading.value = false
+ }
+}
+
/** 提交选择 */
const submitForm = async () => {
- // 提交请求
- formLoading.value = true
try {
message.success(t('common.updateSuccess'))
dialogVisible.value = false
- const emitUserList = userList.value.filter((user: any) =>
+ // 从所有用户列表中筛选出已选择的用户
+ const emitUserList = allUserList.value.filter((user: any) =>
selectedUserIdList.value.includes(user.id)
)
// 发送操作成功的事件
emit('confirm', activityId.value, emitUserList)
} finally {
- formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
deptList.value = []
- userList.value = []
+ allUserList.value = []
+ filteredUserList.value = []
selectedUserIdList.value = []
}
@@ -113,3 +140,20 @@ const handleNodeClick = (row: { [key: string]: any }) => {
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+
+
diff --git a/src/views/bpm/processInstance/create/index.vue b/src/views/bpm/processInstance/create/index.vue
index 92d68bf1..3a8a8810 100644
--- a/src/views/bpm/processInstance/create/index.vue
+++ b/src/views/bpm/processInstance/create/index.vue
@@ -41,7 +41,7 @@
:ref="`category-${categoryCode}`"
>
- {{ getCategoryName(categoryCode) }}
+ {{ getCategoryName(categoryCode as any) }}
{
/** 流程定义的分组 */
const processDefinitionGroup: any = computed(() => {
if (!processDefinitionList.value?.length) return {}
- return groupBy(filteredProcessDefinitionList.value, 'category')
+ const grouped = groupBy(filteredProcessDefinitionList.value, 'category')
+
+ const orderedGroup = {}
+ // 按照 categoryList 的顺序重新组织数据
+ categoryList.value.forEach((category: any) => {
+ if (grouped[category.code]) {
+ orderedGroup[category.code] = grouped[category.code]
+ }
+ })
+
+ return orderedGroup
})
/** 左侧分类切换 */
diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceBpmnViewer.vue b/src/views/bpm/processInstance/detail/ProcessInstanceBpmnViewer.vue
index 7d0b9593..9592214f 100644
--- a/src/views/bpm/processInstance/detail/ProcessInstanceBpmnViewer.vue
+++ b/src/views/bpm/processInstance/detail/ProcessInstanceBpmnViewer.vue
@@ -1,6 +1,6 @@
-
+
+
+
diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue b/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue
index bb5ccc43..bbb67767 100644
--- a/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue
+++ b/src/views/bpm/processInstance/detail/ProcessInstanceTimeline.vue
@@ -16,9 +16,10 @@
-
+
@@ -46,19 +47,22 @@
"
>
-
-
-
+
+
+
+
+
+
-
-
+
+
{{ user.nickname.substring(0, 1) }}
{{ user.nickname }}
@@ -73,40 +77,39 @@
>
-
+
{{ task.assigneeUser?.nickname.substring(0, 1) }}
{{ task.assigneeUser?.nickname }}
-
+
{{ task.ownerUser?.nickname.substring(0, 1) }}
{{ task.ownerUser?.nickname }}
-
+
@@ -126,23 +129,21 @@
-
-
+
+
{{ user.nickname.substring(0, 1) }}
{{ user.nickname }}
-
+
@@ -184,7 +185,7 @@ const statusIconMap2 = {
// 未开始
'-1': { color: '#909398', icon: 'ep-clock' },
// 待审批
- '0': { color: '#e5e7ec', icon: 'ep:loading' },
+ '0': { color: '#00b32a', icon: 'ep:loading' },
// 审批中
'1': { color: '#448ef7', icon: 'ep:loading' },
// 审批通过
@@ -204,7 +205,7 @@ const statusIconMap2 = {
const statusIconMap = {
// 审批未开始
'-1': { color: '#909398', icon: Clock },
- '0': { color: '#e5e7ec', icon: Clock },
+ '0': { color: '#00b32a', icon: Clock },
// 审批中
'1': { color: '#448ef7', icon: Loading },
// 审批通过
@@ -223,9 +224,9 @@ const statusIconMap = {
const nodeTypeSvgMap = {
// 结束节点
- [NodeType.END_EVENT_NODE]: { color: '#ffffff', svg: finishSvg },
+ [NodeType.END_EVENT_NODE]: { color: '#909398', svg: finishSvg },
// 发起人节点
- [NodeType.START_USER_NODE]: { color: '#ffffff', svg: starterSvg },
+ [NodeType.START_USER_NODE]: { color: '#909398', svg: starterSvg },
// 审批人节点
[NodeType.USER_TASK_NODE]: { color: '#ff943e', svg: auditorSvg },
// 抄送人节点
diff --git a/src/views/bpm/processInstance/detail/index.vue b/src/views/bpm/processInstance/detail/index.vue
index 26141f53..4bd62cb9 100644
--- a/src/views/bpm/processInstance/detail/index.vue
+++ b/src/views/bpm/processInstance/detail/index.vue
@@ -5,7 +5,7 @@
编号:{{ id }}
@@ -137,11 +137,11 @@ import ProcessInstanceTaskList from './ProcessInstanceTaskList.vue'
import ProcessInstanceOperationButton from './ProcessInstanceOperationButton.vue'
import ProcessInstanceTimeline from './ProcessInstanceTimeline.vue'
import { FieldPermissionType } from '@/components/SimpleProcessDesignerV2/src/consts'
-// TODO 代码优化,换个明确的 icon 名字
-import audit1 from '@/assets/svgs/bpm/audit1.svg'
-import audit2 from '@/assets/svgs/bpm/audit2.svg'
-import audit3 from '@/assets/svgs/bpm/audit3.svg'
-import audit4 from '@/assets/svgs/bpm/audit4.svg'
+import { TaskStatusEnum } from '@/api/bpm/task'
+import runningSvg from '@/assets/svgs/bpm/running.svg'
+import approveSvg from '@/assets/svgs/bpm/approve.svg'
+import rejectSvg from '@/assets/svgs/bpm/reject.svg'
+import cancelSvg from '@/assets/svgs/bpm/cancel.svg'
defineOptions({ name: 'BpmProcessInstanceDetail' })
const props = defineProps<{
@@ -155,11 +155,11 @@ const processInstance = ref({}) // 流程实例
const processDefinition = ref({}) // 流程定义
const processModelView = ref({}) // 流程模型视图
const operationButtonRef = ref() // 操作按钮组件 ref
-const auditIcons = {
- 1: audit1,
- 2: audit2,
- 3: audit3,
- 4: audit4
+const auditIconsMap = {
+ [TaskStatusEnum.RUNNING]: runningSvg,
+ [TaskStatusEnum.APPROVE]: approveSvg,
+ [TaskStatusEnum.REJECT]: rejectSvg,
+ [TaskStatusEnum.CANCEL]: cancelSvg
}
// ========== 申请信息 ==========
@@ -242,7 +242,6 @@ const getApprovalDetail = async () => {
/** 获取流程模型视图*/
const getProcessModelView = async () => {
-
if (BpmModelType.BPMN === processDefinition.value?.modelType) {
// 重置,解决 BPMN 流程图刷新不会重新渲染问题
processModelView.value = {
@@ -320,6 +319,15 @@ $process-header-height: 194px;
$process-header-height - 40px
);
overflow: auto;
+
+ :deep(.box-card) {
+ height: 100%;
+
+ .el-card__body {
+ height: 100%;
+ padding: 0;
+ }
+ }
}
}