refactor(缺陷管理): 优化第三方平台默认模板默认值的展示

This commit is contained in:
song-cc-rock 2024-08-01 17:09:48 +08:00 committed by Craftsman
parent b05031b548
commit 1c6c8fcb7a
1 changed files with 18 additions and 11 deletions

View File

@ -388,18 +388,25 @@
if (Array.isArray(arr) && arr.length) { if (Array.isArray(arr) && arr.length) {
formRules.value = arr.map((item: any) => { formRules.value = arr.map((item: any) => {
let initValue = item.defaultValue;
const initOptions = item.options ? item.options : JSON.parse(item.platformOptionJson); const initOptions = item.options ? item.options : JSON.parse(item.platformOptionJson);
if (memberType.includes(item.type)) { let initValue;
if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) { if (!isEditOrCopy.value) {
initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id]; initValue = item.defaultValue;
} else if (item.type === 'MULTIPLE_MEMBER' && item.defaultValue) { if (memberType.includes(item.type)) {
initValue = JSON.parse(item.defaultValue); 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)) { } else {
initValue = item.defaultValue ? JSON.parse(item.defaultValue) : []; initValue = null;
} else if (numberType.includes(item.type)) {
initValue = Number(initValue);
} }
return { return {
type: item.type, type: item.type,
@ -590,7 +597,7 @@
value: form.value.platformSystemFields[key], value: form.value.platformSystemFields[key],
}); });
}); });
delete form.value.platformSystemFields; // delete form.value.platformSystemFields;
// , , // , ,
delete form.value.title; delete form.value.title;
delete form.value.description; delete form.value.description;