validate แบบรายงานการประเมินฯ

This commit is contained in:
setthawutttty 2023-09-08 09:52:07 +07:00
parent 1369946b24
commit f78a5c78df

View file

@ -7,7 +7,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const myForm = ref<QForm>();
const myForm = ref<any>(null);
const mixin = useCounterMixin();
const router = useRouter();
const {
@ -18,6 +18,7 @@ const {
showLoader,
hideLoader,
dialogConfirm,
dialogMessageNotify
} = mixin;
const route = useRoute();
const assignId = ref<string>(route.params.form.toString());
@ -28,9 +29,13 @@ const mentors = ref<any>([]);
const commander = ref<any>([]);
const status = ref<boolean>(true);
const saveEdit = (id: string) => {
dialogConfirm($q, async () => {
await postData("put");
const saveEdit = async (id: string) => {
await myForm.value.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, async () => await postData("put"));
}else {
dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ");
}
});
};
const edit = () => {
@ -49,7 +54,6 @@ const fecthAssign = async (id: string) => {
await http
.get(config.API.evaluateReportcreate(id))
.then((res) => {
console.log(res);
// assign.value = res.data.data.assign;
mentors.value = res.data.data.mentors;
// date_start.value = assign.value.date_start;
@ -87,7 +91,6 @@ const fecthResult = async (id: string) => {
.then(async (res: any) => {
if (res.data.data != null) {
const data = await res.data.data.evaluate;
console.log("data ===>", data);
// fullname.value = res.data.data.profile.name;
date_start.value = data.date_start;
@ -127,9 +130,11 @@ const director_id3 = ref<any>(null);
const optionDirector = ref<any>([]);
const savaForm = async () => {
await myForm.value!.validate().then((result: boolean) => {
await myForm.value.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, async () => await postData("post"));
}else {
dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ");
}
});
};
@ -419,6 +424,7 @@ const selectRuslt = () => {
</div>
<div class="col-12 row q-mt-lg">
<div class="col-12">
<q-input
hide-bottom-space
dense
@ -428,8 +434,9 @@ const selectRuslt = () => {
class="bg-white"
type="textarea"
v-model="reson"
lazy-rules
label="เหตุผล"
:rules="[(val) => !!val || 'กรุณาระบุเหตุผล']"
:rules="[(val) => !!val && val.length > 0 || 'กรุณาระบุเหตุผล']"
/>
</div>
</div>