Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-15 17:23:03 +07:00
commit 4de0aed867
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>

View file

@ -8,6 +8,8 @@ const {
} = mixin;
export const useAllocateDataStore = defineStore("insigniaallocate", () => {
const roundId = ref<string>('')
const roundYear = ref<number>()
const insigniaName = ref<string>('')
const insignia = ref<string>('')
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "", type: "" }])
@ -17,7 +19,7 @@ export const useAllocateDataStore = defineStore("insigniaallocate", () => {
const mainTab = ref<string>("")
const fetchDatainsignia = async (data: any) => {
insignia.value = ''
// insignia.value = ''
insigniaOp.value = [{ name: "ทั้งหมด", id: "", type: "" }]
data.forEach((e: any) => {
insigniaOp.value.push({ name: e.name, id: e.id, type: e.insigniaType.id })
@ -41,9 +43,10 @@ export const useAllocateDataStore = defineStore("insigniaallocate", () => {
}))
rows.value = list
listInsignia.value = list
selectInsignia(insignia.value)
}
const selectInsignia = () => {
console.log(insignia.value);
const selectInsignia = (type: string) => {
insignia.value = type
if (insignia.value !== "") {
rows.value = listInsignia.value.filter((e: any) => e.insigniaId === insignia.value)
} else rows.value = listInsignia.value
@ -58,6 +61,8 @@ export const useAllocateDataStore = defineStore("insigniaallocate", () => {
}
}
return {
roundId,
roundYear,
rows,
insignia,
insigniaOp,