แก้ pagination
Some checks failed
frontend-action / build-image (push) Failing after 1m37s

This commit is contained in:
2024-06-24 17:37:56 +07:00
parent 283d208791
commit aa9ee8b67d

View File

@@ -401,44 +401,46 @@ export default {
searchUser(offset) {
this.show = false;
this.load = true;
if (offset == 0) {
this.page = 1;
}
let data = {
offset: offset,
limit: 10,
};
// if (this.province) {
// data.province = this.province;
// // data.province = this.province;
// }
if (this.group) {
if (this.allg !== "all") {
data.group = this.group.id;
}
}
// if (this.district) {
// data.zone = this.district;
// }
if (this.nameUser) {
data.userId = this.nameUser;
}
// ตัวอย่างการดึงข้อมูลจาก API หรือแหล่งข้อมูลอื่น ๆ ตามหน้าปัจจุบันที่เลือก
const startIndex = (this.page - 1) * 10;
const endIndex = startIndex + 10;
// ในตัวอย่างนี้ จะใช้ items ของ this.items เป็นตัวอย่าง โดยใช้ฟังก์ชัน slice หรือการดึงข้อมูลจากแหล่งข้อมูล
if(this.count>0){
this.result = this.result.slice(startIndex, endIndex); }
client.user.getAllUser
.query(data)
.then((rs) => {
this.result = rs;
console.log(rs);
this.load = false;
if (rs.length == 0) {
this.show = true;
}
})
.catch((error) => {
this.load = false;
alert("ไม่สามารถโหลดข้อมูลได้");
console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error);
});
// if (offset == 0) {
// this.page = 1;
// }
// let data = {
// offset: offset,
// limit: 90,
// };
// if (this.group) {
// if (this.allg !== "all") {
// data.group = this.group.id;
// }
// }
// if (this.nameUser) {
// data.userId = this.nameUser;
// }
// client.user.getAllUser
// .query(data)
// .then((rs) => {
// this.result = rs;
// console.log(rs);
// this.load = false;
// if (rs.length == 0) {
// this.show = true;
// }
// })
// .catch((error) => {
// this.load = false;
// alert("ไม่สามารถโหลดข้อมูลได้");
// console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error);
// });
},
searchUserApi(offset, checkg) {
this.allg = checkg;
@@ -451,7 +453,7 @@ export default {
// this.offset = (this.page - 1) * 10;
let data = {
offset: offset,
limit: 10,
limit: 90,
};
// if (this.province) {
// data.province = this.province;