fix bug เครื่องราช
This commit is contained in:
parent
249ec6c9ee
commit
dd70f4d383
4 changed files with 109 additions and 57 deletions
|
|
@ -118,6 +118,8 @@ watch(props, () => {
|
||||||
fectDataByid(props.personId); // เมือแก้ไข เรียกข้อมูลบันทึกผล
|
fectDataByid(props.personId); // เมือแก้ไข เรียกข้อมูลบันทึกผล
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
status.value = "";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,45 +89,54 @@ async function onSubmit(type: string, id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.put(config.API.requestinsignia(type, id), formData)
|
.put(config.API.requestinsignia(type, id), formData)
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
await props.fecthlistInsignia?.();
|
||||||
})
|
await props.close?.();
|
||||||
.catch((e) => {
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
messageError($q, e);
|
|
||||||
})
|
|
||||||
.finally(async () => {
|
|
||||||
Datereceive.value = null;
|
Datereceive.value = null;
|
||||||
files.value = null;
|
files.value = null;
|
||||||
OrganazationId.value = "";
|
OrganazationId.value = "";
|
||||||
Datereturn.value = null;
|
Datereturn.value = null;
|
||||||
filesReturn.value = null;
|
filesReturn.value = null;
|
||||||
OrganazationId2.value = "";
|
OrganazationId2.value = "";
|
||||||
props.fecthlistInsignia?.();
|
})
|
||||||
props.close?.();
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modal,
|
||||||
|
() => {
|
||||||
|
if (props.modal == true) {
|
||||||
|
fetchOrgList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
/** function เรียกหน่วยงาน*/
|
/** function เรียกหน่วยงาน*/
|
||||||
async function fetchOrgList() {
|
async function fetchOrgList() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.insigniaOrg)
|
.get(config.API.activeOrganization)
|
||||||
.then(async (response: any) => {
|
.then((res) => {
|
||||||
const orgArr = response.data.result.map((e: any) => ({
|
const data = res.data.result;
|
||||||
id: e.id,
|
|
||||||
name: e.name + `(${e.shortName})`,
|
http
|
||||||
}));
|
.get(config.API.orgByid(data.activeId))
|
||||||
OrgList.value = orgArr;
|
.then(async (res) => {
|
||||||
OrgList2.value = orgArr;
|
const data = await res.data.result.map((item: any) => ({
|
||||||
// [
|
id: item.orgTreeId,
|
||||||
// {
|
name: item.orgName,
|
||||||
// id: "00000000-0000-0000-0000-000000000000",
|
}));
|
||||||
// name: "สำนักนายกรัฐมนตรี",
|
OrgList.value = data;
|
||||||
// },
|
OrgList2.value = data;
|
||||||
// ...orgArr,
|
})
|
||||||
// ];
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -135,12 +144,35 @@ async function fetchOrgList() {
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
|
// showLoader();
|
||||||
|
// await http
|
||||||
|
// .get(config.API.insigniaOrg)
|
||||||
|
// .then(async (response: any) => {
|
||||||
|
// const orgArr = response.data.result.map((e: any) => ({
|
||||||
|
// id: e.id,
|
||||||
|
// name: e.name + `(${e.shortName})`,
|
||||||
|
// }));
|
||||||
|
// OrgList.value = orgArr;
|
||||||
|
// OrgList2.value = orgArr;
|
||||||
|
// // [
|
||||||
|
// // {
|
||||||
|
// // id: "00000000-0000-0000-0000-000000000000",
|
||||||
|
// // name: "สำนักนายกรัฐมนตรี",
|
||||||
|
// // },
|
||||||
|
// // ...orgArr,
|
||||||
|
// // ];
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// messageError($q, err);
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// hideLoader();
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** callback function จำทำงานเมื่อ props มีการเปลี่ยนแปลง*/
|
/** callback function จำทำงานเมื่อ props มีการเปลี่ยนแปลง*/
|
||||||
watch(props, () => {
|
watch(props, () => {
|
||||||
if (props.dataModal) {
|
if (props.dataModal) {
|
||||||
fetchOrgList();
|
|
||||||
Datereceive.value = props.dataModal.dateReceiveInsignia;
|
Datereceive.value = props.dataModal.dateReceiveInsignia;
|
||||||
Datereturn.value = props.dataModal.dateReturnInsignia;
|
Datereturn.value = props.dataModal.dateReturnInsignia;
|
||||||
OrganazationId.value = props.dataModal.orgReceiveInsignia;
|
OrganazationId.value = props.dataModal.orgReceiveInsignia;
|
||||||
|
|
@ -152,7 +184,7 @@ watch(props, () => {
|
||||||
props.dataModal.orgReturnInsignia == "-"
|
props.dataModal.orgReturnInsignia == "-"
|
||||||
? "00000000-0000-0000-0000-000000000000"
|
? "00000000-0000-0000-0000-000000000000"
|
||||||
: props.dataModal.orgReturnInsignia
|
: props.dataModal.orgReturnInsignia
|
||||||
: "-";
|
: "";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ const stat = ref<any>({
|
||||||
|
|
||||||
/** funcion เรียกข้อมูล stat*/
|
/** funcion เรียกข้อมูล stat*/
|
||||||
async function fecthDashboard() {
|
async function fecthDashboard() {
|
||||||
showLoader();
|
// showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.insigniaManageOrgDashboard(id.value))
|
.get(config.API.insigniaManageOrgDashboard(id.value))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -112,8 +112,8 @@ async function fecthDashboard() {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
});
|
||||||
.finally(() => hideLoader());
|
// .finally(() => hideLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** funcion เรียกข้อมูลรายชื่อ หน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ ตริตาภรณ์มงกุฎไทย ()*/
|
/** funcion เรียกข้อมูลรายชื่อ หน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ ตริตาภรณ์มงกุฎไทย ()*/
|
||||||
|
|
@ -138,21 +138,42 @@ async function fecthListData() {
|
||||||
|
|
||||||
/** funcion เรียกข้อมูลหน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ */
|
/** funcion เรียกข้อมูลหน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ */
|
||||||
async function fetchOrgList() {
|
async function fetchOrgList() {
|
||||||
showLoader();
|
http
|
||||||
await http
|
.get(config.API.activeOrganization)
|
||||||
.get(config.API.typeOc())
|
.then((res) => {
|
||||||
.then(async (response: any) => {
|
const data = res.data.result;
|
||||||
orgList.value = response.data.result.map((e: any) => ({
|
|
||||||
id: e.organizationId,
|
http
|
||||||
name: e.organizationName,
|
.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;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
|
// showLoader();
|
||||||
|
// await http
|
||||||
|
// .get(config.API.typeOc())
|
||||||
|
// .then(async (response: any) => {
|
||||||
|
// orgList.value = response.data.result.map((e: any) => ({
|
||||||
|
// id: e.organizationId,
|
||||||
|
// name: e.organizationName,
|
||||||
|
// }));
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// messageError($q, err);
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// hideLoader();
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** funcion ย้อนกลับหน้าจัดสรรเครื่องราชอิสริยาภรณ์*/
|
/** funcion ย้อนกลับหน้าจัดสรรเครื่องราชอิสริยาภรณ์*/
|
||||||
|
|
@ -179,16 +200,15 @@ async function save(organizationId: string, total: string) {
|
||||||
insigniaManageId: id.value,
|
insigniaManageId: id.value,
|
||||||
total: total,
|
total: total,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
fecthListData();
|
await fecthListData();
|
||||||
fecthDashboard();
|
await fecthDashboard();
|
||||||
|
await close();
|
||||||
|
await success($q, "บันทึกมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
close();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,16 +224,14 @@ async function saveEdit(organizationId: string, amount: number) {
|
||||||
total: Number(amount),
|
total: Number(amount),
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
success($q, "แก้ไขมูลสำเร็จ");
|
|
||||||
await fecthDashboard();
|
await fecthDashboard();
|
||||||
await fecthListData();
|
await fecthListData();
|
||||||
|
await close();
|
||||||
|
await success($q, "แก้ไขมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
close();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,9 +256,9 @@ async function clickDelete(insigniaId: string) {
|
||||||
await http
|
await http
|
||||||
.delete(config.API.insigniaManageOrg(insigniaId))
|
.delete(config.API.insigniaManageOrg(insigniaId))
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
await fecthDashboard();
|
await fecthDashboard();
|
||||||
await fecthListData();
|
await fecthListData();
|
||||||
|
await success($q, "ลบข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
|
||||||
|
|
@ -306,11 +306,11 @@ watch(tab, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
/** callback function จำทำงานเมื่อ modal มีการเปลี่ยนแปลง*/
|
/** callback function จำทำงานเมื่อ modal มีการเปลี่ยนแปลง*/
|
||||||
watch(modal, () => {
|
// watch(modal, () => {
|
||||||
if (modal.value == false) {
|
// if (modal.value == false) {
|
||||||
fecthlistInsignia();
|
// fecthlistInsignia();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
/** function เรียกรายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์/การจ่ายใบกำกับ */
|
/** function เรียกรายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์/การจ่ายใบกำกับ */
|
||||||
async function fecthlistInsignia() {
|
async function fecthlistInsignia() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue