fix(development):sort
This commit is contained in:
parent
8674269934
commit
1b67db241b
7 changed files with 188 additions and 419 deletions
|
|
@ -6,11 +6,11 @@ import { useQuasar, type QTableProps } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { usePagination } from "@/composables/usePagination";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
DataOption,
|
DataOption,
|
||||||
FormFilter,
|
FormFilter,
|
||||||
NewPagination,
|
|
||||||
} from "@/modules/15_development/interface/index/Main";
|
} from "@/modules/15_development/interface/index/Main";
|
||||||
|
|
||||||
import Header from "@/components/DialogHeader.vue";
|
import Header from "@/components/DialogHeader.vue";
|
||||||
|
|
@ -18,33 +18,13 @@ import Header from "@/components/DialogHeader.vue";
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { messageError, dialogMessageNotify, showLoader, hideLoader } = mixin;
|
const { messageError, dialogMessageNotify, showLoader, hideLoader } = mixin;
|
||||||
|
const { pagination, params, onRequest } = usePagination("", searchFilter);
|
||||||
|
|
||||||
const rows = ref<any[]>([]);
|
const rows = ref<any[]>([]);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
upDate: { type: Function },
|
upDate: { type: Function },
|
||||||
});
|
});
|
||||||
|
|
||||||
const maxPage = ref<number>(1); // จำนวนหน้าสูงสุด
|
|
||||||
|
|
||||||
const formFilter = reactive<FormFilter>({
|
|
||||||
page: 1,
|
|
||||||
pageSize: 20,
|
|
||||||
keyword: "",
|
|
||||||
year: new Date().getFullYear(),
|
|
||||||
type: "",
|
|
||||||
posType: "",
|
|
||||||
posLevel: "",
|
|
||||||
retireYear: "",
|
|
||||||
rangeYear: { min: 0, max: 60 },
|
|
||||||
isShowRetire: null,
|
|
||||||
isProbation: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
const pagination = ref({
|
|
||||||
page: 1,
|
|
||||||
rowsPerPage: 20,
|
|
||||||
});
|
|
||||||
|
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const selected = ref<any[]>([]); // checkbox
|
const selected = ref<any[]>([]); // checkbox
|
||||||
const search = ref<string>("citizenId"); // กำหนดค่าเริ่มต้น ค้นหาจาก
|
const search = ref<string>("citizenId"); // กำหนดค่าเริ่มต้น ค้นหาจาก
|
||||||
|
|
@ -62,11 +42,11 @@ const govOp = ref<DataOption[]>([
|
||||||
|
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"citizenId",
|
"citizenId",
|
||||||
"name",
|
"firstName",
|
||||||
"position",
|
"position",
|
||||||
"type",
|
"posType",
|
||||||
"level",
|
"posLevel",
|
||||||
"positionSide",
|
"posExecutive",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -80,7 +60,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "firstName",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ชื่อ-นามสกุล",
|
label: "ชื่อ-นามสกุล",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
|
@ -99,7 +79,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "type",
|
name: "posType",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ตำแหน่งประเภท",
|
label: "ตำแหน่งประเภท",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
|
@ -108,7 +88,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "level",
|
name: "posLevel",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ระดับตำแหน่ง",
|
label: "ระดับตำแหน่ง",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
|
@ -117,7 +97,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positionSide",
|
name: "posExecutive",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ตําแหน่งทางการบริหาร",
|
label: "ตําแหน่งทางการบริหาร",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
|
@ -168,46 +148,49 @@ function closeDialog() {
|
||||||
inputSearch.value = "";
|
inputSearch.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** class */
|
|
||||||
function getClass() {
|
|
||||||
return "inputgreen";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ดึงข้อมูลตาม keyword */
|
/** ดึงข้อมูลตาม keyword */
|
||||||
function searchFilter() {
|
async function searchFilter() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(
|
.get(config.API.registryNew(""), {
|
||||||
config.API.registryNew("") +
|
params: {
|
||||||
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&searchField=${search.value}&searchKeyword=${inputSearch.value}`
|
...params.value,
|
||||||
)
|
searchField: search.value,
|
||||||
|
searchKeyword: inputSearch.value.trim(),
|
||||||
|
},
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result.data;
|
const result = res.data.result;
|
||||||
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
|
pagination.value.rowsNumber = result.total;
|
||||||
rows.value = data.map((item: any) => ({
|
|
||||||
id: item.id ? item.id : null,
|
if (result.data.length !== 0) {
|
||||||
name: item.firstName
|
rows.value = result.data.map((item: any) => ({
|
||||||
? `${item.prefix}${item.firstName} ${item.lastName}`
|
id: item.id ? item.id : null,
|
||||||
: null,
|
name: item.firstName
|
||||||
prefix: item.prefix ? item.prefix : null,
|
? `${item.prefix}${item.firstName} ${item.lastName}`
|
||||||
rank: item.rank ? item.rank : null,
|
: null,
|
||||||
firstName: item.firstName ? item.firstName : null,
|
prefix: item.prefix ? item.prefix : null,
|
||||||
lastName: item.lastName ? item.lastName : null,
|
rank: item.rank ? item.rank : null,
|
||||||
citizenId: item.citizenId ? item.citizenId : null,
|
firstName: item.firstName ? item.firstName : null,
|
||||||
level: item.posLevel ? item.posLevel : null,
|
lastName: item.lastName ? item.lastName : null,
|
||||||
type: item.posType ? item.posType : null,
|
citizenId: item.citizenId ? item.citizenId : null,
|
||||||
posLevelId: item.posLevelId ? item.posLevelId : null,
|
level: item.posLevel ? item.posLevel : null,
|
||||||
posTypeId: item.posTypeId ? item.posTypeId : null,
|
type: item.posType ? item.posType : null,
|
||||||
position: item.position ? item.position : null,
|
posLevelId: item.posLevelId ? item.posLevelId : null,
|
||||||
positionSide: item.posExecutive ? item.posExecutive : null,
|
posTypeId: item.posTypeId ? item.posTypeId : null,
|
||||||
posNo: item.posNo ? item.posNo : null,
|
position: item.position ? item.position : null,
|
||||||
org: item.org ? item.org : null,
|
positionSide: item.posExecutive ? item.posExecutive : null,
|
||||||
rootId: item.rootId ? item.rootId : null,
|
posNo: item.posNo ? item.posNo : null,
|
||||||
rootDnaId: item.rootId ? item.rootDnaId : null,
|
org: item.org ? item.org : null,
|
||||||
root: item.root ? item.root : null,
|
rootId: item.rootId ? item.rootId : null,
|
||||||
orgRootShortName: item.orgRootShortName ? item.orgRootShortName : null,
|
rootDnaId: item.rootId ? item.rootDnaId : null,
|
||||||
orgRevisionId: item.orgRevisionId ? item.orgRevisionId : null,
|
root: item.root ? item.root : null,
|
||||||
}));
|
orgRootShortName: item.orgRootShortName
|
||||||
|
? item.orgRootShortName
|
||||||
|
: null,
|
||||||
|
orgRevisionId: item.orgRevisionId ? item.orgRevisionId : null,
|
||||||
|
}));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -217,25 +200,10 @@ function searchFilter() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** update ค่า เเถวข้อมูล */
|
function onfetchNewData() {
|
||||||
function updatePage(val: number) {
|
pagination.value.page = 1;
|
||||||
formFilter.page = val;
|
|
||||||
searchFilter();
|
searchFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** update ค่า เเถวข้อมูล */
|
|
||||||
function updatePageSize(newPagination: NewPagination) {
|
|
||||||
formFilter.page = 1;
|
|
||||||
formFilter.pageSize = newPagination.rowsPerPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** เช็คเเถวข้อมูลว่ามีการเปลี่ยนแปลงไหม */
|
|
||||||
watch(
|
|
||||||
() => formFilter.pageSize,
|
|
||||||
() => {
|
|
||||||
searchFilter();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="modal" persistent>
|
<q-dialog v-model="modal" persistent>
|
||||||
|
|
@ -266,6 +234,7 @@ watch(
|
||||||
label="ค้นหา"
|
label="ค้นหา"
|
||||||
v-model="inputSearch"
|
v-model="inputSearch"
|
||||||
:mask="search === 'citizenId' ? '#############' : undefined"
|
:mask="search === 'citizenId' ? '#############' : undefined"
|
||||||
|
@keyup.enter="onfetchNewData()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
|
|
@ -275,13 +244,13 @@ watch(
|
||||||
unelevated
|
unelevated
|
||||||
outline
|
outline
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="(formFilter.page = 1), searchFilter()"
|
@click="onfetchNewData()"
|
||||||
>
|
>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="q-mt-sm">
|
<div class="q-mt-sm">
|
||||||
<d-table
|
<p-table
|
||||||
style="max-height: 70vh"
|
style="max-height: 70vh"
|
||||||
virtual-scroll
|
virtual-scroll
|
||||||
selection="single"
|
selection="single"
|
||||||
|
|
@ -298,21 +267,8 @@ watch(
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
v-model:pagination="pagination"
|
v-model:pagination="pagination"
|
||||||
:rows-per-page-options="[20, 25, 50, 100]"
|
:rows-per-page-options="[20, 25, 50, 100]"
|
||||||
@update:pagination="updatePageSize"
|
@request="onRequest"
|
||||||
>
|
>
|
||||||
<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">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
<q-th class="text-center"> </q-th>
|
<q-th class="text-center"> </q-th>
|
||||||
|
|
@ -338,7 +294,7 @@ watch(
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
</d-table>
|
</p-table>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ interface DataOptionTechnique {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormFilter {
|
interface FormFilter {
|
||||||
page: number;
|
|
||||||
pageSize: number;
|
|
||||||
keyword: string;
|
keyword: string;
|
||||||
type: string;
|
type: string;
|
||||||
year: number;
|
year: number;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
interface FormQueryListProject {
|
interface FormQueryListProject {
|
||||||
year: number | null;
|
year: number | null;
|
||||||
page: number;
|
|
||||||
pageSize: number;
|
|
||||||
org: string;
|
org: string;
|
||||||
keyword: string;
|
keyword: string;
|
||||||
status: string;
|
status: string;
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,12 @@ import { useDevelopmentDataStore } from "@/modules/15_development/store/developm
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { calculateFiscalYear } from "@/utils/function";
|
import { calculateFiscalYear } from "@/utils/function";
|
||||||
|
import { usePagination } from "@/composables/usePagination";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
NewPagination,
|
NewPagination,
|
||||||
|
DataHistory,
|
||||||
|
DataOption,
|
||||||
ItemsMenu,
|
ItemsMenu,
|
||||||
} from "@/modules/15_development/interface/index/Main";
|
} from "@/modules/15_development/interface/index/Main";
|
||||||
|
|
||||||
|
|
@ -22,24 +25,16 @@ const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = useDevelopmentDataStore();
|
const store = useDevelopmentDataStore();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
const { pagination, params, onRequest } = usePagination("", getData);
|
||||||
|
|
||||||
const maxPage = ref<number>(1); // จำนวนหน้า
|
|
||||||
const totalList = ref<number>(0); //จำนวนข้อมูลรายการ
|
|
||||||
const formFilter = reactive({
|
const formFilter = reactive({
|
||||||
root: null,
|
root: null,
|
||||||
page: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
keyword: "",
|
keyword: "",
|
||||||
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
||||||
});
|
});
|
||||||
|
|
||||||
const pagination = ref({
|
const rows = ref<DataHistory[]>([]);
|
||||||
page: formFilter.page,
|
const agencyOp = ref<DataOption[]>([]);
|
||||||
rowsPerPage: formFilter.pageSize,
|
|
||||||
});
|
|
||||||
|
|
||||||
const rows = ref<any[]>([]);
|
|
||||||
const agencyOp = ref<any[]>([]);
|
|
||||||
const itemMenu = ref<ItemsMenu[]>([
|
const itemMenu = ref<ItemsMenu[]>([
|
||||||
{
|
{
|
||||||
label: "ไฟล์ .xlsx",
|
label: "ไฟล์ .xlsx",
|
||||||
|
|
@ -54,18 +49,15 @@ const itemMenu = ref<ItemsMenu[]>([
|
||||||
color: "red",
|
color: "red",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"year",
|
"year",
|
||||||
"citizenId",
|
"citizenId",
|
||||||
"name",
|
"fullName",
|
||||||
"position",
|
"position",
|
||||||
"type",
|
"posType",
|
||||||
"level",
|
"posLevel",
|
||||||
"positionSide",
|
|
||||||
"projectName",
|
"projectName",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "year",
|
name: "year",
|
||||||
|
|
@ -87,11 +79,11 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "fullName",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ชื่อ-นามสกุล",
|
label: "ชื่อ-นามสกุล",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "name",
|
field: "fullName",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
|
|
@ -106,20 +98,20 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "type",
|
name: "posType",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "กลุ่มงาน",
|
label: "กลุ่มงาน",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "type",
|
field: "posType",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "level",
|
name: "posLevel",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ระดับชั้นงาน",
|
label: "ระดับชั้นงาน",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "level",
|
field: "posLevel",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
|
|
@ -141,7 +133,7 @@ async function fetchListOrg() {
|
||||||
.get(config.API.developmentHistoryListOrg("employee", formFilter.year))
|
.get(config.API.developmentHistoryListOrg("employee", formFilter.year))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
formFilter.root = null;
|
formFilter.root = null;
|
||||||
formFilter.page = 1;
|
pagination.value.page = 1;
|
||||||
rows.value = [];
|
rows.value = [];
|
||||||
const option = [{ name: "ทั้งหมด", id: null }];
|
const option = [{ name: "ทั้งหมด", id: null }];
|
||||||
const optionNew = await res.data.result.map((e: string) => ({
|
const optionNew = await res.data.result.map((e: string) => ({
|
||||||
|
|
@ -150,7 +142,6 @@ async function fetchListOrg() {
|
||||||
}));
|
}));
|
||||||
option.push(...optionNew);
|
option.push(...optionNew);
|
||||||
agencyOp.value = option;
|
agencyOp.value = option;
|
||||||
// agencyOp.value = res.data.result;
|
|
||||||
await getData();
|
await getData();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -171,9 +162,9 @@ function onDownload(type: string) {
|
||||||
year: formFilter.year,
|
year: formFilter.year,
|
||||||
root: formFilter.root,
|
root: formFilter.root,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const dataList = res.data.result;
|
const dataList = res.data.result;
|
||||||
genReportXLSX(dataList, "รายการประวัติฝึกอบรม/ดูงาน ลูกจ้าง", type);
|
await genReportXLSX(dataList, "รายการประวัติฝึกอบรม/ดูงาน ลูกจ้าง", type);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -183,7 +174,7 @@ function onDownload(type: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** edit page
|
/** ฟังก์ชันแก้ไขข้อมูล
|
||||||
* @param id id ของ row
|
* @param id id ของ row
|
||||||
*/
|
*/
|
||||||
function onEdit(id: string) {
|
function onEdit(id: string) {
|
||||||
|
|
@ -193,30 +184,20 @@ function onEdit(id: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ดึงข้อมูล */
|
/** ฟังก์ชันดึงข้อมูลรายการประวัติฝึกอบรม/ดูงาน */
|
||||||
async function getData() {
|
async function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
formFilter.keyword = formFilter.keyword.trim();
|
formFilter.keyword = formFilter.keyword.trim();
|
||||||
await http
|
await http
|
||||||
.post(config.API.developmentHistoryList("employee"), formFilter)
|
.post(config.API.developmentHistoryList("employee"), {
|
||||||
|
...params.value,
|
||||||
|
...formFilter,
|
||||||
|
keyword: formFilter.keyword.trim(),
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result.data;
|
const result = res.data.result;
|
||||||
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
|
pagination.value.rowsNumber = result.total;
|
||||||
totalList.value = res.data.result.total;
|
rows.value = result.data;
|
||||||
rows.value = data.map((item: any) => ({
|
|
||||||
id: item.id ? item.id : null,
|
|
||||||
citizenId: item.citizenId ? item.citizenId : null,
|
|
||||||
name: item.fullName ? item.fullName : null,
|
|
||||||
prefix: item.prefix ? item.prefix : null,
|
|
||||||
firstName: item.firstName ? item.firstName : null,
|
|
||||||
lastName: item.lastName ? item.lastName : null,
|
|
||||||
position: item.position ? item.position : null,
|
|
||||||
type: item.posType ? item.posType : null,
|
|
||||||
level: item.posLevel ? item.posLevel : null,
|
|
||||||
positionSide: item.posExecutive ? item.posExecutive : null,
|
|
||||||
projectName: item.projectName ? item.projectName : null,
|
|
||||||
year: item.year ? item.year : null,
|
|
||||||
}));
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -226,23 +207,12 @@ async function getData() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** ฟังก์ชันดึงข้อมูลใหม่ */
|
||||||
* function updatePagination
|
function onfetchNewData() {
|
||||||
* @param newPagination ข้อมูล Pagination ใหม่
|
pagination.value.page = 1;
|
||||||
*/
|
getData();
|
||||||
function updatePagination(newPagination: NewPagination) {
|
|
||||||
formFilter.page = 1;
|
|
||||||
formFilter.pageSize = newPagination.rowsPerPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
|
|
||||||
watch(
|
|
||||||
() => formFilter.pageSize,
|
|
||||||
() => {
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/** ดึงข้อมูลเมื่อโหลดหน้าเสร็จสิ้น */
|
/** ดึงข้อมูลเมื่อโหลดหน้าเสร็จสิ้น */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchListOrg();
|
await fetchListOrg();
|
||||||
|
|
@ -253,6 +223,7 @@ onMounted(async () => {
|
||||||
<div class="toptitle text-dark col-12 row items-center">
|
<div class="toptitle text-dark col-12 row items-center">
|
||||||
รายการประวัติฝึกอบรม/ดูงาน ลูกจ้าง
|
รายการประวัติฝึกอบรม/ดูงาน ลูกจ้าง
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-card flat bordered class="q-pa-md">
|
<q-card flat bordered class="q-pa-md">
|
||||||
<div class="row no-wrap shadow-1 justify-between">
|
<div class="row no-wrap shadow-1 justify-between">
|
||||||
<q-toolbar class="row col-8 q-pa-none q-gutter-x-sm">
|
<q-toolbar class="row col-8 q-pa-none q-gutter-x-sm">
|
||||||
|
|
@ -307,7 +278,7 @@ onMounted(async () => {
|
||||||
:options="agencyOp"
|
:options="agencyOp"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
@update:model-value="(formFilter.page = 1), getData()"
|
@update:model-value="onfetchNewData()"
|
||||||
style="min-width: 150px"
|
style="min-width: 150px"
|
||||||
map-options
|
map-options
|
||||||
emit-value
|
emit-value
|
||||||
|
|
@ -359,7 +330,7 @@ onMounted(async () => {
|
||||||
ref="filterRef"
|
ref="filterRef"
|
||||||
outlined
|
outlined
|
||||||
placeholder="ค้นหา"
|
placeholder="ค้นหา"
|
||||||
@keydown.enter.prevent="(formFilter.page = 1), getData()"
|
@keydown.enter.prevent="onfetchNewData()"
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<q-icon name="search" />
|
<q-icon name="search" />
|
||||||
|
|
@ -385,7 +356,7 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<d-table
|
<p-table
|
||||||
for="table"
|
for="table"
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
@ -396,24 +367,10 @@ onMounted(async () => {
|
||||||
dense
|
dense
|
||||||
class="custom-header-table"
|
class="custom-header-table"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
v-model:pagination="pagination"
|
|
||||||
:rows-per-page-options="[10, 25, 50, 100]"
|
:rows-per-page-options="[10, 25, 50, 100]"
|
||||||
@update:pagination="updatePagination"
|
v-model:pagination="pagination"
|
||||||
|
@request="onRequest"
|
||||||
>
|
>
|
||||||
<template v-slot:pagination="scope">
|
|
||||||
ทั้งหมด {{ totalList }} รายการ
|
|
||||||
<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="getData"
|
|
||||||
></q-pagination>
|
|
||||||
</template>
|
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
<q-th auto-width></q-th>
|
<q-th auto-width></q-th>
|
||||||
|
|
@ -444,7 +401,7 @@ onMounted(async () => {
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
</d-table>
|
</p-table>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive, watch } from "vue";
|
import { ref, onMounted, reactive } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useQuasar, type QTableProps } from "quasar";
|
import { useQuasar, type QTableProps } from "quasar";
|
||||||
|
|
||||||
|
|
@ -10,39 +10,31 @@ import { useDevelopmentDataStore } from "@/modules/15_development/store/developm
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { calculateFiscalYear } from "@/utils/function";
|
import { calculateFiscalYear } from "@/utils/function";
|
||||||
|
import { usePagination } from "@/composables/usePagination";
|
||||||
|
|
||||||
/**
|
/** importType*/
|
||||||
* importType
|
|
||||||
*/
|
|
||||||
import type {
|
import type {
|
||||||
DataOption,
|
DataOption,
|
||||||
DataHistory,
|
DataHistory,
|
||||||
NewPagination,
|
|
||||||
ItemsMenu,
|
ItemsMenu,
|
||||||
} from "@/modules/15_development/interface/index/Main";
|
} from "@/modules/15_development/interface/index/Main";
|
||||||
import type { ResHistory } from "@/modules/15_development/interface/response/Main";
|
|
||||||
|
|
||||||
/** use*/
|
/** use*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const store = useDevelopmentDataStore();
|
const store = useDevelopmentDataStore();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
const { pagination, params, onRequest } = usePagination("", getData);
|
||||||
|
|
||||||
const formFilter = reactive({
|
const formFilter = reactive({
|
||||||
root: null,
|
root: null,
|
||||||
page: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
keyword: "",
|
keyword: "",
|
||||||
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
||||||
});
|
});
|
||||||
const agencyOp = ref<DataOption[]>([]); // หน่วยงาน
|
const agencyOp = ref<DataOption[]>([]); // หน่วยงาน
|
||||||
|
|
||||||
/**
|
/** ข้อมูล Table*/
|
||||||
* ข้อมูล Table
|
|
||||||
*/
|
|
||||||
const rows = ref<DataHistory[]>([]);
|
const rows = ref<DataHistory[]>([]);
|
||||||
const maxPage = ref<number>(1); //จำนวนหน้าสูงสุด
|
|
||||||
const totalList = ref<number>(0); //จำนวนข้อมูลรายการ
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "year",
|
name: "year",
|
||||||
|
|
@ -64,11 +56,11 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "fullName",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ชื่อ-นามสกุล",
|
label: "ชื่อ-นามสกุล",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "name",
|
field: "fullName",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
|
|
@ -83,29 +75,29 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "type",
|
name: "posType",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ตำแหน่งประเภท",
|
label: "ตำแหน่งประเภท",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "type",
|
field: "posType",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "level",
|
name: "posLevel",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ระดับตำแหน่ง",
|
label: "ระดับตำแหน่ง",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "level",
|
field: "posLevel",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "positionSide",
|
name: "posExecutive",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ตําแหน่งทางการบริหาร",
|
label: "ตําแหน่งทางการบริหาร",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "positionSide",
|
field: "posExecutive",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
|
|
@ -119,18 +111,14 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const pagination = ref({
|
|
||||||
page: formFilter.page,
|
|
||||||
rowsPerPage: formFilter.pageSize,
|
|
||||||
});
|
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"year",
|
"year",
|
||||||
"citizenId",
|
"citizenId",
|
||||||
"name",
|
"fullName",
|
||||||
"position",
|
"position",
|
||||||
"type",
|
"posType",
|
||||||
"level",
|
"posLevel",
|
||||||
"positionSide",
|
"posExecutive",
|
||||||
"projectName",
|
"projectName",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -150,16 +138,14 @@ const itemMenu = ref<ItemsMenu[]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/** function เรียกข้อมูหน่วยงาน*/
|
||||||
* function เรียกข้อมูหน่วยงาน
|
|
||||||
*/
|
|
||||||
function fetchListOrg() {
|
function fetchListOrg() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.developmentHistoryListOrg("officer", formFilter.year))
|
.get(config.API.developmentHistoryListOrg("officer", formFilter.year))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
formFilter.root = null;
|
formFilter.root = null;
|
||||||
formFilter.page = 1;
|
pagination.value.page = 1;
|
||||||
rows.value = [];
|
rows.value = [];
|
||||||
const option = [{ name: "ทั้งหมด", id: null }];
|
const option = [{ name: "ทั้งหมด", id: null }];
|
||||||
const optionNew = await res.data.result.map((e: string) => ({
|
const optionNew = await res.data.result.map((e: string) => ({
|
||||||
|
|
@ -178,29 +164,20 @@ function fetchListOrg() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** function เรียกข้อมูลรายการประวัติการฝึกอบรม/ดูงาน ข้าราชการกรุงเทพมหานครสามัญ*/
|
||||||
* function เรียกข้อมูลรายการประวัติการฝึกอบรม/ดูงาน ข้าราชการกรุงเทพมหานครสามัญ
|
|
||||||
*/
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
formFilter.keyword = formFilter.keyword.trim();
|
formFilter.keyword = formFilter.keyword.trim();
|
||||||
await http
|
await http
|
||||||
.post(config.API.developmentHistoryList("officer"), formFilter)
|
.post(config.API.developmentHistoryList("officer"), {
|
||||||
|
...params.value,
|
||||||
|
...formFilter,
|
||||||
|
keyword: formFilter.keyword.trim(),
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result.data;
|
const result = res.data.result;
|
||||||
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
|
pagination.value.rowsNumber = result.total;
|
||||||
totalList.value = res.data.result.total;
|
rows.value = result.data;
|
||||||
rows.value = data.map((item: ResHistory) => ({
|
|
||||||
id: item.id ? item.id : null,
|
|
||||||
citizenId: item.citizenId ? item.citizenId : null,
|
|
||||||
name: item.fullName ? item.fullName : null,
|
|
||||||
position: item.position ? item.position : null,
|
|
||||||
type: item.posType ? item.posType : null,
|
|
||||||
level: item.posLevel ? item.posLevel : null,
|
|
||||||
projectName: item.projectName ? item.projectName : null,
|
|
||||||
positionSide: item.posExecutive ? item.posExecutive : null,
|
|
||||||
year: item.year ? item.year : null,
|
|
||||||
}));
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -246,25 +223,12 @@ function onEdit(id: string) {
|
||||||
router.push(`/development/history/${id}`);
|
router.push(`/development/history/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** ฟังก์ชันเรียกข้อมูลใหม่ */
|
||||||
* function updatePagination
|
function onfetchNewData() {
|
||||||
* @param newPagination ข้อมูล Pagination ใหม่
|
pagination.value.page = 1;
|
||||||
*/
|
getData();
|
||||||
function updatePagination(newPagination: NewPagination) {
|
|
||||||
formFilter.page = 1;
|
|
||||||
formFilter.pageSize = newPagination.rowsPerPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* callbackFunction ทำเมื่อมีการอัปเดท pageSize
|
|
||||||
*/
|
|
||||||
watch(
|
|
||||||
() => formFilter.pageSize,
|
|
||||||
() => {
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/** ดึงข้อมูลเมื่ออยู่ในหน้า */
|
/** ดึงข้อมูลเมื่ออยู่ในหน้า */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchListOrg();
|
fetchListOrg();
|
||||||
|
|
@ -329,7 +293,7 @@ onMounted(() => {
|
||||||
:options="agencyOp"
|
:options="agencyOp"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
@update:model-value="(formFilter.page = 1), getData()"
|
@update:model-value="onfetchNewData()"
|
||||||
style="min-width: 150px"
|
style="min-width: 150px"
|
||||||
map-options
|
map-options
|
||||||
emit-value
|
emit-value
|
||||||
|
|
@ -382,7 +346,7 @@ onMounted(() => {
|
||||||
ref="filterRef"
|
ref="filterRef"
|
||||||
outlined
|
outlined
|
||||||
placeholder="ค้นหา"
|
placeholder="ค้นหา"
|
||||||
@keydown.enter.prevent="(formFilter.page = 1), getData()"
|
@keydown.enter.prevent="onfetchNewData()"
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<q-icon name="search" />
|
<q-icon name="search" />
|
||||||
|
|
@ -406,7 +370,7 @@ onMounted(() => {
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<d-table
|
<p-table
|
||||||
for="table"
|
for="table"
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
@ -419,7 +383,7 @@ onMounted(() => {
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
v-model:pagination="pagination"
|
v-model:pagination="pagination"
|
||||||
:rows-per-page-options="[10, 25, 50, 100]"
|
:rows-per-page-options="[10, 25, 50, 100]"
|
||||||
@update:pagination="updatePagination"
|
@request="onRequest"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
@ -452,22 +416,7 @@ onMounted(() => {
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
</p-table>
|
||||||
<template v-slot:pagination="scope">
|
|
||||||
ทั้งหมด {{ totalList }} รายการ
|
|
||||||
<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="getData"
|
|
||||||
></q-pagination>
|
|
||||||
</template>
|
|
||||||
</d-table>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive, watch } from "vue";
|
import { ref, onMounted, reactive } from "vue";
|
||||||
import { useQuasar, type QTableProps } from "quasar";
|
import { useQuasar, type QTableProps } from "quasar";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
|
||||||
|
|
@ -10,13 +10,12 @@ import { useStructureTree } from "@/stores/structureTree";
|
||||||
import genReportXLSX from "@/plugins/genreportxlsx";
|
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||||
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { updateCurrentPage } from "@/utils/function";
|
|
||||||
import { calculateFiscalYear } from "@/utils/function";
|
import { calculateFiscalYear } from "@/utils/function";
|
||||||
|
import { usePagination } from "@/composables/usePagination";
|
||||||
|
|
||||||
/**importType*/
|
/**importType*/
|
||||||
import type {
|
import type {
|
||||||
DataOption,
|
DataOption,
|
||||||
NewPagination,
|
|
||||||
OrgTree,
|
OrgTree,
|
||||||
} from "@/modules/15_development/interface/index/Main";
|
} from "@/modules/15_development/interface/index/Main";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -45,6 +44,10 @@ const {
|
||||||
dialogRemove,
|
dialogRemove,
|
||||||
success,
|
success,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
const { pagination, params, onRequest, checkAndUpdatePage } = usePagination(
|
||||||
|
"",
|
||||||
|
fetchListProject
|
||||||
|
);
|
||||||
|
|
||||||
const node = ref<OrgTree[]>([]); // หน่วยงาน/ส่วนราชการ
|
const node = ref<OrgTree[]>([]); // หน่วยงาน/ส่วนราชการ
|
||||||
const expanded = ref<string[]>([]);
|
const expanded = ref<string[]>([]);
|
||||||
|
|
@ -54,8 +57,6 @@ const filter = ref<string>(""); //ค้นหา เพิ่มโครงก
|
||||||
const filterMain = ref<string>(""); //ค้นหา หน่วยงาน/ส่วนราชการ
|
const filterMain = ref<string>(""); //ค้นหา หน่วยงาน/ส่วนราชการ
|
||||||
const splitterModel = ref<number>(60); //แบ่ง ส่วน
|
const splitterModel = ref<number>(60); //แบ่ง ส่วน
|
||||||
const modal = ref<boolean>(false); // ตัวแปร dialog
|
const modal = ref<boolean>(false); // ตัวแปร dialog
|
||||||
const totalList = ref<number>(0); //จำนวนข้อมูลรายการ
|
|
||||||
const totalPage = ref<number>(1); // จำนวนข้อมูลที่มี
|
|
||||||
|
|
||||||
const statusOpt = ref<DataOption[]>([
|
const statusOpt = ref<DataOption[]>([
|
||||||
{ id: "ONGOING", name: "กำลังดำเนินการ" },
|
{ id: "ONGOING", name: "กำลังดำเนินการ" },
|
||||||
|
|
@ -109,8 +110,6 @@ const formProject = reactive<FormProject>({
|
||||||
/** formQuery */
|
/** formQuery */
|
||||||
const formQuery = reactive<FormQueryListProject>({
|
const formQuery = reactive<FormQueryListProject>({
|
||||||
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
||||||
page: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
org: "1",
|
org: "1",
|
||||||
keyword: "",
|
keyword: "",
|
||||||
status: "ONGOING",
|
status: "ONGOING",
|
||||||
|
|
@ -122,19 +121,20 @@ const formQuery = reactive<FormQueryListProject>({
|
||||||
async function fetchListProject() {
|
async function fetchListProject() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(config.API.developmentMain, {
|
||||||
config.API.developmentMain +
|
params: {
|
||||||
`?page=${formQuery.page}&pageSize=${
|
...params.value,
|
||||||
formQuery.pageSize
|
keyword: formQuery.keyword.trim(),
|
||||||
}&keyword=${formQuery.keyword.trim()}&year=${formQuery.year}&status=${
|
year: formQuery.year,
|
||||||
formQuery.status
|
status: formQuery.status,
|
||||||
}&node=${formQuery.node}&nodeId=${formQuery.nodeId}`
|
node: formQuery.node,
|
||||||
)
|
nodeId: formQuery.nodeId,
|
||||||
|
},
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result.data;
|
const result = res.data.result;
|
||||||
totalPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
pagination.value.rowsNumber = result.total;
|
||||||
totalList.value = res.data.result.total;
|
rows.value = result.data;
|
||||||
rows.value = data;
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -162,7 +162,7 @@ function onAdd() {
|
||||||
* function fetchข้อมูลหน้าแรกใหม่
|
* function fetchข้อมูลหน้าแรกใหม่
|
||||||
*/
|
*/
|
||||||
function fetchListProjectNew() {
|
function fetchListProjectNew() {
|
||||||
formQuery.page = 1;
|
pagination.value.page = 1;
|
||||||
fetchListProject();
|
fetchListProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,9 +242,7 @@ function updateSelected(data: DataTree) {
|
||||||
formProject.orgRevisionId = data.orgRevisionId;
|
formProject.orgRevisionId = data.orgRevisionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** function เลือกหน่วยงานที่จะค้นหาโครงกา*/
|
||||||
* function เลือกหน่วยงานที่จะค้นหาโครงกา
|
|
||||||
*/
|
|
||||||
function updateSelectedTreeMain(data: DataTree) {
|
function updateSelectedTreeMain(data: DataTree) {
|
||||||
if (
|
if (
|
||||||
formQuery.node === data.orgLevel &&
|
formQuery.node === data.orgLevel &&
|
||||||
|
|
@ -259,15 +257,6 @@ function updateSelectedTreeMain(data: DataTree) {
|
||||||
fetchListProjectNew(); // fetch โครงการ
|
fetchListProjectNew(); // fetch โครงการ
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* function updatePagination
|
|
||||||
* @param newPagination ข้อมูล Pagination ใหม่
|
|
||||||
*/
|
|
||||||
function updatePagination(newPagination: NewPagination) {
|
|
||||||
formQuery.page = 1;
|
|
||||||
formQuery.pageSize = newPagination.rowsPerPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function redirect หน้าบันทึกผล
|
* function redirect หน้าบันทึกผล
|
||||||
* @param id โครงการ
|
* @param id โครงการ
|
||||||
|
|
@ -282,11 +271,7 @@ function onDelete(id: string) {
|
||||||
await http
|
await http
|
||||||
.delete(config.API.developmentMain + `/${id}`)
|
.delete(config.API.developmentMain + `/${id}`)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
formQuery.page = await updateCurrentPage(
|
await checkAndUpdatePage(rows.value.length);
|
||||||
formQuery.page,
|
|
||||||
totalList.value,
|
|
||||||
rows.value.length
|
|
||||||
);
|
|
||||||
await fetchListProject();
|
await fetchListProject();
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
|
|
@ -307,14 +292,6 @@ function onDetail(id: string) {
|
||||||
router.push(`/development-detail/${id}`);
|
router.push(`/development-detail/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
|
|
||||||
watch(
|
|
||||||
() => formQuery.pageSize,
|
|
||||||
() => {
|
|
||||||
fetchListProject();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/** ดึงข้อมูลเมื่อโหลดหน้าเสร็จสิ้น */
|
/** ดึงข้อมูลเมื่อโหลดหน้าเสร็จสิ้น */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchActive();
|
fetchActive();
|
||||||
|
|
@ -502,7 +479,7 @@ onMounted(() => {
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<d-table
|
<p-table
|
||||||
for="table"
|
for="table"
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
@ -512,9 +489,10 @@ onMounted(() => {
|
||||||
bordered
|
bordered
|
||||||
dense
|
dense
|
||||||
class="custom-header-table"
|
class="custom-header-table"
|
||||||
:rows-per-page-options="[10, 25, 50, 100]"
|
:rows-per-page-options="[1, 10, 25, 50, 100]"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
@update:pagination="updatePagination"
|
v-model:pagination="pagination"
|
||||||
|
@request="onRequest"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
@ -590,21 +568,7 @@ onMounted(() => {
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:pagination="scope">
|
</p-table>
|
||||||
ทั้งหมด {{ totalList }} รายการ
|
|
||||||
<q-pagination
|
|
||||||
v-model="formQuery.page"
|
|
||||||
active-color="primary"
|
|
||||||
color="dark"
|
|
||||||
:max="Number(totalPage)"
|
|
||||||
size="sm"
|
|
||||||
boundary-links
|
|
||||||
direction-links
|
|
||||||
:max-pages="5"
|
|
||||||
@update:model-value="fetchListProject"
|
|
||||||
></q-pagination>
|
|
||||||
</template>
|
|
||||||
</d-table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, watch } from "vue";
|
import { ref, reactive, onMounted } from "vue";
|
||||||
import { useQuasar, type QTableProps } from "quasar";
|
import { useQuasar, type QTableProps } from "quasar";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
|
|
@ -7,21 +7,17 @@ import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import genReportXLSX from "@/plugins/genreportxlsx";
|
|
||||||
import { calculateFiscalYear } from "@/utils/function";
|
import { calculateFiscalYear } from "@/utils/function";
|
||||||
|
import { usePagination } from "@/composables/usePagination";
|
||||||
|
|
||||||
import type {
|
import type { DataOption } from "@/modules/15_development/interface/index/Main";
|
||||||
DataOption,
|
|
||||||
NewPagination,
|
|
||||||
} from "@/modules/15_development/interface/index/Main";
|
|
||||||
import type { ListSholarship } from "@/modules/15_development/interface/response/Scholarship";
|
import type { ListSholarship } from "@/modules/15_development/interface/response/Scholarship";
|
||||||
/** importStore*/
|
|
||||||
|
|
||||||
/** use*/
|
/** use */
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
const { pagination, params, onRequest } = usePagination("", fetchList);
|
||||||
/** หัวตาราง */
|
/** หัวตาราง */
|
||||||
const rows = ref<ListSholarship[]>([]);
|
const rows = ref<ListSholarship[]>([]);
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -142,32 +138,27 @@ const scholarshipTypeOp = ref<DataOption[]>([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const formQuery = reactive({
|
const formQuery = reactive({
|
||||||
page: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
year: calculateFiscalYear(new Date()), //ปีงบประมาณ
|
||||||
type: "DOMESTICE",
|
type: "DOMESTICE",
|
||||||
keyword: "",
|
keyword: "",
|
||||||
});
|
});
|
||||||
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
|
||||||
const maxPage = ref<number>(1);
|
|
||||||
|
|
||||||
/** ดึงข้อมูล */
|
/** ดึงข้อมูล */
|
||||||
function fetchList() {
|
async function fetchList() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(
|
.get(config.API.devScholarship, {
|
||||||
config.API.devScholarship +
|
params: {
|
||||||
`?page=${formQuery.page}&pageSize=${
|
...params.value,
|
||||||
formQuery.pageSize
|
keyword: formQuery.keyword.trim(),
|
||||||
}&keyword=${formQuery.keyword.trim()}&year=${
|
year: formQuery.year,
|
||||||
formQuery.year
|
scholarshipType: formQuery.type,
|
||||||
}&scholarshipType=${formQuery.type}`
|
},
|
||||||
)
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result.data;
|
const result = res.data.result;
|
||||||
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
pagination.value.rowsNumber = result.total;
|
||||||
totalList.value = res.data.result.total;
|
rows.value = result.data;
|
||||||
rows.value = data;
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -179,7 +170,7 @@ function fetchList() {
|
||||||
|
|
||||||
/** ฟังชั่นดึงข้อมูล รายการ ใหม่ */
|
/** ฟังชั่นดึงข้อมูล รายการ ใหม่ */
|
||||||
function fetchNewList() {
|
function fetchNewList() {
|
||||||
formQuery.page = 1;
|
pagination.value.page = 1;
|
||||||
fetchList();
|
fetchList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,15 +181,12 @@ function onClickAddOrView(status: boolean = false, id: string = "") {
|
||||||
: router.push("/development/scholarship/add");
|
: router.push("/development/scholarship/add");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** ฟังชั่นดูรายละเอียด */
|
||||||
* function updatePagination
|
function onDetail(id: string) {
|
||||||
* @param newPagination ข้อมูล Pagination ใหม่
|
router.push(`/development/scholarship-detail/${id}`);
|
||||||
*/
|
|
||||||
function updatePagination(newPagination: NewPagination) {
|
|
||||||
formQuery.page = 1;
|
|
||||||
formQuery.pageSize = newPagination.rowsPerPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชั่นแปลงสถานะ */
|
||||||
function conventStatus(val: string) {
|
function conventStatus(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "PENDING":
|
case "PENDING":
|
||||||
|
|
@ -212,35 +200,6 @@ function conventStatus(val: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /** download file */
|
|
||||||
// function onDownload() {
|
|
||||||
// showLoader();
|
|
||||||
// http
|
|
||||||
// .get(config.API.developmentReportScholarship())
|
|
||||||
// .then((res) => {
|
|
||||||
// const dataList = res.data.result;
|
|
||||||
// genReportXLSX(dataList, "รายการข้าราชการ ฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม");
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// messageError($q, e);
|
|
||||||
// })
|
|
||||||
// .finally(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** เช็ค เมื่อมีการเปลี่ยนค่าของ ข้อมูลในเเถว */
|
|
||||||
watch(
|
|
||||||
() => formQuery.pageSize,
|
|
||||||
() => {
|
|
||||||
fetchNewList();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
function onDetail(id: string) {
|
|
||||||
router.push(`/development/scholarship-detail/${id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ดึงข้อมูลเมื่ออยู่ในหน้า */
|
/** ดึงข้อมูลเมื่ออยู่ในหน้า */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchList();
|
fetchList();
|
||||||
|
|
@ -251,6 +210,7 @@ onMounted(() => {
|
||||||
<div class="toptitle text-dark col-12 row items-center">
|
<div class="toptitle text-dark col-12 row items-center">
|
||||||
รายการข้าราชการฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม
|
รายการข้าราชการฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-card flat bordered class="q-pa-md">
|
<q-card flat bordered class="q-pa-md">
|
||||||
<q-toolbar class="q-pa-none">
|
<q-toolbar class="q-pa-none">
|
||||||
<div class="row q-gutter-sm">
|
<div class="row q-gutter-sm">
|
||||||
|
|
@ -360,7 +320,7 @@ onMounted(() => {
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<d-table
|
<p-table
|
||||||
for="table"
|
for="table"
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
@ -372,7 +332,8 @@ onMounted(() => {
|
||||||
class="custom-header-table"
|
class="custom-header-table"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
:rows-per-page-options="[10, 25, 50, 100]"
|
:rows-per-page-options="[10, 25, 50, 100]"
|
||||||
@update:pagination="updatePagination"
|
v-model:pagination="pagination"
|
||||||
|
@request="onRequest"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
@ -419,21 +380,7 @@ onMounted(() => {
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:pagination="scope">
|
</p-table>
|
||||||
ทั้งหมด {{ totalList }} รายการ
|
|
||||||
<q-pagination
|
|
||||||
v-model="formQuery.page"
|
|
||||||
active-color="primary"
|
|
||||||
color="dark"
|
|
||||||
:max="Number(maxPage)"
|
|
||||||
size="sm"
|
|
||||||
boundary-links
|
|
||||||
direction-links
|
|
||||||
:max-pages="5"
|
|
||||||
@update:model-value="fetchList"
|
|
||||||
></q-pagination>
|
|
||||||
</template>
|
|
||||||
</d-table>
|
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue