sort
This commit is contained in:
parent
2fa9fcbb4c
commit
66cb55f509
11 changed files with 102 additions and 97 deletions
|
|
@ -128,7 +128,7 @@ onMounted(() => {
|
|||
<d-table
|
||||
ref="table"
|
||||
flat
|
||||
bordere
|
||||
bordered
|
||||
:columns="columns"
|
||||
:rows="store.row"
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ const listMenu = ref<ListMenu[]>([
|
|||
]);
|
||||
|
||||
const pagination = ref<PropsTable.Pagination>({
|
||||
sortBy: "createdAt",
|
||||
sortBy: "",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
|
|
@ -81,7 +81,12 @@ async function fetchEvaluteList() {
|
|||
pageSize: pagination.value.rowsPerPage,
|
||||
keyword: store.filterKeyword,
|
||||
status: selectedStatus.value,
|
||||
...(pagination.value.sortBy && {
|
||||
sortBy: pagination.value.sortBy,
|
||||
descending: pagination.value.descending,
|
||||
}),
|
||||
};
|
||||
|
||||
await http
|
||||
.put(config.API.evaluationList(), body)
|
||||
.then(async (res) => {
|
||||
|
|
@ -216,6 +221,8 @@ onMounted(async () => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-md-11 row q-col-gutter-md">
|
||||
<div class="col-12 row">
|
||||
<q-card bordered class="col-12 row caedNone q-pa-md">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
useA
|
||||
<script setup lang="ts">
|
||||
import type { QTableProps } from "quasar";
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import { ref, onMounted, reactive } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ const type = ref<DataOption[]>([
|
|||
|
||||
const isload = ref<boolean>(false);
|
||||
const pagination = ref<PropsTable.Pagination>({
|
||||
sortBy: "createdAt",
|
||||
sortBy: "",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
|
|
@ -149,23 +149,28 @@ const columns = ref<QTableProps["columns"]>([
|
|||
//นำข้อมูลมาแสดง
|
||||
async function getData() {
|
||||
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
|
||||
.get(
|
||||
config.API.appealMainList(
|
||||
formData.status,
|
||||
formData.type,
|
||||
formData.year,
|
||||
pagination.value.page,
|
||||
pagination.value.rowsPerPage,
|
||||
filterKeyword.value
|
||||
)
|
||||
)
|
||||
.get(config.API.appealMainList() + `?${params.toString()}`)
|
||||
.then(async (res) => {
|
||||
const result = res.data.result;
|
||||
pagination.value.rowsNumber = result.total;
|
||||
dataStore.fetchAppealComplain(result.data);
|
||||
})
|
||||
.catch((e: any) => {
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
name: "topic",
|
||||
align: "left",
|
||||
label: "ชื่อเรื่อง",
|
||||
sortable: false,
|
||||
sortable: true,
|
||||
field: "topic",
|
||||
format: (v) => (v ? v : "-"),
|
||||
headerStyle: "font-size: 14px",
|
||||
|
|
@ -106,6 +106,7 @@ const visibleColumns = ref<string[]>([
|
|||
const pagination = ref<PropsTable.Pagination>({
|
||||
descending: true,
|
||||
page: 1,
|
||||
sortBy: "",
|
||||
rowsPerPage: 10,
|
||||
rowsNumber: 0,
|
||||
});
|
||||
|
|
@ -122,17 +123,26 @@ function onClickAdd() {
|
|||
|
||||
/** function fetch รายการข้อมูลการยื่นคำร้องขอแก้ไขข้อมูล*/
|
||||
async function fetchListRequset() {
|
||||
let queryParams = {
|
||||
page: pagination.value.page,
|
||||
pageSize: pagination.value.rowsPerPage,
|
||||
const queryParams = new URLSearchParams({
|
||||
page: pagination.value.page.toString(),
|
||||
pageSize: pagination.value.rowsPerPage.toString(),
|
||||
status: status.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;
|
||||
await http
|
||||
.get(config.API.requestEditByType(link.value) + `user`, {
|
||||
params: queryParams,
|
||||
})
|
||||
.get(
|
||||
config.API.requestEditByType(link.value) +
|
||||
`user?${queryParams.toString()}`
|
||||
)
|
||||
.then((res) => {
|
||||
const result = res.data.result;
|
||||
pagination.value.rowsNumber = result.total;
|
||||
|
|
|
|||
|
|
@ -122,10 +122,6 @@ function onSearch() {
|
|||
);
|
||||
}
|
||||
|
||||
function onTableRequest() {
|
||||
console.log(1111);
|
||||
}
|
||||
|
||||
/** Hook Lifecycle */
|
||||
onMounted(async () => {
|
||||
await fecthList();
|
||||
|
|
@ -213,7 +209,6 @@ onMounted(async () => {
|
|||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:pagination="pagination"
|
||||
:loading="isLoading"
|
||||
@request="onTableRequest"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const status = ref<string>("ALL"); // สถานะคำร้อง
|
|||
const statusOptions = ref<DataOption[]>(store.optionStatus);
|
||||
const rows = ref<RowsListMain[]>([]);
|
||||
const pagination = ref<PropsTable.Pagination>({
|
||||
sortBy: "createdAt",
|
||||
sortBy: "",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
|
|
@ -40,7 +40,7 @@ const visibleColumns = ref<string[]>([
|
|||
"detail",
|
||||
"document",
|
||||
"status",
|
||||
"remark",
|
||||
"reason",
|
||||
]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -67,7 +67,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
name: "developmentProjects",
|
||||
align: "left",
|
||||
label: "วิธีการพัฒนา",
|
||||
sortable: true,
|
||||
sortable: false,
|
||||
field: "developmentProjects",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
|
|
@ -120,18 +120,18 @@ const columns = ref<QTableProps["columns"]>([
|
|||
name: "status",
|
||||
align: "left",
|
||||
label: "สถานะคำร้อง",
|
||||
sortable: true,
|
||||
sortable: false,
|
||||
field: "status",
|
||||
format: (v) => store.convertStatus(v),
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "remark",
|
||||
name: "reason",
|
||||
align: "left",
|
||||
label: "หมายเหตุ ",
|
||||
sortable: true,
|
||||
field: "remark",
|
||||
field: "reason",
|
||||
format: (v) => (v ? v : "-"),
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
|
|
@ -177,12 +177,21 @@ function onDelete(id: string) {
|
|||
/** list รายการ */
|
||||
async function getListData() {
|
||||
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
|
||||
.get(
|
||||
config.API.developmentRequest +
|
||||
`/user?status=${status.value}&keyword=${filterKeyword.value}&page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}
|
||||
`
|
||||
)
|
||||
.get(config.API.developmentRequest + `/user?${params.toString()}`)
|
||||
|
||||
.then(async (res) => {
|
||||
const result = await res.data.result;
|
||||
pagination.value.rowsNumber = result.total;
|
||||
|
|
@ -247,6 +256,7 @@ async function downloadUrl(id: string, fileName: string) {
|
|||
*/
|
||||
function onTableRequest(requestProps: PropsTable.RequestProps) {
|
||||
const newPagination = requestProps?.pagination || requestProps;
|
||||
|
||||
if (!newPagination?.page || !newPagination?.rowsPerPage) return;
|
||||
pagination.value = { ...newPagination };
|
||||
getListData();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue