filter เครื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-15 17:22:58 +07:00
parent e8abe74e45
commit 7c2ce06998
2 changed files with 33 additions and 11 deletions

View file

@ -64,8 +64,18 @@ const fecthRound = async () => {
name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543),
year: e.year,
}));
selectRound.value = data[0].id;
roundYear.value = data[0].year;
if (DataStore.roundId && DataStore.roundYear) {
selectRound.value = DataStore.roundId;
roundYear.value = DataStore.roundYear;
} else {
selectRound.value = data[0].id;
roundYear.value = data[0].year;
}
if (selectRound.value) {
DataStore.roundId = selectRound.value;
}
// roundYear.value = data[0].year;
if (roundYear.value) {
await fecthInsigniaType();
}
@ -94,8 +104,6 @@ const fecthInsignia = async () => {
};
const fecthInsigniaType = async () => {
console.log(DataStore.mainTab);
await http(config.API.insigniaType)
.then((res) => {
let data = res.data.result;
@ -171,14 +179,21 @@ watch(tab, () => {
insigniaOp.value = DataStore.insigniaOp.filter(
(x: any) => x.type == tab.value || x.type === ""
);
DataStore.insignia = "";
let a = insigniaOp.value.find((e: any) => e.id == DataStore.insignia);
if (!a) {
DataStore.insignia = "";
}
fecthlistInsignia();
});
const selectorRound = (round: string) => {
const selectorRound = (round: string | undefined) => {
selectRound.value = round;
if (selectRound.value) {
DataStore.roundId = selectRound.value;
}
const yearFilter = selectRoundOption.value.find((x: any) => x.id == round);
roundYear.value = yearFilter?.year;
DataStore.roundYear = roundYear.value;
fecthlistInsignia();
};
@ -362,8 +377,10 @@ const resetFilter = () => {
option-value="id"
:readonly="false"
:borderless="false"
style="min-width: 150px"
@update:model-value="DataStore.selectInsignia"
style="min-width: 200px"
@update:model-value="
DataStore.selectInsignia(DataStore.insignia)
"
/>
</div>