ออกคำสั่ง
This commit is contained in:
parent
62e7284d5d
commit
7eb12af9bd
2 changed files with 29 additions and 6 deletions
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue