Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-12-04 09:45:27 +07:00
commit 7ab17d378f
35 changed files with 297 additions and 148 deletions

View file

@ -52,6 +52,7 @@ jobs:
with:
context: .
platforms: linux/amd64
file: docker/Dockerfile
push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
- name: Remote Deployment

102
.onedev-buildspec.yml Normal file
View file

@ -0,0 +1,102 @@
version: 37
jobs:
- name: CI for UAT
steps:
- !CheckoutStep
name: checkout code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !GenerateChecksumStep
name: generate package checksum
files: package-lock.json yarn.lock
targetFile: checksum
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetupCacheStep
name: set up npm cache
key: node_modules_@file:checksum@
loadKeys:
- node_modules
paths:
- node_modules
uploadStrategy: UPLOAD_IF_NOT_HIT
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: "@tag@"
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & test
runInContainer: true
image: node
interpreter: !DefaultInterpreter
commands: |
npm install
npm run build
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep
name: build docker image
dockerfile: ./docker/Dockerfile
output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-mgt:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-mgt:latest
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
tags: uat-*
branches: main
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400
- name: CI for PROD
steps:
- !CheckoutStep
name: checkout code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !GenerateChecksumStep
name: generate package checksum
files: package-lock.json yarn.lock
targetFile: checksum
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetupCacheStep
name: set up npm cache
key: node_modules_@file:checksum@
loadKeys:
- node_modules
paths:
- node_modules
uploadStrategy: UPLOAD_IF_NOT_HIT
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: "@tag@"
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & test
runInContainer: true
image: node
interpreter: !DefaultInterpreter
commands: |
npm install
npm run build
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep
name: build docker image
dockerfile: ./docker/Dockerfile
output: !RegistryOutput
tags: hrms-git.bangkok.go.th/bma-hrms/hrms-mgt:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-mgt:latest
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
tags: prod-*
branches: main
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400

View file

@ -1,21 +0,0 @@
# docker build . -t docker.frappet.com/demo/fe:latest
FROM node:lts as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./ .
RUN npm run build
FROM nginx as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod u+x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

19
docker/Dockerfile Normal file
View file

@ -0,0 +1,19 @@
# docker buildx build --platform=linux/amd64 -f docker/Dockerfile . -t hrms-git.chin.in.th/bma-hrms/hrms-mgt:0.1
# Build Stage
FROM node:latest as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./ .
RUN npm run build
# Production Stage
FROM nginx:stable-alpine AS production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod u+x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

View file

@ -14,10 +14,6 @@ do
sed -i 's|VITE_S3CLUSTER_PUBLIC_URL|'${VITE_S3CLUSTER_PUBLIC_URL}'|g' $file
sed -i 's|VITE_API_PUBLISH_URL|'${VITE_API_PUBLISH_URL}'|g' $file
sed -i 's|VITE_API_REPORT_URL|'${VITE_API_REPORT_URL}'|g' $file
sed -i 's|VITE_URL_KEYCLOAK|'${VITE_URL_KEYCLOAK}'|g' $file
sed -i 's|VITE_REALM_KEYCLOAK|'${VITE_REALM_KEYCLOAK}'|g' $file
sed -i 's|VITE_CLIENTID_KEYCLOAK|'${VITE_CLIENTID_KEYCLOAK}'|g' $file
sed -i 's|VITE_CLIENTSECRET_KEYCLOAK|'${VITE_CLIENTSECRET_KEYCLOAK}'|g' $file
sed -i 's|VITE_MANUAL_URL|'${VITE_MANUAL_URL}'|g' $file
sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file

View file

