Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-04-26 11:33:24 +07:00
commit 3594ac3acc
13 changed files with 177 additions and 123 deletions

View file

@ -13,36 +13,36 @@ const dataStore = useEvaluateDirectorDataStore();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader, dialogRemove, success } = mixin;
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const page = ref<number>(1);
const rowsPerPage = ref<number>(10);
// const currentPage = ref<number>(1);
// const maxPage = ref<number>(1);
// const page = ref<number>(1);
// const rowsPerPage = ref<number>(10);
/**
*pagination ของตาราง
*/
const pagination = ref({
descending: false,
page: page.value,
rowsPerPage: rowsPerPage.value,
page: 1,
rowsPerPage: 10,
});
watch(
() => currentPage.value,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
getList();
}
);
// watch(
// () => currentPage.value,
// () => {
// rowsPerPage.value = pagination.value.rowsPerPage;
// getList();
// }
// );
watch(
() => pagination.value.rowsPerPage,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
currentPage.value = 1;
getList();
}
);
// watch(
// () => pagination.value.rowsPerPage,
// () => {
// rowsPerPage.value = pagination.value.rowsPerPage;
// currentPage.value = 1;
// getList();
// }
// );
function getList() {
showLoader();
@ -180,7 +180,7 @@ onMounted(() => {
v-model:pagination="pagination"
:visible-columns="dataStore.visibleColumns"
>
<template v-slot:pagination="scope">
<!-- <template v-slot:pagination="scope">
<q-pagination
v-model="currentPage"
active-color="primary"
@ -190,7 +190,7 @@ onMounted(() => {
boundary-links
direction-links
></q-pagination>
</template>
</template> -->
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">

View file

@ -20,36 +20,36 @@ const {
success,
} = mixin;
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const page = ref<number>(1);
const rowsPerPage = ref<number>(10);
// const currentPage = ref<number>(1);
// const maxPage = ref<number>(1);
// const page = ref<number>(1);
// const rowsPerPage = ref<number>(10);
/**
*pagination ของตาราง
*/
const pagination = ref({
descending: false,
page: page.value,
rowsPerPage: rowsPerPage.value,
page: 1,
rowsPerPage: 10,
});
watch(
() => currentPage.value,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
getList();
}
);
// watch(
// () => currentPage.value,
// () => {
// rowsPerPage.value = pagination.value.rowsPerPage;
// getList();
// }
// );
watch(
() => pagination.value.rowsPerPage,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
currentPage.value = 1;
getList();
}
);
// watch(
// () => pagination.value.rowsPerPage,
// () => {
// rowsPerPage.value = pagination.value.rowsPerPage;
// currentPage.value = 1;
// getList();
// }
// );
async function getList() {
showLoader();
await http
@ -197,7 +197,7 @@ function filterFn() {
v-model:pagination="pagination"
:visible-columns="dataStore.visibleColumns"
>
<template v-slot:pagination="scope">
<!-- <template v-slot:pagination="scope">
<q-pagination
v-model="currentPage"
active-color="primary"
@ -207,7 +207,7 @@ function filterFn() {
boundary-links
direction-links
></q-pagination>
</template>
</template> -->
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">

View file

@ -42,35 +42,12 @@ const initialPagination = ref<any>({
async function updatePagination(initialPagination: any) {
currentPage.value = 1;
pageSize.value = initialPagination.rowsPerPage;
page.value = 1; // set current page 1 per row
}
/** function callback เมื่อมีการเปลี่ยนหน้า*/
watch(
[
() => currentPage.value,
() => (pageSize.value = initialPagination.value.rowsPerPage),
],
async () => {
fetchEvaluteList();
}
);
/** function callback เมื่อมีการเปลี่ยนหน้า*/
watch(
[() => currentPage.value, () => initialPagination.value.rowsPerPage],
async () => {
page.value = currentPage.value;
await fetchEvaluteList();
}
);
/** function callback เมื่อมีการเปลี่ยนจำนวนแถว*/
watch(
() => initialPagination.value.rowsPerPage,
() => pageSize.value,
() => {
pageSize.value = initialPagination.value.rowsPerPage;
currentPage.value = 1;
fetchEvaluteList();
}
);
@ -106,8 +83,7 @@ async function fetchEvaluteList() {
.then(async (res) => {
const data = res.data.result.data;
total.value = res.data.result.total;
maxPage.value = await Math.ceil(total.value / pageSize.value);
maxPage.value = maxPage.value < 1 ? 1 : maxPage.value;
maxPage.value = Math.ceil(total.value / pageSize.value);
store.fetchData(data);
})
.catch((e) => {
@ -268,7 +244,7 @@ onMounted(async () => {
class="custom-header-table"
:visible-columns="store.visibleColumns"
v-model:pagination="initialPagination"
:rows-per-page-options="[10, 25, 50, 100]"
:rows-per-page-options="[1, 10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:header="props">
@ -309,6 +285,8 @@ onMounted(async () => {
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchEvaluteList"
></q-pagination>
</template>
</d-table>

View file

@ -22,7 +22,6 @@ import config from "@/app.config";
const posTypeOp = ref<DataOption[]>([]);
const posType = ref<string>("");
const maxPage = ref<number>(1);
const $q = useQuasar();
const {
date2Thai,
@ -147,6 +146,8 @@ const formFilter = reactive({
pageSize: 10,
keyword: "",
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
function filterFn() {
formFilter.page = 1;
@ -171,7 +172,7 @@ function getData() {
)
.then((res) => {
const data = res.data.result.data;
const total = res.data.result.total;
totalList.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
rows.value = data.map((item: ResponseData) => ({
id: item.id,
@ -271,7 +272,10 @@ onMounted(() => {
<template v-if="posType" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="posType = '';getData()"
@click.stop.prevent="
posType = '';
getData();
"
class="cursor-pointer"
/>
</template>
@ -409,6 +413,7 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="formFilter.page"
active-color="primary"

View file

@ -39,6 +39,7 @@ const formFilter = reactive<FormFilter>({
keyword: "",
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
/** ข้อมูล Table*/
const columns = ref<QTableProps["columns"]>([
@ -119,6 +120,7 @@ function fetchListChart() {
)
.then((res) => {
rows.value = res.data.result.data;
totalList.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
})
.catch((err) => {
@ -349,6 +351,7 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="formFilter.page"
active-color="primary"

View file

@ -483,6 +483,7 @@ function redirectToPage(id: string, status: string) {
bordered
dense
class="custom-header-table"
:rows-per-page-options="[10, 25, 50, 100, 500]"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>

View file

@ -100,6 +100,7 @@ const formFilter = reactive<FormFilter>({
keyword: "",
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
const pagination = ref({
page: formFilter.page,
@ -127,6 +128,7 @@ function fetchSalalyEmployeeRate() {
.then((res) => {
rows.value = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
totalList.value = res.data.result.total;
})
.catch((err) => {
messageError($q, err);
@ -346,6 +348,7 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="formFilter.page"
active-color="primary"

View file

@ -33,7 +33,7 @@ const {
hideLoader,
} = useCounterMixin();
const isActive = ref<boolean>(false)
const isActive = ref<boolean>(false);
const salaryId = ref<string>(route.params.id.toString());
/** modalDialog*/
@ -121,7 +121,8 @@ const formQuery = reactive<FormQuerySalary>({
pageSize: 100, //*
keyword: "", //keyword
});
const totalRow = ref<number>(1);
const maxPage = ref<number>(1);
const totalRow = ref<number>(0);
async function fetchListSalalyRate() {
showLoader();
@ -134,7 +135,8 @@ async function fetchListSalalyRate() {
`?page=${page}&pageSize=${pageSize}&keyword=${keyword}`
)
.then((res) => {
totalRow.value = Math.ceil(res.data.result.total / formQuery.pageSize);
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
totalRow.value = res.data.result.total;
rows.value = res.data.result.data;
})
@ -202,14 +204,14 @@ function clickDownload() {
hideLoader();
});
}
function fetchList(){
function fetchList() {
http
.get(config.API.salaryChartByid(salaryId.value))
.then((res)=>{
isActive.value = res.data.result.isActive
})
.catch((e)=>{})
.finally(()=>{})
.get(config.API.salaryChartByid(salaryId.value))
.then((res) => {
isActive.value = res.data.result.isActive;
})
.catch((e) => {})
.finally(() => {});
}
onMounted(async () => {
await fetchList();
@ -240,7 +242,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
<q-card flat bordered class="q-pa-md">
<div class="col-12 row">
<q-btn
v-if="!isActive"
v-if="!isActive"
flat
round
dense
@ -285,7 +287,12 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props" :class="props.row.isNext === true ? 'text-edit text-bold':''">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
:class="props.row.isNext === true ? 'text-edit text-bold' : ''"
>
<div v-if="col.name == 'no'">
{{
(formQuery.page - 1) * formQuery.pageSize + props.rowIndex + 1
@ -335,7 +342,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
</q-td>
<q-td>
<q-btn
v-if="!isActive"
v-if="!isActive"
flat
dense
icon="mdi-dots-vertical"
@ -376,11 +383,12 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ totalRow }} รายการ
<q-pagination
v-model="formQuery.page"
active-color="primary"
color="dark"
:max="totalRow"
:max="maxPage"
size="sm"
boundary-links
direction-links

View file

@ -1,6 +1,5 @@
<script setup lang="ts">
import { getDateMeta } from "@fullcalendar/core/internal";
import { ref, reactive, onMounted } from "vue";
import { ref, watch, onMounted } from "vue";
import { useSalaryDataStore } from "@/modules/13_salary/store/SalaryStore";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
@ -37,6 +36,7 @@ const effectiveDate = ref<Date | null>(null);
const yearData = ref<number | null>(0);
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
const currentPage = ref<number>(1);
const page = ref<number>(1);
@ -128,6 +128,7 @@ function getData() {
.then((res) => {
dataStore.fetchDataMap(res.data.result.data);
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
totalList.value = res.data.result.total;
})
.catch((e) => {
messageError($q, e);
@ -137,6 +138,7 @@ function getData() {
});
}
function dataUpdate() {
page.value = 1;
getData();
}
/** set ปี ทั้งหมด */
@ -211,6 +213,18 @@ onMounted(async () => {
dataStore.visibleColumns = visibleColumns.value;
dataStore.columns = columns.value;
});
function updatePageSize(newPagination: any) {
page.value = 1;
rowsPerPage.value = newPagination.rowsPerPage;
}
watch(
() => rowsPerPage.value,
() => {
getData();
}
);
</script>
<template>
@ -330,8 +344,10 @@ onMounted(async () => {
:visible-columns="dataStore.visibleColumns"
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePageSize"
>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="currentPage"
active-color="primary"
@ -340,6 +356,7 @@ onMounted(async () => {
size="sm"
boundary-links
direction-links
@update:model-value="getData"
></q-pagination>
</template>
<template v-slot:header="props">

View file

@ -1,11 +1,13 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { ref, onMounted, reactive, watch } from "vue";
import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import genReportXLSX from "@/plugins/genreportxlsx";
import { useRouter } from "vue-router";
import type { NewPagination } from "@/modules/15_development/interface/index/Main";
/** importStore*/
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import { useCounterMixin } from "@/stores/mixin";
@ -21,6 +23,8 @@ const pagination = ref({
rowsPerPage: 10,
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0); //
const formFilter = reactive({
root: null,
page: 1,
@ -147,8 +151,9 @@ function getData() {
http
.post(config.API.developmentHistoryList("employee"), formFilter)
.then((res) => {
console.log(res.data.result.data);
const data = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
totalList.value = res.data.result.total;
rows.value = data.map((item: any) => ({
id: item.id ? item.id : null,
citizenId: item.citizenId ? item.citizenId : null,
@ -171,6 +176,23 @@ function getData() {
});
}
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: NewPagination) {
formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage;
}
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
watch(
() => formFilter.pageSize,
() => {
getData();
}
);
onMounted(() => {
fetchListOrg();
});
@ -267,7 +289,7 @@ onMounted(() => {
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter.prevent="getData()"
@keydown.enter.prevent="(formFilter.page = 1), getData()"
>
<template v-slot:append>
<q-icon v-if="formFilter.keyword == ''" name="search" />
@ -316,8 +338,10 @@ onMounted(() => {
:visible-columns="visibleColumns"
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="formFilter.page"
active-color="primary"
@ -327,6 +351,7 @@ onMounted(() => {
size="sm"
boundary-links
direction-links
@update:model-value="getData"
></q-pagination>
</template>
<template v-slot:header="props">

View file

@ -1,11 +1,14 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { ref, onMounted, reactive, watch } from "vue";
import { useRouter } from "vue-router";
import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import genReportXLSX from "@/plugins/genreportxlsx";
/**importType*/
import type { NewPagination } from "@/modules/15_development/interface/index/Main";
/** importStore*/
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import { useCounterMixin } from "@/stores/mixin";
@ -23,6 +26,7 @@ const formFilter = reactive({
year: new Date().getFullYear(),
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0); //
/** use*/
const router = useRouter();
@ -110,12 +114,14 @@ const columns = ref<QTableProps["columns"]>([
]);
const agencyOp = ref<[]>([]);
function fetchListOrg() {
showLoader();
http
.get(config.API.developmentHistoryListOrg("officer", formFilter.year))
.then((res) => {
formFilter.root = null;
formFilter.page = 1;
rows.value = [];
agencyOp.value = res.data.result;
getData();
@ -135,6 +141,8 @@ function getData() {
.then((res) => {
console.log(res.data.result.data);
const data = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
totalList.value = res.data.result.total;
rows.value = data.map((item: any) => ({
id: item.id ? item.id : null,
citizenId: item.citizenId ? item.citizenId : null,
@ -181,6 +189,23 @@ function onEdit(id: string) {
router.push(`/development/history/${id}`);
}
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: NewPagination) {
formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage;
}
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
watch(
() => formFilter.pageSize,
() => {
getData();
}
);
onMounted(() => {
fetchListOrg();
});
@ -275,9 +300,8 @@ onMounted(() => {
v-model="formFilter.keyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter.prevent="getData()"
@keydown.enter.prevent="(formFilter.page = 1), getData()"
>
<template v-slot:append>
<q-icon v-if="formFilter.keyword == ''" name="search" />
@ -324,8 +348,10 @@ onMounted(() => {
:visible-columns="visibleColumns"
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="formFilter.page"
active-color="primary"
@ -335,6 +361,7 @@ onMounted(() => {
size="sm"
boundary-links
direction-links
@update:model-value="getData"
></q-pagination>
</template>
<template v-slot:header="props">

View file

@ -98,7 +98,8 @@ const formQuery = reactive<FormQueryListProject>({
node: null,
nodeId: null,
});
const totalList = ref<number>(1); //
const totalList = ref<number>(0); //
const totalPage = ref<number>(1);
/** funciton fetch รายการโครงการ*/
function fetchListProject() {
@ -110,7 +111,8 @@ function fetchListProject() {
)
.then((res) => {
const data = res.data.result.data;
totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize);
totalPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
totalList.value = res.data.result.total;
rows.value = data;
})
.catch((err) => {
@ -499,11 +501,12 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="formQuery.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
:max="Number(totalPage)"
size="sm"
boundary-links
direction-links

View file

@ -108,26 +108,6 @@ const scholarshipTypeOp = ref<DataOption[]>([
name: "ศึกษา ฝึกอบรม ประชุม ดูงาน และปฏิบัติการวิจัย ณ ต่างประเทศ",
},
]);
const itemDownload = ref<ItemsDownload[]>([
{
label: "ดาวน์โหลด 1",
value: "",
icon: "mdi-file-pdf-box",
color: "green",
},
{
label: "ดาวน์โหลด 2",
value: "",
icon: "mdi-file-table",
color: "red",
},
{
label: "ดาวน์โหลด 3",
value: "",
icon: "mdi-file-word",
color: "blue",
},
]);
const formQuery = reactive({
page: 1,
@ -137,6 +117,7 @@ const formQuery = reactive({
keyword: "",
});
const totalList = ref<number>(1); //
const maxPage = ref<number>(1);
function fetchList() {
showLoader();
@ -147,7 +128,9 @@ function fetchList() {
)
.then((res) => {
const data = res.data.result.data;
totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize);
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
totalList.value = res.data.result.total;
rows.value = data;
})
.catch((err) => {
@ -369,11 +352,12 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="formQuery.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
:max="Number(maxPage)"
size="sm"
boundary-links
direction-links