เพิ่ม push.router

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-11 17:56:01 +07:00
parent 649e201540
commit d09dbda153
2 changed files with 260 additions and 72 deletions

View file

@ -19,12 +19,12 @@ const {
hideLoader, hideLoader,
} = mixin; } = mixin;
const route = useRoute(); const route = useRoute();
const router = useRouter();
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
const assign = ref<any>([]); const assign = ref<any>([]);
const mentors = ref<any>([]); const mentors = ref<any>([]);
const commander = ref<any>([]); const commander = ref<any>([]);
const status = ref<boolean>(true);
const evaluate = ref<any>([]); const evaluate = ref<any>([]);
onMounted(() => { onMounted(() => {
@ -39,6 +39,8 @@ const fecthAssign = async (id: string) => {
console.log(res); console.log(res);
assign.value = res.data.data.assign; assign.value = res.data.data.assign;
mentors.value = res.data.data.mentors; mentors.value = res.data.data.mentors;
date_start.value = assign.value.date_start;
date_finish.value = assign.value.date_finish;
director_id.value = res.data.data.commander.name; director_id.value = res.data.data.commander.name;
director_id2.value = mentors.value[0].name; director_id2.value = mentors.value[0].name;
@ -55,14 +57,14 @@ const fecthAssign = async (id: string) => {
hideLoader(); hideLoader();
}); });
}; };
const date_start = ref<Date>(new Date("10-10-2023")); const date_start = ref<Date>(new Date());
const date_finish = ref<Date>(); const date_finish = ref<Date>();
const develop = ref<number>(); const develop = ref<number>();
const result = ref<number>(); const result = ref<number>();
const reson = ref<string>(""); const reson = ref<string>("");
const chairman_dated = ref<string>(""); const chairman_dated = ref<string>("");
const director1_dated = ref<string>(""); const director1_dated = ref<any>("");
const director2_dated = ref<string>(""); const director2_dated = ref<any>("");
const fecthResult = async (id: string) => { const fecthResult = async (id: string) => {
await http await http
.get(config.API.evaluateReport(id)) .get(config.API.evaluateReport(id))
@ -77,6 +79,7 @@ const fecthResult = async (id: string) => {
chairman_dated.value = data.chairman_dated; chairman_dated.value = data.chairman_dated;
director1_dated.value = data.director1_dated; director1_dated.value = data.director1_dated;
director2_dated.value = data.director2_dated; director2_dated.value = data.director2_dated;
status.value = false;
}) })
.catch((e) => { .catch((e) => {
console.log(e); console.log(e);
@ -87,11 +90,11 @@ const fecthResult = async (id: string) => {
const options = [ const options = [
{ value: 1, label: "พัฒนาครบ 3 ส่วน" }, { value: 1, label: "พัฒนาครบ 3 ส่วน" },
{ value: 0, label: "พัฒนาไม่ครบ 3 ส่วน" }, { value: 2, label: "พัฒนาไม่ครบ 3 ส่วน" },
]; ];
const optionsResult = [ const optionsResult = [
{ value: 1, label: "ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อ" }, { value: 1, label: "ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อ" },
{ value: 0, label: "ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกจากราชการ" }, { value: 2, label: "ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกจากราชการ" },
]; ];
const director_id = ref<any>(null); const director_id = ref<any>(null);
@ -272,6 +275,7 @@ const postData = async () => {
emit-value emit-value
map-options map-options
option-label="label" option-label="label"
option-value="value"
outlined outlined
v-model="result" v-model="result"
label="ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ" label="ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ"
@ -371,7 +375,6 @@ const postData = async () => {
:options="optionDirector" :options="optionDirector"
label="" label=""
option-label="name" option-label="name"
/> />
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<datepicker <datepicker
@ -430,7 +433,6 @@ const postData = async () => {
:options="optionDirector" :options="optionDirector"
label="" label=""
option-label="name" option-label="name"
/> />
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<datepicker <datepicker
@ -479,7 +481,12 @@ const postData = async () => {
<q-toolbar class="text-primary"> <q-toolbar class="text-primary">
<q-space /> <q-space />
<q-btn label="บันทึก" color="secondary" @click="savaForm" /> <q-btn
label="บันทึก"
color="secondary"
@click="savaForm"
v-if="status"
/>
</q-toolbar> </q-toolbar>
</q-form> </q-form>
</div> </div>

View file

@ -3,10 +3,24 @@
<q-form ref="myForm" class="q-pa-md"> <q-form ref="myForm" class="q-pa-md">
<div class="row col-12 q-col-gutter-x-lg q-col-gutter-y-md"> <div class="row col-12 q-col-gutter-x-lg q-col-gutter-y-md">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined dense lazy-rules v-model="typeOrder" <selector
:rules="[(val: string) => !!val || `${'กรุณาเลือกประเภทคำสั่ง'}`]" hide-bottom-space :class="getClass(true)"
:label="`${'ประเภทคำสั่ง'}`" @update:modelValue="clickEditRow" emit-value map-options option-label="name" outlined
:options="typeOrderOption" option-value="id" use-input input-debounce="0" /> dense
lazy-rules
v-model="typeOrder"
:rules="[(val: string) => !!val || `${'กรุณาเลือกประเภทคำสั่ง'}`]"
hide-bottom-space
:label="`${'ประเภทคำสั่ง'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="typeOrderOption"
option-value="id"
use-input
input-debounce="0"
/>
<!-- @filter="(inputValue:string, <!-- @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'typeOrderOption' doneFn:Function) => filterSelector(inputValue, doneFn,'typeOrderOption'
) " --> ) " -->
@ -15,36 +29,73 @@
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<!-- :readonly="!edit" <!-- :readonly="!edit"
:borderless="!edit" --> :borderless="!edit" -->
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="nameOrder" <q-input
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]" :label="`${'คำสั่งเรื่อง'}`" :class="getClass(true)"
@update:modelValue="clickEditRow" hide-bottom-space /> outlined
dense
lazy-rules
v-model="nameOrder"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]"
:label="`${'คำสั่งเรื่อง'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div> </div>
<div class="row col-xs-7 col-md-3 q-col-gutter-x-xs"> <div class="row col-xs-7 col-md-3 q-col-gutter-x-xs">
<div class="col-6"> <div class="col-6">
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="command" <q-input
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่ง'}`]" :label="`${'คำสั่ง'}`" @update:modelValue="clickEditRow" :class="getClass(true)"
hide-bottom-space type="number" /> outlined
dense
lazy-rules
v-model="command"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่ง'}`]"
:label="`${'คำสั่ง'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
type="number"
/>
</div> </div>
<label class="col-1 flex justify-center items-center text-bold">/</label> <label class="col-1 flex justify-center items-center text-bold"
>/</label
>
<div class="col-5"> <div class="col-5">
<datepicker v-model="dateYear" :locale="'th'" autoApply year-picker :enableTimePicker="false" <datepicker
@update:modelValue="clickEditRow"> v-model="dateYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:modelValue="clickEditRow"
>
<template #year="{ year }">{{ year + 543 }}</template> <template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{ <template #year-overlay-value="{ value }">{{
parseInt(value + 543) parseInt(value + 543)
}}</template> }}</template>
<template #trigger> <template #trigger>
<q-input :model-value="dateYear + 543" :rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]" <q-input
:label="`${'พ.ศ.'}`" dense outlined> :model-value="dateYear + 543"
:rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
:label="`${'พ.ศ.'}`"
dense
outlined
>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
</div> </div>
</div> </div>
<div class="col-xs-5 col-md-3"> <div class="col-xs-5 col-md-3">
<datepicker menu-class-name="modalfix" v-model="dateCommand" :locale="'th'" autoApply borderless <datepicker
:enableTimePicker="false" week-start="0"> menu-class-name="modalfix"
v-model="dateCommand"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -52,12 +103,24 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="dateCommand != null ? date2Thai(dateCommand) : null <q-input
" :label="`${'วันที่มีผลออกคำสั่ง'}`" :rules="[ outlined
(val) => !!val || `${'กรุณาเลือกวันที่มีผลออกคำสั่ง'}`, dense
]"> class="full-width datepicker"
:model-value="
dateCommand != null ? date2Thai(dateCommand) : null
"
:label="`${'วันที่มีผลออกคำสั่ง'}`"
:rules="[
(val) => !!val || `${'กรุณาเลือกวันที่มีผลออกคำสั่ง'}`,
]"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> <q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -66,10 +129,24 @@
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined dense lazy-rules v-model="byOrder" <selector
:rules="[(val: string) => !!val || `${'กรุณาเลือกคำสั่งโดย'}`]" hide-bottom-space :label="`${'คำสั่งโดย'}`" :class="getClass(true)"
@update:modelValue="clickEditRow" emit-value map-options option-label="name" :options="byOrderOption" outlined
option-value="id" use-input input-debounce="0" /> dense
lazy-rules
v-model="byOrder"
:rules="[(val: string) => !!val || `${'กรุณาเลือกคำสั่งโดย'}`]"
hide-bottom-space
:label="`${'คำสั่งโดย'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="byOrderOption"
option-value="id"
use-input
input-debounce="0"
/>
<!-- @filter="(inputValue:string, <!-- @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'byOrderOption' doneFn:Function) => filterSelector(inputValue, doneFn,'byOrderOption'
) " --> ) " -->
@ -77,25 +154,55 @@
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<!-- :readonly="!edit" <!-- :readonly="!edit"
:borderless="!edit" --> :borderless="!edit" -->
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="nameCommand" <q-input
:rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]" :label="`${'ผู้มีอำนาจลงนาม'}`" :class="getClass(true)"
@update:modelValue="clickEditRow" hide-bottom-space /> outlined
dense
lazy-rules
v-model="nameCommand"
:rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]"
:label="`${'ผู้มีอำนาจลงนาม'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<!-- :readonly="!edit" <!-- :readonly="!edit"
:borderless="!edit" --> :borderless="!edit" -->
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="positionCommand" <q-input
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]" :label="`${'ตำแหน่งผู้มีอำนาจลงนาม'}`" :class="getClass(true)"
@update:modelValue="clickEditRow" hide-bottom-space /> outlined
dense
lazy-rules
v-model="positionCommand"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]"
:label="`${'ตำแหน่งผู้มีอำนาจลงนาม'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div> </div>
<div class="col-12"> <div class="col-12">
<q-separator /> <q-separator />
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined dense lazy-rules v-model="examRound" <selector
:rules="[(val: string) => !!val || `${'กรุณาเลือกรอบการสอบ'}`]" hide-bottom-space :label="`${'รอบการสอบ'}`" :class="getClass(true)"
@update:modelValue="clickEditRow" emit-value map-options option-label="examRoundName" outlined
:options="examRoundOption" option-value="examRoundValue" use-input input-debounce="0" /> dense
lazy-rules
v-model="examRound"
:rules="[(val: string) => !!val || `${'กรุณาเลือกรอบการสอบ'}`]"
hide-bottom-space
:label="`${'รอบการสอบ'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="examRoundName"
:options="examRoundOption"
option-value="examRoundValue"
use-input
input-debounce="0"
/>
<!-- @filter="(inputValue:string, <!-- @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'testOption' doneFn:Function) => filterSelector(inputValue, doneFn,'testOption'
) " --> ) " -->
@ -109,18 +216,39 @@
filterSelector(inputValue, doneFn,'positionOption' ) " --> filterSelector(inputValue, doneFn,'positionOption' ) " -->
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined dense lazy-rules v-model="register" <selector
:rules="[(val: string) => !!val || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)'}`]" hide-bottom-space :class="getClass(true)"
:label="`${'มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)'}`" @update:modelValue="clickEditRow" emit-value outlined
map-options option-label="name" :options="registerOption" option-value="id" use-input input-debounce="0" /> dense
lazy-rules
v-model="register"
:rules="[(val: string) => !!val || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)'}`]"
hide-bottom-space
:label="`${'มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="registerOption"
option-value="id"
use-input
input-debounce="0"
/>
</div> </div>
<!-- @filter="(inputValue:string, <!-- @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'registerOption' doneFn:Function) => filterSelector(inputValue, doneFn,'registerOption'
) " --> ) " -->
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<datepicker menu-class-name="modalfix" v-model="dateRegister" :locale="'th'" autoApply borderless <datepicker
:enableTimePicker="false" week-start="0"> menu-class-name="modalfix"
v-model="dateRegister"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -128,13 +256,25 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="dateRegister != null ? date2Thai(dateRegister) : null <q-input
" :label="`${'ลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`" :rules="[ outlined
(val) => dense
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`, class="full-width datepicker"
]"> :model-value="
dateRegister != null ? date2Thai(dateRegister) : null
"
:label="`${'ลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`,
]"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> <q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -142,18 +282,38 @@
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined dense lazy-rules v-model="announce" <selector
:class="getClass(true)"
outlined
dense
lazy-rules
v-model="announce"
:rules="[(val: string) => !!val || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`]" :rules="[(val: string) => !!val || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`]"
hide-bottom-space :label="`${'มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`" @update:modelValue="clickEditRow" hide-bottom-space
emit-value map-options option-label="name" :options="announceOption" option-value="id" use-input :label="`${'มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`"
input-debounce="0" /> @update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="announceOption"
option-value="id"
use-input
input-debounce="0"
/>
<!-- @filter="(inputValue:string, <!-- @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'announceOption' doneFn:Function) => filterSelector(inputValue, doneFn,'announceOption'
) " --> ) " -->
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<datepicker menu-class-name="modalfix" v-model="dateAnnounce" :locale="'th'" autoApply borderless <datepicker
:enableTimePicker="false" week-start="0"> menu-class-name="modalfix"
v-model="dateAnnounce"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -161,13 +321,25 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="dateAnnounce != null ? date2Thai(dateAnnounce) : null <q-input
" :label="`${'ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`" :rules="[ outlined
(val) => dense
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`, class="full-width datepicker"
]"> :model-value="
dateAnnounce != null ? date2Thai(dateAnnounce) : null
"
:label="`${'ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`,
]"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> <q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -199,14 +371,22 @@ import type {
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { QForm } from "quasar"; import type { QForm } from "quasar";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai, messageError, showLoader, hideLoader, success, dialogMessage } = mixin; const {
date2Thai,
messageError,
showLoader,
hideLoader,
success,
dialogMessage,
} = mixin;
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
const route = useRoute(); const route = useRoute();
const router = useRouter();
const props = defineProps({ const props = defineProps({
next: { next: {
@ -398,7 +578,7 @@ const fecthExamRoundOption = async () => {
examRoundOption.value = res.data.result; examRoundOption.value = res.data.result;
console.log(examRoundOption.value); console.log(examRoundOption.value);
}) })
.catch((e) => { }); .catch((e) => {});
}; };
const submit = async () => { const submit = async () => {
const formdata = { const formdata = {
@ -446,6 +626,7 @@ const createListOrder = async (formData: Object) => {
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
localStorage.setItem("orderId", data.id); localStorage.setItem("orderId", data.id);
router.push(`/order/detail/${data.id}?step=${2}`);
next(); next();
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
}) })