API การแจ้งเตือน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-28 13:36:08 +07:00
parent 4ff1334b32
commit 23314ca3a6
6 changed files with 115 additions and 17 deletions

View file

@ -238,6 +238,35 @@ export const useCounterMixin = defineStore('mixin', () => {
}
}
function dialogRemove(
q: any,
ok?: () => void,
title?: string, // ถ้ามี cancel action ใส่เป็น null
desc?: string, // ถ้ามี cancel action ใส่เป็น null
cancel?: () => void
) {
q.dialog({
component: CustomComponent,
componentProps: {
title: title && title != null ? title : 'ยืนยันการลบข้อมูล',
message:
desc && desc != null
? desc
: 'ต้องการยืนยันการลบข้อมูลนี้ใช่หรือไม่?',
icon: 'delete',
color: 'red',
textOk: 'ตกลง',
onlycancel: false,
},
})
.onOk(() => {
if (ok) ok()
})
.onCancel(() => {
if (cancel) cancel()
})
}
return {
date2Thai,
showLoader,
@ -247,5 +276,6 @@ export const useCounterMixin = defineStore('mixin', () => {
messageError,
success,
notify,
dialogRemove,
}
})