feat(测试计划): 测试计划报告自定义报告配置放开编辑状态&调整参数

This commit is contained in:
xinxin.wu 2024-07-09 16:41:14 +08:00 committed by 刘瑞斌
parent 2ebdd5dfb4
commit 3c39d61554
3 changed files with 24 additions and 17 deletions

View File

@ -211,12 +211,9 @@
}
watch(
() => props.isGroup,
() => hasCaseList.value,
() => {
initDefaultConfig();
},
{
immediate: true,
}
);
@ -389,6 +386,10 @@
confirmLoading.value = false;
}
}
onBeforeMount(() => {
initDefaultConfig();
});
</script>
<style scoped lang="less">

View File

@ -10,7 +10,13 @@
@click="handleClick"
/>
<MsFormItemSub
v-if="hasAnyPermission(['PROJECT_TEST_PLAN_REPORT:READ+UPDATE']) && !shareId && props.showButton && props.canEdit"
v-if="
hasAnyPermission(['PROJECT_TEST_PLAN_REPORT:READ+UPDATE']) &&
!shareId &&
props.showButton &&
props.canEdit &&
props.isPreview
"
:text="t('report.detail.oneClickSummary')"
:show-fill-icon="true"
@fill="handleSummary"
@ -39,22 +45,23 @@
import { useI18n } from '@/hooks/useI18n';
import { hasAnyPermission } from '@/utils/permission';
import type { PlanReportDetail } from '@/models/testPlan/testPlanReport';
import type { customValueForm, PlanReportDetail } from '@/models/testPlan/testPlanReport';
import { getSummaryDetail } from '@/views/test-plan/report/utils';
const { t } = useI18n();
const props = defineProps<{
richText: { content: string; label: string; richTextTmpFileIds?: string[] };
richText: customValueForm;
shareId?: string;
showButton: boolean;
isPlanGroup: boolean;
detail: PlanReportDetail;
canEdit: boolean;
isPreview?: boolean;
}>();
const emit = defineEmits<{
(e: 'updateSummary'): void;
(e: 'updateSummary', form: customValueForm): void;
(e: 'cancel'): void;
(e: 'dblclick'): void;
(e: 'handleSummary', content: string): void;
@ -67,7 +74,7 @@
}
function handleUpdateReportDetail() {
emit('updateSummary');
emit('updateSummary', innerSummary.value);
}
async function handleUploadImage(file: File) {

View File

@ -180,11 +180,12 @@
richTextTmpFileIds: [],
}"
:share-id="shareId"
:is-preview="props.isPreview"
:can-edit="item.enableEdit"
:show-button="showButton"
:is-plan-group="props.isGroup"
:detail="detail"
@update-summary="handleUpdateReportDetail(item)"
@update-summary="(formValue:customValueForm) => updateCustom(formValue, item)"
@cancel="() => handleCancelCustom(item)"
@handle-summary="(value:string) => handleSummary(value,item)"
@dblclick="handleDoubleClick(item)"
@ -529,7 +530,7 @@
}
}
const allowEditType = [ReportCardTypeEnum.CUSTOM_CARD];
const allowEditType = [ReportCardTypeEnum.CUSTOM_CARD, ReportCardTypeEnum.SUMMARY];
function allowEdit(value: ReportCardTypeEnum) {
return allowEditType.includes(value);
}
@ -563,12 +564,10 @@
}
function handleDoubleClick(cardItem: configItem) {
if (props.isPreview) {
if (cardItem.value === ReportCardTypeEnum.SUMMARY) {
showButton.value = true;
}
cardItem.enableEdit = !cardItem.enableEdit;
if (cardItem.value === ReportCardTypeEnum.SUMMARY) {
showButton.value = true;
}
cardItem.enableEdit = !cardItem.enableEdit;
}
async function handleUpdateReportDetail(currentItem: configItem) {
@ -586,7 +585,6 @@
} else {
currentItem.enableEdit = !currentItem.enableEdit;
}
// TODO
emit('updateSuccess');
} catch (error) {
console.log(error);
@ -598,6 +596,7 @@
...currentItem,
...formValue,
};
innerCardList.value = innerCardList.value.map((item: configItem) => {
if (item.id === currentItem.id) {
return {