รายการประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ

This commit is contained in:
STW_TTTY\stwtt 2024-04-03 17:12:04 +07:00
parent 92914dfdda
commit 23bac0373e
10 changed files with 590 additions and 266 deletions

View file

@ -1,14 +1,22 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { ref, watch, reactive } from "vue";
import Header from "@/components/DialogHeader.vue";
import type { DataOption } from "@/modules/15_development/interface/index/Main";
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import type {
DataOption,
FormFilter,
} from "@/modules/15_development/interface/index/Main";
import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const props = defineProps({
upDate: { type: Function },
});
const year = ref<string>("");
const $q = useQuasar();
const mixin = useCounterMixin();
const {
@ -18,27 +26,47 @@ const {
showLoader,
hideLoader,
} = mixin;
const store = useDevelopmentDataStore();
const store = useDevelopmentDataStoreHistory();
const modal = defineModel<boolean>("modal", { required: true });
const maxPage = ref<number>(1);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 20,
keyword: "",
type: "",
year: new Date().getFullYear(),
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: null,
isProbation: null,
});
const selected = ref<any[]>([]);
const search = ref<string>("ID1");
const search = ref<string>("projectName");
const inputSearch = ref<string>("");
const projectOp = ref<DataOption[]>([
{
id: "ID1",
id: "projectName",
name: "ชื่อโครงการ",
},
{
id: "ID2",
id: "year",
name: "ปีงบประมาณ",
},
{
id: "ID3",
name: "ชื่อหน่วยงานที่รับผิดชอบ",
},
// {
// id: "ID3",
// name: "",
// },
]);
/** save ข้อมูล */
@ -49,12 +77,17 @@ function onSubmit() {
dialogConfirm($q, () => {
const data = selected.value[0];
const body = {
project: data.project,
year: data.year,
organizingTraining: data.organizingTraining,
id:data.id,
year:data.year,
project:data.project,
dateStart:data.dateStart,
dateEnd:data.dateEnd,
totalDate:data.totalDate,
addressAcademic:data.addressAcademic,
topicAcademic:data.topicAcademic,
};
closeDialog()
props.upDate?.(body)
closeDialog();
});
}
}
@ -72,52 +105,41 @@ function getClass() {
}
function searchFilter() {
const dataTestGov = [
{
id: "ID1",
citizenId: "1XXXXXXXXXXXX", //
name: "นางสาวรัชภรณ์ ภักดี", // -
position: "นักบริหาร", //
type: "บริหาร", //
level: "ชำนาญการพิเศษ", //
positionSide: "นักบริหาร", //
},
{
id: "ID2",
citizenId: "1XXXXXXXXXXXX", //
name: "นางสาวภาพรรณ ลออ", // -
position: "นักจัดการงานทั่วไป", //
type: "บริหาร", //
level: "วิชาการ", //
positionSide: "ชำนาญงาน", //
},
];
const dataTest = [
{
id: "ID1",
project: "โครงการฝึกอบรมที่หน่วยงานของกรุงเทพมหานคร", ///
year: "2567", //
organizingTraining: "กลุ่มงานช่วยนักบริหาร", //
},
{
id: "ID2",
project: "กิจกรรมฝึกอบรมที่หน่วยงานของกรุงเทพมหานคร", ///
year: "2567", //
organizingTraining: "กลุ่มงานช่วยนักบริหาร", //
},
];
store.rows = dataTest;
let queryParams: any = {
page: formFilter.page,
pageSize: formFilter.pageSize,
searchField: search.value,
searchKeyword: search.value == "year" ? year.value : inputSearch.value,
};
showLoader();
http
.get(config.API.developmentProjectSearch(), { params: queryParams })
.then((res) => {
const data = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
store.rows = data.map((item: any) => ({
id: item.id ? item.id : null,
year: item.year ? item.year : null,
project: item.projectName ? item.projectName : null,
dateStart: item.dateStart ? item.dateStart : null,
dateEnd: item.dateEnd ? item.dateEnd : null,
totalDate: item.totalDate ? item.totalDate : null,
addressAcademic: item.addressAcademic ? item.addressAcademic : null,
topicAcademic: item.topicAcademic ? item.topicAcademic : null,
}));
})
.catch((e) => {
messageError($q, e``);
})
.finally(() => {
hideLoader();
});
}
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 60%">
<Header
:tittle="'เลือกโครงการ'"
:close="closeDialog"
/>
<Header :tittle="'เลือกโครงการ'" :close="closeDialog" />
<q-separator />
<q-card-section>
@ -136,7 +158,48 @@ function searchFilter() {
:class="getClass()"
/>
</div>
<div class="col-8">
<div v-if="search == 'year'" class="col-3">
<datepicker
menu-class-name="modalfix"
v-model="year"
class="col-2"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
lazy-rules
outlined
:model-value="year === '' ? null : Number(year) + 543"
:label="`${'ปีงบประมาณ'}`"
>
<template v-if="year" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="year = ''"
class="cursor-pointer"
/>
</template>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div v-else class="col-8">
<q-input
dense
outlined
@ -145,6 +208,7 @@ function searchFilter() {
:class="getClass()"
/>
</div>
<q-space v-if="search == 'year'" />
<div class="col-2">
<q-btn
label="ค้นหา"
@ -170,7 +234,21 @@ function searchFilter() {
dense
class="custom-header-table"
:visible-columns="store.visibleColumns"
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
>
<template v-slot:pagination="scope">
<q-pagination
v-model="formFilter.page"
active-color="primary"
color="dark"
:max="Number(maxPage)"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
<template v-slot:header="props">
<q-tr :props="props">
<q-th class="text-center"> </q-th>
@ -190,7 +268,10 @@ function searchFilter() {
/>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div class="table_ellipsis">
<div v-if="col.name == 'year'">
{{ col.value ? col.value + 543 : "-" }}
</div>
<div v-else class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>