ปรับ dialog บรรจุ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-17 11:40:46 +07:00
parent 508fb3b02b
commit 1881aa1b2f
23 changed files with 1064 additions and 1072 deletions

View file

@ -9,7 +9,14 @@ import config from "@/app.config";
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { date2Thai, hideLoader, messageError, showLoader, success } = mixin; //
const {
date2Thai,
hideLoader,
messageError,
showLoader,
success,
dialogConfirm,
} = mixin; //
const notFound = ref<string>("ไม่พบข้อมูลที่ค้นหา");
const noData = ref<string>("ไม่พบข้อมูลผังโครงสร้าง");
@ -204,16 +211,21 @@ const clickEditRow = () => {
const closeModal = () => {
if (editDataStatus.value == true) {
$q.dialog({
title: `ข้อมูลมีการแก้ไข`,
message: `ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่?`,
cancel: "ยกเลิก",
ok: "ยืนยัน",
persistent: true,
}).onOk(() => {
editDataStatus.value = false;
closeAndClear();
});
dialogConfirm(
$q,
() => closeAndClear(),
"ข้อมูลมีการแก้ไข",
"ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่"
);
// $q.dialog({
// title: ``,
// message: `?`,
// cancel: "",
// ok: "",
// persistent: true,
// }).onOk(() => {
// closeAndClear();
// });
} else {
closeAndClear();
}
@ -234,6 +246,7 @@ const closeAndClear = async () => {
// dataForm.salaryAmount = null;
// dataForm.mouthSalaryAmount = null;
// dataForm.positionSalaryAmount = null;
editDataStatus.value = false;
};
//
const posNoOptions = ref<Object[]>([
@ -431,32 +444,53 @@ function findByPerson(element: any): any {
return null;
}
const clearPosition = () => {
console.log(personal.value);
$q.dialog({
title: "ยืนยันการคืนตำแหน่ง",
message: "ต้องการยืนยันการคืนตำแหน่งนี้ใช่หรือไม่ ?",
cancel: {
flat: true,
const: "negative",
},
persistent: true,
})
.onOk(async () => {
showLoader();
await http
.post(config.API.clearPosition(personal.value.personalId), {})
.then((res: Object) => success($q, "คืนตำแหน่งสำเร็จ"))
.catch((e: Object) => {
console.log(e);
})
.finally(async () => {
hideLoader();
await closeAndClear();
});
// console.log(personal.value);
dialogConfirm(
$q,
async () => postClearPosition(),
"ยืนยันการคืนตำแหน่ง",
"ต้องการยืนยันการคืนตำแหน่งนี้ใช่หรือไม่ ?"
);
// $q.dialog({
// title: "",
// message: " ?",
// cancel: {
// flat: true,
// const: "negative",
// },
// persistent: true,
// })
// .onOk(async () => {
// showLoader();
// await http
// .post(config.API.clearPosition(personal.value.personalId), {})
// .then((res: Object) => success($q, ""))
// .catch((e: Object) => {
// console.log(e);
// })
// .finally(async () => {
// hideLoader();
// await closeAndClear();
// });
// })
// .onCancel(() => {})
// .onDismiss(() => {});
};
const postClearPosition = async () => {
showLoader();
await http
.post(config.API.clearPosition(personal.value.personalId), {})
.then(() => {
success($q, "คืนตำแหน่งสำเร็จ");
})
.onCancel(() => {})
.onDismiss(() => {});
.catch((e: Object) => {
console.log(e);
})
.finally(async () => {
hideLoader();
await closeAndClear();
});
};
</script>