diff --git a/src/components/search/SearchMain.vue b/src/components/search/SearchMain.vue index 5886d91..def30d2 100644 --- a/src/components/search/SearchMain.vue +++ b/src/components/search/SearchMain.vue @@ -352,39 +352,11 @@ export default { let data = { offset: offset, }; - // if (this.province) { - // data.province = this.province; - // // data.province = this.province; - // } + if (this.group && this.group.id) { - // console.log(this.group.id); data.group = this.group.id; } - // if (this.district) { - // data.zone = this.district; - // } - - // let param = { input: JSON.stringify({ 0: data }) }; - // var axios = require("axios"); - // var config = { - // method: "get", - // url: "http://localhost:3000/api/user.getAllUser", - // params: param, - // headers: {}, - // }; - - // axios(config) - // .then((response) => { - // this.nameUserItems = response.data.result.data; - // this.loadname = false; - // console.log("nameUserItems", this.nameUserItems); - // }) - // .catch((error) => { - // this.loadname = false; - // console.log(error); - // }); - client.user.getAllUser .query(data) .then((rs) => { @@ -398,7 +370,7 @@ export default { console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); }); }, - searchUser(offset) { + searchUser() { this.show = false; this.load = true; // ตัวอย่างการดึงข้อมูลจาก API หรือแหล่งข้อมูลอื่น ๆ ตามหน้าปัจจุบันที่เลือก @@ -406,7 +378,7 @@ export default { const endIndex = startIndex + 10; // ในตัวอย่างนี้ จะใช้ items ของ this.items เป็นตัวอย่าง โดยใช้ฟังก์ชัน slice หรือการดึงข้อมูลจากแหล่งข้อมูล if(this.count>0){ - this.result = this.result.slice(startIndex, endIndex); } + this.result = [...this.result].slice(startIndex, endIndex); } // if (offset == 0) { // this.page = 1; @@ -473,32 +445,9 @@ export default { data.userId = this.nameUser; } - // let param = { input: JSON.stringify({ 0: data }) }; - // var axios = require("axios"); - // if (this.nameUser) { - // this.count = 1; - // } else { - // var config = { - // method: "get", - // url: "http://localhost:3000/api/user.getAllUserCount", - // params: param, - // headers: {}, - // }; - - // axios(config) - // .then((response) => { - // this.count = response.data.result.data; - // console.log("getAllUserCount", this.count); - // }) - // .catch((error) => { - // console.log(error); - // }); - // } + - // if (this.nameUser) { - // this.count = 1; - // } else { client.user.getAllUserCount .query(data) .then((rs) => { @@ -509,29 +458,7 @@ export default { alert("ไม่สามารถโหลดข้อมูลได้"); console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); }); - // } - - - - // var config2 = { - // method: "get", - // url: "http://localhost:3000/api/user.getAllUser", - // params: param, - // headers: {}, - // }; - - // axios(config2) - // .then((response) => { - // this.result = response.data.result.data; - // this.load = false; - // console.log("nameUserItems", this.nameUserItems); - // }) - // .catch((error) => { - // this.load = false; - - // console.log(error); - // }); - + client.user.getAllUser .query(data) .then((rs) => {