fix(缺陷管理): 缺陷详情评论相关BUG
This commit is contained in:
parent
01da2bf54e
commit
2ddfe47a39
|
@ -51,18 +51,18 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineModel, ref } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import {defineModel, ref} from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import MsAvatar from '@/components/pure/ms-avatar/index.vue';
|
||||
import MsIconfont from '@/components/pure/ms-icon-font/index.vue';
|
||||
import MsAvatar from '@/components/pure/ms-avatar/index.vue';
|
||||
import MsIconfont from '@/components/pure/ms-icon-font/index.vue';
|
||||
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useUserStore from '@/store/modules/user/index';
|
||||
import {useI18n} from '@/hooks/useI18n';
|
||||
import useUserStore from '@/store/modules/user/index';
|
||||
|
||||
import { CommentItem } from './types';
|
||||
import {CommentItem} from './types';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userStore = useUserStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({ name: 'MsCommentItem' });
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
import Item from './comment-item.vue';
|
||||
import CommentInput from './input.vue';
|
||||
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
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(';'),
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MsComment from '@/components/business/ms-comment';
|
||||
import { CommentItem, CommentParams } from '@/components/business/ms-comment/types';
|
||||
import MsComment from '@/components/business/ms-comment';
|
||||
import {CommentItem, CommentParams} from '@/components/business/ms-comment/types';
|
||||
|
||||
import { createOrUpdateComment, deleteComment, getCommentList } from '@/api/modules/bug-management/index';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
import {createOrUpdateComment, deleteComment, getCommentList} from '@/api/modules/bug-management/index';
|
||||
import {useI18n} from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
|
||||
import message from '@arco-design/web-vue/es/message';
|
||||
import message from '@arco-design/web-vue/es/message';
|
||||
|
||||
const { openModal } = useModal();
|
||||
const { openModal } = useModal();
|
||||
|
||||
const props = defineProps<{
|
||||
bugId: string;
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue