เพิ่ม validate

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-07 16:49:14 +07:00
parent b03cf1d5be
commit 059e295689
3 changed files with 65 additions and 91 deletions

View file

@ -290,7 +290,8 @@ import { useCounterMixin } from "@/stores/mixin";
import type { resMain } from "@/modules/06_retirement/interface/response/Main";
const mixin = useCounterMixin();
const { messageError, date2Thai, showLoader, hideLoader } = mixin;
const { messageError, date2Thai, showLoader, hideLoader, dialogConfirm } =
mixin;
const router = useRouter();
const $q = useQuasar(); // noti quasar
const modal = ref<boolean>(false);
@ -482,54 +483,22 @@ const rows2 = ref<FormMainProbation2[]>([
// };
const clickAdd = () => {
// console.log(rows.value.length, type.value);
console.log(rows.value.length, type.value);
if (rows.value.length == 0) {
$q.dialog({
title: "ยืนยันการเพิ่มข้อมูลประกาศเกษียณ",
message: "ต้องการเพิ่มข้อมูลประกาศเกษียณใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
dialogConfirm(
$q,
async () => {
let data = { type: type.value, year: currentYear };
await cerateRetirement(data);
})
.onCancel(() => {})
.onDismiss(() => {});
},
"ยืนยันการเพิ่มข้อมูลประกาศเกษียณ",
"ต้องการเพิ่มข้อมูลประกาศเกษียณใช่หรือไม่ ?"
);
} else {
modal.value = true;
action.value = "";
radio.value = "";
}
// $q.dialog({
// title: "",
// message: "",
// options: {
// type: "radio",
// model: "opt1",
// // inline: true
// items: [
// { label: "", value: "ADD" },
// { label: "", value: "EDIT" },
// { label: "", value: "REMOVE" },
// ],
// },
// cancel: {
// flat: true,
// color: "negative",
// },
// persistent: true,
// })
// .onOk((data) => {
// console.log("option===>", data);
// router.push(`/retirement/list/${type.value}/${currentYear}`);
// })
// .onCancel(() => {})
// .onDismiss(() => {});
};
const cerateRetirement = async (data: object) => {
await http
@ -544,40 +513,26 @@ const cerateRetirement = async (data: object) => {
});
};
const clickSelect = async (action: string) => {
// console.log(action);
// console.log(radio.value);
$q.dialog({
title: "ยืนยันการแก้ไขข้อมูลประกาศเกษียณ",
message: "ต้องการแก้ไขข้อมูลประกาศเกษียณใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
dialogConfirm(
$q,
async () => {
let data = {
type: type.value,
year: currentYear,
retireHistoryId: action,
option: radio.value,
};
// console.log(data);
await cerateRetirement(data);
})
.onCancel(() => {})
.onDismiss(() => {});
},
"ยืนยันการแก้ไขข้อมูลประกาศเกษียณ",
"ต้องการแก้ไขข้อมูลประกาศเกษียณใช่หรือไม่ ?"
);
};
// const clickClose = async () => {
// modal.value = false;
// };
const checkjson = ref<boolean>();
const checkststus = (data: any) => {
let jsonfasle = data.find((e: any) => e.document == false);
// console.log(jsonfasle)