feat(requirement): 优化需求标题列的交互体验
feat(project): 新增执行阶段需求选项获取接口 feat(membership): 优化项目负责人选项加载逻辑 fix(task): 优化任务操作按钮的显示逻辑 feat(todo): 优化待办任务截止时间显示
This commit is contained in:
@@ -1150,6 +1150,21 @@ export async function fetchGetProjectRequirementPage(params?: Api.Project.Projec
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取项目需求分页列表(排除了终止态的需求) */
|
||||||
|
export async function fetchGetExecutionRequirementOptions(params?: Api.Project.ProjectRequirementSearchParams) {
|
||||||
|
const result = await request<ProjectRequirementPageResponse>({
|
||||||
|
...safeJsonRequestConfig,
|
||||||
|
url: `${PROJECT_REQUIREMENT_PREFIX}/execution-options`,
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
|
||||||
|
return mapServiceResult(result as ServiceRequestResult<ProjectRequirementPageResponse>, data => ({
|
||||||
|
...data,
|
||||||
|
list: data.list.map(normalizeProjectRequirement)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取项目需求树形列表 */
|
/** 获取项目需求树形列表 */
|
||||||
export async function fetchGetProjectRequirementTree(params?: Api.Project.ProjectRequirementSearchParams) {
|
export async function fetchGetProjectRequirementTree(params?: Api.Project.ProjectRequirementSearchParams) {
|
||||||
const result = await request<ProjectRequirementPageResponse>({
|
const result = await request<ProjectRequirementPageResponse>({
|
||||||
|
|||||||
@@ -350,12 +350,24 @@ const columns = computed(() => [
|
|||||||
prop: 'title',
|
prop: 'title',
|
||||||
label: '需求名称',
|
label: '需求名称',
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
|
className: 'requirement-title-column',
|
||||||
formatter: (row: Api.Product.Requirement) => {
|
formatter: (row: Api.Product.Requirement) => {
|
||||||
return (
|
return (
|
||||||
<ElTooltip content={row.title} placement="top" show-after={300}>
|
<ElTooltip content={row.title} placement="top" show-after={300}>
|
||||||
<ElButton link type="primary" class="requirement-title" onClick={() => openView(row)}>
|
<span
|
||||||
|
class="requirement-title"
|
||||||
|
role="button"
|
||||||
|
tabindex={0}
|
||||||
|
onClick={() => openView(row)}
|
||||||
|
onKeydown={event => {
|
||||||
|
if (event.key === 'Enter' || event.key === ' ') {
|
||||||
|
event.preventDefault();
|
||||||
|
openView(row);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
{row.title}
|
{row.title}
|
||||||
</ElButton>
|
</span>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1035,14 +1047,29 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.requirement-title) {
|
:deep(.requirement-title) {
|
||||||
|
display: block;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-width: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
max-width: 180px;
|
color: var(--el-color-primary);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
height: auto;
|
vertical-align: middle;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.requirement-title-column .cell) {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.requirement-title:hover) {
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.requirement-title--terminal) {
|
:deep(.requirement-title--terminal) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { fetchGetProjectRequirementPage } from '@/service/api/project';
|
import { fetchGetExecutionRequirementOptions } from '@/service/api/project';
|
||||||
|
|
||||||
export interface ProjectRequirementTreeNode {
|
export interface ProjectRequirementTreeNode {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -32,10 +32,10 @@ export function useProjectRequirementOptions(projectId: () => string | null) {
|
|||||||
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const { data, error } = await fetchGetProjectRequirementPage({
|
const { data, error } = await fetchGetExecutionRequirementOptions({
|
||||||
projectId: id,
|
projectId: id,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 100
|
pageSize: -1
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error || !data?.list) {
|
if (error || !data?.list) {
|
||||||
@@ -86,6 +86,7 @@ export function useProjectRequirementOptions(projectId: () => string | null) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pruneEmptyChildren(roots);
|
pruneEmptyChildren(roots);
|
||||||
|
|
||||||
return roots;
|
return roots;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export interface TaskActionEmits {
|
|||||||
/**
|
/**
|
||||||
* 任务行操作按钮的集中装配。
|
* 任务行操作按钮的集中装配。
|
||||||
*
|
*
|
||||||
* 只在这里收口任务行按钮的最终显示口径,不改动底层子任务 / 父任务负责人 / 执行负责人那套权限体系:
|
* 这里只收口任务行按钮的最终显示口径,不改动底层子任务 / 父任务负责人 / 执行负责人那套权限体系:
|
||||||
* - 当前用户是任务负责人(task.ownerId): 显示 填报 / 编辑 / 删除
|
* - 当前用户是任务负责人(task.ownerId): 显示 填报 / 编辑 / 删除
|
||||||
* - 当前用户是协办人(task.assignees[].userId): 只显示 填报
|
* - 当前用户是协办人(task.assignees[].userId): 只显示 填报
|
||||||
* - 都不是: 也显示 填报
|
* - 都不是: 也显示 填报
|
||||||
@@ -37,6 +37,7 @@ export function useTaskActions(emits: TaskActionEmits) {
|
|||||||
function createActions(row: Api.Project.ProjectTask): TaskAction[] {
|
function createActions(row: Api.Project.ProjectTask): TaskAction[] {
|
||||||
const actions: TaskAction[] = [];
|
const actions: TaskAction[] = [];
|
||||||
const isOwner = Boolean(currentUserId.value) && row.ownerId === currentUserId.value;
|
const isOwner = Boolean(currentUserId.value) && row.ownerId === currentUserId.value;
|
||||||
|
const isCompleted = row.statusCode === 'completed';
|
||||||
|
|
||||||
actions.push({
|
actions.push({
|
||||||
key: 'report',
|
key: 'report',
|
||||||
@@ -50,7 +51,7 @@ export function useTaskActions(emits: TaskActionEmits) {
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row.statusCode !== 'completed') {
|
if (!isCompleted) {
|
||||||
actions.push({
|
actions.push({
|
||||||
key: 'edit',
|
key: 'edit',
|
||||||
tooltip: '编辑',
|
tooltip: '编辑',
|
||||||
@@ -58,7 +59,6 @@ export function useTaskActions(emits: TaskActionEmits) {
|
|||||||
type: 'primary',
|
type: 'primary',
|
||||||
onClick: () => emits.edit(row)
|
onClick: () => emits.edit(row)
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
actions.push({
|
actions.push({
|
||||||
key: 'delete',
|
key: 'delete',
|
||||||
@@ -67,6 +67,7 @@ export function useTaskActions(emits: TaskActionEmits) {
|
|||||||
type: 'danger',
|
type: 'danger',
|
||||||
onClick: () => emits.remove(row)
|
onClick: () => emits.remove(row)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
fetchCreateProjectTaskAssignee,
|
fetchCreateProjectTaskAssignee,
|
||||||
fetchDeleteProjectTask,
|
fetchDeleteProjectTask,
|
||||||
fetchGetProjectExecutionAssignees,
|
fetchGetProjectExecutionAssignees,
|
||||||
|
fetchGetProjectMembers,
|
||||||
fetchGetProjectTask,
|
fetchGetProjectTask,
|
||||||
fetchGetProjectTaskAssignees,
|
fetchGetProjectTaskAssignees,
|
||||||
fetchGetProjectTaskBoardPageCross,
|
fetchGetProjectTaskBoardPageCross,
|
||||||
@@ -667,11 +668,31 @@ async function refreshAssigneesAfterMutation() {
|
|||||||
|
|
||||||
async function loadExecutionAssigneeOptions(specificExecutionId?: string) {
|
async function loadExecutionAssigneeOptions(specificExecutionId?: string) {
|
||||||
const targetId = specificExecutionId || executionId.value;
|
const targetId = specificExecutionId || executionId.value;
|
||||||
if (!props.projectId || !targetId) {
|
|
||||||
|
if (!props.projectId) {
|
||||||
executionAssigneeOptions.value = [];
|
executionAssigneeOptions.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!targetId) {
|
||||||
|
const { error, data: members } = await fetchGetProjectMembers(props.projectId);
|
||||||
|
|
||||||
|
if (error || !members) {
|
||||||
|
executionAssigneeOptions.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
executionAssigneeOptions.value = members
|
||||||
|
.filter(item => item.status === 0)
|
||||||
|
.map(item => ({
|
||||||
|
id: item.userId,
|
||||||
|
nickname: item.userNickname || item.userId,
|
||||||
|
username: null,
|
||||||
|
deptName: item.roleName || item.roleCode || null
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { error, data: assignees } = await fetchGetProjectExecutionAssignees(props.projectId, targetId);
|
const { error, data: assignees } = await fetchGetProjectExecutionAssignees(props.projectId, targetId);
|
||||||
|
|
||||||
if (error || !assignees) {
|
if (error || !assignees) {
|
||||||
@@ -802,11 +823,7 @@ watch(
|
|||||||
// execution 锚定变化 → 拉/清"执行协办人选项"(操作弹层用),任务列表的重拉由 scopedExecutionIds watch 统一处理
|
// execution 锚定变化 → 拉/清"执行协办人选项"(操作弹层用),任务列表的重拉由 scopedExecutionIds watch 统一处理
|
||||||
watch(
|
watch(
|
||||||
() => props.execution?.id,
|
() => props.execution?.id,
|
||||||
async value => {
|
async () => {
|
||||||
if (!value) {
|
|
||||||
executionAssigneeOptions.value = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await loadExecutionAssigneeOptions();
|
await loadExecutionAssigneeOptions();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -832,9 +849,10 @@ watch(
|
|||||||
if (!canLoadAnyTasks.value) {
|
if (!canLoadAnyTasks.value) {
|
||||||
data.value = [];
|
data.value = [];
|
||||||
taskStatusBoard.value = null;
|
taskStatusBoard.value = null;
|
||||||
|
executionAssigneeOptions.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await Promise.all([getDataByPage(1), loadTaskStatusBoard()]);
|
await Promise.all([getDataByPage(1), loadTaskStatusBoard(), loadExecutionAssigneeOptions()]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -352,11 +352,23 @@ const columns = computed(() => [
|
|||||||
prop: 'title',
|
prop: 'title',
|
||||||
label: '需求名称',
|
label: '需求名称',
|
||||||
minWidth: 220,
|
minWidth: 220,
|
||||||
|
className: 'requirement-title-column',
|
||||||
formatter: (row: Api.Project.ProjectRequirement) => (
|
formatter: (row: Api.Project.ProjectRequirement) => (
|
||||||
<ElTooltip content={row.title} placement="top" show-after={300}>
|
<ElTooltip content={row.title} placement="top" show-after={300}>
|
||||||
<ElButton link type="primary" class="requirement-title" onClick={() => openView(row)}>
|
<span
|
||||||
|
class="requirement-title"
|
||||||
|
role="button"
|
||||||
|
tabindex={0}
|
||||||
|
onClick={() => openView(row)}
|
||||||
|
onKeydown={event => {
|
||||||
|
if (event.key === 'Enter' || event.key === ' ') {
|
||||||
|
event.preventDefault();
|
||||||
|
openView(row);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
{row.title}
|
{row.title}
|
||||||
</ElButton>
|
</span>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -1020,14 +1032,29 @@ Promise.all([loadStatusOptions()]);
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.requirement-title) {
|
:deep(.requirement-title) {
|
||||||
|
display: block;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-width: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
max-width: 200px;
|
color: var(--el-color-primary);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
height: auto;
|
vertical-align: middle;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.requirement-title-column .cell) {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.requirement-title:hover) {
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.requirement-table-card-body) {
|
:deep(.requirement-table-card-body) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Component, computed, markRaw, onActivated, ref, watch } from 'vue';
|
import { type Component, computed, markRaw, onActivated, ref, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
import type { RouteKey } from '@elegant-router/types';
|
import type { RouteKey } from '@elegant-router/types';
|
||||||
import { OBJECT_CONTEXT_QUERY_KEY } from '@/constants/object-context';
|
import { OBJECT_CONTEXT_QUERY_KEY } from '@/constants/object-context';
|
||||||
import { RDMS_REQ_PRIORITY_DICT_CODE } from '@/constants/dict';
|
import { RDMS_REQ_PRIORITY_DICT_CODE } from '@/constants/dict';
|
||||||
@@ -251,6 +252,16 @@ const TASK_ACTION_ICONS: Partial<Record<Api.Project.ProjectTaskActionCode, Compo
|
|||||||
cancel: markRaw(IconMdiCloseCircleOutline)
|
cancel: markRaw(IconMdiCloseCircleOutline)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function normalizeTaskTodoDeadline(deadline: string | null) {
|
||||||
|
if (!deadline) return null;
|
||||||
|
|
||||||
|
if (/^\d{4}-\d{2}-\d{2}$/.test(deadline)) {
|
||||||
|
return dayjs(deadline).endOf('day').format('YYYY-MM-DD HH:mm');
|
||||||
|
}
|
||||||
|
|
||||||
|
return deadline;
|
||||||
|
}
|
||||||
|
|
||||||
function getTaskActionButtonType(code: Api.Project.ProjectTaskActionCode) {
|
function getTaskActionButtonType(code: Api.Project.ProjectTaskActionCode) {
|
||||||
if (code === 'complete') return 'success' as const;
|
if (code === 'complete') return 'success' as const;
|
||||||
if (code === 'cancel') return 'danger' as const;
|
if (code === 'cancel') return 'danger' as const;
|
||||||
@@ -820,7 +831,7 @@ async function loadMyTaskItems() {
|
|||||||
category: 'task' as const,
|
category: 'task' as const,
|
||||||
title: task.taskTitle,
|
title: task.taskTitle,
|
||||||
createdTime: task.createTime,
|
createdTime: task.createTime,
|
||||||
deadline: task.plannedEndDate,
|
deadline: normalizeTaskTodoDeadline(task.plannedEndDate),
|
||||||
source: task.projectName,
|
source: task.projectName,
|
||||||
progressRate: task.progressRate,
|
progressRate: task.progressRate,
|
||||||
priority: mapTaskTodoPriority(task.priority),
|
priority: mapTaskTodoPriority(task.priority),
|
||||||
|
|||||||
Reference in New Issue
Block a user