- add common dialog (remove, confirm & message notify) และลองใช้ในส่วนของออกคำสั่ง

- เพิ่ม action สร้างข้อมูลทุกอันที่ส่งจากทะเบียนประวัติ
- fix bug call function in certificate
This commit is contained in:
Warunee Tamkoo 2023-08-11 23:47:18 +07:00
parent d09dbda153
commit d163ac8e1c
9 changed files with 341 additions and 1422 deletions

View file

@ -411,6 +411,77 @@ export const useCounterMixin = defineStore("mixin", () => {
});
};
//*** Dialog ***//
const dialogConfirm = (
q: any,
ok?: Function,
title?: string, // ถ้ามี cancel action ใส่เป็น null
desc?: string, // ถ้ามี cancel action ใส่เป็น null
cancel?: Function
) => {
q.dialog({
component: CustomComponent,
componentProps: {
title: title && title != null ? title : "ยืนยันการบันทึก",
message:
desc && desc != null
? desc
: "ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?",
icon: "info",
color: "public",
textOk: "ตกลง",
onlycancel: false,
},
})
.onOk(() => {
if (ok) ok();
})
.onCancel(() => {
if (cancel) cancel();
});
};
const dialogRemove = (q: any, ok?: Function, cancel?: Function) => {
q.dialog({
component: CustomComponent,
componentProps: {
title: "ยืนยันการลบข้อมูล",
message: "ต้องการยืนยันการลบข้อมูลนี้ใช่หรือไม่?",
icon: "delete",
color: "red",
textOk: "ตกลง",
onlycancel: false,
},
})
.onOk(() => {
if (ok) ok();
})
.onCancel(() => {
if (cancel) cancel();
});
};
const dialogMessageNotify = (
q: any,
desc?: string, // ถ้ามี cancel action ใส่เป็น null
cancel?: Function
) => {
q.dialog({
component: CustomComponent,
componentProps: {
title: "ข้อความแจ้งเตือน",
message: desc && desc != null ? desc : "กรุณากรอกข้อมูลให้ครบ",
icon: "warning",
color: "orange",
textOk: "ตกลง",
onlycancel: true,
},
}).onCancel(() => {
if (cancel) cancel();
});
};
//*** END Dialog ***//
const showLoader = () => {
Loading.show({
spinner: QSpinnerCube,
@ -718,5 +789,9 @@ export const useCounterMixin = defineStore("mixin", () => {
typeChangeName,
statusLeave,
modalWarning,
// common dialog
dialogConfirm,
dialogRemove,
dialogMessageNotify
};
});