no message
This commit is contained in:
parent
5c1747262f
commit
b130568ef4
12 changed files with 938 additions and 472 deletions
|
|
@ -1,14 +1,23 @@
|
|||
<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,
|
||||
NewPagination,
|
||||
} 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 +27,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: 20,
|
||||
});
|
||||
|
||||
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 +78,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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -70,54 +104,59 @@ function closeDialog() {
|
|||
function getClass() {
|
||||
return "inputgreen";
|
||||
}
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
||||
function updatePage(val:number){
|
||||
formFilter.page = val;
|
||||
searchFilter();
|
||||
}
|
||||
|
||||
function updatePageSize(newPagination: NewPagination) {
|
||||
formFilter.page = 1;
|
||||
formFilter.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formFilter.pageSize,
|
||||
() => {
|
||||
searchFilter();
|
||||
}
|
||||
);
|
||||
</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 +175,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,10 +225,11 @@ function searchFilter() {
|
|||
:class="getClass()"
|
||||
/>
|
||||
</div>
|
||||
<q-space v-if="search == 'year'" />
|
||||
<div class="col-2">
|
||||
<q-btn
|
||||
label="ค้นหา"
|
||||
class="full-width full-height"
|
||||
class="full-width"
|
||||
unelevated
|
||||
color="teal"
|
||||
@click="searchFilter()"
|
||||
|
|
@ -170,7 +251,23 @@ function searchFilter() {
|
|||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="store.visibleColumns"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[20, 25, 50, 100]"
|
||||
@update:pagination="updatePageSize"
|
||||
>
|
||||
<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
|
||||
@update:model-value="updatePage"
|
||||
></q-pagination>
|
||||
</template>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th class="text-center"> </q-th>
|
||||
|
|
@ -190,7 +287,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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue