fix(缺陷管理): 缺陷详情评论相关BUG

This commit is contained in:
song-cc-rock 2024-02-22 21:30:12 +08:00 committed by 刘瑞斌
parent 01da2bf54e
commit 2ddfe47a39
4 changed files with 28 additions and 24 deletions

View File

@ -5,7 +5,7 @@ import CommentInput from './input.vue';
import {useI18n} from '@/hooks/useI18n';
import { CommentItem, CommentParams, CommentType } from './types';
import {CommentEvent, CommentItem, CommentParams, CommentType} from './types';
import message from '@arco-design/web-vue/es/message';
export default defineComponent({
@ -45,18 +45,22 @@ export default defineComponent({
};
const handlePublish = (content: string, item: CommentItem) => {
// 这个组件里的都是回复和编辑不涉及新增,所以是 COMMENT 或 REPLAY
// 这个组件里的都是回复和编辑不涉及新增,所以是 COMMENT 或 REPLY
let parentId = '';
let event: CommentEvent = 'COMMENT';
if (currentItem.commentType === 'REPLY') {
parentId = item.id;
event = 'REPLY';
} else if (currentItem.commentType === 'EDIT') {
parentId = item.parentId || '';
if (noticeUserIds.value.length > 0) {
event = 'AT';
}
}
const params: CommentParams = {
id: currentItem.id,
bugId: item.bugId,
content,
event: noticeUserIds.value.length > 0 ? 'REPLAY' : 'COMMENT',
event,
commentType: currentItem.commentType,
fetchType: currentItem.commentType === 'EDIT' ? 'UPDATE' : 'ADD',
notifier: noticeUserIds.value.join(';'),

View File

@ -20,7 +20,7 @@ export interface CommentItem {
}
// 仅评论: COMMENT; 评论并@: AT; 回复评论/回复并@: REPLAY;)
export type CommentEvent = 'COMMENT' | 'AT' | 'REPLAY';
export type CommentEvent = 'COMMENT' | 'AT' | 'REPLY';
// 评论请求的时候是编辑还是新增
export type FetchType = 'ADD' | 'UPDATE';
export type CommentType = 'REPLY' | 'EDIT' | 'ADD';

View File

@ -30,7 +30,7 @@
}
};
const handleDelete = async (bugid: string) => {
const handleDelete = async (commentId: string) => {
openModal({
type: 'error',
title: t('ms.comment.deleteConfirm'),
@ -42,9 +42,9 @@
},
onBeforeOk: async () => {
try {
await deleteComment(bugid);
await deleteComment(commentId);
message.success(t('common.deleteSuccess'));
initData(bugid);
initData(props.bugId);
} catch (error) {
message.error(t('common.deleteFail'));
// eslint-disable-next-line no-console