Merge branch 'develop' into dev-tee

This commit is contained in:
setthawutttty 2023-09-15 17:36:28 +07:00
commit 3d862e21e8
4 changed files with 47 additions and 19 deletions

View file

@ -57,7 +57,11 @@ const fecthlistRound = async () => {
if (optionRound.value.length !== 0) {
DataStore.optionRound = optionRound.value;
const lastValue = optionRound.value[0];
round.value = lastValue.id.toString();
if (DataStore.roundId) {
round.value = DataStore.roundId;
} else {
round.value = lastValue.id.toString();
}
DataStore.roundId = round.value;
roundName.value = lastValue.name;
await fecthStat(round.value);

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

@ -85,14 +85,16 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
}
} else typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }];
};
const searchDataTable = async (type: string, employeeClass: string) => {
if (type !== 'all' && employeeClass !== 'all') {
rows.value = listinsignia.value.filter((e: any) => e.insigniaSend === type && e.employeeType === profileType(employeeClass))
} else if (type !== 'all' && employeeClass === 'all') {
const searchDataTable = async (type: string, employeeClasstype: string) => {
typeinsignia.value = type
employeeClass.value = employeeClasstype
if (type !== 'all' && employeeClasstype !== 'all') {
rows.value = listinsignia.value.filter((e: any) => e.insigniaSend === type && e.employeeType === profileType(employeeClasstype))
} else if (type !== 'all' && employeeClasstype === 'all') {
rows.value = listinsignia.value.filter((e: any) => e.insigniaSend === type)
} else if (type === 'all' && employeeClass !== 'all') {
rows.value = listinsignia.value.filter((e: any) => e.employeeType === profileType(employeeClass))
} else if (type === 'all' && employeeClass === 'all') {
} else if (type === 'all' && employeeClasstype !== 'all') {
rows.value = listinsignia.value.filter((e: any) => e.employeeType === profileType(employeeClasstype))
} else if (type === 'all' && employeeClasstype === 'all') {
rows.value = listinsignia.value
}

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,