แก้ไข UI / UX ทำ function search ใหม่ ตามบรีฟพี่อาร์ม
All checks were successful
frontend-action / build-image (push) Successful in 1m22s

This commit is contained in:
2024-04-25 19:11:29 +07:00
parent 6ae1017ad2
commit 5fc473780c
25 changed files with 623 additions and 297 deletions

View File

@@ -7,11 +7,25 @@
src="@/assets/logo-title.png"
width="250"
></v-img>
<div class="text-title txt-black">นหาผสมครสว.</div>
<div class="text-title txt-black">นหาผสมคร สว.</div>
<div class="my-5 text-sub2">
สามารถคนหาผแสดงตนเปนผสมคร สว. ใน งหว/เขต
วเองเปนผแสดงตน
</div>
<v-container>
<!-- {{ checkdata }} -->
<v-row>
<v-col cols="12" md="4">
<v-autocomplete
<v-text-field
v-if="province"
label="จังหวัด"
variant="solo"
v-model="province"
:value="province.name"
readonly
></v-text-field>
<!-- <v-autocomplete
clearable
label="จังหวัด"
:items="provinceItems"
@@ -23,9 +37,18 @@
@update:modelValue="filterData"
hide-details
></v-autocomplete
></v-col>
> -->
</v-col>
<v-col cols="12" md="4">
<v-autocomplete
<v-text-field
v-if="province"
label="อำเภอ / เขต"
variant="solo"
v-model="district"
:value="district.name"
readonly
></v-text-field>
<!-- <v-autocomplete
clearable
label="อำเภอ / เขต"
:items="districtItems"
@@ -37,7 +60,8 @@
hide-details
:disabled="province == null"
></v-autocomplete
></v-col>
> -->
</v-col>
<v-col cols="12" md="4">
<v-autocomplete
clearable
@@ -81,11 +105,12 @@
</div>
<!-- {{ count }}
{{ Number(result.length)/ 2 }} -->
<div class="text-center">
<v-pagination
v-if="count > 0"
v-model="page"
:length="Math.ceil(count/ 10)"
:length="Math.ceil(count / 10)"
rounded="circle"
@click="searchUser((this.page - 1) * 2)"
></v-pagination>
@@ -105,6 +130,7 @@ export default {
},
data() {
return {
checkdata: "",
show: false,
load: false,
result: [],
@@ -116,7 +142,7 @@ export default {
items: [],
group: null,
offset: 0,
count:0,
count: 0,
};
},
methods: {
@@ -126,28 +152,22 @@ export default {
if (offset == 0) {
this.page = 1;
}
// this.offset = (this.page - 1) * 10;
let data = {
offset: offset,
limit: 10,
// group: this.group,
// zone: this.district,
limit: 10,
};
if (this.province) {
data.province = this.province;
data.province = this.province.id;
// data.province = this.province;
}
if (this.group) {
data.group = this.group;
}
if (this.district) {
data.zone = this.district;
data.zone = this.district.id;
}
// for (const key in data) {
// if (data[key] === null) {
// delete data[key];
// }
// }
console.log(data);
// console.log(data);
client.user.getAllUser
.query(data)
.then((rs) => {
@@ -176,25 +196,24 @@ export default {
// this.offset = (this.page - 1) * 10;
let data = {
offset: offset,
limit: 10,
// group: this.group,
// zone: this.district,
limit: 10,
};
if (this.province) {
data.province = this.province;
data.province = this.province.id;
// data.province = this.province;
}
if (this.group) {
data.group = this.group;
}
if (this.district) {
data.zone = this.district;
data.zone = this.district.id;
}
console.log(data);
// console.log(data);
client.user.getAllUserCount
.query(data)
.then((rs) => {
this.count = rs;
this.count = rs;
})
.catch((error) => {
alert("ไม่สามารถโหลดข้อมูลได้");
@@ -235,6 +254,20 @@ export default {
});
}
},
getUser(datap) {
client.user.getSelf
.mutate({})
.then((data) => {
let province = datap.filter((x) => x.id === data.zone.province);
this.province = province[0];
this.district = data.zone;
this.checkdata = { ...data };
})
.catch((error) => {
alert("ไม่สามารถโหลดข้อมูลได้");
console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error);
});
},
},
mounted() {
client.info.getAllGroups
@@ -251,6 +284,7 @@ export default {
.query({})
.then((data) => {
this.provinceItems = data;
this.getUser(data);
})
.catch((error) => {
alert("ไม่สามารถโหลดข้อมูลได้");