diff --git a/src/modules/07_insignia/components/2_Manage/Tab1.vue b/src/modules/07_insignia/components/2_Manage/Tab1.vue index d8dad1344..4c01eb36e 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab1.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab1.vue @@ -92,7 +92,6 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, - { name: "insigniaType", align: "left", @@ -175,7 +174,6 @@ const Note = ref(""); const titleModal = ref(""); const actionModal = ref(""); const person = ref([]); - const props = defineProps({ tab: { type: String, @@ -192,12 +190,11 @@ const props = defineProps({ }); onMounted(async () => { + if (DataStore.typeOc == "") { + organization.value = DataStore.optionsTypeOc[2].id; + DataStore.typeOc = organization.value; + } else organization.value = DataStore.typeOc; organizationOptions.value = DataStore.optionsTypeOc; - organization.value = organizationOptions.value[2].id; - DataStore.typeOc = organization.value; - // if (props.fecthInsigniaAll) { - // await props.fecthInsigniaAll(props.roundId, props.tab); - // } if (organization.value !== "" || organization.value !== undefined) { if (props.fecthInsigniaByOc) { props.fecthInsigniaByOc( @@ -218,6 +215,7 @@ const changtypeOc = () => { props.tab ); } + DataStore.typeOc = organization.value; }; const clickmodalAdd = () => { showLoader(); @@ -324,8 +322,8 @@ const addlistperson = async (id: string) => { // modalNote.value = true; // }; const clickmodalEdit = (props: any) => { - insignia.value = ""; - insigniaType.value = ""; + insignia.value = props.insigniaSend; + insigniaType.value = props.insigniaLevel; person.value = props; console.log(person.value); modalEdit.value = true; @@ -616,9 +614,8 @@ const paginationLabel2 = (start: string, end: string, total: string) => { {{ props.row.level }} - {{ props.row.salary }} + {{ Number(props.row.salary).toLocaleString() }} - {{ props.row.insigniaType }} diff --git a/src/modules/07_insignia/components/2_Manage/Tab2.vue b/src/modules/07_insignia/components/2_Manage/Tab2.vue index f3a5127e8..5d24b7a6c 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab2.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab2.vue @@ -133,8 +133,7 @@ const columns = ref([ onMounted(async () => { organizationOptions.value = DataStore.optionsTypeOc; - organization.value = organizationOptions.value[0].id; - DataStore.typeOc = organization.value; + organization.value = DataStore.typeOc; // if (props.fecthInsigniaAll) { // await props.fecthInsigniaAll(props.roundId, props.tab); // } @@ -158,6 +157,7 @@ const changtypeOc = () => { props.tab ); } + DataStore.typeOc = organization.value; }; const filterKeyword = ref(""); diff --git a/src/modules/07_insignia/components/2_Manage/Tab3.vue b/src/modules/07_insignia/components/2_Manage/Tab3.vue index 86e56a117..a9eacf464 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab3.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab3.vue @@ -129,8 +129,7 @@ const columns = ref([ ]); onMounted(async () => { organizationOptions.value = DataStore.optionsTypeOc; - organization.value = organizationOptions.value[0].id; - DataStore.typeOc = organization.value; + organization.value = DataStore.typeOc; // if (props.fecthInsigniaAll) { // await props.fecthInsigniaAll(props.roundId, props.tab); // } @@ -154,6 +153,7 @@ const changtypeOc = () => { props.tab ); } + DataStore.typeOc = organization.value; }; const filterKeyword = ref(""); diff --git a/src/modules/07_insignia/components/2_Manage/listManage.vue b/src/modules/07_insignia/components/2_Manage/listManage.vue index aae193506..a8840174e 100644 --- a/src/modules/07_insignia/components/2_Manage/listManage.vue +++ b/src/modules/07_insignia/components/2_Manage/listManage.vue @@ -48,7 +48,7 @@ const fecthlistRound = async () => { year: e.period_year, name: `รอบการเสนอพระราชทานเครื่องราช ${e.period_name} ปี ${e.period_year} `, })); - console.log(optionRound.value); + // console.log(optionRound.value); // const lastIndex = optionRound.value.length; const lastValue = optionRound.value[0]; round.value = lastValue.id.toString(); @@ -95,21 +95,21 @@ const changround = () => { fecthStat(round.value); fecthInsigniaByOc(round.value, DataStore.typeOc, "officer", tab.value); }; -const fecthInsigniaAll = async (periodId: string, tab: string) => { - // let data: any = []; - // for (const item of DataStore.optionsTypeOc) { - // await http - // .get(config.API.insigniaList(periodId, item["id"], "officer", tab)) - // .then((res) => { - // // console.log(res); - // data.push(res.data.result); - // }) - // .catch((err) => { - // console.log(err); - // }); - // } - // console.log(data); -}; +// const fecthInsigniaAll = async (periodId: string, tab: string) => { +// // let data: any = []; +// // for (const item of DataStore.optionsTypeOc) { +// // await http +// // .get(config.API.insigniaList(periodId, item["id"], "officer", tab)) +// // .then((res) => { +// // // console.log(res); +// // data.push(res.data.result); +// // }) +// // .catch((err) => { +// // console.log(err); +// // }); +// // } +// // console.log(data); +// }; const fecthInsigniaByOc = async ( roundId: string, ocId: string, @@ -204,7 +204,6 @@ const fecthInsigniaByOc = async ( @@ -212,7 +211,6 @@ const fecthInsigniaByOc = async ( @@ -220,7 +218,6 @@ const fecthInsigniaByOc = async ( diff --git a/src/modules/07_insignia/store.ts b/src/modules/07_insignia/store.ts index fbed84c4d..4ff9dfd02 100644 --- a/src/modules/07_insignia/store.ts +++ b/src/modules/07_insignia/store.ts @@ -26,8 +26,8 @@ export const useInsigniaDataStore = defineStore("insignia", () => { name: e.fullName, position: e.position, level: e.rank, - salary2: e.salary, - salary: Number(e.salary).toLocaleString(), + salary: e.salary, + salary2: Number(e.salary).toLocaleString(), insigniaType: e.lastInsignia, insigniaSend: e.requestInsignia, insigniaLevel: e.level, @@ -41,13 +41,19 @@ export const useInsigniaDataStore = defineStore("insignia", () => { } const filtertypeInsignia = async () => { typeinsignia.value = "all" - for (const data of listinsignia.value) { - const Type = data.insigniaType; - if (Type !== null && !typeinsigniaValues.has(Type)) { - typeinsigniaOptions.value.push({ id: Type, name: Type }) - typeinsigniaValues.add(Type); - } - } + if (listinsignia.value.length !== 0) { + const double_name = [ + ...new Set(listinsignia.value.map((item: any) => item.insigniaType)), + ]; + for (let i = 1; i <= double_name.length; i++) { + const type = double_name[i - 1]; + const listtype = { + id: type, + name: type, + }; + typeinsigniaOptions.value.push(listtype) + } + } else typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }] }; const searchFilterTable = async () => { if (typeinsignia.value !== undefined && typeinsignia.value !== null) {