refactor: 重构缺陷管理&用例管理详情页面展示

This commit is contained in:
xinxin.wu 2024-04-19 13:03:59 +08:00 committed by Craftsman
parent fec6cfce98
commit 12e3eae473
12 changed files with 256 additions and 316 deletions

View File

@ -222,8 +222,8 @@ export interface CaseModuleQueryParams extends TableQueryParams {
} }
export interface TabItemType { export interface TabItemType {
key: string; value: string;
title: string; label: string;
canHide: boolean; canHide: boolean;
isShow: boolean; isShow: boolean;
} }

View File

@ -96,14 +96,22 @@
:class="[ :class="[
`${ `${
activeTab === 'comment' && hasAnyPermission(['PROJECT_BUG:READ+COMMENT']) && !commentInputIsActive activeTab === 'comment' && hasAnyPermission(['PROJECT_BUG:READ+COMMENT']) && !commentInputIsActive
? 'h-[calc(100%-72px)]' ? 'h-[calc(100%-118px)]'
: commentInputIsActive : commentInputIsActive
? 'h-[calc(100%-286px)]' ? 'h-[calc(100%-338px)]'
: 'h-full' : 'h-full'
}`, }`,
'bg-white', 'bg-white',
]" ]"
> >
<div class="header relative h-[48px] pl-2">
<MsTab
v-model:active-key="activeTab"
:content-tab-list="contentTabList"
:get-text-func="getTabBadge"
class="no-content relative border-b"
/>
</div>
<MsSplitBox <MsSplitBox
expand-direction="right" expand-direction="right"
:size="0.8" :size="0.8"
@ -115,15 +123,7 @@
<template #first> <template #first>
<div class="leftWrapper h-full"> <div class="leftWrapper h-full">
<a-spin :loading="detailLoading" class="w-full"> <a-spin :loading="detailLoading" class="w-full">
<div class="header h-[50px]"> <div class="tab-pane-container p-4">
<MsTab
v-model:active-key="activeTab"
:content-tab-list="contentTabList"
:get-text-func="getTabBadge"
class="no-content relative mb-[8px]"
/>
</div>
<div class="tab-pane-container">
<BugDetailTab <BugDetailTab
v-if="activeTab === 'detail'" v-if="activeTab === 'detail'"
ref="bugDetailTabRef" ref="bugDetailTabRef"
@ -150,9 +150,9 @@
</div> </div>
</template> </template>
<template #second> <template #second>
<!-- <a-spin :loading="rightLoading" class="w-full"> --> <a-spin :loading="rightLoading" class="w-full">
<!-- 所属平台一致, 详情展示 --> <!-- 所属平台一致, 详情展示 -->
<div v-if="props.currentPlatform === detailInfo.platform" class="rightWrapper h-full p-[24px]"> <div v-if="props.currentPlatform === detailInfo.platform" class="rightWrapper h-full p-4">
<!-- 自定义字段开始 --> <!-- 自定义字段开始 -->
<div class="inline-block w-full break-words"> <div class="inline-block w-full break-words">
<a-skeleton v-if="rightLoading" class="w-full" :loading="rightLoading" :animation="true"> <a-skeleton v-if="rightLoading" class="w-full" :loading="rightLoading" :animation="true">
@ -208,7 +208,7 @@
<div v-else> <div v-else>
<a-empty> {{ $t('messageBox.noContent') }} </a-empty> <a-empty> {{ $t('messageBox.noContent') }} </a-empty>
</div> </div>
<!-- </a-spin> --> </a-spin>
</template> </template>
</MsSplitBox> </MsSplitBox>
</div> </div>

View File

