diff --git a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue
index 3e65a95f7..c3b5e8f16 100644
--- a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue
+++ b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue
@@ -39,7 +39,7 @@ const returndate = ref
();
const reason = ref("");
const listPerson = ref([]);
const OrgList = ref([]);
-const filterOrgList = ref([]);
+const filterOrgList = ref([]);
const insigniaNoteProfileId = ref("");
const filterSelectRound = ref();
const selectRound = ref();
@@ -124,25 +124,32 @@ async function fecthlistInsignia() {
}
/** function ดึงข้อมูลรายการหน่วยงาน */
-// async function fetchOrgList() {
-// showLoader();
-// await http
-// .get(config.API.typeOc())
-// .then(async (response: any) => {
-// const orgArr = response.data.result.map((e: any) => ({
-// id: e.organizationId,
-// name: e.organizationName,
-// }));
-// OrgList.value = orgArr;
-// filterOrgList.value = OrgList.value;
-// })
-// .catch((err) => {
-// messageError($q, err);
-// })
-// .finally(() => {
-// hideLoader();
-// });
-// }
+
+/** funcion เรียกข้อมูลหน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ */
+async function fetchOrgList() {
+ http
+ .get(config.API.activeOrganization)
+ .then((res) => {
+ const data = res.data.result;
+
+ http
+ .get(config.API.orgByid(data.activeId))
+ .then(async (res) => {
+ const data = await res.data.result.map((item: any) => ({
+ id: item.orgTreeId,
+ name: item.orgName,
+ }));
+ OrgList.value = data;
+ filterOrgList.value = data;
+ })
+ .catch((err) => {
+ messageError($q, err);
+ });
+ })
+ .catch((err) => {
+ messageError($q, err);
+ });
+}
// ดึงข้อมูลการยืม-คืนมาแสดงเก็บไว้ก่อนเผื่อต้องเอาข้อมูลมาแสดงเพิ่ม
// const fetchData = async () => {
@@ -172,7 +179,6 @@ async function onSubmit() {
.then(async () => {
await props.closeAndFecth();
await clearData();
- // await hideLoader();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@@ -189,7 +195,6 @@ async function onSubmit() {
.then(async () => {
await props.closeAndFecth();
await clearData();
- // await hideLoader();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@@ -215,7 +220,6 @@ async function searchcardid() {
?.shortName || ""
})`;
insigniaNoteProfileId.value = node.id;
- insigniaNoteProfileId.value = node.id;
hideLoader();
} else {
notifyError($q, "ไม่พบข้อมูลการได้รับในรอบนี้");
@@ -229,7 +233,6 @@ async function searchcardid() {
fullName.value = "";
brand.value = "";
receivedate.value = null;
- // OrganazationId.value = "";
}
}
@@ -281,11 +284,13 @@ onMounted(() => {
/** function callback เช็ค props ถ้าเปิด dialog ให้ดึงรายการข้อมูล */
watch(props, () => {
- // type.value = props.type;
if (props.modal == true && props.roundId != "all") {
roundNo.value = props.roundId;
- fecthlistInsignia();
- // fetchOrgList();
+ if (props.action === "editData") {
+ fetchOrgList();
+ } else {
+ fecthlistInsignia();
+ }
}
});
@@ -484,27 +489,27 @@ watch(props, () => {
-
+ />
+
- {{ props.value }}
+ {{ props.value ?? "-" }}