diff --git a/src/views/personal-center/my-item/index.vue b/src/views/personal-center/my-item/index.vue index 74736d4..73a7295 100644 --- a/src/views/personal-center/my-item/index.vue +++ b/src/views/personal-center/my-item/index.vue @@ -255,9 +255,9 @@ function openView(row: Api.PersonalItem.PersonalItem) { function buildRowActions(row: Api.PersonalItem.PersonalItem): PersonalItemRowAction[] { currentStatusItem.value = row; + const isCompleted = row.statusCode === 'completed'; const rawLifecycleActions = [...(row.availableActions ?? [])]; const pauseAction = rawLifecycleActions.find(action => action.actionCode === 'pause') ?? null; - const cancelAction = rawLifecycleActions.find(action => action.actionCode === 'cancel') ?? null; const completeAction = rawLifecycleActions.find(action => action.actionCode === 'complete') ?? null; const lifecycleActions = rawLifecycleActions @@ -292,26 +292,30 @@ function buildRowActions(row: Api.PersonalItem.PersonalItem): PersonalItemRowAct openOperateDialog(); } }, - { - key: 'delete', - tooltip: '删除', - icon: markRaw(IconMdiDeleteOutline), - type: 'danger', - onClick: async () => handleDelete(row) - }, - { - key: 'status-pause', - tooltip: pauseAction?.actionName ?? '暂停', - icon: markRaw(IconMdiPause), - type: 'warning', - disabled: !pauseAction, - onClick: async () => - handleStatusAction(row, { - actionCode: pauseAction?.actionCode ?? 'pause', - actionName: pauseAction?.actionName ?? '暂停', - needReason: pauseAction?.needReason ?? false - }) - }, + ...(!isCompleted + ? ([ + { + key: 'delete', + tooltip: '删除', + icon: markRaw(IconMdiDeleteOutline), + type: 'danger', + onClick: async () => handleDelete(row) + }, + { + key: 'status-pause', + tooltip: pauseAction?.actionName ?? '暂停', + icon: markRaw(IconMdiPause), + type: 'warning', + disabled: !pauseAction, + onClick: async () => + handleStatusAction(row, { + actionCode: pauseAction?.actionCode ?? 'pause', + actionName: pauseAction?.actionName ?? '暂停', + needReason: pauseAction?.needReason ?? false + }) + } + ] satisfies PersonalItemRowAction[]) + : []), // { // key: 'status-cancel', // tooltip: cancelAction?.actionName ?? '取消', @@ -326,19 +330,23 @@ function buildRowActions(row: Api.PersonalItem.PersonalItem): PersonalItemRowAct // }) // }, ...lifecycleActions, - { - key: 'status-complete', - tooltip: completeAction?.actionName ?? '完成', - icon: markRaw(IconMdiCheckCircleOutline), - type: 'success', - disabled: !completeAction, - onClick: async () => - handleStatusAction(row, { - actionCode: completeAction?.actionCode ?? 'complete', - actionName: completeAction?.actionName ?? '完成', - needReason: completeAction?.needReason ?? false - }) - } + ...(!isCompleted + ? ([ + { + key: 'status-complete', + tooltip: completeAction?.actionName ?? '完成', + icon: markRaw(IconMdiCheckCircleOutline), + type: 'success', + disabled: !completeAction, + onClick: async () => + handleStatusAction(row, { + actionCode: completeAction?.actionCode ?? 'complete', + actionName: completeAction?.actionName ?? '完成', + needReason: completeAction?.needReason ?? false + }) + } + ] satisfies PersonalItemRowAction[]) + : []) ]; } @@ -452,7 +460,7 @@ async function handleStatusActionSubmit(reason: string | null) { async function handleDelete(row: Api.PersonalItem.PersonalItem) { try { - await ElMessageBox.confirm(`确定删除个人事项“${row.taskTitle}”吗?`, '删除确认', { + await ElMessageBox.confirm(`确定删除我的事项“${row.taskTitle}”吗?`, '删除确认', { type: 'warning', confirmButtonText: '确定', cancelButtonText: '取消' @@ -473,12 +481,12 @@ async function handleDelete(row: Api.PersonalItem.PersonalItem) { async function handleBatchDelete() { if (!checkedRowIds.value.length) { - window.$message?.warning('请先选择个人事项'); + window.$message?.warning('请先选择我的事项'); return; } try { - await ElMessageBox.confirm(`确定删除选中的 ${selectedCount.value} 条个人事项吗?`, '删除确认', { + await ElMessageBox.confirm(`确定删除选中的 ${selectedCount.value} 条我的事项吗?`, '删除确认', { type: 'warning', confirmButtonText: '确定', cancelButtonText: '取消' @@ -500,7 +508,7 @@ async function handleBatchDelete() { function handleOpenBindExecution() { if (!checkedRowIds.value.length) { - window.$message?.warning('请先选择个人事项'); + window.$message?.warning('请先选择我的事项'); return; } @@ -541,7 +549,7 @@ onActivated(() => {