feat(功能用例): 用例评审脑图-模块操作
This commit is contained in:
parent
106156a51f
commit
2de9d0534d
|
@ -11,13 +11,12 @@
|
|||
:can-show-more-menu="canShowFloatMenu"
|
||||
:can-show-enter-node="canShowEnterNode"
|
||||
:can-show-more-menu-node-operation="false"
|
||||
:more-menu-other-operation-list="canShowEnterNode ? [] : moreMenuOtherOperationList"
|
||||
:more-menu-other-operation-list="canShowFloatMenu ? moreMenuOtherOperationList : []"
|
||||
disabled
|
||||
@node-select="handleNodeSelect"
|
||||
@before-exec-command="handleBeforeExecCommand"
|
||||
>
|
||||
<template #extractMenu>
|
||||
<template v-if="showCaseMenu">
|
||||
<!-- 评审 查看详情 -->
|
||||
<a-trigger
|
||||
v-if="hasAnyPermission(['CASE_REVIEW:READ+REVIEW']) && isReviewer"
|
||||
|
@ -42,14 +41,15 @@
|
|||
<div class="w-[440px] rounded bg-white p-[16px] shadow-[0_0_10px_rgba(0,0,0,0.05)]">
|
||||
<ReviewSubmit
|
||||
:review-pass-rule="reviewPassRule"
|
||||
:case-id="selectCaseId"
|
||||
:select-node="selectNode"
|
||||
:user-id="props.viewFlag ? userStore.id || '' : ''"
|
||||
:review-id="route.query.id as string"
|
||||
@done="handleReviewDone"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</a-trigger>
|
||||
<a-tooltip :content="t('common.detail')">
|
||||
<a-tooltip v-if="canShowDetail" :content="t('common.detail')">
|
||||
<MsButton
|
||||
type="icon"
|
||||
:class="[
|
||||
|
@ -62,7 +62,6 @@
|
|||
</MsButton>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</template>
|
||||
<template #extractTabContent>
|
||||
<MsDescription
|
||||
v-if="activeExtraKey === 'baseInfo'"
|
||||
|
@ -169,7 +168,7 @@
|
|||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'operation', type: string, data: MinderJsonNodeData): void;
|
||||
(e: 'operation', type: string, node: MinderJsonNode): void;
|
||||
(e: 'handleReviewDone'): void;
|
||||
}>();
|
||||
|
||||
|
@ -519,16 +518,16 @@
|
|||
const isReviewer = ref(false); // 是否是此用例的评审人
|
||||
const caseReviewerList = ref<CaseReviewFunctionalCaseUserItem[]>([]);
|
||||
const canShowEnterNode = ref(false);
|
||||
const showCaseMenu = ref(false);
|
||||
const canShowDetail = ref(false);
|
||||
const moreMenuOtherOperationList = ref();
|
||||
function setMoreMenuOtherOperationList(data: MinderJsonNodeData) {
|
||||
function setMoreMenuOtherOperationList(node: MinderJsonNode) {
|
||||
moreMenuOtherOperationList.value = [
|
||||
{
|
||||
value: 'changeReviewer',
|
||||
label: t('caseManagement.caseReview.changeReviewer'),
|
||||
permission: ['CASE_REVIEW:READ+UPDATE'],
|
||||
onClick: () => {
|
||||
emit('operation', 'changeReviewer', data);
|
||||
emit('operation', 'changeReviewer', node);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -536,7 +535,7 @@
|
|||
label: t('caseManagement.caseReview.reReview'),
|
||||
permission: ['CASE_REVIEW:READ+UPDATE'],
|
||||
onClick: () => {
|
||||
emit('operation', 'reReview', data);
|
||||
emit('operation', 'reReview', node);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -544,31 +543,16 @@
|
|||
label: t('caseManagement.caseReview.disassociate'),
|
||||
permission: ['CASE_REVIEW:READ+RELEVANCE'],
|
||||
onClick: () => {
|
||||
emit('operation', 'disassociate', data);
|
||||
emit('operation', 'disassociate', node);
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const selectCaseId = ref('');
|
||||
const selectNode = ref();
|
||||
const reviewVisible = ref(false);
|
||||
function handleReviewDone(status: ReviewResultStatus) {
|
||||
function handleReviewDone() {
|
||||
reviewVisible.value = false;
|
||||
let origin = window.minder.queryCommandValue('resource');
|
||||
if (origin[0] !== caseTag) {
|
||||
origin[0] = statusTagMap[status];
|
||||
} else {
|
||||
origin = [statusTagMap[status], ...origin];
|
||||
}
|
||||
window.minder.execCommand('resource', origin);
|
||||
minderStore.dispatchEvent(
|
||||
MinderEventName.SET_TAG,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
window.minder.getSelectedNodes()
|
||||
);
|
||||
setPriorityView(true, 'P');
|
||||
emit('handleReviewDone');
|
||||
}
|
||||
|
||||
|
@ -594,27 +578,34 @@
|
|||
setPriorityView(true, 'P');
|
||||
return;
|
||||
}
|
||||
// 展示浮动菜单: 模块节点有子节点且非根节点、用例节点
|
||||
selectNode.value = node;
|
||||
|
||||
// 展示浮动菜单: 模块节点有子节点、用例节点
|
||||
if (
|
||||
node.data?.resource?.includes(caseTag) ||
|
||||
(node.data?.resource?.includes(moduleTag) && node.type !== 'root' && (node.children || []).length > 0)
|
||||
(node.data?.resource?.includes(moduleTag) && (node.children || []).length > 0)
|
||||
) {
|
||||
canShowFloatMenu.value = true;
|
||||
setMoreMenuOtherOperationList(node);
|
||||
} else {
|
||||
canShowFloatMenu.value = false;
|
||||
}
|
||||
|
||||
// 展示进入节点菜单: 模块节点
|
||||
if (data?.resource?.includes(moduleTag)) {
|
||||
if (data?.resource?.includes(moduleTag) && (node.children || []).length > 0 && node.type !== 'root') {
|
||||
canShowEnterNode.value = true;
|
||||
} else {
|
||||
canShowEnterNode.value = false;
|
||||
}
|
||||
|
||||
if (data?.resource?.includes(moduleTag) && (node.children || []).length > 0) {
|
||||
isReviewer.value = true;
|
||||
} else {
|
||||
isReviewer.value = false;
|
||||
}
|
||||
|
||||
if (data?.resource?.includes(caseTag)) {
|
||||
showCaseMenu.value = true;
|
||||
selectCaseId.value = node.data?.caseId ?? '';
|
||||
setMoreMenuOtherOperationList(node.data as MinderJsonNodeData);
|
||||
canShowDetail.value = true;
|
||||
setIsReviewer(node.data);
|
||||
if (extraVisible.value) {
|
||||
toggleDetail(true);
|
||||
|
@ -622,11 +613,11 @@
|
|||
} else if (data?.resource?.includes(moduleTag) && data.count > 0 && data.isLoaded !== true) {
|
||||
// 模块节点且有用例且未加载过用例数据
|
||||
await initNodeCases(node);
|
||||
showCaseMenu.value = false;
|
||||
extraVisible.value = false;
|
||||
canShowDetail.value = false;
|
||||
} else {
|
||||
showCaseMenu.value = false;
|
||||
extraVisible.value = false;
|
||||
canShowDetail.value = false;
|
||||
resetExtractInfo();
|
||||
removeFakeNode(node, 'fakeNode');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
import type { MinderJsonNode } from '@/components/pure/ms-minder-editor/props';
|
||||
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { mapTree } from '@/utils';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
export function getMinderOffspringIds(node: MinderJsonNode) {
|
||||
const offspringIds: string[] = [];
|
||||
mapTree(node.children || [], (e) => {
|
||||
if (e.data.resource?.includes(t('common.module')) && e.data.id !== 'fakeNode') {
|
||||
offspringIds.push(e.data.id);
|
||||
}
|
||||
return e;
|
||||
});
|
||||
return offspringIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取脑图操作的参数
|
||||
* @param node 选中节点
|
||||
*/
|
||||
export function getMinderOperationParams(node: MinderJsonNode) {
|
||||
if (node.data?.resource?.includes(t('common.module'))) {
|
||||
return {
|
||||
selectIds: [],
|
||||
selectAll: true,
|
||||
condition: {},
|
||||
moduleIds: node.data?.id === 'NONE' ? [] : [node.data?.id, ...getMinderOffspringIds(node)],
|
||||
};
|
||||
}
|
||||
return {
|
||||
selectIds: [node.data?.caseId],
|
||||
selectAll: false,
|
||||
condition: {},
|
||||
};
|
||||
}
|
|
@ -143,7 +143,7 @@
|
|||
:review-progress="props.reviewProgress"
|
||||
:review-pass-rule="props.reviewPassRule"
|
||||
@operation="handleMinderOperation"
|
||||
@handle-review-done="emitRefresh"
|
||||
@handle-review-done="handleReviewDone"
|
||||
/>
|
||||
</div>
|
||||
<a-modal
|
||||
|
@ -303,7 +303,7 @@
|
|||
import { FilterFormItem, FilterResult, FilterType } from '@/components/pure/ms-advance-filter/type';
|
||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
|
||||
import type { MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props';
|
||||
import type { MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props';
|
||||
import MsPopconfirm from '@/components/pure/ms-popconfirm/index.vue';
|
||||
import MsRichText from '@/components/pure/ms-rich-text/MsRichText.vue';
|
||||
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
||||
|
@ -313,6 +313,7 @@
|
|||
import { MsFileItem } from '@/components/pure/ms-upload/types';
|
||||
import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue';
|
||||
import MsCaseReviewMinder from '@/components/business/ms-minders/caseReviewMinder/index.vue';
|
||||
import { getMinderOperationParams } from '@/components/business/ms-minders/caseReviewMinder/utils';
|
||||
import MsSelect from '@/components/business/ms-select';
|
||||
|
||||
import {
|
||||
|
@ -367,7 +368,8 @@
|
|||
const { t } = useI18n();
|
||||
const { openModal } = useModal();
|
||||
|
||||
const minderSelectData = ref(); // 当前脑图选中的数据
|
||||
const minderSelectData = ref<MinderJsonNodeData>(); // 当前脑图选中的数据
|
||||
const minderParams = ref();
|
||||
const keyword = ref('');
|
||||
const filterRowCount = ref(0);
|
||||
const filterConfigList = ref<FilterFormItem[]>([]);
|
||||
|
@ -725,11 +727,7 @@
|
|||
...batchParams.value,
|
||||
...tableParams.value,
|
||||
}
|
||||
: {
|
||||
selectIds: [minderSelectData.value.id],
|
||||
selectAll: false,
|
||||
condition: {},
|
||||
}),
|
||||
: minderParams.value),
|
||||
});
|
||||
Message.success(t('common.updateSuccess'));
|
||||
dialogLoading.value = false;
|
||||
|
@ -786,11 +784,7 @@
|
|||
...batchParams.value,
|
||||
...tableParams.value,
|
||||
}
|
||||
: {
|
||||
selectIds: [minderSelectData.value.id],
|
||||
selectAll: false,
|
||||
condition: {},
|
||||
}),
|
||||
: minderParams.value),
|
||||
});
|
||||
Message.success(t('common.updateSuccess'));
|
||||
dialogVisible.value = false;
|
||||
|
@ -822,11 +816,7 @@
|
|||
...tableParams.value,
|
||||
selectIds: batchParams.value.selectIds.length > 0 ? batchParams.value.selectIds : [record.id],
|
||||
}
|
||||
: {
|
||||
selectIds: [minderSelectData.value.id],
|
||||
selectAll: false,
|
||||
condition: {},
|
||||
}),
|
||||
: minderParams.value),
|
||||
});
|
||||
Message.success(t('common.updateSuccess'));
|
||||
dialogVisible.value = false;
|
||||
|
@ -927,11 +917,17 @@
|
|||
}
|
||||
|
||||
// 脑图操作
|
||||
function handleMinderOperation(type: string, data: MinderJsonNodeData) {
|
||||
minderSelectData.value = data;
|
||||
function handleMinderOperation(type: string, node: MinderJsonNode) {
|
||||
minderSelectData.value = node.data;
|
||||
minderParams.value = getMinderOperationParams(node);
|
||||
handleOperation(type);
|
||||
}
|
||||
|
||||
function handleReviewDone() {
|
||||
refresh(false);
|
||||
emitRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理表格选中后批量操作
|
||||
* @param event 批量操作事件对象
|
||||
|
|
|
@ -34,23 +34,31 @@
|
|||
import { useEventListener } from '@vueuse/core';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
|
||||
import type { MinderJsonNode } from '@/components/pure/ms-minder-editor/props';
|
||||
import { getMinderOperationParams } from '@/components/business/ms-minders/caseReviewMinder/utils';
|
||||
import ReviewForm from './reviewFormRichText.vue';
|
||||
|
||||
import { saveCaseReviewResult } from '@/api/modules/case-management/caseReview';
|
||||
import { batchReview } from '@/api/modules/case-management/caseReview';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
|
||||
import { ReviewFormParams, ReviewPassRule, ReviewResult } from '@/models/caseManagement/caseReview';
|
||||
import {
|
||||
BatchReviewCaseParams,
|
||||
ReviewFormParams,
|
||||
ReviewPassRule,
|
||||
ReviewResult,
|
||||
} from '@/models/caseManagement/caseReview';
|
||||
import { StartReviewStatus } from '@/enums/caseEnum';
|
||||
|
||||
const props = defineProps<{
|
||||
caseId: string;
|
||||
selectNode: MinderJsonNode;
|
||||
reviewPassRule: ReviewPassRule;
|
||||
reviewId: string;
|
||||
userId: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', status: ReviewResult): void;
|
||||
(e: 'done'): void;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -84,7 +92,7 @@
|
|||
});
|
||||
|
||||
watch(
|
||||
() => props.caseId,
|
||||
() => props.selectNode.data?.caseId,
|
||||
() => {
|
||||
form.value = { ...defaultForm };
|
||||
}
|
||||
|
@ -94,18 +102,19 @@
|
|||
async function submit() {
|
||||
try {
|
||||
submitLoading.value = true;
|
||||
const params = {
|
||||
const params: BatchReviewCaseParams = {
|
||||
projectId: appStore.currentProjectId,
|
||||
caseId: props.caseId,
|
||||
userId: props.userId,
|
||||
reviewId: props.reviewId,
|
||||
reviewPassRule: props.reviewPassRule,
|
||||
...form.value,
|
||||
notifier: form.value.notifiers?.join(';') ?? '',
|
||||
...getMinderOperationParams(props.selectNode),
|
||||
};
|
||||
await saveCaseReviewResult(params);
|
||||
await batchReview(params);
|
||||
modalVisible.value = false;
|
||||
Message.success(t('caseManagement.caseReview.reviewSuccess'));
|
||||
emit('done', form.value.status);
|
||||
emit('done');
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
|
Loading…
Reference in New Issue