@ -1,6 +1,5 @@
<template> <template>
<div class="p-4"> <div class="mb-4 flex items-center justify-between">
<div class="flex items-center justify-between">
<a-button type="primary" :disabled="!hasAnyPermission(['PROJECT_BUG:READ+UPDATE'])" @click="handleSelect">{{ <a-button type="primary" :disabled="!hasAnyPermission(['PROJECT_BUG:READ+UPDATE'])" @click="handleSelect">{{
t('caseManagement.featureCase.linkCase') t('caseManagement.featureCase.linkCase')
}}</a-button> }}</a-button>
@ -83,7 +82,6 @@
@save="saveHandler" @save="saveHandler"
> >
</MsCaseAssociate> </MsCaseAssociate>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 所属平台一致, 详情展示 --> <!-- 所属平台一致, 详情展示 -->
<div v-if="props.currentPlatform === props.detailInfo.platform" class="relative p-[16px] pb-[16px]"> <div v-if="props.currentPlatform === props.detailInfo.platform" class="relative">
<div class="header"> <div class="header">
<div v-permission="['PROJECT_BUG:READ+UPDATE']" class="header-action"> <div v-permission="['PROJECT_BUG:READ+UPDATE']" class="header-action">
<a-button type="text" @click="contentEditAble = !contentEditAble"> <a-button type="text" @click="contentEditAble = !contentEditAble">

View File

@ -1,5 +1,5 @@
<template> <template>
<ms-base-table class="mt-[16px]" v-bind="propsRes" v-on="propsEvent"> <ms-base-table v-bind="propsRes" v-on="propsEvent">
<template #changeNumber="{ record }"> <template #changeNumber="{ record }">
<span>{{ record.id }}</span> <span>{{ record.id }}</span>
<MsTag v-if="record.latest" size="small" class="ml-2">{{ t('bugManagement.history.current') }}</MsTag> <MsTag v-if="record.latest" size="small" class="ml-2">{{ t('bugManagement.history.current') }}</MsTag>

View File

@ -1,12 +1,5 @@
<template> <template>
<div class="pl-2 pt-4"> <div>
<a-scrollbar
:style="{
overflow: 'auto',
height: 'calc(100vh - 236px)',
width: '100%',
}"
>
<MsEmpty v-if="commentList.length === 0" /> <MsEmpty v-if="commentList.length === 0" />
<MsComment <MsComment
v-else v-else
@ -16,7 +9,6 @@
@delete="handleDelete" @delete="handleDelete"
@update-or-add="handleUpdate" @update-or-add="handleUpdate"
/> />
</a-scrollbar>
</div> </div>
</template> </template>

View File

