From 1f96ec8c2e84e4ffd24876d3c74fa1a39264b79b Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 21 Aug 2023 18:07:35 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20?= =?UTF-8?q?=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=87?= =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../07_insignia/components/2_Manage/Tab1.vue | 136 +++++++++++++++++- .../07_insignia/components/2_Manage/Tab2.vue | 75 ++++++---- .../07_insignia/components/2_Manage/Tab3.vue | 58 ++++++-- 3 files changed, 228 insertions(+), 41 deletions(-) diff --git a/src/modules/07_insignia/components/2_Manage/Tab1.vue b/src/modules/07_insignia/components/2_Manage/Tab1.vue index f96c72b1b..418e6ea82 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab1.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab1.vue @@ -21,6 +21,7 @@ const DataStore = useInsigniaDataStore(); const modalNote = ref(false); const modalAdd = ref(false); +const modalEdit = ref(false); const organization = ref(""); const organizationOptions = ref([{ id: "1", name: "ทั้งหมด" }]); const visibleColumns = ref([ @@ -255,6 +256,7 @@ const props = defineProps({ }); const typeinsignia = ref("all"); const typeinsigniaOptions = reactive([{ id: "all", name: "ทั้งหมด" }]); +const typeinsigniaValues: Set = new Set(); onMounted(async () => { organizationOptions.value = DataStore.optionsTypeOc; organization.value = organizationOptions.value[0].id; @@ -269,7 +271,7 @@ onMounted(async () => { "officer", props.tab ); - + filtertypeInsignia(); } } }); @@ -353,10 +355,10 @@ const addlistperson = async (id: string) => { showLoader(); let data = { profileId: id, - insigniaId: organization.value, + // insigniaId: organization.value, insigniaPeriodId: props.roundId, }; - // console.log(data); + console.log(data); await http .post(config.API.insigniaCreate(), data) .then(() => { @@ -387,7 +389,12 @@ const addlistperson = async (id: string) => { // actionModal.value = action; // modalNote.value = true; // }; -const clickEdit = () => { +const clickmodalEdit = () => { + modalEdit.value = true; + fecthInsignia(); + fecthInsigniaType(); +}; +const clickSave = () => { dialogConfirm( $q, async () => { @@ -449,6 +456,52 @@ const listdelete = async () => { messageError($q, err); }); }; +const insignia = ref(""); +const insigniaOptions = ref([]); +const insigniaType = ref(""); +const insigniaTypeOptions = ref([]); + +const fecthInsignia = async () => { + await http + .get(config.API.insignia) + .then((res) => { + insigniaOptions.value = res.data.result; + }) + .catch((err) => {}); +}; +const fecthInsigniaType = async () => { + await http(config.API.insigniaType) + .then((res) => { + insigniaTypeOptions.value = res.data.result; + }) + .catch((err) => {}); +}; + +const listinsignia = ref([]); +const filtertypeInsignia = async () => { + listinsignia.value = rows.value; + for (const data of listinsignia.value) { + const Type = data.insigniaType; + if (Type !== null && !typeinsigniaValues.has(Type)) { + typeinsigniaOptions.push({ + id: Type.toString(), + name: Type.toString(), + }); + typeinsigniaValues.add(Type); + } + } +}; +const searchFilterTable = async () => { + if (typeinsignia.value !== undefined && typeinsignia.value !== null) { + if (typeinsignia.value === "all") { + rows.value = listinsignia.value; + } else { + rows.value = listinsignia.value.filter( + (e) => e.insigniaType === typeinsignia.value + ); + } + } +}; const filterKeyword = ref(""); const filterKeyword2 = ref(""); @@ -519,7 +572,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => { :outlined="true" :hide-dropdown-icon="false" style="min-width: 150px" - @update:model-value="changtypeOc" + @update:model-value="searchFilterTable" />
@@ -648,7 +701,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => { { + + + + + แก้ไขเครื่องราชฯ ที่ยื่นขอ + + + + + +
+
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+
+
+ diff --git a/src/modules/07_insignia/components/2_Manage/Tab2.vue b/src/modules/07_insignia/components/2_Manage/Tab2.vue index 15e972d72..9bec42a41 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab2.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab2.vue @@ -1,5 +1,5 @@