clear code + comment

This commit is contained in:
STW_TTTY\stwtt 2024-04-30 14:31:55 +07:00
parent a9609d2d7f
commit ac70090e22
19 changed files with 231 additions and 166 deletions

View file

@ -59,6 +59,7 @@ function getClass() {
return "inputgreen";
}
/** ดึงข้อมูล */
function fetchData() {
showLoader();
http
@ -106,6 +107,7 @@ function fetchData() {
});
}
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
onMounted(() => {
if (id.value) {
fetchData();

View file

@ -181,6 +181,7 @@ function getClass() {
return "inputgreen";
}
/** ดึงข้อมูลตาม keyword */
function searchFilter() {
showLoader();
http
@ -223,16 +224,19 @@ function searchFilter() {
});
}
/** update ค่า เเถวข้อมูล */
function updatePage(val: number) {
formFilter.page = val;
searchFilter();
}
/** update ค่า เเถวข้อมูล */
function updatePageSize(newPagination: NewPagination) {
formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage;
}
/** เช็คเเถวข้อมูลว่ามีการเปลี่ยนแปลงไหม */
watch(
() => formFilter.pageSize,
() => {

View file

@ -13,7 +13,7 @@ import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const rows = ref<any[]>([])
const rows = ref<any[]>([]);
const props = defineProps({
upDate: { type: Function },
@ -72,13 +72,7 @@ const projectOp = ref<DataOption[]>([
// },
]);
const visibleColumns = ref<string[]>([
"project",
"year",
"organizingTraining",
]);
const visibleColumns = ref<string[]>(["project", "year", "organizingTraining"]);
const columns = ref<QTableProps["columns"]>([
{
@ -116,21 +110,19 @@ function onSubmit() {
if (selected.value?.length == 0) {
dialogMessageNotify($q, `กรุณาเลือก 1 รายการ`);
} else {
const data = selected.value[0];
const body = {
id:data.id,
year:data.year,
project:data.project,
dateStart:data.dateStart,
dateEnd:data.dateEnd,
totalDate:data.totalDate,
addressAcademic:data.addressAcademic,
topicAcademic:data.topicAcademic,
};
props.upDate?.(body)
closeDialog();
const data = selected.value[0];
const body = {
id: data.id,
year: data.year,
project: data.project,
dateStart: data.dateStart,
dateEnd: data.dateEnd,
totalDate: data.totalDate,
addressAcademic: data.addressAcademic,
topicAcademic: data.topicAcademic,
};
props.upDate?.(body);
closeDialog();
}
}
@ -139,7 +131,7 @@ function closeDialog() {
modal.value = false;
rows.value = [];
selected.value = [];
inputSearch.value = ''
inputSearch.value = "";
}
/** class */
@ -147,6 +139,7 @@ function getClass() {
return "inputgreen";
}
/** ค้นข้อมูลตาม ฟิลเตอร์ */
function searchFilter() {
let queryParams: any = {
page: formFilter.page,
@ -179,16 +172,19 @@ function searchFilter() {
});
}
function updatePage(val:number){
/** update ค่า เเถวข้อมูล */
function updatePage(val: number) {
formFilter.page = val;
searchFilter();
}
/** update ค่า เเถวข้อมูล */
function updatePageSize(newPagination: NewPagination) {
formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage;
}
/** เช็คเเถวข้อมูลว่ามีการเปลี่ยนแปลงไหม */
watch(
() => formFilter.pageSize,
() => {