ทะเบียนประวัติ => ข้อมูลส่วนตัว

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-16 13:45:46 +07:00
parent 722794a27e
commit ddf4c8b9d4
9 changed files with 228 additions and 168 deletions

View file

@ -345,10 +345,10 @@ function onSubmit() {
route.name === "registry-employeeId" ? "TEMP" : undefined,
})
.then(async () => {
await getData();
await props.fetchDataPersonal?.();
await getData();
modal.value = false;
success($q, "บันทึกข้อมูลสำเร็จ");
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);

View file

@ -331,7 +331,7 @@ async function uploadProfile(id: string) {
.catch((err) => {
messageError($q, err);
hideLoader();
})
});
}
async function uploadFileURL(uploadUrl: string, file: any) {
@ -576,16 +576,7 @@ watch(
>
<q-tooltip>เพมขอม</q-tooltip></q-btn
>
<!-- <q-btn
flat
dense
round
icon="mdi-history"
color="deep-purple"
@click="() => (fetchHistoryData(props.row.id), (historyDialog = true))"
>
<q-tooltip>ประวการเปลยนช-นามสก</q-tooltip>
</q-btn> -->
<q-space />
<q-input
dense
@ -632,15 +623,21 @@ watch(
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="(col, index) in props.cols" :key="col.name">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
<q-td auto-width>
<q-btn
color="green"
@ -652,27 +649,6 @@ watch(
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<!-- <q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round
color="edit"
icon="edit"
clickable
@click="
() => {
editForm(props.row);
}
"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn> -->
</q-td>
<q-td v-for="(col, index) in props.cols" :key="col.name">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
@ -706,24 +682,6 @@ watch(
/>
</div>
</div>
<!-- <q-select
class="inputgreen"
outlined
v-model="changeNameData.status"
:options="statusOption"
label="สถานะการเปลี่ยนชื่อ"
use-input
hide-bottom-space
input-debounce="0"
:rules="[
(val) => !!val || `${'กรุณาเลือกสถานะการเปลี่ยนชื่อ'}`,
]"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'statusOptions'
) "
dense
/> -->
</div>
</div>
<div class="row q-gutter-sm q-mb-md">

View file

@ -40,8 +40,6 @@ const profileId = ref<string>(
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const rowsHistory = ref<ResponseObject[]>([]);
@ -375,9 +373,9 @@ async function editData() {
...formData,
id: undefined,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
fetchAll();
.then(async (res) => {
await fetchAll();
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {

View file

@ -169,6 +169,9 @@ const fromData = reactive({
statusMarital: "",
});
/**
* function fetch อมลบดา
*/
function fetchDataFather() {
showLoader();
http
@ -194,6 +197,10 @@ function fetchDataFather() {
hideLoader();
});
}
/**
* function fetch อมลมารดา
*/
function fetchDataMother() {
showLoader();
http
@ -218,6 +225,10 @@ function fetchDataMother() {
hideLoader();
});
}
/**
* function fetch อมลคสมรส
*/
function fetchDataCouple() {
showLoader();
http
@ -244,6 +255,10 @@ function fetchDataCouple() {
hideLoader();
});
}
/**
* function fetch อมลบตร
*/
function fetchDataChildren() {
showLoader();
http
@ -263,6 +278,10 @@ function fetchDataChildren() {
});
}
/**
* function นทกขอม
* @param type ประเภทของขอม
*/
function onSubmit(type: string) {
dialogConfirm($q, async () => {
showLoader();
@ -288,14 +307,14 @@ function onSubmit(type: string) {
const method = isEdit.value && type === "children" ? "patch" : "post";
try {
await http[method](url, formBody);
success($q, "บันทึกข้อมูลสำเร็จ");
type === "father"
? fetchDataFather()
? await fetchDataFather()
: type === "mother"
? fetchDataMother()
? await fetchDataMother()
: type === "couple"
? fetchDataCouple()
: fetchDataChildren();
? await fetchDataCouple()
: await fetchDataChildren();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
} catch (e) {
messageError($q, e);
@ -305,9 +324,13 @@ function onSubmit(type: string) {
});
}
/**
* function popup
*/
function closeDialog() {
modal.value = false;
modalHistory.value = false;
// formData
fromData.isLive = 1;
fromData.citizenId = "";
fromData.prefix = "";
@ -318,6 +341,12 @@ function closeDialog() {
fromData.statusMarital = "";
}
/**
* function แกไขขอม
* @param type ประเภทของบคคล
* @param isStatusEdit สถานะแกไข
* @param data อมลเด
*/
function onOpenDialogForm(
type: string,
isStatusEdit: boolean = false,
@ -326,11 +355,9 @@ function onOpenDialogForm(
modal.value = true;
typeForm.value = type;
isEdit.value = isStatusEdit;
console.log(data);
if (type === "father") {
titleForm.value = "บิดา";
console.log(fatherData);
fromData.isLive =
fatherData.isLive === null ? 1 : fatherData.isLive ? 1 : 0;
@ -351,9 +378,11 @@ function onOpenDialogForm(
fromData.job = motherData.job;
} else if (type === "couple") {
titleForm.value = "คู่สมรส";
fromData.isLive = 1;
} else if (type === "children") {
titleForm.value = "บุตร";
if (isStatusEdit) {
childernId.value = data.id;
fromData.isLive =
@ -367,6 +396,11 @@ function onOpenDialogForm(
}
}
/**
* function ประวการแกไขขอม
* @param type ประเภทของบคคล
* @param id
*/
function onOpenDialogHistory(type: string, id: string = "") {
modalHistory.value = true;
typeForm.value = type;
@ -374,6 +408,9 @@ function onOpenDialogHistory(type: string, id: string = "") {
fetchHistory(historyId, type);
}
/**
* function fetch อมลความสมพนธ
*/
function fetchDataRelationship() {
showLoader();
http
@ -393,14 +430,24 @@ function fetchDataRelationship() {
});
}
const filterSelectorRelation = (val: any, update: Function) => {
/**
* function นหาขอมลใน select
* @param val คำคนหา
* @param update function
*/
function filterSelectorRelation(val: any, update: Function) {
update(() => {
optionRelationship.value = optionRelationshipMain.value.filter(
(v: any) => v.name.indexOf(val) > -1
);
});
};
}
/**
* function fetch อมลประวการแกไขขอม
* @param id
* @param type
*/
function fetchHistory(id: string, type: string) {
hideLoader();
http
@ -426,11 +473,13 @@ function fetchHistory(id: string, type: string) {
}
onMounted(() => {
fetchDataFather();
fetchDataMother();
fetchDataCouple();
fetchDataChildren();
fetchDataRelationship();
Promise.all([
fetchDataFather(),
fetchDataMother(),
fetchDataCouple(),
fetchDataChildren(),
fetchDataRelationship(),
]);
});
</script>

View file

@ -495,18 +495,26 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdatedAt",
]);
async function onSubmit() {
/**
* function นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* function นหา คำใน option
* @param val คำคนหา
* @param update function
* @param refData type select
*/
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "educationOption":
@ -528,6 +536,9 @@ function filterSelector(val: string, update: Function, refData: string) {
}
}
/**
* function เคลยร formData
*/
function clearForm() {
isDate.value = "false";
educationData.educationLevel = "";
@ -549,6 +560,10 @@ function clearForm() {
educationData.note = "";
}
/**
* function แกไขขอมลประวการศกษา
* @param row อมลประวการศกษา
*/
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
@ -579,19 +594,30 @@ function editForm(row: any) {
dialog.value = true;
}
/**
* function popup ลประวการศกษา
*/
function closeDialog() {
clearForm();
dialog.value = false;
}
/**
* funcitob popup ประวการศกษา
*/
function closeHistoryDialog() {
historyDialog.value = false;
}
async function fetchData(id: string) {
/**
* function fetch อมลประวการศกษา
* @param id คคล
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewEducationByProfileId(id, empType.value))
.then(async (res) => {
.then((res) => {
rows.value = res.data.result;
})
.catch((err) => {
@ -602,9 +628,11 @@ async function fetchData(id: string) {
});
}
async function fetchEducationLevel() {
showLoader();
await http
/**
* function fetch อมลระดบการศกษา
*/
function fetchEducationLevel() {
http
.get(config.API.orgEducationLevel)
.then(async (res) => {
res.data.result.map((r: any) => {
@ -617,15 +645,16 @@ async function fetchEducationLevel() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function fetchHistoryData(id: string) {
/**
* function fetch ประวการแกไขประวการศกษา
* @param id ประวการศกษา
*/
function fetchHistoryData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewEducationHisByEducationId(id, empType.value))
.then(async (res) => {
historyRows.value = res.data.result;
@ -638,8 +667,12 @@ async function fetchHistoryData(id: string) {
});
}
async function addData() {
await http
/**
* function เพมขอมลประวการศกษา
*/
function addData() {
showLoader();
http
.post(config.API.profileNewEducation(empType.value), {
...educationData,
startYear: undefined,
@ -648,9 +681,10 @@ async function addData() {
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -660,9 +694,12 @@ async function addData() {
});
}
/**
* function นทกการแกไขขอม
* @param idData ประวการศกษา
*/
function editData(idData: string) {
console.log(educationData);
showLoader();
http
.patch(config.API.profileNewEducationByEducationId(idData, empType.value), {
...educationData,
@ -673,9 +710,10 @@ function editData(idData: string) {
durationYear:
educationData.durationYear === "" ? null : educationData.durationYear,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -685,23 +723,6 @@ function editData(idData: string) {
});
}
// function deleteData(idData: string) {
// dialogRemove($q, () =>
// http
// .delete(config.API.profileNewEducationByEducationId(idData))
// .then(() => {
// fetchData(id.value);
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// })
// );
// }
onMounted(async () => {
await fetchData(id.value);
fetchEducationLevel();

View file

@ -15,7 +15,6 @@ const mixin = useCounterMixin();
const $q = useQuasar();
const mode = ref<string>("table");
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
@ -189,6 +188,7 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
function closeDialog() {
dialog.value = false;
}
@ -197,18 +197,23 @@ function closeHistoryDialog() {
historyDialog.value = false;
}
async function onSubmit() {
/**
* function นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* function เคลยร formData
*/
function clearForm() {
specialSkill.detail = "";
specialSkill.field = "";
@ -216,6 +221,10 @@ function clearForm() {
specialSkill.remark = "";
}
/**
* function
* @param row อมลความสามารถพเศษ
*/
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
@ -226,11 +235,14 @@ function editForm(row: any) {
dialog.value = true;
}
async function fetchData(id: string) {
/**
* function fetch อมลความสามรรถพเศษ
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewAbilityByProfileId(id, empType.value))
.then(async (res) => {
.then((res) => {
rows.value = res.data.result;
})
.catch((err) => {
@ -241,11 +253,15 @@ async function fetchData(id: string) {
});
}
async function fetchHistoryData(id: string) {
/**
* function fetch ประวการแกไขความสามรรถพเศษ
* @param id ความสามรรถพเศษ
*/
function fetchHistoryData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
.then(async (res) => {
.then((res) => {
historyRows.value = res.data.result;
})
.catch((err) => {
@ -256,8 +272,12 @@ async function fetchHistoryData(id: string) {
});
}
async function addData() {
await http
/**
* function เพมขอมลความสามรรถพเศษ
*/
function addData() {
showLoader();
http
.post(config.API.profileNewAbility(empType.value), {
...specialSkill,
dateStart: null,
@ -265,9 +285,10 @@ async function addData() {
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -277,17 +298,23 @@ async function addData() {
});
}
async function editData(idData: string) {
await http
/**
* function นทกการแกไขขอม
* @param idData ความสามรรถพเศษ
*/
function editData(idData: string) {
showLoader();
http
.patch(config.API.profileNewAbilityByAbilityId(idData, empType.value), {
...specialSkill,
dateStart: null,
dateEnd: null,
profileId: undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -297,25 +324,8 @@ async function editData(idData: string) {
});
}
async function deleteData(idData: string) {
dialogRemove($q, () =>
http
.delete(config.API.profileNewAbilityByAbilityId(idData, empType.value))
.then(() => {
fetchData(id.value);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
})
);
}
onMounted(async () => {
await fetchData(id.value);
onMounted(() => {
fetchData(id.value);
});
</script>
<template>

View file

@ -44,6 +44,9 @@ const statusOptionMain = ref<DataOption[]>(
);
const statusOption = ref<DataOption[]>(statusOptionMain.value);
/**
* function นทกรายการคำรอง
*/
function onSubmit() {
dialogConfirm($q, () => {
showLoader();
@ -64,6 +67,9 @@ function onSubmit() {
});
}
/**
* function popup
*/
function closeDialog() {
modal.value = false;
formData.status = "";
@ -77,6 +83,11 @@ function classInput(val: boolean) {
};
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
statusOption.value = statusOptionMain.value.filter(
@ -85,6 +96,9 @@ function filterOption(val: string, update: Function) {
});
}
/**
* function fetch อมลคำรองแกไข
*/
function fetchDataRequest() {
showLoader();
http

View file

@ -573,9 +573,9 @@ function selectAvatarHistory() {
http
.get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
.then(async () => {
closeImage();
await fetchDataPersonal();
await fetchProfile(profileId.value);
closeImage();
})
.catch((e) => {
messageError($q, e);
@ -942,19 +942,6 @@ onMounted(async () => {
:src="n.downloadUrl"
:class="imageClass(n)"
>
<!-- <div
class="absolute-top bg-transparent cursor-pointer text-right"
style="padding: 5px"
>
<q-btn
icon="delete"
unelevated
round
dense
@click="deletePhoto"
style="color: #ff8080"
/>
</div> -->
<div
class="absolute-bottom col-12 cursor-pointer flex justify-between items-center"
style="padding: 5px"

View file

@ -132,6 +132,9 @@ const statusOption = ref<DataOption[]>(store.optionStatus);
const modalStatus = ref<boolean>(false);
const requestId = ref<string>("");
/**
* function fetch รายการคำรองขอแกไขทะเบยนประว
*/
function fetchListRequset() {
showLoader();
http
@ -157,16 +160,28 @@ function fetchListRequset() {
});
}
/**
* function เลอกสถานะคำรอง
*/
function updateStatusValue() {
page.value = 1;
// fetch
fetchListRequset();
}
/**
* function เคลยร สถานะคำรอง
*/
function clearStatus() {
status.value = "";
statusOption.value = store.optionStatus;
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
status.value = val ? "" : status.value;
@ -176,11 +191,19 @@ function filterOption(val: string, update: Function) {
});
}
/**
* funciton แกไขคำรอง
* @param id รายการคำรอง
*/
function onclickEdit(id: string) {
modalStatus.value = true;
requestId.value = id;
}
/**
* function เลอกแถวตอหน
* @param newPagination
*/
function updatePageSizePagination(newPagination: Pagination) {
page.value = 1;
pageSize.value = newPagination.rowsPerPage;
@ -200,9 +223,9 @@ function onDownloadFile(id: string) {
id
)
)
.then((res) => {
.then(async (res) => {
if (res.data.length !== 0) {
downloadUrl(id, res.data[0].fileName);
await downloadUrl(id, res.data[0].fileName);
} else {
hideLoader();
}