ปรับวินัย
This commit is contained in:
parent
117cc8aeb8
commit
5c1b67a642
12 changed files with 161 additions and 190 deletions
|
|
@ -19,28 +19,23 @@ const { fetchList } = dataInvestigateDis;
|
|||
const rowsPerPage = ref<number>(10);
|
||||
const $q = useQuasar(); // show dialog
|
||||
const router = useRouter();
|
||||
|
||||
const filter = ref<string>(""); //search data table
|
||||
const page = ref<number>(1);
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
|
||||
async function fetchListDisciplinary() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.disciplineDisciplinary() +
|
||||
`?page=${page.value}&pageSize=${rowsPerPage.value}`
|
||||
`?page=${page.value}&pageSize=${rowsPerPage.value}&keyword=${filter.value}`
|
||||
)
|
||||
.then((res) => {
|
||||
const data = res.data.result.data;
|
||||
maxPage.value = Math.ceil(
|
||||
res.data.result.total / rowsPerPage.value
|
||||
);
|
||||
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
|
||||
fetchList(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
|
@ -78,7 +73,6 @@ onMounted(async () => {
|
|||
style="max-height: 80vh"
|
||||
:rows="dataInvestigateDis.rows"
|
||||
:columns="dataInvestigateDis.columns"
|
||||
:filter="filter"
|
||||
:visible-columns="dataInvestigateDis.visibleColumns"
|
||||
v-model:inputfilter="filter"
|
||||
v-model:inputvisible="dataInvestigateDis.visibleColumns"
|
||||
|
|
@ -89,6 +83,7 @@ onMounted(async () => {
|
|||
:rowsPerPage="rowsPerPage"
|
||||
:page="page"
|
||||
:maxPage="maxPage"
|
||||
:fetchListDisciplinary="fetchListDisciplinary"
|
||||
@update:pagination="updatePagingProp"
|
||||
v-model:open-edit="openEdit"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const filterRef = ref<any>(null);
|
|||
const attrs = ref<any>(useAttrs());
|
||||
const paging = ref<boolean>(true);
|
||||
const currentPage = ref<number>(1);
|
||||
const statusFilter = ref<string>('ALL')
|
||||
const statusFilter = ref<string>("ALL");
|
||||
|
||||
/** รับ props มาจากหน้าหลัก */
|
||||
const props = defineProps({
|
||||
|
|
@ -29,6 +29,10 @@ const props = defineProps({
|
|||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
fetchListDisciplinary: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
nornmalData: {
|
||||
type: Boolean,
|
||||
defualt: true,
|
||||
|
|
@ -86,6 +90,7 @@ function resetFilter() {
|
|||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
emit("update:inputfilter", "");
|
||||
filterRef.value.focus();
|
||||
props.fetchListDisciplinary?.();
|
||||
}
|
||||
|
||||
function updateProp(newPagination: any, page: number) {
|
||||
|
|
@ -108,28 +113,31 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
function dataUpdate(){
|
||||
console.log(statusFilter.value)
|
||||
function dataUpdate() {
|
||||
console.log(statusFilter.value);
|
||||
}
|
||||
|
||||
function filterFn() {
|
||||
props.fetchListDisciplinary?.();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="q-pb-sm row q-col-gutter-sm">
|
||||
<div class="col-2">
|
||||
<q-select
|
||||
v-model="statusFilter"
|
||||
label="สถานะ"
|
||||
dense
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="dataInvestigateDis.statusOptions"
|
||||
@update:model-value="dataUpdate"
|
||||
/>
|
||||
</div>
|
||||
<q-select
|
||||
v-model="statusFilter"
|
||||
label="สถานะ"
|
||||
dense
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="dataInvestigateDis.statusOptions"
|
||||
@update:model-value="dataUpdate"
|
||||
/>
|
||||
</div>
|
||||
<q-space />
|
||||
<!-- ค้นหาข้อความใน table -->
|
||||
<q-input
|
||||
|
|
@ -143,6 +151,7 @@ console.log(statusFilter.value)
|
|||
placeholder="ค้นหา"
|
||||
style="max-width: 200px"
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
@keydown.enter.prevent="filterFn"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="inputfilter == ''" name="search" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue