diff --git a/src/views/Can/CanSignature.vue b/src/views/Can/CanSignature.vue
index e172015..bb317a8 100644
--- a/src/views/Can/CanSignature.vue
+++ b/src/views/Can/CanSignature.vue
@@ -52,8 +52,32 @@
max-width="200"
max-height="200"
align="center"
+ class="center-image"
/>
+
+
+
+
+
+
+ 수정
+
+
+
+
+ 삭제
+
+
+
+
+
@@ -75,10 +99,7 @@
persistent
>
-
- 시그니처 캔 수정
-
-
+
시그니처 캔 등록
@@ -146,20 +167,109 @@
취소
+ 등록
+
+
+
+
+
+
+
+
+
+ 시그니처 캔 수정
+
+
+
+
+ 캔
+
+
+ {{ selected_signature_can.can }} 캔
+
+
+
+
+
+
+
+ 이미지
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 취소
+
+
수정
+
+
+
+
+
+
+
+
+
+ 삭제하시겠습니까?
+
+
+
- 등록
+ 취소
+
+
+ 확인
@@ -177,8 +287,9 @@ export default {
data() {
return {
is_loading: false,
- is_modify: false,
show_write_dialog: false,
+ show_modify_dialog: false,
+ show_delete_confirm_dialog: false,
signature_list: [],
@@ -190,7 +301,7 @@ export default {
image_url: null,
creator_id: null,
is_active: null,
- selected_signature_can: null,
+ selected_signature_can: {},
headers: [
{
@@ -217,6 +328,12 @@ export default {
sortable: false,
value: 'image',
},
+ {
+ text: '관리',
+ align: 'center',
+ sortable: false,
+ value: 'management',
+ },
],
}
},
@@ -249,10 +366,14 @@ export default {
},
showModifyDialog(item) {
- this.selected_signature_can = item
- this.is_active = item.is_active
this.image_url = item.image;
- this.show_write_dialog = true
+ this.selected_signature_can = item
+ this.show_modify_dialog = true
+ },
+
+ showDeleteConfirm(item) {
+ this.selected_signature_can = item
+ this.show_delete_confirm_dialog = true
},
validate() {
@@ -269,12 +390,13 @@ export default {
cancel() {
this.show_write_dialog = false
+ this.show_modify_dialog = false
+ this.show_delete_confirm_dialog = false
this.image = null
this.image_url = null
- this.creator_id = null
this.can = 0
this.is_active = null
- this.selected_signature_can = null
+ this.selected_signature_can = {}
},
async getSignatureList() {
@@ -332,6 +454,11 @@ export default {
},
async modifySignatureCan() {
+ if (this.image === null) {
+ this.notifyError('수정사항이 없습니다.')
+ return;
+ }
+
if (this.is_loading) return;
this.is_loading = true
@@ -339,14 +466,7 @@ export default {
try {
const formData = new FormData()
formData.append("id", this.selected_signature_can.id)
-
- if (this.image !== null) {
- formData.append("image", this.image)
- }
-
- if (this.selected_signature_can.isActive !== this.is_active) {
- formData.append("isActive", this.is_active)
- }
+ formData.append("image", this.image)
const res = await api.modifySignature(formData)
if (res.status === 200 && res.data.success === true) {
@@ -366,6 +486,35 @@ export default {
}
},
+ async deleteSignature() {
+ if (this.is_loading) return;
+
+ this.is_loading = true
+
+ try {
+ const formData = new FormData()
+ formData.append("id", this.selected_signature_can.id)
+ formData.append("isActive", false)
+
+ const res = await api.modifySignature(formData)
+ if (res.status === 200 && res.data.success === true) {
+ this.cancel()
+ this.notifySuccess(res.data.message || '등록되었습니다.')
+
+ this.page = 1
+ await this.getSignatureList()
+ } else {
+ this.is_loading = false
+ this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
+ }
+ } catch (e) {
+ this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
+ this.is_loading = false
+ } finally {
+ this.is_loading = false
+ }
+ },
+
async next() {
await this.getSignatureList();
}
@@ -414,8 +563,8 @@ export default {
}
-td img {
+.center-image {
display: block;
- margin: 10px auto;
+ margin: 0 auto;
}