fix api ออกคำสั่ง & set value step 1

This commit is contained in:
Warunee Tamkoo 2023-08-04 15:12:23 +07:00
parent cb2379a231
commit fef7c21fcd
3 changed files with 89 additions and 259 deletions

View file

@ -54,8 +54,10 @@ export default {
// order // order
yearOptionsOrder: () => `${order}/order/fiscal-year`, yearOptionsOrder: () => `${order}/order/fiscal-year`,
createOrder: () => `${order}/order/detail`,
listOrder: () => `${order}/order`, listOrder: () => `${order}/order`,
detailOrder:(orderId:string) => `${order}/order/${orderId}`, detailOrder:(orderId:string) => `${order}/order/detail/${orderId}`,
deleteOrder:(orderId:string) => `${order}/order/${orderId}`,
typeOrder: () => `${order}/order/order-type`, typeOrder: () => `${order}/order/order-type`,
examroundOrder: () => `${order}/order/detail/exam-round`, examroundOrder: () => `${order}/order/detail/exam-round`,
}; };

View file

@ -423,7 +423,7 @@ const clickDelete = (id: string) => {
const deleteData = async (id: string) => { const deleteData = async (id: string) => {
showLoader(); showLoader();
await http await http
.delete(config.API.detailOrder(id)) .delete(config.API.deleteOrder(id))
.then((res) => { .then((res) => {
success($q, "ลบข้อมูลสำเร็จ"); success($q, "ลบข้อมูลสำเร็จ");
}) })

View file

@ -3,24 +3,10 @@
<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 <selector :class="getClass(true)" outlined dense lazy-rules v-model="typeOrder"
:class="getClass(true)" :rules="[(val: string) => !!val || `${'กรุณาเลือกประเภทคำสั่ง'}`]" hide-bottom-space
outlined :label="`${'ประเภทคำสั่ง'}`" @update:modelValue="clickEditRow" emit-value map-options option-label="name"
dense :options="typeOrderOption" option-value="id" use-input input-debounce="0" />
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'
) " --> ) " -->
@ -29,73 +15,36 @@
<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 <q-input :class="getClass(true)" outlined dense lazy-rules v-model="nameOrder"
:class="getClass(true)" :rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]" :label="`${'คำสั่งเรื่อง'}`"
outlined @update:modelValue="clickEditRow" hide-bottom-space />
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 <q-input :class="getClass(true)" outlined dense lazy-rules v-model="command"
:class="getClass(true)" :rules="[(val) => !!val || `${'กรุณากรอกคำสั่ง'}`]" :label="`${'คำสั่ง'}`" @update:modelValue="clickEditRow"
outlined hide-bottom-space type="number" />
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 class="col-1 flex justify-center items-center text-bold">/</label>
>/</label
>
<div class="col-5"> <div class="col-5">
<datepicker <datepicker v-model="dateYear" :locale="'th'" autoApply year-picker :enableTimePicker="false"
v-model="dateYear" @update:modelValue="clickEditRow">
: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 <q-input :model-value="dateYear + 543" :rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
:model-value="dateYear + 543" :label="`${'พ.ศ.'}`" dense outlined>
: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 <datepicker menu-class-name="modalfix" v-model="dateCommand" :locale="'th'" autoApply borderless
menu-class-name="modalfix" :enableTimePicker="false" week-start="0">
v-model="dateCommand"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -103,24 +52,12 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input <q-input outlined dense class="full-width datepicker" :model-value="dateCommand != null ? date2Thai(dateCommand) : null
outlined " :label="`${'วันที่มีผลออกคำสั่ง'}`" :rules="[
dense (val) => !!val || `${'กรุณาเลือกวันที่มีผลออกคำสั่ง'}`,
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 <q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)">
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -129,24 +66,10 @@
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector <selector :class="getClass(true)" outlined dense lazy-rules v-model="byOrder"
:class="getClass(true)" :rules="[(val: string) => !!val || `${'กรุณาเลือกคำสั่งโดย'}`]" hide-bottom-space :label="`${'คำสั่งโดย'}`"
outlined @update:modelValue="clickEditRow" emit-value map-options option-label="name" :options="byOrderOption"
dense option-value="id" use-input input-debounce="0" />
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'
) " --> ) " -->
@ -154,115 +77,50 @@
<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 <q-input :class="getClass(true)" outlined dense lazy-rules v-model="nameCommand"
:class="getClass(true)" :rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]" :label="`${'ผู้มีอำนาจลงนาม'}`"
outlined @update:modelValue="clickEditRow" hide-bottom-space />
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 <q-input :class="getClass(true)" outlined dense lazy-rules v-model="positionCommand"
:class="getClass(true)" :rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]" :label="`${'ตำแหน่งผู้มีอำนาจลงนาม'}`"
outlined @update:modelValue="clickEditRow" hide-bottom-space />
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 <selector :class="getClass(true)" outlined dense lazy-rules v-model="examRound"
:class="getClass(true)" :rules="[(val: string) => !!val || `${'กรุณาเลือกรอบการสอบ'}`]" hide-bottom-space :label="`${'รอบการสอบ'}`"
outlined @update:modelValue="clickEditRow" emit-value map-options option-label="examRoundName"
dense :options="examRoundOption" option-value="examRoundValue" use-input input-debounce="0" />
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'
) " --> ) " -->
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector <selector :class="getClass(true)" outlined dense lazy-rules v-model="position"
:class="getClass(true)" :rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่งรับสมัคร'}`]" hide-bottom-space
outlined :label="`${'ตำแหน่งรับสมัคร'}`" @update:modelValue="clickEditRow" emit-value map-options option-label="name"
dense :options="positionOption" option-value="id" use-input input-debounce="0" />
lazy-rules
v-model="position"
:rules="[(val:string) => !!val || `${'กรุณาเลือกตำแหน่งรับสมัคร'}`]"
hide-bottom-space
:label="`${'ตำแหน่งรับสมัคร'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionOption"
option-value="id"
use-input
input-debounce="0"
/>
<!-- @filter="(inputValue:string, doneFn:Function) => <!-- @filter="(inputValue:string, doneFn:Function) =>
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 <selector :class="getClass(true)" outlined dense lazy-rules v-model="register"
:class="getClass(true)" :rules="[(val: string) => !!val || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)'}`]" hide-bottom-space
outlined :label="`${'มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)'}`" @update:modelValue="clickEditRow" emit-value
dense map-options option-label="name" :options="registerOption" option-value="id" use-input input-debounce="0" />
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 <datepicker menu-class-name="modalfix" v-model="dateRegister" :locale="'th'" autoApply borderless
menu-class-name="modalfix" :enableTimePicker="false" week-start="0">
v-model="dateRegister"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -270,25 +128,13 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input <q-input outlined dense class="full-width datepicker" :model-value="dateRegister != null ? date2Thai(dateRegister) : null
outlined " :label="`${'ลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`" :rules="[
dense (val) =>
class="full-width datepicker" !!val || `${'กรุณาเลือกลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`,
:model-value=" ]">
dateRegister != null ? date2Thai(dateRegister) : null
"
:label="`${'ลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`,
]"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)">
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -296,38 +142,18 @@
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector <selector :class="getClass(true)" outlined dense lazy-rules v-model="announce"
:class="getClass(true)" :rules="[(val: string) => !!val || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`]"
outlined hide-bottom-space :label="`${'มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`" @update:modelValue="clickEditRow"
dense emit-value map-options option-label="name" :options="announceOption" option-value="id" use-input
lazy-rules input-debounce="0" />
v-model="announce"
:rules="[(val:string) => !!val || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`]"
hide-bottom-space
:label="`${'มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`"
@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 <datepicker menu-class-name="modalfix" v-model="dateAnnounce" :locale="'th'" autoApply borderless
menu-class-name="modalfix" :enableTimePicker="false" week-start="0">
v-model="dateAnnounce"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -335,25 +161,13 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input <q-input outlined dense class="full-width datepicker" :model-value="dateAnnounce != null ? date2Thai(dateAnnounce) : null
outlined " :label="`${'ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`" :rules="[
dense (val) =>
class="full-width datepicker" !!val || `${'กรุณาเลือกลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`,
:model-value=" ]">
dateAnnounce != null ? date2Thai(dateAnnounce) : null
"
:label="`${'ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`,
]"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)">
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -429,7 +243,7 @@ const typeOrderOptionFilter = ref<DataOption1[]>([]);
const byOrder = ref<string>(""); const byOrder = ref<string>("");
const byOrderOption = ref<DataOption1[]>([ const byOrderOption = ref<DataOption1[]>([
{ name: "นายคำสั่งที่ 1", id: "3fa85f64-5717-4562-b3fc-2c963f66afa6" }, { name: "นายดด นน", id: "3fa85f64-5717-4562-b3fc-2c963f66afa6" },
]); ]);
const byOrderOptionFilter = ref<DataOption1[]>([]); const byOrderOptionFilter = ref<DataOption1[]>([]);
@ -447,7 +261,7 @@ const announceOptionFilter = ref<DataOption[]>([]);
const position = ref<string>(""); const position = ref<string>("");
const positionOption = ref<DataOption1[]>([ const positionOption = ref<DataOption1[]>([
{ name: "นายก", id: "3fa85f64-5717-4562-b3fc-2c963f66afa6" }, { name: "ผู้ช่วย", id: "3fa85f64-5717-4562-b3fc-2c963f66afa6" },
]); ]);
const positionOptionFilter = ref<DataOption[]>([]); const positionOptionFilter = ref<DataOption[]>([]);
@ -541,8 +355,22 @@ const fetchdetailOrder = async () => {
let orderIdString = orderId.toString(); let orderIdString = orderId.toString();
await http await http
.get(config.API.detailOrder(orderIdString)) .get(config.API.detailOrder(orderIdString))
.then((res) => { .then((res: any) => {
console.log(res); const data = res.data.result;
typeOrder.value = data.orderTypeValue;
nameOrder.value = data.orderTitle;
command.value = data.orderNo;
dateYear.value = Number(data.orderYear);
dateCommand.value = data.orderDate;
byOrder.value = data.orderBy;
nameCommand.value = data.signatoryBy;
positionCommand.value = data.signatoryPosition;
examRound.value = data.examRound;
position.value = data.registerPosition;
register.value = data.conclusionRegisterNo;
dateRegister.value = data.conclusionRegisterDate;
announce.value = data.conclusionResultNo;
dateAnnounce.value = data.conclusionResultDate;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -570,7 +398,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 = {
@ -609,7 +437,7 @@ const submit = async () => {
const createListOrder = async (formData: Object) => { const createListOrder = async (formData: Object) => {
console.log(formData); console.log(formData);
await http await http
.post(config.API.listOrder(), formData) .post(config.API.createOrder(), formData)
.then((res) => { .then((res) => {
console.log(res); console.log(res);
next(); next();