fix(缺陷管理): 修复缺陷管理复制缺陷模板下拉回显bug

This commit is contained in:
xinxin.wu 2024-12-20 18:51:52 +08:00 committed by 刘瑞斌
parent 94dc028725
commit f7355b11ec
2 changed files with 13 additions and 5 deletions

View File

@ -81,7 +81,7 @@
loading.value = true; loading.value = true;
const res = await getTemplateOption(appStore.currentProjectId); const res = await getTemplateOption(appStore.currentProjectId);
templateOption.value = res.map((item) => { templateOption.value = res.map((item) => {
if (item.enableDefault && !isEdit.value) { if (item.enableDefault && !route.query.id) {
// //
bugTemplateId.value = item.id; bugTemplateId.value = item.id;
} }

View File

@ -774,6 +774,7 @@
loading.value = true; loading.value = true;
const res = await getBugDetail(bugId.value as string); const res = await getBugDetail(bugId.value as string);
const { templateId, attachments } = res; const { templateId, attachments } = res;
if (templateId) { if (templateId) {
await setTemplateValue(res); await setTemplateValue(res);
} }
@ -855,26 +856,33 @@
return data; return data;
} }
const originTemId = ref<string>('');
watch( watch(
() => innerTemplateId.value, () => innerTemplateId.value,
(val) => { (val) => {
if (val) { if (val) {
form.value.templateId = val; form.value.templateId = val;
templateChange(val); if (props.isCopyBug && originTemId.value === val) {
getDetailInfo();
} else {
templateChange(val);
}
} }
},
{
immediate: true,
} }
); );
const { registerCatchSaveShortcut, removeCatchSaveShortcut } = useShortcutSave(() => { const { registerCatchSaveShortcut, removeCatchSaveShortcut } = useShortcutSave(() => {
saveHandler(); saveHandler();
}); });
onMounted(async () => { onMounted(async () => {
if (isEditOrCopy.value) { if (isEditOrCopy.value) {
// //
await getDetailInfo(); await getDetailInfo();
if (props.isCopyBug) {
originTemId.value = form.value.templateId;
innerTemplateId.value = form.value.templateId;
}
} }
registerCatchSaveShortcut(); registerCatchSaveShortcut();
}); });