เพิ่มอัตรากำลัง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-31 17:44:07 +07:00
parent b2c8dd6eed
commit cf92aaae0a
2 changed files with 55 additions and 23 deletions

View file

@ -27,6 +27,7 @@ const props = defineProps({
close: Function,
orgLevel: Number,
treeId: String,
actionType: String,
});
const isReadonly = ref<boolean>(false); //
@ -210,6 +211,21 @@ const visibleColumns = ref<string[]>([
"positionArea",
]);
async function fetchPosition(id: string) {
showLoader();
await http
.get(config.API.orgPosPositionById(id))
.then((res) => {
console.log(res);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function เรียกรายการประเภทตำแหน่ง */
async function fetchType() {
showLoader();
@ -329,22 +345,21 @@ function onSubmit() {
orgChild2Id: props.orgLevel === 2 ? props.treeId : null,
orgChild3Id: props.orgLevel === 3 ? props.treeId : null,
orgChild4Id: props.orgLevel === 4 ? props.treeId : null,
positions: [positionsData],
positions: positionsData,
};
console.log(body);
// showLoader();
// await http
// .post(config.API.orgPosMaster, body)
// .then((res) => {
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// props.close?.();
// hideLoader();
// });
showLoader();
await http
.post(config.API.orgPosMaster, body)
.then((res) => {
success($q, "เพิ่มข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.close?.();
hideLoader();
});
});
}
/** ฟังชั่น บันทึก */
@ -443,10 +458,14 @@ watch(
fetchType();
fetchLevel();
fetchExecutive();
rowsPositionSelect.value = [];
search.value = "";
rows.value = [];
clearFormPositionSelect();
if (props.actionType === "ADD") {
rowsPositionSelect.value = [];
search.value = "";
rows.value = [];
clearFormPositionSelect();
} else {
// props.treeId && fetchPosition(props.treeId);
}
}
}
);
@ -502,7 +521,7 @@ async function clearFormPositionSelect() {
<template>
<q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 96vw">
<DialogHeader tittle="เพิ่มอัตรากำลัง" :close="props.close" />
<DialogHeader :tittle="props.actionType === 'ADD' ? 'เพิ่มอัตรากำลัง':'แก้ไขอัตรากำลัง'" :close="props.close" />
<q-separator />
<q-card-section class="q-pa-sm">