fix(测试计划): 调整测试计划报告分享
This commit is contained in:
parent
9abac8e0fa
commit
8d6ba0bfce
|
@ -56,7 +56,10 @@ export function updateReportDetail(data: UpdateReportDetailParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 测试计划-报告-详情
|
// 测试计划-报告-详情
|
||||||
export function getReportDetail(id: string) {
|
export function getReportDetail(id: string, shareId?: string) {
|
||||||
|
if (shareId) {
|
||||||
|
return MSR.get({ url: `${reportUrl.PlanReportShareDetailUrl}/${shareId}/${id}` });
|
||||||
|
}
|
||||||
return MSR.get({ url: `${reportUrl.PlanReportDetailUrl}/${id}` });
|
return MSR.get({ url: `${reportUrl.PlanReportDetailUrl}/${id}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@ export const WHITE_LIST = [
|
||||||
path: '/shareReportCase',
|
path: '/shareReportCase',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'shareReportTestPlan',
|
||||||
|
path: '/shareReportTestPlan',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reportId: string;
|
reportId: string;
|
||||||
shareId?: string;
|
shareId?: string;
|
||||||
isDelete: boolean;
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const tableStore = useTableStore();
|
const tableStore = useTableStore();
|
||||||
|
@ -81,7 +80,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (props.reportId && !props.isDelete) {
|
if (props.reportId) {
|
||||||
loadCaseList();
|
loadCaseList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reportId: string;
|
reportId: string;
|
||||||
shareId?: string;
|
shareId?: string;
|
||||||
isDelete: boolean;
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const tableStore = useTableStore();
|
const tableStore = useTableStore();
|
||||||
|
@ -116,7 +115,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (props.reportId && !props.isDelete) {
|
if (props.reportId) {
|
||||||
loadCaseList();
|
loadCaseList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -153,19 +153,14 @@
|
||||||
no-content
|
no-content
|
||||||
class="relative mb-[16px] border-b"
|
class="relative mb-[16px] border-b"
|
||||||
/>
|
/>
|
||||||
<BugTable v-if="activeTab === 'bug'" :report-id="reportId" :share-id="shareId" :is-delete="isDelete" />
|
<BugTable v-if="activeTab === 'bug'" :report-id="detail.id" :share-id="shareId" />
|
||||||
<FeatureCaseTable
|
<FeatureCaseTable v-if="activeTab === 'featureCase'" :report-id="detail.id" :share-id="shareId" />
|
||||||
v-if="activeTab === 'featureCase'"
|
|
||||||
:report-id="reportId"
|
|
||||||
:is-delete="isDelete"
|
|
||||||
:share-id="shareId"
|
|
||||||
/>
|
|
||||||
</MsCard>
|
</MsCard>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useEventListener } from '@vueuse/core';
|
import { useEventListener } from '@vueuse/core';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
@ -181,18 +176,10 @@
|
||||||
import BugTable from '@/views/test-plan/report/detail/component/bugTable.vue';
|
import BugTable from '@/views/test-plan/report/detail/component/bugTable.vue';
|
||||||
import FeatureCaseTable from '@/views/test-plan/report/detail/component/featureCaseTable.vue';
|
import FeatureCaseTable from '@/views/test-plan/report/detail/component/featureCaseTable.vue';
|
||||||
|
|
||||||
import {
|
import { editorUploadFile, planReportShare, updateReportDetail } from '@/api/modules/test-plan/report';
|
||||||
editorUploadFile,
|
|
||||||
getReportDetail,
|
|
||||||
planGetShareHref,
|
|
||||||
planReportShare,
|
|
||||||
planReportShareDetail,
|
|
||||||
updateReportDetail,
|
|
||||||
} from '@/api/modules/test-plan/report';
|
|
||||||
import { PreviewEditorImageUrl } from '@/api/requrls/case-management/featureCase';
|
import { PreviewEditorImageUrl } from '@/api/requrls/case-management/featureCase';
|
||||||
import { defaultReportDetail, statusConfig } from '@/config/testPlan';
|
import { defaultReportDetail, statusConfig } from '@/config/testPlan';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import { NOT_FOUND_RESOURCE } from '@/router/constants';
|
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import { addCommasToNumber } from '@/utils';
|
import { addCommasToNumber } from '@/utils';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
@ -208,7 +195,11 @@
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reportId: string;
|
detailInfo: PlanReportDetail;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'updateSuccess'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const detail = ref<PlanReportDetail>({ ...cloneDeep(defaultReportDetail) });
|
const detail = ref<PlanReportDetail>({ ...cloneDeep(defaultReportDetail) });
|
||||||
|
@ -220,16 +211,13 @@
|
||||||
/**
|
/**
|
||||||
* 分享share
|
* 分享share
|
||||||
*/
|
*/
|
||||||
const router = useRouter();
|
|
||||||
const shareLink = ref<string>('');
|
const shareLink = ref<string>('');
|
||||||
const shareId = ref<string>(route.query.shareId as string);
|
const shareId = ref<string>(route.query.shareId as string);
|
||||||
const reportId = ref<string>(props.reportId);
|
|
||||||
const shareLoading = ref<boolean>(false);
|
const shareLoading = ref<boolean>(false);
|
||||||
const isDelete = ref<boolean>(false);
|
|
||||||
async function shareHandler() {
|
async function shareHandler() {
|
||||||
try {
|
try {
|
||||||
const res = await planReportShare({
|
const res = await planReportShare({
|
||||||
reportId: reportId.value,
|
reportId: detail.value.id,
|
||||||
projectId: appStore.currentProjectId,
|
projectId: appStore.currentProjectId,
|
||||||
});
|
});
|
||||||
const { origin } = window.location;
|
const { origin } = window.location;
|
||||||
|
@ -271,8 +259,8 @@
|
||||||
name: '',
|
name: '',
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: ['62%', '80%'],
|
radius: ['62%', '80%'],
|
||||||
|
center: ['50%', '50%'],
|
||||||
avoidLabelOverlap: false,
|
avoidLabelOverlap: false,
|
||||||
padAngle: 10,
|
|
||||||
label: {
|
label: {
|
||||||
show: false,
|
show: false,
|
||||||
position: 'center',
|
position: 'center',
|
||||||
|
@ -287,18 +275,6 @@
|
||||||
labelLine: {
|
labelLine: {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
itemStyle: {
|
|
||||||
normal: {
|
|
||||||
borderWidth: 2,
|
|
||||||
borderColor: '#ffffff',
|
|
||||||
},
|
|
||||||
emphasis: {
|
|
||||||
borderWidth: 0,
|
|
||||||
shadowBlur: 0,
|
|
||||||
shadowOffsetX: 0,
|
|
||||||
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
value: 0,
|
value: 0,
|
||||||
|
@ -366,18 +342,6 @@
|
||||||
labelLine: {
|
labelLine: {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
itemStyle: {
|
|
||||||
normal: {
|
|
||||||
borderWidth: 2,
|
|
||||||
borderColor: '#ffffff',
|
|
||||||
},
|
|
||||||
emphasis: {
|
|
||||||
borderWidth: 0,
|
|
||||||
shadowBlur: 0,
|
|
||||||
shadowOffsetX: 0,
|
|
||||||
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
value: 0,
|
value: 0,
|
||||||
|
@ -398,6 +362,8 @@
|
||||||
name: t(item.label),
|
name: t(item.label),
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: item.color,
|
color: item.color,
|
||||||
|
borderWidth: 2,
|
||||||
|
borderColor: '#ffffff',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -422,36 +388,13 @@
|
||||||
name: t(item.label),
|
name: t(item.label),
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: success ? item.color : '#D4D4D8',
|
color: success ? item.color : '#D4D4D8',
|
||||||
|
borderWidth: 2,
|
||||||
|
borderColor: '#ffffff',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDetail() {
|
|
||||||
try {
|
|
||||||
// 如果分享id存在则为分享页面
|
|
||||||
if (shareId.value) {
|
|
||||||
// 获取分享资源的详情
|
|
||||||
const hrefShareDetail = await planGetShareHref(shareId.value);
|
|
||||||
if (hrefShareDetail.deleted) {
|
|
||||||
isDelete.value = hrefShareDetail.deleted;
|
|
||||||
router.push({
|
|
||||||
name: NOT_FOUND_RESOURCE,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reportId.value = hrefShareDetail.reportId;
|
|
||||||
const result = await planReportShareDetail(shareId.value, reportId.value);
|
|
||||||
detail.value = result;
|
|
||||||
} else {
|
|
||||||
detail.value = await getReportDetail(reportId.value);
|
|
||||||
}
|
|
||||||
richText.value = { summary: detail.value.summary };
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleUploadImage(file: File) {
|
async function handleUploadImage(file: File) {
|
||||||
const { data } = await editorUploadFile({
|
const { data } = await editorUploadFile({
|
||||||
fileList: [file],
|
fileList: [file],
|
||||||
|
@ -468,7 +411,7 @@
|
||||||
});
|
});
|
||||||
Message.success(t('common.updateSuccess'));
|
Message.success(t('common.updateSuccess'));
|
||||||
showButton.value = false;
|
showButton.value = false;
|
||||||
getDetail();
|
emit('updateSuccess');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -498,9 +441,10 @@
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
watchEffect(async () => {
|
watchEffect(() => {
|
||||||
if (props.reportId) {
|
if (props.detailInfo) {
|
||||||
await getDetail();
|
// await getDetail();
|
||||||
|
detail.value = cloneDeep(props.detailInfo);
|
||||||
initOptionsData();
|
initOptionsData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,36 @@
|
||||||
<template>
|
<template>
|
||||||
<PlanDetail :report-id="reportId" />
|
<PlanDetail :detail-info="detail" @update-success="getDetail()" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
import PlanDetail from '@/views/test-plan/report/detail/component/planDetail.vue';
|
import PlanDetail from '@/views/test-plan/report/detail/component/planDetail.vue';
|
||||||
|
|
||||||
|
import { getReportDetail } from '@/api/modules/test-plan/report';
|
||||||
|
import { defaultReportDetail } from '@/config/testPlan';
|
||||||
|
|
||||||
|
import type { PlanReportDetail } from '@/models/testPlan/testPlanReport';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const reportId = ref<string>(route.query.id as string);
|
const reportId = ref<string>(route.query.id as string);
|
||||||
|
|
||||||
|
const detail = ref<PlanReportDetail>(cloneDeep(defaultReportDetail));
|
||||||
|
|
||||||
|
async function getDetail() {
|
||||||
|
try {
|
||||||
|
detail.value = await getReportDetail(reportId.value);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
getDetail();
|
||||||
|
});
|
||||||
|
// 测试代码结束
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less"></style>
|
<style scoped lang="less"></style>
|
||||||
|
|
|
@ -1,30 +1,46 @@
|
||||||
<template>
|
<template>
|
||||||
<PlanDetail :report-id="reportId" />
|
<PlanDetail :detail-info="detail" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
import PlanDetail from '@/views/test-plan/report/detail/component/planDetail.vue';
|
import PlanDetail from '@/views/test-plan/report/detail/component/planDetail.vue';
|
||||||
|
|
||||||
import { planGetShareHref } from '@/api/modules/test-plan/report';
|
import { getReportDetail, planGetShareHref } from '@/api/modules/test-plan/report';
|
||||||
|
import { defaultReportDetail } from '@/config/testPlan';
|
||||||
|
import { NOT_FOUND_RESOURCE } from '@/router/constants';
|
||||||
|
|
||||||
|
import type { PlanReportDetail } from '@/models/testPlan/testPlanReport';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const shareId = ref<string>(route.query.shareId as string);
|
const router = useRouter();
|
||||||
const reportId = ref<string>(route.query.id as string);
|
const reportId = ref<string>(route.query.id as string);
|
||||||
|
|
||||||
|
const detail = ref<PlanReportDetail>(cloneDeep(defaultReportDetail));
|
||||||
|
|
||||||
async function getShareDetail() {
|
async function getShareDetail() {
|
||||||
try {
|
try {
|
||||||
const hrefShareDetail = await planGetShareHref(shareId.value);
|
const hrefShareDetail = await planGetShareHref(route.query.shareId as string);
|
||||||
reportId.value = hrefShareDetail.reportId;
|
reportId.value = hrefShareDetail.reportId;
|
||||||
|
if (hrefShareDetail.deleted) {
|
||||||
|
router.push({
|
||||||
|
name: NOT_FOUND_RESOURCE,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
detail.value = await getReportDetail(reportId.value, route.query.shareId as string);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
watchEffect(() => {
|
||||||
getShareDetail();
|
if (route.query.shareId) {
|
||||||
|
getShareDetail();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue