Merge branch 'develop' into warunee-dev

This commit is contained in:
Warunee Tamkoo 2023-08-08 11:17:30 +07:00
commit 069851ce90
10 changed files with 1141 additions and 654 deletions

View file

@ -46,23 +46,59 @@ export default {
//education
placementEducationId: (id: string) => `${placement}/education/${id}`,
// position
// position
placementPosition: () => `${placement}/position/use`,
// putPositiom
putPosition: (id: any) => `${placement}/position/${id}`,
// clear Position
clearPosition: (personalId: string) => `${placement}/position/clear/${personalId}`,
clearPosition: (personalId: string) =>
`${placement}/position/clear/${personalId}`,
// order
yearOptionsOrder: () => `${order}/order/fiscal-year`,
createOrder: () => `${order}/order/detail`,
listOrder: () => `${order}/order`,
detailOrder: (orderId: string) => `${order}/order/detail/${orderId}`,
deleteOrder: (orderId: string) => `${order}/order/${orderId}`,
typeOrder: () => `${order}/order/order-type`,
examroundOrder: () => `${order}/order/detail/exam-round`,
attachmentOrder: (orderId: string) => `${order}/order/attachment/${orderId}`,
createOrder: () => `${order}/order/detail`,
examroundOrder: () => `${order}/order/detail/exam-round`,
//ข้อมูลเลือกรายชื่อออกคำสั่ง, ลบรายชื่อ
personsOrder: (orderId: string) => `${order}/order/persons/${orderId}`,
//เปลี่ยน status ของคำสั่งไปขั้นตอนถัดไป
nextOrder: (orderId: string) => `${order}/order/next/${orderId}`,
//เปลี่ยน status ของคำสั่งไปขั้นตอนถัดไป
preventOrder: (orderId: string) => `${order}/order/prev/${orderId}`,
//สลับลำดับข้อมูลในบัญชีแนบท้ายขึ้น
swapUpOrder: (personalId: string) => `${order}/order/swap/up/${personalId}`,
//สลับลำดับข้อมูลในบัญชีแนบท้ายลง
swapDownOrder: (personalId: string) =>
`${order}/order/swap/down/${personalId}`,
//บันทึกข้อมูลเงินเดือนสำหรับผู้บรรจุ
salaryOrder: (id: string) => `${order}/order/salary/${id}`,
// popup แสดงรายชื่อตามหน่วยงานที่เลือก , popup เลือกรายชื่อส่งสำเนา
copyOrderPersonsId: (id: string) => `${order}/order/copy-order/persons/${id}`,
copyOrder: `${order}/order/copy-order`,
copyOrderId: (id: string) => `${order}/order/copy-order/${id}`,
attachmentId: (id: string) => `${order}/order/attachment/${id}`,
attachmentOrderId: (orderId: string) =>
`${order}/order/attachment/order-file/${orderId}`,
attachmentFileId: (orderId: string) =>
`${order}/order/attachment/file/${orderId}`,
orderReady: (id: string) => `${order}/order/ready/${id}`,
attachmentOrder: (orderId: string) => `${order}/order/attachment/${orderId}`,
receiveData: () => `${receive}`,
receiveDataId: (id: string) => `${receive}/${id}`,

View file

@ -48,6 +48,7 @@
:name="4"
title="รายละเอียดคำสั่งและแนบท้าย"
prefix="4"
:done="step > 4"
:header-nav="step > 4"
/>
<template v-slot:message>
@ -61,8 +62,12 @@
</template>
<script setup lang="ts">
import { useRouter } from "vue-router";
import { ref, defineAsyncComponent, onMounted } from "vue";
import { ref, defineAsyncComponent, onMounted, onUnmounted } from "vue";
import type { QStepper } from "quasar";
import { useProbationDataStore } from "@/modules/05_placement/store";
const probationData = useProbationDataStore();
const { stepOrder, setStepOrder } = probationData;
const step01 = defineAsyncComponent(
() =>
@ -85,6 +90,10 @@ const router = useRouter();
const step = ref<number>(1);
const stepper = ref<QStepper>();
onUnmounted(() => {
destroyLocalStorage();
});
const nextStep = () => {
stepper.value!.next();
localStorage.setItem("currentStep", step.value.toString());

View file

@ -3,10 +3,24 @@
<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="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined 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" />
<selector
:class="getClass(true)"
outlined
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,
doneFn:Function) => filterSelector(inputValue, doneFn,'typeOrderOption'
) " -->
@ -15,36 +29,73 @@
<div class="col-xs-12 col-md-6">
<!-- :readonly="!edit"
:borderless="!edit" -->
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="nameOrder"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]" :label="`${'คำสั่งเรื่อง'}`"
@update:modelValue="clickEditRow" hide-bottom-space />
<q-input
:class="getClass(true)"
outlined
dense
lazy-rules
v-model="nameOrder"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]"
:label="`${'คำสั่งเรื่อง'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="row col-xs-7 col-md-3 q-col-gutter-x-xs">
<div class="col-6">
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="command"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่ง'}`]" :label="`${'คำสั่ง'}`" @update:modelValue="clickEditRow"
hide-bottom-space type="number" />
<q-input
:class="getClass(true)"
outlined
dense
lazy-rules
v-model="command"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่ง'}`]"
:label="`${'คำสั่ง'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
type="number"
/>
</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">
<datepicker v-model="dateYear" :locale="'th'" autoApply year-picker :enableTimePicker="false"
@update:modelValue="clickEditRow">
<datepicker
v-model="dateYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:modelValue="clickEditRow"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input :model-value="dateYear + 543" :rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
:label="`${'พ.ศ.'}`" dense outlined>
<q-input
:model-value="dateYear + 543"
:rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
:label="`${'พ.ศ.'}`"
dense
outlined
>
</q-input>
</template>
</datepicker>
</div>
</div>
<div class="col-xs-5 col-md-3">
<datepicker menu-class-name="modalfix" v-model="dateCommand" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<datepicker
menu-class-name="modalfix"
v-model="dateCommand"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
@ -52,12 +103,24 @@
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="dateCommand != null ? date2Thai(dateCommand) : null
" :label="`${'วันที่มีผลออกคำสั่ง'}`" :rules="[
(val) => !!val || `${'กรุณาเลือกวันที่มีผลออกคำสั่ง'}`,
]">
<q-input
outlined
dense
class="full-width datepicker"
:model-value="
dateCommand != null ? date2Thai(dateCommand) : null
"
:label="`${'วันที่มีผลออกคำสั่ง'}`"
:rules="[
(val) => !!val || `${'กรุณาเลือกวันที่มีผลออกคำสั่ง'}`,
]"
>
<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>
</template>
</q-input>
@ -66,10 +129,24 @@
</div>
<div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined 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" />
<selector
:class="getClass(true)"
outlined
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,
doneFn:Function) => filterSelector(inputValue, doneFn,'byOrderOption'
) " -->
@ -77,25 +154,55 @@
<div class="col-xs-12 col-md-6">
<!-- :readonly="!edit"
:borderless="!edit" -->
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="nameCommand"
:rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]" :label="`${'ผู้มีอำนาจลงนาม'}`"
@update:modelValue="clickEditRow" hide-bottom-space />
<q-input
:class="getClass(true)"
outlined
dense
lazy-rules
v-model="nameCommand"
:rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]"
:label="`${'ผู้มีอำนาจลงนาม'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-md-6">
<!-- :readonly="!edit"
:borderless="!edit" -->
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="positionCommand"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]" :label="`${'ตำแหน่งผู้มีอำนาจลงนาม'}`"
@update:modelValue="clickEditRow" hide-bottom-space />
<q-input
:class="getClass(true)"
outlined
dense
lazy-rules
v-model="positionCommand"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]"
:label="`${'ตำแหน่งผู้มีอำนาจลงนาม'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="col-12">
<q-separator />
</div>
<div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined 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" />
<selector
:class="getClass(true)"
outlined
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,
doneFn:Function) => filterSelector(inputValue, doneFn,'testOption'
) " -->
@ -109,18 +216,39 @@
filterSelector(inputValue, doneFn,'positionOption' ) " -->
</div>
<div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined 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" />
<selector
:class="getClass(true)"
outlined
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>
<!-- @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'registerOption'
) " -->
<div class="col-xs-12 col-md-6">
<datepicker menu-class-name="modalfix" v-model="dateRegister" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<datepicker
menu-class-name="modalfix"
v-model="dateRegister"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
@ -128,13 +256,25 @@
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="dateRegister != null ? date2Thai(dateRegister) : null
" :label="`${'ลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`" :rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`,
]">
<q-input
outlined
dense
class="full-width datepicker"
:model-value="
dateRegister != null ? date2Thai(dateRegister) : null
"
:label="`${'ลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง รับสมัครสอบฯ)'}`,
]"
>
<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>
</template>
</q-input>
@ -142,18 +282,38 @@
</datepicker>
</div>
<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 || `${'กรุณาเลือกมติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`]"
hide-bottom-space :label="`${'มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)'}`" @update:modelValue="clickEditRow"
emit-value map-options option-label="name" :options="announceOption" option-value="id" use-input
input-debounce="0" />
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,
doneFn:Function) => filterSelector(inputValue, doneFn,'announceOption'
) " -->
</div>
<div class="col-xs-12 col-md-6">
<datepicker menu-class-name="modalfix" v-model="dateAnnounce" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<datepicker
menu-class-name="modalfix"
v-model="dateAnnounce"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
@ -161,13 +321,25 @@
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="dateAnnounce != null ? date2Thai(dateAnnounce) : null
" :label="`${'ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`" :rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`,
]">
<q-input
outlined
dense
class="full-width datepicker"
:model-value="
dateAnnounce != null ? date2Thai(dateAnnounce) : null
"
:label="`${'ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกลงวันที่ (เรื่อง ผลการสอบแข่งขัน)'}`,
]"
>
<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>
</template>
</q-input>
@ -198,13 +370,13 @@ import type {
} from "@/modules/05_placement/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
import type { QForm } from "quasar";
import http from "@/plugins/http";
import { useQuasar } from "quasar";
import config from "@/app.config";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin();
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
const { date2Thai, messageError, showLoader, hideLoader, success } = mixin;
const $q = useQuasar(); // noti quasar
const route = useRoute();
@ -398,7 +570,7 @@ const fecthExamRoundOption = async () => {
examRoundOption.value = res.data.result;
console.log(examRoundOption.value);
})
.catch((e) => { });
.catch((e) => {});
};
const submit = async () => {
const formdata = {
@ -430,7 +602,7 @@ const submit = async () => {
}).onOk(async () => {
showLoader();
if (!orderId) {
createListOrder(formdata);
createListOrder(formdata);
} else {
let orderIdString = orderId.toString();
updateOrder(formdata, orderIdString);
@ -444,11 +616,13 @@ const createListOrder = async (formData: Object) => {
await http
.post(config.API.createOrder(), formData)
.then((res) => {
console.log(res);
const data = res.data.result;
localStorage.setItem("orderId", data.id);
next();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();
@ -462,9 +636,10 @@ const updateOrder = async (formData: Object, orderId: string) => {
.then((res) => {
console.log(res);
next();
success($q, "แก้ไขข้อมูลสำเร็จ");
})
.catch((e) => {
console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();

View file

@ -1,9 +1,10 @@
div
<template>
<div>
<div class="q-py-md q-pl-md" style="height: 68vh; overflow-y: scroll">
<div class="col-12 row q-pb-sm items-center">
<q-btn flat round color="primary" @click="refresh" icon="mdi-refresh">
<q-tooltip>ปเดตอม</q-tooltip>
<q-btn flat round color="primary" @click="refresh" icon="mdi-plus">
<q-tooltip>เพอม</q-tooltip>
</q-btn>
<q-space />
<div class="items-center" style="display: flex">
@ -52,46 +53,20 @@
:visible-columns="visibleColumns"
:filter="filter"
row-key="name"
selection="multiple"
v-model:selected="selected"
>
<!-- <template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template> -->
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-th>
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
<q-th auto-width />
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
@ -127,6 +102,19 @@
<!-- <q-tooltip>เลอนลำดบลง</q-tooltip> -->
</q-btn>
</q-td>
<q-td auto-width>
<q-btn
dense
size="12px"
flat
round
color="red"
@click="dialogDeleteData(props.row.personId)"
icon="mdi-delete"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</d-table>
@ -158,21 +146,15 @@
</q-btn> -->
</div>
</div>
<!--********************************** เงนเดอน ********************************** -->
<q-dialog v-model="modal" persistent>
<q-card style="width: 70vw; max-width: 70vw">
<q-card style="width: 50vw; max-width: 50vw">
<q-form ref="myForm">
<DialogHeader :tittle="titleName" :close="modalOpenClose" />
<q-separator />
<q-card-section class="q-pa-sm bg-grey-1">
<div class="row col-12 q-col-gutter-sm">
<div class="col-xs-12 col-sm-6 row">
<q-card flat bordered class="fit q-pa-sm">
<!-- style="height: 70vh" -->
<q-scroll-area visible> </q-scroll-area>
</q-card>
</div>
<div class="col-xs-12 col-sm-6">
<div class="col-xs-12">
<div class="col-12 row q-py-sm items-center q-col-gutter-sm">
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
@ -236,14 +218,86 @@
</q-form>
</q-card>
</q-dialog>
<!--********************************** รายช ********************************** -->
<q-dialog v-model="modalAdd" persistent>
<q-card style="width: 50vw; max-width: 50vw">
<q-form ref="myFormAdd">
<DialogHeader tittle="รายชื่อในการออกคำสั่ง" :close="modalAddChange" />
<q-separator />
<q-card-section class="q-pa-sm bg-grey-1">
<d-table
:rows="rows"
:columns="columns"
:visible-columns="visibleColumns"
:filter="filter"
row-key="name"
selection="multiple"
v-model:selected="selected"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-th>
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>{{ col.name == "no" ? props.rowIndex + 1 : col.value }}</q-td
>
</q-tr>
</template>
</d-table>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
dense
unelevated
label="บันทึก"
color="public"
@click="saveModalAdd"
class="q-px-md"
><!-- icon="mdi-content-save-outline"
<q-tooltip>นท</q-tooltip> -->
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import type { QInput } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps, QForm } from "quasar";
import { useRoute } from "vue-router";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import type { ResponseData } from "@/modules/05_placement/interface/response/Order";
import http from "@/plugins/http";
import config from "@/app.config";
const props = defineProps({
next: {
@ -259,8 +313,9 @@ const props = defineProps({
const next = () => props.next();
const previous = () => props.previous();
const mixin = useCounterMixin(); //
const { dialogMessage, messageError, showLoader, hideLoader } = mixin;
const { dialogMessage, messageError, showLoader, hideLoader, success } = mixin;
const route = useRoute();
const $q = useQuasar();
const modalData = ref<any>({
@ -269,19 +324,31 @@ const modalData = ref<any>({
mouthSalaryAmount: 0,
});
const myForm = ref<QForm | null>(null);
const myFormAdd = ref<QForm | null>(null);
const modal = ref<boolean>(false);
const modalAdd = ref<boolean>(false);
const titleName = ref<string>("");
const filterRef = ref<QInput>();
const filter = ref<string>("");
const visibleColumns = ref<String[]>(["no", "idcard", "name", "educate"]);
const visibleColumns = ref<String[]>(["no", "idCard", "name", "education"]);
const columns = ref<QTableProps["columns"]>([
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: true },
{
name: "idcard",
name: "no",
align: "left",
label: "ลำดับ",
field: "no",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "idCard",
align: "left",
label: "เลขประจำตัวประชาชน",
field: "idcard",
field: "idCard",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "name",
@ -289,94 +356,155 @@ const columns = ref<QTableProps["columns"]>([
label: "ชื่อ-สกุล",
field: "name",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "educate",
name: "education",
align: "left",
label: "วุฒิการศึกษาในการออกคำสั่ง",
field: "educate",
field: "education",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const rows = ref<any>([
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
idcard: "9158455632145",
educate: "ปริญญาตรี",
},
{
no: "0de607a0-b094-4a6d-9e30-979343ab5e53",
name: "นางขรรค์ จันทรสมบัติ",
idcard: "8558455632126",
educate: "ปริญญาตรี",
},
{
no: "93ca7366-2a35-4f94-a331-9c23c9ea78d3",
name: "นางโอภาส จรัสวงศ์",
idcard: "8158455635425",
educate: "ปริญญาตรี",
},
{
no: "d3777c19-2bd0-42df-90ce-c3eeeee55ac6",
name: "นางธิญา หงษ์ทอง",
idcard: "4558455632145",
educate: "ปริญญาตรี",
},
{
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
name: "นางธนวิทย์ พิกุลเทพ",
idcard: "5542455632145",
educate: "ปริญญาตรี",
},
{
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
name: "นางหนึ่ง สตาภิรมย์",
idcard: "7448455632145",
educate: "ปริญญาตรี",
},
{
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
name: "นางสัจพร คมคาย",
idcard: "1236455632145",
educate: "ปริญญาตรี",
},
{
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
name: "นางตุลยากร ปรีดาศิริกุล",
idcard: "1523455632145",
educate: "ปริญญาตรี",
},
{
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
name: "นางบัลลังค์ จิรวาณิชย์",
idcard: "1258455632145",
educate: "ปริญญาตรี",
},
{
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
name: "นางคมคาย เรืองรังสรรค์",
idcard: "8548455632145",
educate: "ปริญญาตรี",
},
{
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
name: "นางพรทิพา คมคาย",
idcard: "6598455632145",
educate: "ปริญญาตรี",
},
]);
const rows = ref<ResponseData[]>([]);
const selected = ref([]);
const upDown = (value: any, up: boolean = true) => {
onMounted(async () => {
await conditionData();
});
const conditionData = async () => {
const id = route.params.orderid
? route.params.orderid.toString()
: localStorage.getItem("orderId")
? localStorage.getItem("orderId")
: null;
if (id !== null) {
await getData(id);
}
};
const getData = async (id: string) => {
showLoader();
await http
.get(config.API.personsOrder(id))
.then((res) => {
const data = res.data.result;
// console.log(data);
let list: ResponseData[] = [];
data.map((r: ResponseData) => {
list.push({
education: r.education ?? "",
idCard: r.idCard ?? "",
name: r.name ?? "",
personId: r.personId ?? "",
selectStatus: r.selectStatus !== null ? r.selectStatus : false,
sequence: r.sequence !== null ? r.sequence : 0,
});
});
// console.log("list", list);
rows.value = list;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const saveSalary = async (id: string) => {
await http
.put(config.API.salaryOrder(id))
.then((res) => {
// const data = res.data.result;
// console.log(res);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const dialogDeleteData = async (id: string) => {
dialogMessage(
$q,
"ยืนยันการลบข้อมูล",
"ต้องการลบข้อมูลนี้ใช่หรือไม่?",
"mdi-help-circle-outline",
"ตกลง",
"red",
() => deleteData(id),
undefined
);
};
const deleteData = async (id: string) => {
await http
.delete(config.API.personsOrder(id))
.then((res) => {
// const data = res.data.result;
// console.log(res);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const swapUp = async (id: string) => {
// id = personalId
await http
.put(config.API.swapUpOrder(id))
.then((res) => {
// const data = res.data.result;
// console.log(res);
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await conditionData();
hideLoader();
});
};
const swapDown = async (id: string) => {
// id = personalId
await http
.put(config.API.swapDownOrder(id))
.then((res) => {
// const data = res.data.result;
// console.log(res);
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await conditionData();
hideLoader();
});
};
const upDown = async (value: any, up: boolean = true) => {
const indexCurrent = value.rowIndex;
if (up) {
rows.value[indexCurrent] = rows.value[indexCurrent - 1];
rows.value[indexCurrent - 1] = value.row;
await swapUp(value.row.personId);
// rows.value[indexCurrent] = rows.value[indexCurrent - 1];
// rows.value[indexCurrent - 1] = value.row;
} else {
rows.value[indexCurrent] = rows.value[indexCurrent + 1];
rows.value[indexCurrent + 1] = value.row;
await swapDown(value.row.personId);
// rows.value[indexCurrent] = rows.value[indexCurrent + 1];
// rows.value[indexCurrent + 1] = value.row;
}
};
@ -407,32 +535,51 @@ const modalOpenClose = () => {
}
};
const modalAddChange = () => {
modalAdd.value = !modalAdd.value;
};
const saveModalAdd = () => {
if (myFormAdd.value !== null) {
myFormAdd.value.validate().then(async (result: boolean) => {
if (result) {
modalAddChange();
}
});
}
};
const click = (e: any) => {
console.log(e);
console.log(rows.value.length);
};
const save = () => {
if (selected.value.length > 0) {
next();
} else {
dialogMessage(
$q,
"ข้อความแจ้งเตือน",
"กรุณาเลือกรายชื่อ",
"warning",
undefined,
"orange",
undefined,
undefined,
true
);
}
// if (selected.value.length > 0) {
// next();
// } else {
// dialogMessage(
// $q,
// "",
// "",
// "warning",
// undefined,
// "orange",
// undefined,
// undefined,
// true
// );
// }
next();
};
const selectData = (row: any) => {};
const refresh = () => {};
const refresh = async () => {
await conditionData();
modalAddChange();
selected.value = [];
};
const resetFilter = () => {
// reset X

View file

@ -72,25 +72,27 @@ const fecthlistRecevice = async () => {
.then((res) => {
let response = res.data.result;
listRecevice.value = response;
console.log(response);
// console.log(response);
rows.value = response.map((e: any) => ({
personalId: e.id,
citizenId: e.citizenId,
fullname: e.firstname + " " + e.lastname,
organizationName:
e.organizationName +
" " +
e.organizationShortName +
" " +
e.positionNumber +
" " +
e.positionPath,
orgName: e.organizationName,
organizationShortName: e.organizationShortName,
e.organizationName +
" " +
e.organizationShortName +
" " +
e.positionNumber +
" " +
e.positionPath,
orgName: e.organizationName,
organizationShortName: e.organizationShortName,
positionNumber: e.positionNumber,
positionPath: e.positionPath,
birthday: date2Thai(e.dateOfBirth),
}));
// console.log(rows.value);
rows2.value = rows.value.filter((e: any) => e.orgName !== null);
})
.catch((e) => {
console.log(typeof e);
@ -116,6 +118,19 @@ const rows = ref<any>([
// birthday: dateText(new Date("1989-09-03")),
// },
]);
const rows2 = ref<any>([
{
personalId: "08db721d-add6-47b0-8a13-5f45d106e8d1",
citizenId: "1234444332222",
fullname: "นางสาวอย พชช",
organizationName: "นักจัดการงานทั่วไป",
orgName: "กลุ่มงานช่วยนักบริหาร",
organizationShortName: "สกจ.",
positionNumber: "กก. 1",
positionPath: "นักจัดการงานทั่วไป",
birthday: dateText(new Date("1989-09-03")),
},
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -219,7 +234,7 @@ const openModalTree = (id: string) => {
personalId.value = id;
console.log(personalId.value);
personal.value = listRecevice.value.filter((e) => e.id === id);
personal.value = listRecevice.value.filter((e: any) => e.id === id);
modalTree.value = true;
};

View file

@ -0,0 +1,7 @@
interface RequestCopyOrder {
personalId: string;
emailChannel: boolean;
inboxChannel: boolean;
}
export type { RequestCopyOrder };

View file

@ -0,0 +1,43 @@
interface ResponseData {
education: string;
idCard: string;
name: string;
personId: string;
selectStatus: boolean;
sequence: number;
}
interface ResponseOrganiz {
firstName: string;
idCard: string;
lastName: string;
name: string;
position: string;
prefixId: string;
profileId: string;
unit: string;
}
interface ResponseCopyOrder {
emailChannel: boolean;
idCard: string;
inboxChannel: boolean;
name: string;
personalId: string;
position: string;
selectStatus: boolean;
sequence: number;
unit: string;
}
interface DataCopyOrder {
personalId: string;
name: string;
idCard: string;
position: string;
unit: string;
send: string;
mutiselect: number[];
}
export type { ResponseData, ResponseOrganiz, ResponseCopyOrder, DataCopyOrder };

View file

@ -229,8 +229,6 @@ export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
) => {
DataMainUpdateOrder.value = [];
if (filter_1 === "" && filter_2 === "" && filterYear === 0) {
DataMainUpdateOrder.value = DataMainOrigOrder.value;
} else if (filter_1 !== "" && filter_2 === "" && filterYear === 0) {
@ -269,7 +267,11 @@ export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
item.OrderStatus === filter_2 &&
item.fiscalYear === filterYear
);
} else if (filter_1 == "ทั้งหมด" && filter_2 == "ทั้งหมด" && filterYear !== null) {
} else if (
filter_1 == "ทั้งหมด" &&
filter_2 == "ทั้งหมด" &&
filterYear !== null
) {
DataMainUpdateOrder.value = DataMainOrigOrder.value;
}
};
@ -294,8 +296,18 @@ export const useProbationDataStore = defineStore("probationDataStore", () => {
"blue-9",
"blue-10",
]);
const orderId = ref<string>("");
const stepOrder = ref<number>(2);
const setOrderId = (val: string) => (orderId.value = val);
const setStepOrder = (val: number) => (stepOrder.value = val);
return {
ratingColors,
orderId,
stepOrder,
setOrderId,
setStepOrder,
};
});

View file

@ -263,7 +263,12 @@
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat label="ยกเลิก" color="red" v-close-popup />
<q-btn flat label="ตกลง" @click="clickSelect(action)" />
<q-btn
flat
label="ตกลง"
@click="clickSelect(action)"
:disable="radio === '' || (action === '' && radio !== 'ADD')"
/>
</q-card-actions>
</q-card>
</q-dialog>