From 1b23dbac6f1322bc1cefffc5ee0c71416b6d3e12 Mon Sep 17 00:00:00 2001 From: xiaozzzi <42293085+xiaozzzi@users.noreply.github.com> Date: Mon, 8 Apr 2024 00:49:37 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E5=BE=85=E5=8A=9E=E4=BA=8B=E9=A1=B9?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/server/todo/TodoService.java | 6 +- .../renderer/src/views/todo/TaskProgress.vue | 4 - .../src/renderer/src/views/todo/TodoIndex.vue | 78 ++++++++++++------- 3 files changed, 55 insertions(+), 33 deletions(-) diff --git a/blossom-backend/backend/src/main/java/com/blossom/backend/server/todo/TodoService.java b/blossom-backend/backend/src/main/java/com/blossom/backend/server/todo/TodoService.java index 20e3faa..dd6f55b 100644 --- a/blossom-backend/backend/src/main/java/com/blossom/backend/server/todo/TodoService.java +++ b/blossom-backend/backend/src/main/java/com/blossom/backend/server/todo/TodoService.java @@ -43,8 +43,11 @@ public class TodoService extends ServiceImpl { TodoGroupRes res = TodoGroupRes.build(); Map> map = todos.stream().collect(Collectors.groupingBy(TodoEntity::getTodoId)); + + // 遍历每个待办事项的所有任务 map.forEach((todoId, data) -> { TodoGroupRes.TodoGroup group = data.get(0).to(TodoGroupRes.TodoGroup.class); + // 根据状态分组 Map> taskStatusMap = data.stream().collect(Collectors.groupingBy(TodoEntity::getTaskStatus)); int w = 0, p = 0, c = 0; if (CollUtil.isNotEmpty(taskStatusMap.get(TaskStatusEnum.WAITING.name()))) { @@ -56,7 +59,8 @@ public class TodoService extends ServiceImpl { if (CollUtil.isNotEmpty(taskStatusMap.get(TaskStatusEnum.COMPLETED.name()))) { c = taskStatusMap.get(TaskStatusEnum.COMPLETED.name()).get(0).getTaskCount(); } - group.setTaskCountStat(String.format("%d|%d|%d", w, p, c)); + group.setTaskCountStat(String.format("%d/%d/%d", w, p, c)); + group.setTaskCount(w + p + c); if (TodoTypeEnum.DAY.getType().equals(data.get(0).getTodoType())) { res.getTodoDays().put(group.getTodoId(), group); diff --git a/blossom-editor/src/renderer/src/views/todo/TaskProgress.vue b/blossom-editor/src/renderer/src/views/todo/TaskProgress.vue index 8721db4..8563534 100644 --- a/blossom-editor/src/renderer/src/views/todo/TaskProgress.vue +++ b/blossom-editor/src/renderer/src/views/todo/TaskProgress.vue @@ -654,10 +654,7 @@ const dragStart = (doms: any, e: DragEvent) => { e.preventDefault() return } - console.log('drag start') - e.dataTransfer!.setDragImage(img, 0, 0) - let ele = e!.target as Element let cloneNode = ele.cloneNode(true) as HTMLElement const targetRect = ele.getBoundingClientRect() @@ -673,7 +670,6 @@ const dragStart = (doms: any, e: DragEvent) => { // 拖拽事件 const onDrag = (e: any) => { - console.log('onDrag') if (cloneNode) { cloneNode.style.transform = `translate(${e.clientX - distLeft - targetRect.left}px, ${e.clientY - distTop - targetRect.top}px)` } diff --git a/blossom-editor/src/renderer/src/views/todo/TodoIndex.vue b/blossom-editor/src/renderer/src/views/todo/TodoIndex.vue index 8d1cc87..92e951e 100644 --- a/blossom-editor/src/renderer/src/views/todo/TodoIndex.vue +++ b/blossom-editor/src/renderer/src/views/todo/TodoIndex.vue @@ -2,7 +2,7 @@
-
+
@@ -29,10 +29,8 @@ -
- -
{{ phased.todoName }}
- {{ phased.taskCountStat }} + +
+ {{ phased.todoName }} +
+
{{ phased.taskCountStat }}
- + @blur="blurPhasedAddHandle">
新增计划
-
- {{ phased.todoName }} - {{ phased.taskCountStat }} +
{{ phased.taskCountStat }}
+
{{ phased.todoName }}
@@ -114,6 +112,7 @@ const selectDate = (val: CalendarDateType) => { const TaskProgressRef = ref() const TodoStatRef = ref() const activeName = ref('1') +// key:日期; value:当日的待办统计 const todoDayMaps = ref>(new Map()) const getTodos = () => { todosApi().then((resp) => { @@ -269,8 +268,9 @@ const blurPhasedUpdHandle = (todoId: string) => { inset -1px 3px 5px #dfdfdf, inset -1px -3px 5px #dfdfdf; height: calc(100% - #{$item-height}); - overflow-y: auto; - padding: 0 10px 0 20px; + padding: 0 5px 0 15px; + overflow-x: hidden; + overflow-y: scroll; [class='dark'] & { box-shadow: @@ -333,33 +333,54 @@ const blurPhasedUpdHandle = (todoId: string) => { } } - .task-day, .task-phased { - @include flex(row, flex-start, center); + @include box(220px, auto); + @include flex(row, flex-start, flex-start); @include font(13px, 300); + border: 1px solid var(--el-border-color); + min-height: 40px; flex-wrap: wrap; - padding: 1px 3px; - border-radius: 4px; + padding: 3px 5px; + margin-bottom: 10px; color: var(--bl-text-color); + border-radius: 3px; + position: relative; + overflow: hidden; + transition: + box-shadow 0.3s, + border-color 0.3s; cursor: pointer; &:hover { - background-color: var(--el-color-info-light-9); + @include themeShadow(0 0 9px #c0c0c0, 0 0 10px #000000); + border-color: var(--el-color-primary); + + .phased-stat { + background-color: var(--el-color-primary-light-8); + } } &:first-child { - margin-top: 5px; + margin-top: 15px; + } + + .phase-name { + line-height: 14px; word-break: break-all; } - &:last-child { - margin-bottom: 5px; + .phased-stat { + font-size: 11px; + line-height: 15px; + padding: 2px 10px 0 10px; + color: var(--bl-text-color-light); + background-color: var(--bl-bg-color); + border-top-left-radius: 3px; + position: absolute; + right: 0; + bottom: 0; + transition: background-color 0.1s; } - } - - .task-phased { - padding: 5px 3px; - @include flex(row, flex-start, flex-start); .task-count { padding: 0 5px; @@ -368,11 +389,12 @@ const blurPhasedUpdHandle = (todoId: string) => { } .task-phased-add { - @include themeBorder(1px, #b4b4b4, #515151, 'around', 6px, dashed); + @include themeBorder(1px, #b4b4b4, #515151, 'around', 3px, dashed); + width: 220px; padding: 1px 5px; margin: 10px 0; color: var(--bl-text-color-light); - transition: 0.3s; + transition: box-shadow 0.3s; text-align: center; cursor: pointer;