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

View File

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

View File

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