From f7355b11ecbae9071b889cc0939ec6e5a76fc2e6 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Fri, 20 Dec 2024 18:51:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E7=BC=BA=E9=99=B7=E6=A8=A1=E6=9D=BF=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=9B=9E=E6=98=BEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/bug-management/createAndEditBug.vue | 2 +- frontend/src/views/bug-management/edit.vue | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/bug-management/createAndEditBug.vue b/frontend/src/views/bug-management/createAndEditBug.vue index d459271e70..2a5f8ec00b 100644 --- a/frontend/src/views/bug-management/createAndEditBug.vue +++ b/frontend/src/views/bug-management/createAndEditBug.vue @@ -81,7 +81,7 @@ loading.value = true; const res = await getTemplateOption(appStore.currentProjectId); templateOption.value = res.map((item) => { - if (item.enableDefault && !isEdit.value) { + if (item.enableDefault && !route.query.id) { // 选中默认模板 bugTemplateId.value = item.id; } diff --git a/frontend/src/views/bug-management/edit.vue b/frontend/src/views/bug-management/edit.vue index badb575d7c..6dd47941c7 100644 --- a/frontend/src/views/bug-management/edit.vue +++ b/frontend/src/views/bug-management/edit.vue @@ -774,6 +774,7 @@ loading.value = true; const res = await getBugDetail(bugId.value as string); const { templateId, attachments } = res; + if (templateId) { await setTemplateValue(res); } @@ -855,26 +856,33 @@ return data; } + const originTemId = ref(''); watch( () => innerTemplateId.value, (val) => { if (val) { form.value.templateId = val; - templateChange(val); + if (props.isCopyBug && originTemId.value === val) { + getDetailInfo(); + } else { + templateChange(val); + } } - }, - { - immediate: true, } ); const { registerCatchSaveShortcut, removeCatchSaveShortcut } = useShortcutSave(() => { saveHandler(); }); + onMounted(async () => { if (isEditOrCopy.value) { // 获取详情 await getDetailInfo(); + if (props.isCopyBug) { + originTemId.value = form.value.templateId; + innerTemplateId.value = form.value.templateId; + } } registerCatchSaveShortcut(); });