From 74b8b33d6edc232a72025faa616a18747d2dcfc7 Mon Sep 17 00:00:00 2001 From: zhihao <18915542763@163.com> Date: Tue, 16 Jun 2026 18:44:49 +0800 Subject: [PATCH] =?UTF-8?q?czh-20260616-=E6=9B=B4=E6=94=B9=E5=8D=8F?= =?UTF-8?q?=E4=BD=9C=E4=BA=BA=E9=80=89=E4=BA=BA=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collabUserComponent/SzCollabUserModal.vue | 202 ++++++ .../SzCollabUserSelect.vue | 536 +++++++++++++++ .../semri/collabUserComponent/types.ts | 79 +++ .../deptUserComponent/SzDeptUserModal.vue | 7 +- .../tasklist/components/CollaboratorModal.vue | 618 +++--------------- src/views/tasklist/components/TaskContent.vue | 19 +- .../tasklist/components/TaskFlatView.vue | 9 +- src/views/tasklist/index.vue | 12 +- 8 files changed, 951 insertions(+), 531 deletions(-) create mode 100644 src/components/semri/collabUserComponent/SzCollabUserModal.vue create mode 100644 src/components/semri/collabUserComponent/SzCollabUserSelect.vue create mode 100644 src/components/semri/collabUserComponent/types.ts diff --git a/src/components/semri/collabUserComponent/SzCollabUserModal.vue b/src/components/semri/collabUserComponent/SzCollabUserModal.vue new file mode 100644 index 0000000..683dc03 --- /dev/null +++ b/src/components/semri/collabUserComponent/SzCollabUserModal.vue @@ -0,0 +1,202 @@ + + + + + + + + 选择 + + + + + + + (tempEditable = v)" + @update:readonlyUsers="(v) => (tempReadonly = v)" + /> + + 取消 + 确定 + + + + + + + + diff --git a/src/components/semri/collabUserComponent/SzCollabUserSelect.vue b/src/components/semri/collabUserComponent/SzCollabUserSelect.vue new file mode 100644 index 0000000..317c18c --- /dev/null +++ b/src/components/semri/collabUserComponent/SzCollabUserSelect.vue @@ -0,0 +1,536 @@ + + + + + + + + + + + + 重置 + 全选 + 清空 + + + 当前选择模式: + + 编 可编辑 + 阅 可阅读 + + + + + + + + + + + 已选 ({{ selectedRows.length }}) + 清空 + + + + + + + + {{ user.permission === '2' ? '编' : '阅' }} + + + onMoveUserPermission(user, key as '2' | '3')"> + + 编 可编辑 + + + + 阅 可阅读 + + + + + + + {{ user.realname }} + + + + + + + + + 编辑 {{ editableCount }} 人 + | + 阅读 {{ readonlyCount }} 人 + + + + + + + + diff --git a/src/components/semri/collabUserComponent/types.ts b/src/components/semri/collabUserComponent/types.ts new file mode 100644 index 0000000..85f2df0 --- /dev/null +++ b/src/components/semri/collabUserComponent/types.ts @@ -0,0 +1,79 @@ +export interface UserItem { + id: string; + username: string; + realname: string; + orgCodeTxt?: string; + userSecurityLevel?: number; + userSecurityLevel_dictText?: string; + sex_dictText?: string; + sortno?: number; + departId?: string; + departName?: string; +} + +export interface CollabUserItem extends UserItem { + permission: '2' | '3'; +} + +export interface DepartTreeNode { + id: string; + key: string; + value: string; + title: string; + isLeaf?: boolean; + departType?: string | number; + distributable?: number; + disableCheckbox?: boolean; + children?: DepartTreeNode[]; + description?: string; + parentId?: string; + orgCode?: string; +} + +export interface CollabConfirmResult { + editableIds: string; + editableNames: string; + readonlyIds: string; + readonlyNames: string; +} + +export function deleteIfExist>(array: T[], value: T, key: string): void { + const idx = array.findIndex((item) => item[key] === value[key]); + if (idx >= 0) { + array.splice(idx, 1); + } +} + +export function pushIfNotExist>(array: T[], value: T, key: string): void { + const idx = array.findIndex((item) => item[key] === value[key]); + if (idx < 0) { + array.push(value); + } +} + +export function filterDepartTree>(departTree: T[], searchValue: string): T[] { + let filtered: T[] = []; + departTree.forEach((item) => { + if (item.title && item.title.includes(searchValue)) { + filtered.push(Object.assign({}, item, { children: null, isLeaf: true })); + } + if (item.children) { + const result = filterDepartTree(item.children, searchValue); + if (result.length > 0) { + filtered = filtered.concat(result); + } + } + }); + return filtered; +} + +export function recurTree, R>(tree: T[], callback: (node: T) => R[]): R[] { + let res: R[] = []; + tree.forEach((item) => { + res = res.concat(callback(item)); + if (item.children) { + res = res.concat(recurTree(item.children, callback)); + } + }); + return res; +} diff --git a/src/components/semri/deptUserComponent/SzDeptUserModal.vue b/src/components/semri/deptUserComponent/SzDeptUserModal.vue index e39b762..1a7767f 100644 --- a/src/components/semri/deptUserComponent/SzDeptUserModal.vue +++ b/src/components/semri/deptUserComponent/SzDeptUserModal.vue @@ -125,10 +125,11 @@ function openModal() { visible.value = true; } -async function open() { +async function open(valueStr?: string) { if (props.disabled) return; - if (props.value) { - await loadUsersByUsernames(props.value); + const val = valueStr !== undefined ? valueStr : props.value; + if (val) { + await loadUsersByUsernames(val); } else { innerSelectedUsers.value = []; } diff --git a/src/views/tasklist/components/CollaboratorModal.vue b/src/views/tasklist/components/CollaboratorModal.vue index c91c0bb..17bbc4d 100644 --- a/src/views/tasklist/components/CollaboratorModal.vue +++ b/src/views/tasklist/components/CollaboratorModal.vue @@ -1,539 +1,135 @@ - - - - - - - {{ (item.username || '?').charAt(0) }} - - - - {{ item.username }} - 所有者 - - - - - 所有者 - - - - - {{ item.permission === '2' ? '可编辑' : '可阅读' }} - - - - onPermissionChange(item.permissionId, key)"> - - 可编辑 - - - - 可阅读 - - - - - - - - - - - {{ item.permission === '2' ? '可编辑' : '可阅读' }} - - - - - - 暂无协作人 - - - - - - 添加协作人 - - - - - - - - 权限 - - 可编辑 - 可阅读 - - - - - - - - - - + - - diff --git a/src/views/tasklist/components/TaskContent.vue b/src/views/tasklist/components/TaskContent.vue index 9f25a17..9e3c28c 100644 --- a/src/views/tasklist/components/TaskContent.vue +++ b/src/views/tasklist/components/TaskContent.vue @@ -1362,19 +1362,20 @@ userSelectModalTaskId.value = taskId; const task = findTaskById(taskId); + let ids = ''; if (type === 'assignee') { - userSelectModalCurrentIds.value = task?.assigneeId || ''; + ids = task?.assigneeId || ''; userSelectModalCurrentNames.value = task?.assigneeName || ''; } else if (type === 'participant') { - userSelectModalCurrentIds.value = task?.participantId || ''; + ids = task?.participantId || ''; userSelectModalCurrentNames.value = task?.participantName || ''; } else { - userSelectModalCurrentIds.value = task?.followersId || ''; + ids = task?.followersId || ''; userSelectModalCurrentNames.value = task?.followersName || ''; } nextTick(() => { - userSelectModalRef.value?.open(); + userSelectModalRef.value?.open(ids); }); } @@ -1911,6 +1912,7 @@ display: flex; align-items: center; justify-content: space-between; + overflow: hidden; } .content-header-row { @@ -1924,6 +1926,8 @@ display: flex; align-items: center; gap: 4px; + min-width: 0; + overflow: hidden; } .add-list-btn { @@ -1952,6 +1956,7 @@ display: flex; align-items: center; gap: 8px; + flex-shrink: 0; } .header-secret-badge { @@ -1972,6 +1977,7 @@ border-radius: 6px; border: 1px solid #e8e8e8; transition: all 0.15s; + white-space: nowrap; &:hover { border-color: #d0d0d0; @@ -2001,6 +2007,9 @@ font-size: 18px; font-weight: 600; color: #1f1f1f; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .header-more-btn { @@ -2017,6 +2026,8 @@ display: flex; align-items: center; gap: 0; + min-width: 0; + overflow: hidden; } .content-header-rename-row { diff --git a/src/views/tasklist/components/TaskFlatView.vue b/src/views/tasklist/components/TaskFlatView.vue index d150229..4f8ab48 100644 --- a/src/views/tasklist/components/TaskFlatView.vue +++ b/src/views/tasklist/components/TaskFlatView.vue @@ -668,19 +668,20 @@ userSelectModalTaskId.value = taskId; const task = props.tasks.find((t) => t.id === taskId); + let ids = ''; if (type === 'assignee') { - userSelectModalCurrentIds.value = task?.assigneeId || ''; + ids = task?.assigneeId || ''; userSelectModalCurrentNames.value = task?.assigneeName || ''; } else if (type === 'participant') { - userSelectModalCurrentIds.value = task?.participantId || ''; + ids = task?.participantId || ''; userSelectModalCurrentNames.value = task?.participantName || ''; } else { - userSelectModalCurrentIds.value = task?.followersId || ''; + ids = task?.followersId || ''; userSelectModalCurrentNames.value = task?.followersName || ''; } nextTick(() => { - userSelectModalRef.value?.open(); + userSelectModalRef.value?.open(ids); }); } diff --git a/src/views/tasklist/index.vue b/src/views/tasklist/index.vue index 4bad5c3..23cb45e 100644 --- a/src/views/tasklist/index.vue +++ b/src/views/tasklist/index.vue @@ -94,7 +94,7 @@ @unfollow-task="onUnfollowTask" @move-task="onMoveTask" /> - + @@ -300,8 +300,6 @@ return findListInGroups(taskListGroups.value, currentListId.value) || findListInGroups(quickAccessGroups.value, currentListId.value); }); - const isCurrentOwner = computed(() => currentList.value?.myPermission === '1'); - async function loadPermissionForList(listId: string) { const silentOpts = { successMessageMode: 'none' as const }; try { @@ -497,7 +495,7 @@ function onOpenCollaborator() { collaboratorTargetListId.value = ''; - collaboratorModalRef.value?.open(); + collaboratorModalRef.value?.open(currentListId.value); } const collaboratorTargetList = computed(() => { @@ -510,10 +508,6 @@ return null; }); - const isOwnerOfTargetList = computed(() => { - return collaboratorTargetList.value?.myPermission === '1'; - }); - function onOpenCollaboratorForList(listId: string) { const list = findListInQuickAccess(listId); if (list && list.myPermission !== '1') { @@ -521,7 +515,7 @@ return; } collaboratorTargetListId.value = listId; - collaboratorModalRef.value?.open(); + collaboratorModalRef.value?.open(listId); } function findListInQuickAccess(listId: string): TaskList | null {