Merge branch 'NiceDev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-09-15 13:53:12 +07:00
commit ec8f370785
24 changed files with 282 additions and 167 deletions

View file

@ -0,0 +1,50 @@
# /.forgejo/workflows/build.yml
name: Build
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:
env:
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }}
IMAGE_VERSION: build
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[registry."${{ env.REGISTRY }}"]
ca=["/etc/ssl/certs/ca-certificates.crt"]
- name: Tag Version
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/v//g' >> $GITHUB_ENV
else
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
fi
- name: Login in to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Build and push docker image
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
context: .
file: ./docker/Dockerfile
tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
push: true

View file

@ -0,0 +1,29 @@
name: Build
on:
workflow_dispatch:
inputs:
version:
description: "Version to deploy"
type: string
required: false
default: "latest"
env:
IMAGE_VERSION: build
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Remote Deploy
uses: appleboy/ssh-action@v1.2.1
with:
host: ${{ vars.SSH_DEPLOY_HOST }}
port: ${{ vars.SSH_DEPLOY_PORT }}
username: ${{ secrets.SSH_DEPLOY_USER }}
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
script: |
cd ~/repo
./replace-env.sh APP_USER "${{ inputs.version }}"
./deploy.sh hrms-user

View file

@ -1,4 +1,4 @@
version: 37 version: 38
jobs: jobs:
- name: CI for UAT - name: CI for UAT
steps: steps:
@ -40,7 +40,7 @@ jobs:
name: build docker image name: build docker image
dockerfile: ./docker/Dockerfile dockerfile: ./docker/Dockerfile
output: !RegistryOutput output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-user:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-user:latest tags: '@server@/bma-hrms/hrms-user:@build_version@ @server@/bma-hrms/hrms-user:latest'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers: triggers:
- !TagCreateTrigger - !TagCreateTrigger
@ -90,7 +90,7 @@ jobs:
name: build docker image name: build docker image
dockerfile: ./docker/Dockerfile dockerfile: ./docker/Dockerfile
output: !RegistryOutput output: !RegistryOutput
tags: hrms-git.bangkok.go.th/bma-hrms/hrms-user:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-user:latest tags: '@server@/bma-hrms/hrms-user:@build_version@ @server@/bma-hrms/hrms-user:latest'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers: triggers:
- !TagCreateTrigger - !TagCreateTrigger

View file

@ -7,15 +7,7 @@ export default {
profileBykeycloak: () => `${profile}`, profileBykeycloak: () => `${profile}`,
// positionBykeycloak: () => `${env.API_URI}/org/profile/keycloak/position`, // positionBykeycloak: () => `${env.API_URI}/org/profile/keycloak/position`,
appealMainList: ( appealMainList: () => `${appeal}/user`,
status: string,
type: string,
year: number,
page: number,
pageSize: number,
keyword: string
) =>
`${appeal}/user?status=${status}&type=${type}&year=${year}&page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
appealAdd: () => `${appeal}`, appealAdd: () => `${appeal}`,
appealByID: (id: string) => `${appeal}/${id}`, appealByID: (id: string) => `${appeal}/${id}`,

View file

@ -138,9 +138,9 @@ function onRequest(requestProp: any) {
...newPagination, ...newPagination,
}; };
if (isPageChange) { // if (isPageChange) {
emit("request", requestProp); emit("request", requestProp);
} // }
} }
function handlePageChange(newPage: number) { function handlePageChange(newPage: number) {

View file

@ -7,9 +7,9 @@ import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { Pagination } from "@/components/Workflow/interface/index/Main";
import type { DataQuery } from "@/components/Workflow/interface/request/Main"; import type { DataQuery } from "@/components/Workflow/interface/request/Main";
import type { DataCommander } from "@/components/Workflow/interface/response/Main"; import type { DataCommander } from "@/components/Workflow/interface/response/Main";
import type { PropsTable } from "@/interface/PropsTable";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
@ -76,17 +76,19 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const pagination = ref<PropsTable.Pagination>({
const total = ref<number>(0); sortBy: "",
const totalList = ref<number>(1); descending: true,
page: 1,
rowsPerPage: 10,
rowsNumber: 0,
});
const isAcceptSetting = ref<boolean>(false); const isAcceptSetting = ref<boolean>(false);
const isApproveSetting = ref<boolean>(false); const isApproveSetting = ref<boolean>(false);
const isReasonSetting = ref<boolean>(false); const isReasonSetting = ref<boolean>(false);
const formDataQuery = reactive<DataQuery>({ const formDataQuery = reactive<DataQuery>({
page: 1,
pageSize: 10,
isAct: false, isAct: false,
keyword: "", keyword: "",
}); });
@ -97,12 +99,11 @@ async function fetchLists() {
.put(config.API.workflow + `commander/${props.type}`, { .put(config.API.workflow + `commander/${props.type}`, {
...formDataQuery, ...formDataQuery,
keycloakId: props.keycloakId, keycloakId: props.keycloakId,
page: pagination.value.page,
pageSize: pagination.value.rowsPerPage,
}) })
.then(async (res) => { .then(async (res) => {
totalList.value = Math.ceil( pagination.value.rowsNumber = res.data.result.total;
res.data.result.total / formDataQuery.pageSize
);
total.value = res.data.result.total;
rows.value = res.data.result.data; rows.value = res.data.result.data;
}) })
.catch((err) => { .catch((err) => {
@ -139,7 +140,7 @@ function onSubmit() {
} }
function onSearchData() { function onSearchData() {
formDataQuery.page = 1; pagination.value.page = 1;
fetchLists(); fetchLists();
} }
@ -150,32 +151,25 @@ function onCloseModal() {
isAcceptSetting.value = false; isAcceptSetting.value = false;
isApproveSetting.value = false; isApproveSetting.value = false;
isReasonSetting.value = false; isReasonSetting.value = false;
formDataQuery.page = 1;
formDataQuery.pageSize = 10;
formDataQuery.isAct = false; formDataQuery.isAct = false;
formDataQuery.keyword = ""; formDataQuery.keyword = "";
} }
/**
* งกนร request จากตาราง เมอมการเปลยน pagination
* @param requestProps อมลการรองขอจากตาราง
*/
function onTableRequest(requestProps: PropsTable.RequestProps) {
const newPagination = requestProps?.pagination || requestProps;
if (!newPagination?.page || !newPagination?.rowsPerPage) return;
pagination.value = { ...newPagination };
}
watch(modal, (val) => { watch(modal, (val) => {
if (val) { if (val) {
fetchLists(); fetchLists();
} }
}); });
// watch(
// () => [formDataQuery.isAct, formDataQuery.pageSize],
// () => {
// onSearchData();
// }
// );
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: Pagination) {
formDataQuery.pageSize = newPagination.rowsPerPage;
}
</script> </script>
<template> <template>
@ -231,7 +225,8 @@ function updatePagination(newPagination: Pagination) {
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
selection="single" selection="single"
v-model:selected="selected" v-model:selected="selected"
@update:pagination="updatePagination" v-model:pagination="pagination"
@request="onTableRequest"
> >
<template v-slot:header-selection="scope"> <template v-slot:header-selection="scope">
<q-checkbox <q-checkbox
@ -266,21 +261,6 @@ function updatePagination(newPagination: Pagination) {
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="formDataQuery.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchLists()"
></q-pagination>
</template>
</d-table> </d-table>
<div class="q-gutter-xs q-pt-sm"> <div class="q-gutter-xs q-pt-sm">
<div> <div>

View file

@ -1,6 +1,4 @@
interface DataQuery { interface DataQuery {
page: number;
pageSize: number;
isAct: boolean; isAct: boolean;
keyword: string; keyword: string;
} }

View file

@ -44,11 +44,11 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "fullName", name: "firstName",
align: "left", align: "left",
label: "ชื่อ-นามสกุล", label: "ชื่อ-นามสกุล",
sortable: true, sortable: true,
field: "fullName", field: "firstName",
format(val, row) { format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`; return `${row.prefix}${row.firstName} ${row.lastName}`;
}, },
@ -66,7 +66,7 @@ const columns = ref<QTableProps["columns"]>([
}, },
]); ]);
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "createdAt", sortBy: "",
descending: true, descending: true,
page: 1, page: 1,
rowsPerPage: 10, rowsPerPage: 10,
@ -83,6 +83,10 @@ async function getCommander() {
page: pagination.value.page, page: pagination.value.page,
pageSize: pagination.value.rowsPerPage, pageSize: pagination.value.rowsPerPage,
keycloakId: storeData.formData.keycloakId, keycloakId: storeData.formData.keycloakId,
...(pagination.value.sortBy && {
sortBy: pagination.value.sortBy,
descending: pagination.value.descending,
}),
type: type:
storeData.officerType.toLocaleUpperCase() == "OFFICER" storeData.officerType.toLocaleUpperCase() == "OFFICER"
? "officer" ? "officer"
@ -117,7 +121,7 @@ function closeDialog() {
rows.value = []; rows.value = [];
selected.value = []; selected.value = [];
pagination.value = { pagination.value = {
sortBy: "createdAt", sortBy: "",
descending: true, descending: true,
page: 1, page: 1,
rowsPerPage: 10, rowsPerPage: 10,

View file

@ -37,6 +37,8 @@ const maxPage = ref<number>(1);
const page = ref<number>(1); const page = ref<number>(1);
const pageSize = ref<number>(10); const pageSize = ref<number>(10);
const total = ref<number>(0); const total = ref<number>(0);
const sortBy = ref<string>("dateSendLeave");
const descending = ref<boolean>(true);
/** function เรียกข้อมูลการลา*/ /** function เรียกข้อมูลการลา*/
async function fetchDataTable() { async function fetchDataTable() {
isLoading.value = true; isLoading.value = true;
@ -47,6 +49,10 @@ async function fetchDataTable() {
page: page.value.toString(), //* page: page.value.toString(), //*
pageSize: pageSize.value.toString(), //* pageSize: pageSize.value.toString(), //*
keyword: filter.value, //keyword keyword: filter.value, //keyword
...(sortBy.value && {
sortBy: sortBy.value,
descending: descending.value,
}),
}; };
await http await http
.post(config.API.leaveTableList(), body) .post(config.API.leaveTableList(), body)
@ -141,9 +147,14 @@ async function updateFilterTable(y: number, t: string, s: string, k: string) {
* function updatePagination * function updatePagination
* @param p หน * @param p หน
* @param ps แถวตอหน * @param ps แถวตอหน
* @param s เรยงลำดบตาม
* @param d เรยงลำดบจากนอยไปมาก
*/ */
async function updatePagination(p: number, ps: number) { async function updatePagination(p: number, ps: number, s: string, d: boolean) {
(page.value = p), (pageSize.value = ps); page.value = p;
pageSize.value = ps;
sortBy.value = s;
descending.value = d;
await fetchDataTable(); await fetchDataTable();
} }
@ -188,6 +199,8 @@ onMounted(async () => {
:pageSize="pageSize" :pageSize="pageSize"
:leaveType="leaveType" :leaveType="leaveType"
:total="total" :total="total"
:sortBy="sortBy"
:descending="descending"
:isloadingData="isLoading" :isloadingData="isLoading"
> >
<template #columns="props"> <template #columns="props">
@ -215,7 +228,7 @@ onMounted(async () => {
}} }}
</q-td> </q-td>
<q-td <q-td
key="dateLeave" key="leaveStartDate"
:props="props" :props="props"
@click="onClickView(props.row.id, props.row.status)" @click="onClickView(props.row.id, props.row.status)"
> >

View file

@ -38,6 +38,14 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
sortBy: {
type: String,
default: "dateSendLeave",
},
descending: {
type: Boolean,
default: true,
},
}); });
/** /**
@ -56,11 +64,10 @@ const table = ref<any>(null);
const currentPage = ref<number>(1); const currentPage = ref<number>(1);
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "dateSendLeave", sortBy: props.sortBy,
descending: true, descending: props.descending,
page: 1, page: 1,
rowsPerPage: Number(props.pageSize), rowsPerPage: Number(props.pageSize),
rowsNumber: Number(props.total), rowsNumber: Number(props.total),
}); });
@ -94,9 +101,20 @@ function filterTable() {
); );
} }
/** function updatePagination*/ /**
function updatePagination(p: number, ps: number) { * งกนอปเดตการแบงหน
emit("update:Pagination", p, ps); * @param p หน
* @param ps ขนาดหน
* @param sortBy เรยงลำดบตาม
* @param descending เรยงลำดบจากนอยไปมาก
*/
function updatePagination(
p: number,
ps: number,
sortBy?: string,
descending?: boolean
) {
emit("update:Pagination", p, ps, sortBy, descending);
} }
/** /**
@ -108,7 +126,12 @@ function onTableRequest(requestProps: PropsTable.RequestProps) {
if (!newPagination?.page || !newPagination?.rowsPerPage) return; if (!newPagination?.page || !newPagination?.rowsPerPage) return;
currentPage.value = newPagination.page; currentPage.value = newPagination.page;
pagination.value = { ...newPagination }; pagination.value = { ...newPagination };
updatePagination(newPagination.page, newPagination.rowsPerPage); updatePagination(
newPagination.page,
newPagination.rowsPerPage,
newPagination.sortBy,
newPagination.descending
);
} }
</script> </script>

View file

@ -200,7 +200,7 @@ export const useLeaveStore = defineStore("Leave", () => {
"leaveTypeName", "leaveTypeName",
"dateSendLeave", "dateSendLeave",
"status", "status",
"dateLeave", "leaveStartDate",
]); ]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -208,7 +208,7 @@ export const useLeaveStore = defineStore("Leave", () => {
name: "no", name: "no",
align: "left", align: "left",
label: "ลำดับ", label: "ลำดับ",
sortable: true, sortable: false,
field: "no", field: "no",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px; width:5%;", style: "font-size: 14px; width:5%;",
@ -223,7 +223,7 @@ export const useLeaveStore = defineStore("Leave", () => {
style: "font-size: 14px; width:15%;", style: "font-size: 14px; width:15%;",
}, },
{ {
name: "dateLeave", name: "leaveStartDate",
align: "left", align: "left",
label: "วันที่ลา", label: "วันที่ลา",
sortable: true, sortable: true,
@ -259,7 +259,6 @@ export const useLeaveStore = defineStore("Leave", () => {
*/ */
function typeConvert(item: string, subitem: any) { function typeConvert(item: string, subitem: any) {
typeLeave.value = convertSubtitle(item); typeLeave.value = convertSubtitle(item);
// }
typeId.value = convertId(item); typeId.value = convertId(item);
} }

View file

@ -35,13 +35,13 @@ const props = defineProps({
const emit = defineEmits(["update:pagination"]); const emit = defineEmits(["update:pagination"]);
/** ค้นหาคอลัม */ /** ค้นหาคอลัม */
const visibleColumns = ref<string[]>(["no", "type_th", "dateSend", "status"]); const visibleColumns = ref<string[]>(["no", "type_th", "lastUpdatedAt", "status"]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
align: "left", align: "left",
label: "ลำดับ", label: "ลำดับ",
sortable: true, sortable: false,
field: "no", field: "no",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px; ", style: "font-size: 14px; ",
@ -50,13 +50,13 @@ const columns = ref<QTableProps["columns"]>([
name: "type_th", name: "type_th",
align: "left", align: "left",
label: "ระดับที่ยื่นขอ", label: "ระดับที่ยื่นขอ",
sortable: true, sortable: false,
field: "type_th", field: "type_th",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px; ", style: "font-size: 14px; ",
}, },
{ {
name: "dateSend", name: "lastUpdatedAt",
align: "left", align: "left",
label: "วันที่ยื่นขอ", label: "วันที่ยื่นขอ",
sortable: true, sortable: true,
@ -68,7 +68,7 @@ const columns = ref<QTableProps["columns"]>([
name: "status", name: "status",
align: "left", align: "left",
label: "สถานะ", label: "สถานะ",
sortable: true, sortable: false,
field: "status", field: "status",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -128,7 +128,7 @@ onMounted(() => {
<d-table <d-table
ref="table" ref="table"
flat flat
bordere bordered
:columns="columns" :columns="columns"
:rows="store.row" :rows="store.row"
dense dense

View file

@ -52,7 +52,7 @@ const listMenu = ref<ListMenu[]>([
]); ]);
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "createdAt", sortBy: "",
descending: true, descending: true,
page: 1, page: 1,
rowsPerPage: 10, rowsPerPage: 10,
@ -81,7 +81,12 @@ async function fetchEvaluteList() {
pageSize: pagination.value.rowsPerPage, pageSize: pagination.value.rowsPerPage,
keyword: store.filterKeyword, keyword: store.filterKeyword,
status: selectedStatus.value, status: selectedStatus.value,
...(pagination.value.sortBy && {
sortBy: pagination.value.sortBy,
descending: pagination.value.descending,
}),
}; };
await http await http
.put(config.API.evaluationList(), body) .put(config.API.evaluationList(), body)
.then(async (res) => { .then(async (res) => {
@ -216,6 +221,8 @@ onMounted(async () => {
</div> </div>
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-11 row q-col-gutter-md"> <div class="col-xs-12 col-sm-12 col-md-11 row q-col-gutter-md">
<div class="col-12 row"> <div class="col-12 row">
<q-card bordered class="col-12 row caedNone q-pa-md"> <q-card bordered class="col-12 row caedNone q-pa-md">

View file

@ -1,7 +1,7 @@
useA useA
<script setup lang="ts"> <script setup lang="ts">
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { ref, onMounted, reactive, watch } from "vue"; import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
@ -28,7 +28,7 @@ const type = ref<DataOption[]>([
const isload = ref<boolean>(false); const isload = ref<boolean>(false);
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "createdAt", sortBy: "",
descending: true, descending: true,
page: 1, page: 1,
rowsPerPage: 10, rowsPerPage: 10,
@ -56,7 +56,7 @@ const columns = ref<QTableProps["columns"]>([
name: "no", name: "no",
align: "left", align: "left",
label: "ลำดับ", label: "ลำดับ",
sortable: true, sortable: false,
field: "no", field: "no",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px; width:5px;", style: "font-size: 14px; width:5px;",
@ -74,7 +74,7 @@ const columns = ref<QTableProps["columns"]>([
name: "type", name: "type",
align: "left", align: "left",
label: "ประเภท", label: "ประเภท",
sortable: true, sortable: false,
field: "type", field: "type",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px; width:15%;", style: "font-size: 14px; width:15%;",
@ -83,7 +83,7 @@ const columns = ref<QTableProps["columns"]>([
name: "year", name: "year",
align: "left", align: "left",
label: "ปีงบประมาณ", label: "ปีงบประมาณ",
sortable: true, sortable: false,
field: "year", field: "year",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -149,23 +149,28 @@ const columns = ref<QTableProps["columns"]>([
// //
async function getData() { async function getData() {
isload.value = true; isload.value = true;
const params = new URLSearchParams({
status: formData.status,
type: formData.type,
year: String(formData.year),
page: String(pagination.value.page),
pageSize: String(pagination.value.rowsPerPage),
keyword: filterKeyword.value,
});
if (pagination.value.sortBy) {
params.append("sortBy", pagination.value.sortBy);
params.append("descending", String(pagination.value.descending));
}
await http await http
.get( .get(config.API.appealMainList() + `?${params.toString()}`)
config.API.appealMainList(
formData.status,
formData.type,
formData.year,
pagination.value.page,
pagination.value.rowsPerPage,
filterKeyword.value
)
)
.then(async (res) => { .then(async (res) => {
const result = res.data.result; const result = res.data.result;
pagination.value.rowsNumber = result.total; pagination.value.rowsNumber = result.total;
dataStore.fetchAppealComplain(result.data); dataStore.fetchAppealComplain(result.data);
}) })
.catch((e: any) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {

View file

@ -27,8 +27,8 @@ const props = defineProps({
}); });
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "desc", sortBy: formQuery.value.sortBy,
descending: false, descending: formQuery.value.descending,
page: formQuery.value.page, page: formQuery.value.page,
rowsPerPage: formQuery.value.pageSize, rowsPerPage: formQuery.value.pageSize,
rowsNumber: total.value, rowsNumber: total.value,
@ -48,6 +48,8 @@ function onTableRequest(requestProps: PropsTable.RequestProps) {
if (!newPagination?.page || !newPagination?.rowsPerPage) return; if (!newPagination?.page || !newPagination?.rowsPerPage) return;
formQuery.value.page = newPagination.page; formQuery.value.page = newPagination.page;
formQuery.value.pageSize = newPagination.rowsPerPage; formQuery.value.pageSize = newPagination.rowsPerPage;
formQuery.value.sortBy = newPagination.sortBy;
formQuery.value.descending = newPagination.descending;
props?.fetchList?.(); props?.fetchList?.();
} }
@ -96,7 +98,7 @@ watch(
:key="col.id" :key="col.id"
@click="redirectViewDetail(props.row.id)" @click="redirectViewDetail(props.row.id)"
> >
<div v-if="col.name === 'name'"> <div v-if="col.name === 'firstName'">
{{ {{
`${props.row.prefix}${props.row.firstname} ${props.row.lastname}` `${props.row.prefix}${props.row.firstname} ${props.row.lastname}`
}} }}

View file

@ -41,8 +41,8 @@ const props = defineProps({
}); });
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "desc", sortBy: formQuery.value.sortBy,
descending: false, descending: formQuery.value.descending,
page: formQuery.value.page, page: formQuery.value.page,
rowsPerPage: formQuery.value.pageSize, rowsPerPage: formQuery.value.pageSize,
rowsNumber: total.value, rowsNumber: total.value,
@ -115,6 +115,8 @@ function onTableRequest(requestProps: PropsTable.RequestProps) {
if (!newPagination?.page || !newPagination?.rowsPerPage) return; if (!newPagination?.page || !newPagination?.rowsPerPage) return;
formQuery.value.page = newPagination.page; formQuery.value.page = newPagination.page;
formQuery.value.pageSize = newPagination.rowsPerPage; formQuery.value.pageSize = newPagination.rowsPerPage;
formQuery.value.sortBy = newPagination.sortBy;
formQuery.value.descending = newPagination.descending;
props?.fetchList?.(); props?.fetchList?.();
} }
@ -128,6 +130,8 @@ watch(
pagination.value.page = page; pagination.value.page = page;
pagination.value.rowsPerPage = pageSize; pagination.value.rowsPerPage = pageSize;
pagination.value.rowsNumber = total; pagination.value.rowsNumber = total;
pagination.value.sortBy = formQuery.value.sortBy;
pagination.value.descending = formQuery.value.descending;
} }
); );
</script> </script>
@ -219,7 +223,7 @@ watch(
<q-item-label caption>{{ col.label }}</q-item-label> <q-item-label caption>{{ col.label }}</q-item-label>
<q-item-label> <q-item-label>
<div v-if="col.name === 'name'"> <div v-if="col.name === 'firstName'">
{{ {{
`${props.row.prefix}${props.row.firstname} ${props.row.lastname}` `${props.row.prefix}${props.row.firstname} ${props.row.lastname}`
}} }}

View file

@ -69,11 +69,13 @@ interface FormQuery {
pageSize: number; pageSize: number;
round: string; round: string;
keyword: string; keyword: string;
sortBy?: string;
descending?: boolean;
} }
interface ListTarget { interface ListTarget {
id: string; id: string;
createdAt: string; createdAt: string;
createdUserId: string; createdUserId: string;
lastUpdatedAt: string; lastUpdatedAt: string;
lastUpdateUserId: string; lastUpdateUserId: string;
@ -99,5 +101,5 @@ export type {
FormComment, FormComment,
FormCommentByRole, FormCommentByRole,
FormQuery, FormQuery,
ListTarget ListTarget,
}; };

View file

@ -14,6 +14,8 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
pageSize: 10, pageSize: 10,
round: "", round: "",
keyword: "", keyword: "",
sortBy: "",
descending: false,
}); });
const selected = ref([]); const selected = ref([]);
const work = ref<boolean>(false); const work = ref<boolean>(false);

View file

@ -50,8 +50,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => date2Thai(v), format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "year", name: "year",
@ -62,8 +60,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => v + 543, format: (v) => v + 543,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "durationKPI", name: "durationKPI",
@ -74,8 +70,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => (v == "OCT" ? "รอบที่ 2 ตุลาคม" : "รอบที่ 1 เมษายน"), format: (v) => (v == "OCT" ? "รอบที่ 2 ตุลาคม" : "รอบที่ 1 เมษายน"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "evaluationStatus", name: "evaluationStatus",
@ -86,8 +80,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => store.convertStatus(v), format: (v) => store.convertStatus(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "evaluationResults", name: "evaluationResults",
@ -98,8 +90,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => store.convertResults(v), format: (v) => store.convertResults(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
@ -147,7 +137,7 @@ const formQuery = reactive({
const isRoundClose = ref<boolean>(false); const isRoundClose = ref<boolean>(false);
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "desc", sortBy: "",
descending: false, descending: false,
page: 1, page: 1,
rowsPerPage: 10, rowsPerPage: 10,
@ -212,6 +202,10 @@ async function fetchList() {
status: formQuery.status === "" ? undefined : formQuery.status, status: formQuery.status === "" ? undefined : formQuery.status,
results: formQuery.results === "" ? undefined : formQuery.results, results: formQuery.results === "" ? undefined : formQuery.results,
year: year.value, year: year.value,
...(pagination.value.sortBy && {
sortBy: pagination.value.sortBy,
descending: pagination.value.descending,
}),
}; };
await http await http
.get(config.API.kpiEvaluation, { .get(config.API.kpiEvaluation, {

View file

@ -28,22 +28,20 @@ const dataListMain = ref<ResEvaluatorAssessor[]>([]);
const roundOp = ref<DataOptions[]>([]); const roundOp = ref<DataOptions[]>([]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"name", "firstName",
"createdAt", "createdAt",
"evaluationStatus", "evaluationStatus",
"evaluationResults", "evaluationResults",
]); ]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "name", name: "firstName",
align: "left", align: "left",
label: "ผู้ขอรับการประเมิน", label: "ผู้ขอรับการประเมิน",
sortable: true, sortable: true,
field: "name", field: "firstName",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "createdAt", name: "createdAt",
@ -54,8 +52,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => date2Thai(v), format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "evaluationStatus", name: "evaluationStatus",
@ -66,8 +62,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => store.convertStatus(v), format: (v) => store.convertStatus(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "evaluationResults", name: "evaluationResults",
@ -78,8 +72,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => store.convertResults(v), format: (v) => store.convertResults(v),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
@ -147,6 +139,10 @@ async function fetchList() {
? "SUMMARY" ? "SUMMARY"
: undefined, : undefined,
reqedit: store.tabMainevaluator === "3" ? "NEW" : undefined, reqedit: store.tabMainevaluator === "3" ? "NEW" : undefined,
...(store.formQuery.sortBy && {
sortBy: store.formQuery.sortBy,
descending: store.formQuery.descending,
}),
}; };
await http await http

View file

@ -49,7 +49,7 @@ const columns = ref<QTableProps["columns"]>([
name: "topic", name: "topic",
align: "left", align: "left",
label: "ชื่อเรื่อง", label: "ชื่อเรื่อง",
sortable: false, sortable: true,
field: "topic", field: "topic",
format: (v) => (v ? v : "-"), format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
@ -59,21 +59,13 @@ const columns = ref<QTableProps["columns"]>([
name: "detail", name: "detail",
align: "left", align: "left",
label: "รายละเอียด", label: "รายละเอียด",
sortable: false, sortable: true,
field: "detail", field: "detail",
format: (v) => (v ? v : "-"), format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
// {
// name: "document",
// align: "center",
// label: "",
// sortable: false,
// field: "document",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{ {
name: "status", name: "status",
align: "left", align: "left",
@ -88,7 +80,7 @@ const columns = ref<QTableProps["columns"]>([
name: "remark", name: "remark",
align: "left", align: "left",
label: "หมายเหตุ ", label: "หมายเหตุ ",
sortable: false, sortable: true,
field: "remark", field: "remark",
format: (v) => (v ? v : "-"), format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
@ -106,6 +98,7 @@ const visibleColumns = ref<string[]>([
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
descending: true, descending: true,
page: 1, page: 1,
sortBy: "",
rowsPerPage: 10, rowsPerPage: 10,
rowsNumber: 0, rowsNumber: 0,
}); });
@ -122,17 +115,26 @@ function onClickAdd() {
/** function fetch รายการข้อมูลการยื่นคำร้องขอแก้ไขข้อมูล*/ /** function fetch รายการข้อมูลการยื่นคำร้องขอแก้ไขข้อมูล*/
async function fetchListRequset() { async function fetchListRequset() {
let queryParams = { const queryParams = new URLSearchParams({
page: pagination.value.page, page: pagination.value.page.toString(),
pageSize: pagination.value.rowsPerPage, pageSize: pagination.value.rowsPerPage.toString(),
status: status.value, status: status.value,
keyword: keyword.value, keyword: keyword.value,
}; });
if (pagination.value.sortBy) {
queryParams.append("sortBy", pagination.value.sortBy);
queryParams.append(
"descending",
pagination.value.descending ? "true" : "false"
);
}
isLoading.value = true; isLoading.value = true;
await http await http
.get(config.API.requestEditByType(link.value) + `user`, { .get(
params: queryParams, config.API.requestEditByType(link.value) +
}) `user?${queryParams.toString()}`
)
.then((res) => { .then((res) => {
const result = res.data.result; const result = res.data.result;
pagination.value.rowsNumber = result.total; pagination.value.rowsNumber = result.total;

View file

@ -122,10 +122,6 @@ function onSearch() {
); );
} }
function onTableRequest() {
console.log(1111);
}
/** Hook Lifecycle */ /** Hook Lifecycle */
onMounted(async () => { onMounted(async () => {
await fecthList(); await fecthList();
@ -213,7 +209,6 @@ onMounted(async () => {
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:pagination="pagination" :pagination="pagination"
:loading="isLoading" :loading="isLoading"
@request="onTableRequest"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">

View file

@ -23,7 +23,7 @@ const status = ref<string>("ALL"); // สถานะคำร้อง
const statusOptions = ref<DataOption[]>(store.optionStatus); const statusOptions = ref<DataOption[]>(store.optionStatus);
const rows = ref<RowsListMain[]>([]); const rows = ref<RowsListMain[]>([]);
const pagination = ref<PropsTable.Pagination>({ const pagination = ref<PropsTable.Pagination>({
sortBy: "createdAt", sortBy: "",
descending: true, descending: true,
page: 1, page: 1,
rowsPerPage: 10, rowsPerPage: 10,
@ -40,7 +40,7 @@ const visibleColumns = ref<string[]>([
"detail", "detail",
"document", "document",
"status", "status",
"remark", "reason",
]); ]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -67,7 +67,7 @@ const columns = ref<QTableProps["columns"]>([
name: "developmentProjects", name: "developmentProjects",
align: "left", align: "left",
label: "วิธีการพัฒนา", label: "วิธีการพัฒนา",
sortable: true, sortable: false,
field: "developmentProjects", field: "developmentProjects",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -120,18 +120,18 @@ const columns = ref<QTableProps["columns"]>([
name: "status", name: "status",
align: "left", align: "left",
label: "สถานะคำร้อง", label: "สถานะคำร้อง",
sortable: true, sortable: false,
field: "status", field: "status",
format: (v) => store.convertStatus(v), format: (v) => store.convertStatus(v),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "remark", name: "reason",
align: "left", align: "left",
label: "หมายเหตุ ", label: "หมายเหตุ ",
sortable: true, sortable: true,
field: "remark", field: "reason",
format: (v) => (v ? v : "-"), format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -177,12 +177,21 @@ function onDelete(id: string) {
/** list รายการ */ /** list รายการ */
async function getListData() { async function getListData() {
isLoading.value = true; isLoading.value = true;
const params = new URLSearchParams({
status: status.value,
keyword: filterKeyword.value,
page: pagination.value.page.toString(),
pageSize: pagination.value.rowsPerPage.toString(),
});
if (pagination.value.sortBy) {
params.append("sortBy", pagination.value.sortBy);
params.append("descending", pagination.value.descending ? "true" : "false");
}
await http await http
.get( .get(config.API.developmentRequest + `/user?${params.toString()}`)
config.API.developmentRequest +
`/user?status=${status.value}&keyword=${filterKeyword.value}&page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}
`
)
.then(async (res) => { .then(async (res) => {
const result = await res.data.result; const result = await res.data.result;
pagination.value.rowsNumber = result.total; pagination.value.rowsNumber = result.total;
@ -247,6 +256,7 @@ async function downloadUrl(id: string, fileName: string) {
*/ */
function onTableRequest(requestProps: PropsTable.RequestProps) { function onTableRequest(requestProps: PropsTable.RequestProps) {
const newPagination = requestProps?.pagination || requestProps; const newPagination = requestProps?.pagination || requestProps;
if (!newPagination?.page || !newPagination?.rowsPerPage) return; if (!newPagination?.page || !newPagination?.rowsPerPage) return;
pagination.value = { ...newPagination }; pagination.value = { ...newPagination };
getListData(); getListData();

View file

@ -247,6 +247,14 @@ const landingPageUrl = ref<string>(configParam.landingPageUrl);
function onViewDetailNoti(url: string) { function onViewDetailNoti(url: string) {
window.open(url, "_blank"); window.open(url, "_blank");
} }
/** ดูการเปลี่ยน route name เพื่อเปลี่ยน tab */
watch(
() => route.name,
(newVal) => {
tab.value = newVal;
}
);
</script> </script>
<!-- โครงเว --> <!-- โครงเว -->