fix(缺陷管理): 缺陷详情评论相关BUG
This commit is contained in:
parent
01da2bf54e
commit
2ddfe47a39
|
@ -51,18 +51,18 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineModel, ref } from 'vue';
|
import {defineModel, ref} from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import MsAvatar from '@/components/pure/ms-avatar/index.vue';
|
import MsAvatar from '@/components/pure/ms-avatar/index.vue';
|
||||||
import MsIconfont from '@/components/pure/ms-icon-font/index.vue';
|
import MsIconfont from '@/components/pure/ms-icon-font/index.vue';
|
||||||
|
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import {useI18n} from '@/hooks/useI18n';
|
||||||
import useUserStore from '@/store/modules/user/index';
|
import useUserStore from '@/store/modules/user/index';
|
||||||
|
|
||||||
import { CommentItem } from './types';
|
import {CommentItem} from './types';
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
defineOptions({ name: 'MsCommentItem' });
|
defineOptions({ name: 'MsCommentItem' });
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
import Item from './comment-item.vue';
|
import Item from './comment-item.vue';
|
||||||
import CommentInput from './input.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';
|
import message from '@arco-design/web-vue/es/message';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -45,18 +45,22 @@ export default defineComponent({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePublish = (content: string, item: CommentItem) => {
|
const handlePublish = (content: string, item: CommentItem) => {
|
||||||
// 这个组件里的都是回复和编辑不涉及新增,所以是 COMMENT 或 REPLAY
|
// 这个组件里的都是回复和编辑不涉及新增,所以是 COMMENT 或 REPLY
|
||||||
let parentId = '';
|
let parentId = '';
|
||||||
|
let event: CommentEvent = 'COMMENT';
|
||||||
if (currentItem.commentType === 'REPLY') {
|
if (currentItem.commentType === 'REPLY') {
|
||||||
parentId = item.id;
|
parentId = item.id;
|
||||||
|
event = 'REPLY';
|
||||||
} else if (currentItem.commentType === 'EDIT') {
|
} else if (currentItem.commentType === 'EDIT') {
|
||||||
parentId = item.parentId || '';
|
parentId = item.parentId || '';
|
||||||
|
if (noticeUserIds.value.length > 0) {
|
||||||
|
event = 'AT';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const params: CommentParams = {
|
const params: CommentParams = {
|
||||||
id: currentItem.id,
|
|
||||||
bugId: item.bugId,
|
bugId: item.bugId,
|
||||||
content,
|
content,
|
||||||
event: noticeUserIds.value.length > 0 ? 'REPLAY' : 'COMMENT',
|
event,
|
||||||
commentType: currentItem.commentType,
|
commentType: currentItem.commentType,
|
||||||
fetchType: currentItem.commentType === 'EDIT' ? 'UPDATE' : 'ADD',
|
fetchType: currentItem.commentType === 'EDIT' ? 'UPDATE' : 'ADD',
|
||||||
notifier: noticeUserIds.value.join(';'),
|
notifier: noticeUserIds.value.join(';'),
|
||||||
|
|
|
@ -20,7 +20,7 @@ export interface CommentItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 仅评论: ’COMMENT‘; 评论并@: ’AT‘; 回复评论/回复并@: ’REPLAY‘;)
|
// 仅评论: ’COMMENT‘; 评论并@: ’AT‘; 回复评论/回复并@: ’REPLAY‘;)
|
||||||
export type CommentEvent = 'COMMENT' | 'AT' | 'REPLAY';
|
export type CommentEvent = 'COMMENT' | 'AT' | 'REPLY';
|
||||||
// 评论请求的时候是编辑还是新增
|
// 评论请求的时候是编辑还是新增
|
||||||
export type FetchType = 'ADD' | 'UPDATE';
|
export type FetchType = 'ADD' | 'UPDATE';
|
||||||
export type CommentType = 'REPLY' | 'EDIT' | 'ADD';
|
export type CommentType = 'REPLY' | 'EDIT' | 'ADD';
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import MsComment from '@/components/business/ms-comment';
|
import MsComment from '@/components/business/ms-comment';
|
||||||
import { CommentItem, CommentParams } from '@/components/business/ms-comment/types';
|
import {CommentItem, CommentParams} from '@/components/business/ms-comment/types';
|
||||||
|
|
||||||
import { createOrUpdateComment, deleteComment, getCommentList } from '@/api/modules/bug-management/index';
|
import {createOrUpdateComment, deleteComment, getCommentList} from '@/api/modules/bug-management/index';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import {useI18n} from '@/hooks/useI18n';
|
||||||
import useModal from '@/hooks/useModal';
|
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<{
|
const props = defineProps<{
|
||||||
bugId: string;
|
bugId: string;
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = async (bugid: string) => {
|
const handleDelete = async (commentId: string) => {
|
||||||
openModal({
|
openModal({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: t('ms.comment.deleteConfirm'),
|
title: t('ms.comment.deleteConfirm'),
|
||||||
|
@ -42,9 +42,9 @@
|
||||||
},
|
},
|
||||||
onBeforeOk: async () => {
|
onBeforeOk: async () => {
|
||||||
try {
|
try {
|
||||||
await deleteComment(bugid);
|
await deleteComment(commentId);
|
||||||
message.success(t('common.deleteSuccess'));
|
message.success(t('common.deleteSuccess'));
|
||||||
initData(bugid);
|
initData(props.bugId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(t('common.deleteFail'));
|
message.error(t('common.deleteFail'));
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
Loading…
Reference in New Issue