@ -90,38 +90,24 @@
<template #default="{ loading }"> <template #default="{ loading }">
<div <div
ref="wrapperRef" ref="wrapperRef"
:class="[`${!commentInputIsActive ? 'h-[calc(100%-72px)]' : 'h-[calc(100%-286px)]'}`, 'bg-white']" :class="[`${!commentInputIsActive ? 'h-[calc(100%-118px)]' : 'h-[calc(100%-338px)]'}`, 'bg-white']"
> >
<div class="header relative h-[48px] pl-2">
<MsTab
v-model:active-key="activeTab"
:content-tab-list="tabSetting"
:get-text-func="getTotal"
class="no-content relative border-b"
@change="clickMenu"
/>
<span class="absolute bottom-0 right-4 top-4 my-auto text-[var(--color-text-2)]" @click="showMenuSetting">{{
t('caseManagement.featureCase.detailDisplaySetting')
}}</span>
</div>
<MsSplitBox :size="0.8" :max="0.7" :min="0.6" direction="horizontal" expand-direction="right"> <MsSplitBox :size="0.8" :max="0.7" :min="0.6" direction="horizontal" expand-direction="right">
<template #first> <template #first>
<div class="leftWrapper h-full"> <div class="leftWrapper h-full">
<div class="header h-[50px]"> <div class="leftContent mt-4 w-full pl-[16px] pr-[24px]">
<a-menu mode="horizontal" :default-selected-keys="[activeTab || 'detail']" @menu-item-click="clickMenu">
<a-menu-item v-for="tab of tabSetting" :key="tab.key">
<div class="flex items-center">
<span>{{ t(tab.title) }}</span>
<a-badge
v-if="getTotal(tab.key)"
class="ml-1"
:class="activeTab === tab.key ? 'active' : ''"
:text="getTotal(tab.key)"
/> </div
></a-menu-item>
<a-menu-item key="setting">
<span @click="showMenuSetting">{{
t('caseManagement.featureCase.detailDisplaySetting')
}}</span></a-menu-item
>
</a-menu>
</div>
<keep-alive>
<div class="leftContent mt-4 w-full px-[24px]">
<a-scrollbar
:style="{
overflow: 'auto',
height: 'calc(100vh - 190px)',
}"
>
<template v-if="activeTab === 'detail'"> <template v-if="activeTab === 'detail'">
<TabDetail <TabDetail
ref="tabDetailRef" ref="tabDetailRef"
@ -156,13 +142,11 @@
<template v-if="activeTab === 'changeHistory'"> <template v-if="activeTab === 'changeHistory'">
<TabChangeHistory :case-id="props.detailId" /> <TabChangeHistory :case-id="props.detailId" />
</template> </template>
</a-scrollbar>
</div> </div>
</keep-alive>
</div> </div>
</template> </template>
<template #second> <template #second>
<div class="rightWrapper h-full p-[24px]"> <div class="rightWrapper h-full p-4">
<a-skeleton v-if="loading" class="w-full" :loading="loading" :animation="true"> <a-skeleton v-if="loading" class="w-full" :loading="loading" :animation="true">
<a-space direction="vertical" class="w-[100%]" size="large"> <a-space direction="vertical" class="w-[100%]" size="large">
<a-skeleton-line :rows="14" :line-height="30" :line-spacing="30" /> <a-skeleton-line :rows="14" :line-height="30" :line-spacing="30" />
@ -263,6 +247,7 @@
import MsFormCreate from '@/components/pure/ms-form-create/ms-form-create.vue'; import MsFormCreate from '@/components/pure/ms-form-create/ms-form-create.vue';
import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types'; import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types';
import MsSplitBox from '@/components/pure/ms-split-box/index.vue'; import MsSplitBox from '@/components/pure/ms-split-box/index.vue';
import MsTab from '@/components/pure/ms-tab/index.vue';
import type { MsPaginationI } from '@/components/pure/ms-table/type'; import type { MsPaginationI } from '@/components/pure/ms-table/type';
import MsTag from '@/components/pure/ms-tag/ms-tag.vue'; import MsTag from '@/components/pure/ms-tag/ms-tag.vue';
import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue'; import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue';
@ -347,8 +332,9 @@
// const tabSetting = ref<TabItemType[]>([...tabSettingList.value]); // const tabSetting = ref<TabItemType[]>([...tabSettingList.value]);
const tabSetting = ref<TabItemType[]>([]); const tabSetting = ref<TabItemType[]>([]);
const activeTab = ref<string | number>('detail'); const activeTab = ref<string>('detail');
function clickMenu(key: string | number) {
function clickMenu(key: string) {
activeTab.value = key; activeTab.value = key;
featureCaseStore.setActiveTab(key); featureCaseStore.setActiveTab(key);
switch (activeTab.value) { switch (activeTab.value) {
@ -642,39 +628,38 @@
const tabDefaultSettingList: TabItemType[] = [ const tabDefaultSettingList: TabItemType[] = [
{ {
key: 'detail', value: 'detail',
title: 'caseManagement.featureCase.detail', label: t('caseManagement.featureCase.detail'),
canHide: false, canHide: false,
isShow: true, isShow: true,
}, },
{ {
key: 'case', value: 'case',
title: 'caseManagement.featureCase.case', label: t('caseManagement.featureCase.case'),
canHide: true,
isShow: true,
},
{
key: 'dependency',
title: 'caseManagement.featureCase.dependency',
canHide: true, canHide: true,
isShow: true, isShow: true,
}, },
{ {
key: 'caseReview', value: 'dependency',
title: 'caseManagement.featureCase.caseReview', label: t('caseManagement.featureCase.dependency'),
canHide: true, canHide: true,
isShow: true, isShow: true,
}, },
{ {
key: 'comments', value: 'caseReview',
title: 'caseManagement.featureCase.comments', label: t('caseManagement.featureCase.caseReview'),
canHide: true, canHide: true,
isShow: true, isShow: true,
}, },
{ {
key: 'changeHistory', value: 'comments',
title: 'caseManagement.featureCase.changeHistory', label: t('caseManagement.featureCase.comments'),
canHide: true,
isShow: true,
},
{
value: 'changeHistory',
label: t('caseManagement.featureCase.changeHistory'),
canHide: true, canHide: true,
isShow: true, isShow: true,
}, },
@ -683,14 +668,14 @@
const moduleTabMap: Record<string, TabItemType[]> = { const moduleTabMap: Record<string, TabItemType[]> = {
bugManagement: [ bugManagement: [
{ {
key: 'requirement', value: 'requirement',
title: 'caseManagement.featureCase.requirement', label: t('caseManagement.featureCase.requirement'),
canHide: true, canHide: true,
isShow: true, isShow: true,
}, },
{ {
key: 'bug', value: 'bug',
title: 'caseManagement.featureCase.bug', label: t('caseManagement.featureCase.bug'),
canHide: true, canHide: true,
isShow: true, isShow: true,
}, },

View File

@ -400,7 +400,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { Message, TableChangeExtra, TableColumnData, TableData } from '@arco-design/web-vue'; import { Message, TableChangeExtra, TableData } from '@arco-design/web-vue';
import { CustomTypeMaps, MsAdvanceFilter } from '@/components/pure/ms-advance-filter'; import { CustomTypeMaps, MsAdvanceFilter } from '@/components/pure/ms-advance-filter';
import { FilterFormItem, FilterResult, FilterType } from '@/components/pure/ms-advance-filter/type'; import { FilterFormItem, FilterResult, FilterType } from '@/components/pure/ms-advance-filter/type';

View File

@ -31,8 +31,8 @@
<div class="ms-table-column-seletor"> <div class="ms-table-column-seletor">
<div class="flex-col"> <div class="flex-col">
<div v-for="item in nonCloseColumn" :key="item.key" class="column-item"> <div v-for="item in nonCloseColumn" :key="item.value" class="column-item">
<div>{{ t(item.title) }}</div> <div>{{ t(item.label) }}</div>
<a-switch v-model="item.isShow" disabled size="small" type="line" @change="handleSwitchChange" /> <a-switch v-model="item.isShow" disabled size="small" type="line" @change="handleSwitchChange" />
</div> </div>
</div> </div>
@ -41,26 +41,15 @@
t('project.environmental.nonClose') t('project.environmental.nonClose')
}}</span></a-divider }}</span></a-divider
> >
<!-- <div>
<div class="itemTab">
<span>{{ t('caseManagement.featureCase.detail') }}</span>
<a-switch v-model="detailEnable" size="small" :disabled="true" type="line" />
</div>
<a-divider orientation="center" class="non-sort"
><span class="one-line-text text-xs text-[var(--color-text-4)]">{{
t('caseManagement.featureCase.nonClosableTab')
}}</span></a-divider
>
</div> -->
<VueDraggable <VueDraggable
v-model="couldCloseColumn" v-model="couldCloseColumn"
class="ms-assertion-body-left" class="ms-assertion-body-left"
ghost-class="ghost" ghost-class="ghost"
handle=".column-drag-item" handle=".column-drag-item"
> >
<div v-for="element in couldCloseColumn" :key="element.key" class="column-drag-item"> <div v-for="element in couldCloseColumn" :key="element.value" class="column-drag-item">
<div class="flex w-[90%] items-center"> <div class="flex w-[90%] items-center">
<span class="ml-[8px]">{{ t(element.title) }}</span> <span class="ml-[8px]">{{ t(element.label) }}</span>
</div> </div>
<a-switch v-model="element.isShow" size="small" type="line" @change="handleSwitchChange" /> <a-switch v-model="element.isShow" size="small" type="line" @change="handleSwitchChange" />
</div> </div>
@ -123,7 +112,7 @@
const loadTab = async () => { const loadTab = async () => {
const res = (await featureCaseStore.getContentTabList()) || []; const res = (await featureCaseStore.getContentTabList()) || [];
nonCloseColumn.value = res.filter((item) => !item.canHide && item.key !== 'SETTING'); nonCloseColumn.value = res.filter((item) => !item.canHide);
couldCloseColumn.value = res.filter((item) => item.canHide); couldCloseColumn.value = res.filter((item) => item.canHide);
}; };

View File

@ -113,40 +113,6 @@
{{ t('common.save') }} {{ t('common.save') }}
</a-button></div </a-button></div
> >
<!-- <a-form-item v-if="props.allowEdit" field="attachment" :label="t('caseManagement.featureCase.attachment')">
<div class="flex flex-col">
<div class="mb-1">
<a-dropdown position="tr" trigger="hover">
<a-button v-permission="['FUNCTIONAL_CASE:READ+UPDATE']" type="outline">
<template #icon> <icon-plus class="text-[14px]" /> </template
>{{ t('system.orgTemplate.addAttachment') }}</a-button
>
<template #content>
<a-upload
ref="uploadRef"
v-model:file-list="fileList"
:auto-upload="false"
:show-file-list="false"
:before-upload="beforeUpload"
>
<template #upload-button>
<a-button type="text" class="!text-[var(--color-text-1)]">
<icon-upload />{{ t('caseManagement.featureCase.uploadFile') }}
</a-button>
</template>
</a-upload>
<a-button type="text" class="!text-[var(--color-text-1)]" @click="associatedFile">
<MsIcon type="icon-icon_link-copy_outlined" size="16" />
{{ t('caseManagement.featureCase.associatedFile') }}
</a-button>
</template>
</a-dropdown>
</div>
<div class="!hover:bg-[rgb(var(--primary-1))] !text-[var(--color-text-4)]">
{{ t('system.orgTemplate.addAttachmentTip') }}
</div>
</div>
</a-form-item> -->
<div v-permission="['FUNCTIONAL_CASE:READ+UPDATE']"> <div v-permission="['FUNCTIONAL_CASE:READ+UPDATE']">
<AddAttachment v-model:file-list="fileList" multiple @change="handleChange" @link-file="associatedFile" /> <AddAttachment v-model:file-list="fileList" multiple @change="handleChange" @link-file="associatedFile" />
</div> </div>
@ -504,13 +470,14 @@
if (valid === true) { if (valid === true) {
confirmLoading.value = true; confirmLoading.value = true;
await updateCaseRequest(getParams()); await updateCaseRequest(getParams());
confirmLoading.value = false;
Message.success(t('caseManagement.featureCase.editSuccess')); Message.success(t('caseManagement.featureCase.editSuccess'));
isEditPreposition.value = false; isEditPreposition.value = false;
emit('updateSuccess'); emit('updateSuccess');
} }
}); });
} catch (error) { } catch (error) {
// console.log(error); console.log(error);
} finally { } finally {
confirmLoading.value = false; confirmLoading.value = false;
} }
@ -665,7 +632,6 @@
async function restartUpload() { async function restartUpload() {
await sleep(300); await sleep(300);
console.log('ooo');
fileListRef.value?.startUpload(); fileListRef.value?.startUpload();
} }
@ -675,6 +641,7 @@
fileId: '', fileId: '',
local: true, local: true,
}); });
function transferFileHandler(item: MsFileItem) { function transferFileHandler(item: MsFileItem) {
activeTransferFileParams.value = { activeTransferFileParams.value = {
projectId: currentProjectId.value, projectId: currentProjectId.value,

View File

@ -37,7 +37,16 @@
const activeKey = ref('requestHeader'); const activeKey = ref('requestHeader');
const GlobalVariable = ref<EnvConfigItem[]>([]); const GlobalVariable = ref<EnvConfigItem[]>([]);
const { t } = useI18n(); const { t } = useI18n();
const { setIsSave } = useLeaveUnSaveTip();
const leaveTitle = 'common.tip';
const leaveContent = 'apiTestDebug.unsavedLeave';
const { setIsSave } = useLeaveUnSaveTip({
leaveTitle,
leaveContent,
tipType: 'warning',
});
setIsSave(true); setIsSave(true);
const canSave = ref(false); const canSave = ref(false);

View File

@ -81,7 +81,7 @@
:label="t('system.authorized.license')" :label="t('system.authorized.license')"
field="licenseCode" field="licenseCode"
asterisk-position="end" asterisk-position="end"
required :rules="[{ required: true, message: t('system.authorized.LicenseIsRequired') }]"
:validate-trigger="['input']" :validate-trigger="['input']"
> >
<MsUpload <MsUpload