diff --git a/src/views/tasklist/components/PlanPreviewModal.vue b/src/views/tasklist/components/PlanPreviewModal.vue new file mode 100644 index 0000000..2a2e088 --- /dev/null +++ b/src/views/tasklist/components/PlanPreviewModal.vue @@ -0,0 +1,1038 @@ + + + + + + + diff --git a/src/views/tasklist/components/TaskContent.vue b/src/views/tasklist/components/TaskContent.vue index 047adf4..af32848 100644 --- a/src/views/tasklist/components/TaskContent.vue +++ b/src/views/tasklist/components/TaskContent.vue @@ -274,7 +274,7 @@
密级
创建时间
-
+
{{ list.name }} @@ -915,6 +915,7 @@ 'create-list': []; 'load-more': []; 'search-keyword': [keyword: string]; + 'preview-list': [list: TaskList]; }>(); const userStore = useUserStore(); @@ -1255,6 +1256,14 @@ } } + function onListRowClick(list: TaskList) { + if (isFavorited(list.id)) { + emit('list-select', list.id); + } else { + emit('preview-list', list); + } + } + const _isOwner = computed(() => props.currentList?.myPermission === '1'); const canEdit = computed(() => props.currentList?.myPermission === '1' || props.currentList?.myPermission === '2'); const isReadOnly = computed(() => props.currentList?.myPermission === '3'); diff --git a/src/views/tasklist/components/TaskDetailDrawer.vue b/src/views/tasklist/components/TaskDetailDrawer.vue index 5990a6a..1722fcf 100644 --- a/src/views/tasklist/components/TaskDetailDrawer.vue +++ b/src/views/tasklist/components/TaskDetailDrawer.vue @@ -205,7 +205,7 @@
- + {{ taskData.taskDesc || '添加描述' }} @@ -218,11 +218,11 @@
@@ -309,10 +309,10 @@ -
+
添加关注人 - +
-
@@ -408,11 +402,14 @@ const isFullReadOnly = computed(() => isReadOnly.value && !isAssigneeEdit.value); const showNewSubTaskInput = ref(false); const newSubTaskName = ref(''); + const subTaskInputRef = ref(); const startTimeDayjs = ref(null); const endTimeDayjs = ref(null); const editingTitle = ref(false); const showDescEditor = ref(false); const showRemarkEditor = ref(false); + const descTextareaRef = ref(); + const remarkTextareaRef = ref(); const subtaskExpanded = ref(true); const subTaskUserSelectId = ref(''); @@ -526,6 +523,27 @@ endTimeDayjs.value = data?.task?.endTime || null; }); + watch(showNewSubTaskInput, async (val) => { + if (val) { + await nextTick(); + subTaskInputRef.value?.focus(); + } + }); + + watch(showDescEditor, async (val) => { + if (val) { + await nextTick(); + descTextareaRef.value?.focus(); + } + }); + + watch(showRemarkEditor, async (val) => { + if (val) { + await nextTick(); + remarkTextareaRef.value?.focus(); + } + }); + function autoSave() { if (taskData.value) { const updated = { @@ -589,7 +607,7 @@ } taskData.value.followersId = idList.join(','); taskData.value.followersName = nameList.join(','); - autoSave(); + emit('unfollow-task', taskData.value.id); } else { const idList = (taskData.value.followersId || '').split(',').filter(Boolean); const nameList = (taskData.value.followersName || '').split(/[,,、]/).map((s) => s.trim()).filter(Boolean); @@ -599,7 +617,7 @@ } taskData.value.followersId = idList.join(','); taskData.value.followersName = nameList.join(','); - autoSave(); + emit('follow-task', taskData.value.id); } } diff --git a/src/views/tasklist/index.vue b/src/views/tasklist/index.vue index 50c9a83..615eb9e 100644 --- a/src/views/tasklist/index.vue +++ b/src/views/tasklist/index.vue @@ -59,6 +59,7 @@ @create-list="onCreateListModal('')" @load-more="onLoadMoreListViews" @search-keyword="onSearchKeywordChange" + @preview-list="onPreviewList" /> +
@@ -119,6 +133,7 @@ import CreateListModal from './components/CreateListModal.vue'; import TaskDetailDrawer from './components/TaskDetailDrawer.vue'; import CollaboratorModal from './components/CollaboratorModal.vue'; +import PlanPreviewModal from './components/PlanPreviewModal.vue'; import { getMyFavorites, addTaskListGroup, @@ -198,6 +213,14 @@ const collaboratorTargetListId = ref(''); const defaultGroupRealIdMap = ref>({}); + const previewModalVisible = ref(false); + const previewListId = ref(''); + const previewListName = ref(''); + const previewSecretLevel = ref(1); + const previewSecretText = ref('非密'); + const previewCollaboratorNames = ref(''); + const previewIsFavorited = computed(() => favoriteIdMap.value.has(previewListId.value)); + const userStore = useUserStore(); const currentUserSecurityLevel = ref(3); @@ -531,6 +554,21 @@ } } + function onPreviewList(list: TaskList) { + previewListId.value = list.id; + previewListName.value = list.name; + previewSecretLevel.value = (list as any).secretLevel || 1; + previewSecretText.value = (list as any).secretText || '非密'; + previewCollaboratorNames.value = list.collaboratorNames || ''; + previewModalVisible.value = true; + } + + function onPreviewTaskClick(task: TaskItem, allPreviewTasks: TaskItem[]) { + currentDrawerTaskId.value = task.id; + const readOnly = false; + openDetailDrawer(true, { task, allTasks: allPreviewTasks, readOnly, secretLevel: previewSecretLevel.value || 1 }); + } + function onOpenCollaborator() { collaboratorTargetListId.value = ''; collaboratorModalRef.value?.open(currentListId.value); @@ -600,6 +638,11 @@ try { await addToFavorites({ taskListId, pid: pid || undefined }); await loadFavorites(); + if (previewModalVisible.value) { + previewModalVisible.value = false; + onListSelect(taskListId); + } + message.success('已添加收藏'); } catch (e) { console.error('[TaskList] 添加收藏失败', e); } @@ -1386,8 +1429,7 @@ await deleteTaskListApi({ id: listId }); } if (currentListId.value === listId) { - const firstAvailable = findFirstAvailableList(); - currentListId.value = firstAvailable?.id || ''; + onQuickAccessTabClick('all'); } await loadFavorites(); } catch (e) {