This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-16 10:26:09 +07:00
parent 51707646e7
commit df481043b1
9 changed files with 138 additions and 91 deletions

View file

@ -133,10 +133,9 @@ function saveSelectEdit() {
};
await http
.put(url, body)
.then(() => {
success($q, "เพิ่มข้อมูลสำเร็จ");
props.getData?.();
.then(async () => {
await props.getData?.();
await success($q, "เพิ่มข้อมูลสำเร็จ");
close();
})
.catch((err) => {
@ -192,10 +191,12 @@ function onSubmitSelectEdit() {
await http
.post(url, body)
.then(() => {
success($q, "เพิ่มข้อมูลสำเร็จ");
props.emitSearch?.(formPositionSelect.positionName, "positionName");
.then(async () => {
await props.emitSearch?.(
formPositionSelect.positionName,
"positionName"
);
await success($q, "เพิ่มข้อมูลสำเร็จ");
close();
})
.catch((err) => {
@ -241,7 +242,12 @@ function inputEdit(val: boolean) {
};
}
/**
* function เลอกประเภทตำแหน
* @param val id ประเภทตำแหน
*/
function updateSelectType(val: string) {
//
const listLevel = dataLevel.value.find((e: any) => e.id === val);
levelOpsMain.value = listLevel.posLevels.map((e: OptionLevel) => ({
id: e.id,
@ -257,8 +263,7 @@ function close() {
}
async function fetchType() {
showLoader();
await http
http
.get(config.API.orgPosType)
.then((res) => {
dataLevel.value = res.data.result;
@ -270,16 +275,12 @@ async function fetchType() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function เรียกรายการตำแหน่งทางการบริหาร */
async function fetchExecutive() {
showLoader();
await http
function fetchExecutive() {
http
.get(config.API.orgPosExecutive)
.then((res) => {
executiveOpsMain.value = res.data.result.map((e: OptionExecutive) => ({
@ -290,9 +291,6 @@ async function fetchExecutive() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -300,8 +298,9 @@ watch(
() => modal.value,
async () => {
if (modal.value === true) {
await fetchType();
await fetchExecutive();
showLoader();
await Promise.all([fetchType(), fetchExecutive()]);
hideLoader();
if (props.data) {
const dataList = props.data;