czh-20260701-优化未收藏的计划的显示

This commit is contained in:
zhihao
2026-07-01 10:44:33 +08:00
parent b8d7e31de8
commit 20bf8acf5a
4 changed files with 1123 additions and 16 deletions
+44 -2
View File
@@ -59,6 +59,7 @@
@create-list="onCreateListModal('')"
@load-more="onLoadMoreListViews"
@search-keyword="onSearchKeywordChange"
@preview-list="onPreviewList"
/>
<TaskFlatView
v-else
@@ -103,6 +104,19 @@
@move-task="onMoveTask"
/>
<CollaboratorModal ref="collaboratorModalRef" :task-list-id="collaboratorTargetListId || currentListId" :secret-level="collaboratorTargetList ? collaboratorTargetList.secretLevel || 1 : currentList?.secretLevel || 1" @changed="onCollaboratorsChanged" />
<PlanPreviewModal
:visible="previewModalVisible"
:list-id="previewListId"
:list-name="previewListName"
:secret-level="previewSecretLevel"
:secret-text="previewSecretText"
:collaborator-names="previewCollaboratorNames"
:is-favorited="previewIsFavorited"
@update:visible="(v) => (previewModalVisible = v)"
@add-to-favorites="onAddToFavorites"
@remove-from-favorites="onRemoveFavorite"
@task-click="onPreviewTaskClick"
/>
</div>
</template>
@@ -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<Record<string, string>>({});
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<number>(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) {