fix(character-form): 수정 모드에서 변경 사항만 있으면 저장 버튼 활성화

- isSaveDisabled 로직을 등록/수정 모드로 분리
- 수정(edit) 모드에서는 필수값 유효성과 무관하게 변경 감지 시 버튼 활성화
- 등록(create) 모드에서는 기존대로 폼 유효성으로 활성화 판단
- saveCharacter에서도 등록 모드에서만 필수값 유효성 검사를 강제하도록 수정

관련 파일: src/views/Chat/CharacterForm.vue
This commit is contained in:
Yu Sung 2025-08-13 00:55:35 +09:00
parent 30e08c862a
commit e09f654aba
1 changed files with 7 additions and 4 deletions

View File

@ -1014,10 +1014,12 @@ export default {
computed: { computed: {
isSaveDisabled() { isSaveDisabled() {
if (this.isLoading) return true; if (this.isLoading) return true;
if (!this.isFormValid) return true; // (create)
if (!this.isEdit) return false; // if (!this.isEdit) {
return !this.isFormValid;
}
// // (edit) ( )
const changed = this.getChangedFields(); const changed = this.getChangedFields();
const hasNonIdField = Object.keys(changed || {}).some(k => k !== 'id'); const hasNonIdField = Object.keys(changed || {}).some(k => k !== 'id');
const imageChanged = !!this.character.image; // const imageChanged = !!this.character.image; //
@ -1443,7 +1445,8 @@ export default {
}, },
async saveCharacter() { async saveCharacter() {
if (!this.isFormValid) { // (create)
if (!this.isEdit && !this.isFormValid) {
this.notifyError("필수 항목을 모두 입력하세요"); this.notifyError("필수 항목을 모두 입력하세요");
return; return;
} }