This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-09-08 11:33:05 +07:00
parent 2fa9fcbb4c
commit 66cb55f509
11 changed files with 102 additions and 97 deletions

View file

@ -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();