@ -404,7 +404,6 @@ onMounted(async () => {
v-model="formFilter.keyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
@keyup.enter="(formFilter.page = 1), fetchList()"
>

View file

@ -67,6 +67,7 @@ const props = defineProps({
type: Object,
required: true,
},
fetchDataTable: Function,
});
const title = ref<string>("ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน"); //title Dialog
@ -93,14 +94,6 @@ const isDisable = computed(() => {
} else return false;
});
/**
* function เช filter
*/
function resetFilter() {
filterTree.value = "";
filterRef.value.focus();
}
/**
* function เลอกขอมลหนวยงาน
*/
@ -157,6 +150,12 @@ function updatePagination(newPagination: NewPagination) {
reqMaster.value.page = 1;
}
function onSearchData() {
reqMaster.value.page = 1;
reqMaster.value.keyword = filterTable.value;
props.fetchDataTable?.(store.treeId, store.level, false);
}
/**
* การเปลยนแปลง modal เมอเป true
*/
@ -165,6 +164,7 @@ watch(
() => {
reqMaster.value.page = 1;
filterTree.value = "";
filterTable.value = "";
pagination.value.rowsPerPage = reqMaster.value.pageSize;
title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`;
@ -190,7 +190,10 @@ watch(
>
<q-header>
<q-toolbar>
<HeaderDialog :tittle="title" :close="() => (modal = false)" />
<HeaderDialog
:tittle="title"
:close="() => ((modal = false), (reqMaster.keyword = ''))"
/>
</q-toolbar>
<q-separator color="grey-4" />
</q-header>
@ -206,7 +209,13 @@ watch(
<q-space />
<div>
<q-input outlined dense v-model="filterTable" label="ค้นหา">
<q-input
outlined
dense
v-model="filterTable"
label="ค้นหา"
@keydown.enter="onSearchData"
>
<template v-slot:append>
<q-icon name="search" />
</template>
@ -214,71 +223,72 @@ watch(
</div>
</q-toolbar>
<d-table
flat
bordered
:rows="rows"
:columns="columns"
row-key="id"
:filter="filterTable.trim()"
no-data-label="ไม่มีข้อมูล"
selection="multiple"
v-model:selected="selectedFilter"
:rows-per-page-options="[10, 25, 50, 100]"
v-model:pagination="pagination"
@update:pagination="updatePagination"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<div class="col-12">
<d-table
flat
bordered
:rows="rows"
:columns="columns"
row-key="id"
no-data-label="ไม่มีข้อมูล"
selection="multiple"
v-model:selected="selectedFilter"
:rows-per-page-options="[10, 25, 50, 100]"
v-model:pagination="pagination"
@update:pagination="updatePagination"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name == 'no'">
{{
(reqMaster.page - 1) * Number(reqMaster.pageSize) +
props.rowIndex +
1
}}
</div>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name == 'no'">
{{
(reqMaster.page - 1) * Number(reqMaster.pageSize) +
props.rowIndex +
1
}}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="reqMaster.page"
active-color="primary"
color="dark"
:max="totalPage"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table>
<div v-else>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="reqMaster.page"
active-color="primary"
color="dark"
:max="totalPage"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table>
</div>
</q-card>
<q-card

View file

@ -106,6 +106,7 @@ async function fetchDataTable(id: string, level: number, action: boolean) {
: store.historyId;
isLoad.value = true;
}
posMaster.value = [];
await http
.post(config.API.orgPosMasterList, {
@ -113,7 +114,6 @@ async function fetchDataTable(id: string, level: number, action: boolean) {
keyword: reqMaster.keyword.trim(),
})
.then(async (res) => {
posMaster.value = [];
const dataMain: PosMaster[] = [];
totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
res.data.result.data.forEach((e: PosMaster) => {

View file

@ -528,6 +528,10 @@ watch(
if (!modalDialogMMove.value) {
pagination.value.page = 1;
pagination.value.rowsPerPage = reqMaster.value.pageSize;
if (posMaster.value.length === 0) {
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
}
}
}
);
@ -616,7 +620,7 @@ watch(
@keydown.enter.prevent="props.filterKeyword(reqMaster.keyword)"
>
<template v-slot:append>
<q-icon name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
</div>
@ -936,6 +940,7 @@ watch(
:type="typeMove"
:rowId="rowId"
:mainTree="props.mainTree ? props.mainTree : []"
:fetchDataTable="props.fetchDataTable"
/>
<!-- ประวตำแหน -->

View file

@ -295,7 +295,7 @@ watch(
borderless
outlined
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
style="width: 200px; max-width: auto"

View file

@ -657,7 +657,7 @@ onMounted(async () => {
v-model="filterKeyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter.prevent="(pagination.page = 1), getPerson()"
>

View file

@ -701,7 +701,7 @@ onMounted(async () => {
v-model="formProbation.keyword"
ref="filterRef2"
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter.prevent="filterKeyword2Fn(formProbation.page)"
>

View file

@ -233,7 +233,6 @@ const filterAndApply = () => {
v-model="filter"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
@keyup.enter="filterAndApply"
>

View file

@ -1267,7 +1267,6 @@ onMounted(async () => {
borderless
outlined
dense
debounce="300"
placeholder="ค้นหา"
v-model="formFilter.searchKeyword"
@keydown.enter="(formFilter.page = 1), fecthlistperson()"

View file

@ -322,6 +322,8 @@ watch(
lazy-rules
emit-value
map-options
hide-selected
fill-input
hide-bottom-space
input-debounce="0"
option-label="name"
@ -342,6 +344,8 @@ watch(
outlined
clearable
use-input
hide-selected
fill-input
lazy-rules
emit-value
map-options
@ -449,6 +453,8 @@ watch(
dense
outlined
use-input
hide-selected
fill-input
clearable
lazy-rules
emit-value
@ -471,6 +477,8 @@ watch(
dense
outlined
use-input
hide-selected
fill-input
clearable
lazy-rules
emit-value
@ -515,6 +523,8 @@ watch(
dense
outlined
use-input
hide-selected
fill-input
clearable
lazy-rules
emit-value
@ -537,6 +547,8 @@ watch(
dense
outlined
use-input
hide-selected
fill-input
clearable
lazy-rules
emit-value

View file

@ -201,7 +201,12 @@ const visibleColumns = ref<String[]>([
async function fetchList() {
showLoader();
await http
.get(config.API.registryNew("-temp"), { params: queryParams })
.get(config.API.registryNew("-temp"), {
params: {
...queryParams,
searchKeyword: queryParams.searchKeyword.trim(),
},
})
.then(async (res) => {
rows.value = await res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / queryParams.pageSize);
@ -343,11 +348,10 @@ onMounted(async () => {
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
clearable
@keydown.enter.prevent="(queryParams.page = 1), fetchList()"
>
<template v-slot:append>
<q-icon v-if="queryParams.searchKeyword == ''" name="search" />
<q-icon name="search" />
</template>
</q-input>
<!-- แสดงคอลมนใน table -->

View file

@ -87,7 +87,6 @@ function filterFn() {
outlined
v-model="keyword"
label="ค้นหา"
debounce="300"
@keydown.enter.prevent="filterFn"
>
<template v-slot:append>
@ -109,7 +108,6 @@ function filterFn() {
map-options
:options="workStore.columns"
option-value="name"
/>
</div>
</div>

View file

@ -257,7 +257,11 @@ async function fetchData() {
await http
.get(
config.API.specialTime() +
`?year=${year.value}&month=${month.value}&page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&keyword=${filterKeyword.value.trim()}`
`?year=${year.value}&month=${month.value}&page=${
pagination.value.page
}&pageSize=${
pagination.value.rowsPerPage
}&keyword=${filterKeyword.value.trim()}`
)
.then(async (res) => {
let data = res.data.result.data;
@ -371,7 +375,6 @@ onMounted(async () => {
v-model="filterKeyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหาชื่อ-นามสกุล"
@keydown.enter.prevent="getSearch()"
>

View file

@ -175,8 +175,6 @@ watch(
borderless
outlined
dense
class="col-12 q-mb-sm"
debounce="300"
v-model="filterKeyword2"
@keydown.enter.prevent="updateInput"
placeholder="ค้นหารายชื่อ"

View file

@ -211,11 +211,10 @@ onMounted(async () => {
outlined
v-model="filter"
label="ค้นหา"
debounce="300"
@keydown.enter.prevent="filterFn"
>
<template v-slot:append>
<q-icon name="search" />
<q-icon name="search" />
</template>
</q-input>

View file

@ -223,7 +223,6 @@ watch(
<q-input
borderless
dense
debounce="300"
outlined
placeholder="ค้นหา"
v-model="formFilter.keyword"

View file

@ -308,7 +308,7 @@ watch(
<q-input
borderless
dense
debounce="300"
outlined
v-model="formFilter.keyword"
placeholder="ค้นหา"

View file

@ -334,7 +334,6 @@ function onClickViewInfo(type: string, id: string) {
<q-input
borderless
dense
debounce="300"
outlined
v-model="formFilter.keyword"
placeholder="ค้นหา"
@ -356,7 +355,6 @@ function onClickViewInfo(type: string, id: string) {
map-options
:options="!checkPermission($route)?.attrIsGet ? columns?.filter((col:any) => col.name !== 'posSalary' && col.name !== 'discipline' && col.name !== 'leave' ) : columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>

View file

@ -320,7 +320,6 @@ watch(
<q-input
borderless
dense
debounce="300"
outlined
v-model="formFilter.keyword"
placeholder="ค้นหา"
@ -348,7 +347,6 @@ watch(
: []
"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>

View file

@ -348,7 +348,6 @@ watch(
<q-input
borderless
dense
debounce="300"
outlined
v-model="formFilter.keyword"
placeholder="ค้นหา"
@ -372,7 +371,6 @@ watch(
? columns?.filter((col:any) => col.name !== 'posSalary' && col.name !== 'discipline' && col.name !== 'leave' )
: columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>

View file

@ -254,7 +254,6 @@ onMounted(() => {
<q-input
borderless
dense
debounce="300"
outlined
v-model="formQuery.keyword"
placeholder="ค้นหา"

View file

@ -14,7 +14,7 @@ import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
import type {
ResRound,
ResDevelopment,
} from "@/modules/14_KPI/interface/response/Index";
} from "@/modules/14_KPI/interface/response/index";
/** importComponents*/
import DialogIndividual from "@/modules/14_KPI/components/results/dialogIndividual.vue";

View file

@ -358,7 +358,6 @@ onMounted(async () => {
v-model="formFilter.keyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter.prevent="(formFilter.page = 1), getData()"
>

View file

@ -41,7 +41,6 @@ const {
messageError,
dialogMessageNotify,
success,
onSearchDataTable,
} = useCounterMixin();
/**
@ -70,6 +69,7 @@ const props = defineProps({
type: Object,
required: true,
},
fetchDataTable: Function,
});
const title = ref<string>("ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน");
@ -80,7 +80,14 @@ const levelTree = ref<number>(0);
const filterTable = ref<string>("");
const selectedFilter = ref<PosMaster2[]>([]);
const dataMain = ref<PosMaster2[]>([...rows.value]);
/**
* function เช filter
*/
function resetFilter() {
filterTree.value = "";
filterRef.value.focus();
}
/**
* function เลอกขอมลหนวยงาน
@ -149,12 +156,10 @@ const pagination = ref({
rowsPerPage: reqMaster.value.pageSize,
});
function onSearchTable() {
rows.value = onSearchDataTable(
filterTable.value,
dataMain.value,
columns.value ? columns.value : []
);
function onSearchData() {
reqMaster.value.page = 1;
reqMaster.value.keyword = filterTable.value;
props.fetchDataTable?.(store.treeId, store.level, false);
}
watch(
@ -162,9 +167,8 @@ watch(
() => {
reqMaster.value.page = 1;
filterTree.value = "";
pagination.value.rowsPerPage = reqMaster.value.pageSize;
dataMain.value = rows.value;
filterTable.value = "";
pagination.value.rowsPerPage = reqMaster.value.pageSize;
title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`;
if (modal.value && props.type === "SINGER") {
@ -188,7 +192,10 @@ watch(
>
<q-header>
<q-toolbar>
<HeaderDialog :tittle="title" :close="() => (modal = false)" />
<HeaderDialog
:tittle="title"
:close="() => ((modal = false), (reqMaster.keyword = ''))"
/>
</q-toolbar>
<q-separator color="grey-4" />
</q-header>
@ -209,7 +216,7 @@ watch(
dense
v-model="filterTable"
label="ค้นหา"
@keydown.enter="onSearchTable"
@keydown.enter="onSearchData"
>
<template v-slot:append>
<q-icon name="search" />
@ -217,6 +224,7 @@ watch(
</q-input>
</div>
</q-toolbar>
<div class="col-12">
<d-table
flat

View file

@ -366,6 +366,10 @@ watch(
if (!modalDialogMMove.value) {
pagination.value.page = 1;
pagination.value.rowsPerPage = reqMaster.value.pageSize;
if (posMaster.value.length === 0) {
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
}
}
}
);
@ -682,6 +686,7 @@ watch(
:type="typeMove"
:rowId="rowId"
:mainTree="props.mainTree ? props.mainTree : []"
:fetchDataTable="props.fetchDataTable"
/>
<!-- ประวตำแหน -->

View file

@ -94,10 +94,10 @@ function fetchDataTable(id: string, level: number, action: boolean) {
if (action === true) {
isLoad.value = true;
}
posMaster.value = [];
http
.post(config.API.orgPosMasterListEmp, reqMaster)
.then(async (res) => {
posMaster.value = [];
const dataMain: PosMaster[] = [];
totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
res.data.result.data.forEach((e: PosMaster) => {

View file

@ -469,7 +469,6 @@ watch(
borderless
outlined
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
style="width: 200px; max-width: auto"

View file

@ -28,6 +28,7 @@ const {
showLoader,
hideLoader,
success,
onSearchDataTable,
} = useCounterMixin();
// const isChangeData = defineModel<boolean>("isChangeData", { required: true }); //
@ -61,6 +62,8 @@ const position = ref<string>("");
const filter = ref<string>("");
const rows = ref<PersonInfo[]>([]);
const rowsMain = ref<PersonInfo[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -236,12 +239,21 @@ async function getPersonList() {
templatePos.value = data.commandSalaryId;
position.value = data.positionDetail;
rows.value = data.commandRecives;
rowsMain.value = data.commandRecives;
})
.catch((e) => {
messageError($q, e);
});
}
function onSearchData() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
const promises = [getPersonList()];
@ -325,8 +337,8 @@ onMounted(async () => {
v-model="filter"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
@keydown.enter="onSearchData()"
>
<template v-slot:append>
<q-icon name="search" />
@ -354,7 +366,6 @@ onMounted(async () => {
:rows="rows"
:columns="columns"
:visible-columns="visibleColumns"
:filter="filter.trim()"
row-key="name"
>
<template v-slot:header="props">

View file

@ -26,6 +26,7 @@ const {
showLoader,
hideLoader,
success,
onSearchDataTable,
} = useCounterMixin();
const isChangeData = defineModel<boolean>("isChangeData", { required: true });
@ -35,6 +36,7 @@ const { onCheckChangeData } = defineProps({
const filter = ref<string>("");
const rows = ref<DataPerson[]>([]);
const rowsMain = ref<DataPerson[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -59,8 +61,11 @@ const columns = ref<QTableProps["columns"]>([
name: "fullName",
align: "left",
label: "ชื่อ-นามสกุล",
field: "name",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
sortable: true,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -119,6 +124,7 @@ async function fetchData() {
.then(async (res) => {
const data = await res.data.result;
rows.value = data;
rowsMain.value = data;
isChangeData.value = false;
})
.catch((err) => {
@ -191,6 +197,14 @@ function onSubmit() {
});
}
function onSearchData() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
onMounted(() => {
fetchData();
});
@ -213,13 +227,12 @@ onMounted(() => {
<div class="items-center" style="display: flex">
<!-- นหาขอความใน table -->
<q-input
standout
dense
v-model="filter"
outlined
debounce="300"
placeholder="ค้นหา"
class="q-ml-sm"
@keydown.enter="onSearchData()"
>
<template v-slot:append>
<q-icon name="search" />
@ -250,7 +263,6 @@ onMounted(() => {
:rows="rows"
:columns="columns"
:visible-columns="visibleColumns"
:filter="filter.trim()"
row-key="id"
>
<template v-slot:header="props">