캐릭터 챗봇 #74
|
@ -1014,10 +1014,12 @@ export default {
|
|||
computed: {
|
||||
isSaveDisabled() {
|
||||
if (this.isLoading) return true;
|
||||
if (!this.isFormValid) return true;
|
||||
if (!this.isEdit) return false; // 등록 시에는 변경 감지 없이 유효성만 확인
|
||||
// 등록(create) 모드에서는 폼 유효성으로 판단
|
||||
if (!this.isEdit) {
|
||||
return !this.isFormValid;
|
||||
}
|
||||
|
||||
// 수정 시에는 변경 사항이 있는 경우에만 저장 가능
|
||||
// 수정(edit) 모드에서는 변경 사항이 있는지만 판단(필수값 유효성과 무관)
|
||||
const changed = this.getChangedFields();
|
||||
const hasNonIdField = Object.keys(changed || {}).some(k => k !== 'id');
|
||||
const imageChanged = !!this.character.image; // 새 이미지 선택 여부
|
||||
|
@ -1443,7 +1445,8 @@ export default {
|
|||
},
|
||||
|
||||
async saveCharacter() {
|
||||
if (!this.isFormValid) {
|
||||
// 등록(create) 모드에서만 필수값 유효성 검사를 강제
|
||||
if (!this.isEdit && !this.isFormValid) {
|
||||
this.notifyError("필수 항목을 모두 입력하세요");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue