From 1c6c8fcb7ad78292088695518baf5ff000a7317f Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Thu, 1 Aug 2024 17:09:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E7=AC=AC=E4=B8=89=E6=96=B9=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E9=BB=98=E8=AE=A4=E6=A8=A1=E6=9D=BF=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/bug-management/edit.vue | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/frontend/src/views/bug-management/edit.vue b/frontend/src/views/bug-management/edit.vue index 2527eb844c..5e61812f0a 100644 --- a/frontend/src/views/bug-management/edit.vue +++ b/frontend/src/views/bug-management/edit.vue @@ -388,18 +388,25 @@ if (Array.isArray(arr) && arr.length) { formRules.value = arr.map((item: any) => { - let initValue = item.defaultValue; const initOptions = item.options ? item.options : JSON.parse(item.platformOptionJson); - if (memberType.includes(item.type)) { - if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) { - initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id]; - } else if (item.type === 'MULTIPLE_MEMBER' && item.defaultValue) { - initValue = JSON.parse(item.defaultValue); + let initValue; + if (!isEditOrCopy.value) { + initValue = item.defaultValue; + if (memberType.includes(item.type)) { + if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) { + initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id]; + } else if (item.type === 'MULTIPLE_MEMBER' && item.defaultValue) { + initValue = JSON.parse(item.defaultValue); + } + } else if (multipleType.includes(item.type)) { + if (item.defaultValue && item.defaultValue.length > 0) { + initValue = item.defaultValue ? JSON.parse(item.defaultValue) : []; + } + } else if (numberType.includes(item.type)) { + initValue = Number(initValue); } - } else if (multipleType.includes(item.type)) { - initValue = item.defaultValue ? JSON.parse(item.defaultValue) : []; - } else if (numberType.includes(item.type)) { - initValue = Number(initValue); + } else { + initValue = null; } return { type: item.type, @@ -590,7 +597,7 @@ value: form.value.platformSystemFields[key], }); }); - delete form.value.platformSystemFields; + // delete form.value.platformSystemFields; // 平台默认模板不传递名称, 描述, 标签等参数 delete form.value.title; delete form.value.description;