diff --git a/frontend/src/components/business/ms-comment/style.less b/frontend/src/components/business/ms-comment/style.less index 8a9d645ff5..d81b4acf05 100644 --- a/frontend/src/components/business/ms-comment/style.less +++ b/frontend/src/components/business/ms-comment/style.less @@ -31,3 +31,14 @@ list-style: decimal !important; } } +.ms-comment-list { + @apply h-full; + .ms-comment-list-item { + @apply flex; + + gap: 8px; + &:not(:last-child) { + margin-bottom: 16px; + } + } +} diff --git a/frontend/src/components/business/ms-minders/featureCaseMinder.vue b/frontend/src/components/business/ms-minders/featureCaseMinder.vue index 82674f7d7b..b8c5126522 100644 --- a/frontend/src/components/business/ms-minders/featureCaseMinder.vue +++ b/frontend/src/components/business/ms-minders/featureCaseMinder.vue @@ -61,7 +61,7 @@ {{ t('common.cancel') }} -
+
-
+
{{ @@ -175,21 +175,23 @@ @change="getAllCommentList" >
- - + +
-
+
{{ t('caseManagement.featureCase.linkDefect') }} - {{ t('caseManagement.featureCase.createDefect') }} + + {{ t('caseManagement.featureCase.createDefect') }} -
-
-
- {{ item.num }} - - {{ t('ms.add.attachment.cancelAssociate') }} - + + +
@@ -243,7 +258,7 @@ v-model:visible="showCreateBugDrawer" :case-id="activeCase.id" :extra-params="{ caseId: activeCase.id }" - @success="initBugList" + @success="loadBugList" /> 0 && data.isLoaded !== true) { - try { - loading.value = true; - const res = await getCaseMinder({ - projectId: appStore.currentProjectId, - moduleId: data.id, - }); - const fakeNode = node.children?.find((e) => e.data?.id === undefined); // 移除占位的虚拟节点 - if (fakeNode) { - window.minder.removeNode(fakeNode); - } - if ((!res || res.length === 0) && node.children?.length) { - // 如果模块下没有用例且有别的模块节点,正常展开 - node.expand(); - node.renderTree(); - window.minder.layout(); - return; - } - // TODO:递归渲染存在的子节点 - res.forEach((e) => { - // 用例节点 - const child = window.minder.createNode(e.data, node); - child.render(); - e.children?.forEach((item) => { - // 前置/步骤/备注节点 - const grandChild = window.minder.createNode(item.data, child); - grandChild.render(); - item.children?.forEach((subItem) => { - // 预期结果节点 - const greatGrandChild = window.minder.createNode(subItem.data, grandChild); - greatGrandChild.render(); - }); - }); - child.expand(); - child.renderTree(); - }); - node.expand(); - node.renderTree(); - window.minder.layout(); - if (node.data) { - node.data.isLoaded = true; - } - } catch (error) { - // eslint-disable-next-line no-console - console.log(error); - } finally { - loading.value = false; - } - } else { - extraVisible.value = false; - activeCase.value = {}; - } - } - onBeforeMount(() => { initDefaultFields(); }); @@ -1285,55 +1238,37 @@ } const bugList = ref([]); + const noMoreData = ref(false); + const pageNation = ref({ + total: 0, + pageSize: 10, + current: 1, + }); - async function initBugList() { - bugList.value = [ - { - name: 'sdasd', - id: '3d23d23d', - num: 100001, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100002, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100003, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100004, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100005, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100006, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100007, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100008, - }, - { - name: 'sdasd', - id: '3d23d23d', - num: 100009, - }, - ]; + async function loadBugList() { + try { + const res = await getLinkedCaseBugList({ + keyword: '', + projectId: appStore.currentProjectId, + caseId: activeCase.value.id, + current: pageNation.value.current || 1, + pageSize: pageNation.value.pageSize, + }); + res.list.forEach((item) => bugList.value.push(item)); + pageNation.value.total = res.total; + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } + } + + // 滚动翻页 + function handleReachBottom() { + pageNation.value.current += 1; + if (pageNation.value.current > Math.ceil(pageNation.value.total / pageNation.value.pageSize)) { + return; + } + loadBugList(); } const cancelLoading = ref(false); @@ -1378,7 +1313,7 @@ drawerLoading.value = true; await associatedDebug(params); Message.success(t('caseManagement.featureCase.associatedSuccess')); - initBugList(); + loadBugList(); showLinkBugDrawer.value = false; } catch (error) { // eslint-disable-next-line no-console @@ -1388,11 +1323,88 @@ } } + function resetExtractInfo() { + activeCase.value = {}; + pageNation.value.current = 1; + bugList.value = []; + commentList.value = []; + reviewCommentList.value = []; + fileList.value = []; + } + + /** + * 处理脑图节点激活/点击 + * @param node 被激活/点击的节点 + */ + async function handleNodeClick(node: MinderJsonNode) { + const { data } = node; + if (data?.resource && data.resource.includes(caseTag)) { + extraVisible.value = true; + activeExtraKey.value = 'baseInfo'; + resetExtractInfo(); + initCaseDetail(data); + } else if (data?.resource?.includes(moduleTag) && data.count > 0 && data.isLoaded !== true) { + try { + loading.value = true; + const res = await getCaseMinder({ + projectId: appStore.currentProjectId, + moduleId: data.id, + }); + const fakeNode = node.children?.find((e) => e.data?.id === undefined); // 移除占位的虚拟节点 + if (fakeNode) { + window.minder.removeNode(fakeNode); + } + if ((!res || res.length === 0) && node.children?.length) { + // 如果模块下没有用例且有别的模块节点,正常展开 + node.expand(); + node.renderTree(); + window.minder.layout(); + return; + } + // TODO:递归渲染存在的子节点 + res.forEach((e) => { + // 用例节点 + const child = window.minder.createNode(e.data, node); + child.render(); + e.children?.forEach((item) => { + // 前置/步骤/备注节点 + const grandChild = window.minder.createNode(item.data, child); + grandChild.render(); + item.children?.forEach((subItem) => { + // 预期结果节点 + const greatGrandChild = window.minder.createNode(subItem.data, grandChild); + greatGrandChild.render(); + }); + }); + child.expand(); + child.renderTree(); + }); + node.expand(); + node.renderTree(); + window.minder.layout(); + if (node.data) { + node.data.isLoaded = true; + } + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } finally { + loading.value = false; + } + } else { + extraVisible.value = false; + resetExtractInfo(); + } + } + watch( () => activeExtraKey.value, (val) => { if (val === 'comments') { getAllCommentList(); + } else if (val === 'bug') { + pageNation.value.current = 1; + loadBugList(); } } ); @@ -1408,29 +1420,27 @@ overflow-y: auto; height: calc(100% - 64px); } - .bug-list { + .bug-item { + @apply cursor-pointer; + &:not(:last-child) { + margin-bottom: 8px; + } + + padding: 8px; + border: 1px solid var(--color-text-n8); + border-radius: var(--border-radius-small); + background-color: white; + &:hover { + @apply relative; + + background: var(--color-text-n9); + box-shadow: inset 0 0 0.5px 0.5px rgb(var(--primary-5)); + } + } + .comment-container { .ms-scroll-bar(); overflow-y: auto; - margin-bottom: 16px; - height: calc(100% - 46px); - border-radius: var(--border-radius-small); - .bug-item { - @apply cursor-pointer; - &:not(:last-child) { - margin-bottom: 8px; - } - - padding: 8px; - border: 1px solid var(--color-text-n8); - border-radius: var(--border-radius-small); - background-color: white; - &:hover { - @apply relative; - - background: var(--color-text-n9); - box-shadow: inset 0 0 0.5px 0.5px rgb(var(--primary-5)); - } - } + height: calc(100% - 130px); } diff --git a/frontend/src/components/pure/ms-card/index.vue b/frontend/src/components/pure/ms-card/index.vue index ba9392f0ec..e2027b8321 100644 --- a/frontend/src/components/pure/ms-card/index.vue +++ b/frontend/src/components/pure/ms-card/index.vue @@ -1,12 +1,17 @@