ทะเบียนประวัติ => ข้อมูลส่วนตัว
This commit is contained in:
parent
722794a27e
commit
ddf4c8b9d4
9 changed files with 228 additions and 168 deletions
|
|
@ -345,10 +345,10 @@ function onSubmit() {
|
||||||
route.name === "registry-employeeId" ? "TEMP" : undefined,
|
route.name === "registry-employeeId" ? "TEMP" : undefined,
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await getData();
|
|
||||||
await props.fetchDataPersonal?.();
|
await props.fetchDataPersonal?.();
|
||||||
|
await getData();
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ async function uploadProfile(id: string) {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
hideLoader();
|
hideLoader();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadFileURL(uploadUrl: string, file: any) {
|
async function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
|
|
@ -576,16 +576,7 @@ watch(
|
||||||
>
|
>
|
||||||
<q-tooltip>เพิ่มข้อมูล</q-tooltip></q-btn
|
<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-space />
|
||||||
<q-input
|
<q-input
|
||||||
dense
|
dense
|
||||||
|
|
@ -632,15 +623,21 @@ watch(
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
<q-th auto-width />
|
|
||||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<span class="text-weight-medium">{{ col.label }}</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
|
<q-th auto-width />
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="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-td auto-width>
|
||||||
<q-btn
|
<q-btn
|
||||||
color="green"
|
color="green"
|
||||||
|
|
@ -652,27 +649,6 @@ watch(
|
||||||
>
|
>
|
||||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||||
</q-btn>
|
</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-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -706,24 +682,6 @@ watch(
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</div>
|
||||||
<div class="row q-gutter-sm q-mb-md">
|
<div class="row q-gutter-sm q-mb-md">
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ const profileId = ref<string>(
|
||||||
);
|
);
|
||||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||||
|
|
||||||
const currentPage = ref<number>(1);
|
|
||||||
const maxPage = ref<number>(1);
|
|
||||||
const modal = ref<boolean>(false);
|
const modal = ref<boolean>(false);
|
||||||
const modalHistory = ref<boolean>(false);
|
const modalHistory = ref<boolean>(false);
|
||||||
const rowsHistory = ref<ResponseObject[]>([]);
|
const rowsHistory = ref<ResponseObject[]>([]);
|
||||||
|
|
@ -375,9 +373,9 @@ async function editData() {
|
||||||
...formData,
|
...formData,
|
||||||
id: undefined,
|
id: undefined,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
await fetchAll();
|
||||||
fetchAll();
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,9 @@ const fromData = reactive({
|
||||||
statusMarital: "",
|
statusMarital: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลบิดา
|
||||||
|
*/
|
||||||
function fetchDataFather() {
|
function fetchDataFather() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -194,6 +197,10 @@ function fetchDataFather() {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลมารดา
|
||||||
|
*/
|
||||||
function fetchDataMother() {
|
function fetchDataMother() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -218,6 +225,10 @@ function fetchDataMother() {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลคู่สมรส
|
||||||
|
*/
|
||||||
function fetchDataCouple() {
|
function fetchDataCouple() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -244,6 +255,10 @@ function fetchDataCouple() {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลบุตร
|
||||||
|
*/
|
||||||
function fetchDataChildren() {
|
function fetchDataChildren() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -263,6 +278,10 @@ function fetchDataChildren() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function บันทึกข้อมูล
|
||||||
|
* @param type ประเภทของข้อมูล
|
||||||
|
*/
|
||||||
function onSubmit(type: string) {
|
function onSubmit(type: string) {
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -288,14 +307,14 @@ function onSubmit(type: string) {
|
||||||
const method = isEdit.value && type === "children" ? "patch" : "post";
|
const method = isEdit.value && type === "children" ? "patch" : "post";
|
||||||
try {
|
try {
|
||||||
await http[method](url, formBody);
|
await http[method](url, formBody);
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
||||||
type === "father"
|
type === "father"
|
||||||
? fetchDataFather()
|
? await fetchDataFather()
|
||||||
: type === "mother"
|
: type === "mother"
|
||||||
? fetchDataMother()
|
? await fetchDataMother()
|
||||||
: type === "couple"
|
: type === "couple"
|
||||||
? fetchDataCouple()
|
? await fetchDataCouple()
|
||||||
: fetchDataChildren();
|
: await fetchDataChildren();
|
||||||
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
closeDialog();
|
closeDialog();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -305,9 +324,13 @@ function onSubmit(type: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ปิด popup
|
||||||
|
*/
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
modalHistory.value = false;
|
modalHistory.value = false;
|
||||||
|
// เคลียร์ formData
|
||||||
fromData.isLive = 1;
|
fromData.isLive = 1;
|
||||||
fromData.citizenId = "";
|
fromData.citizenId = "";
|
||||||
fromData.prefix = "";
|
fromData.prefix = "";
|
||||||
|
|
@ -318,6 +341,12 @@ function closeDialog() {
|
||||||
fromData.statusMarital = "";
|
fromData.statusMarital = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function แก้ไขข้อมูล
|
||||||
|
* @param type ประเภทของบุคคล
|
||||||
|
* @param isStatusEdit สถานะแก่้ไข
|
||||||
|
* @param data ข้อมูลเดิม
|
||||||
|
*/
|
||||||
function onOpenDialogForm(
|
function onOpenDialogForm(
|
||||||
type: string,
|
type: string,
|
||||||
isStatusEdit: boolean = false,
|
isStatusEdit: boolean = false,
|
||||||
|
|
@ -326,11 +355,9 @@ function onOpenDialogForm(
|
||||||
modal.value = true;
|
modal.value = true;
|
||||||
typeForm.value = type;
|
typeForm.value = type;
|
||||||
isEdit.value = isStatusEdit;
|
isEdit.value = isStatusEdit;
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (type === "father") {
|
if (type === "father") {
|
||||||
titleForm.value = "บิดา";
|
titleForm.value = "บิดา";
|
||||||
console.log(fatherData);
|
|
||||||
|
|
||||||
fromData.isLive =
|
fromData.isLive =
|
||||||
fatherData.isLive === null ? 1 : fatherData.isLive ? 1 : 0;
|
fatherData.isLive === null ? 1 : fatherData.isLive ? 1 : 0;
|
||||||
|
|
@ -351,9 +378,11 @@ function onOpenDialogForm(
|
||||||
fromData.job = motherData.job;
|
fromData.job = motherData.job;
|
||||||
} else if (type === "couple") {
|
} else if (type === "couple") {
|
||||||
titleForm.value = "คู่สมรส";
|
titleForm.value = "คู่สมรส";
|
||||||
|
|
||||||
fromData.isLive = 1;
|
fromData.isLive = 1;
|
||||||
} else if (type === "children") {
|
} else if (type === "children") {
|
||||||
titleForm.value = "บุตร";
|
titleForm.value = "บุตร";
|
||||||
|
|
||||||
if (isStatusEdit) {
|
if (isStatusEdit) {
|
||||||
childernId.value = data.id;
|
childernId.value = data.id;
|
||||||
fromData.isLive =
|
fromData.isLive =
|
||||||
|
|
@ -367,6 +396,11 @@ function onOpenDialogForm(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ดูประวัติการแก้ไขข้อมูล
|
||||||
|
* @param type ประเภทของบุคคล
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
function onOpenDialogHistory(type: string, id: string = "") {
|
function onOpenDialogHistory(type: string, id: string = "") {
|
||||||
modalHistory.value = true;
|
modalHistory.value = true;
|
||||||
typeForm.value = type;
|
typeForm.value = type;
|
||||||
|
|
@ -374,6 +408,9 @@ function onOpenDialogHistory(type: string, id: string = "") {
|
||||||
fetchHistory(historyId, type);
|
fetchHistory(historyId, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลความสัมพันธ์
|
||||||
|
*/
|
||||||
function fetchDataRelationship() {
|
function fetchDataRelationship() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
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(() => {
|
update(() => {
|
||||||
optionRelationship.value = optionRelationshipMain.value.filter(
|
optionRelationship.value = optionRelationshipMain.value.filter(
|
||||||
(v: any) => v.name.indexOf(val) > -1
|
(v: any) => v.name.indexOf(val) > -1
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลประวัติการแก้ไขข้อมูล
|
||||||
|
* @param id
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
function fetchHistory(id: string, type: string) {
|
function fetchHistory(id: string, type: string) {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -426,11 +473,13 @@ function fetchHistory(id: string, type: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchDataFather();
|
Promise.all([
|
||||||
fetchDataMother();
|
fetchDataFather(),
|
||||||
fetchDataCouple();
|
fetchDataMother(),
|
||||||
fetchDataChildren();
|
fetchDataCouple(),
|
||||||
fetchDataRelationship();
|
fetchDataChildren(),
|
||||||
|
fetchDataRelationship(),
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -495,18 +495,26 @@ const historyVisibleColumns = ref<string[]>([
|
||||||
"lastUpdatedAt",
|
"lastUpdatedAt",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
async function onSubmit() {
|
/**
|
||||||
|
* function ยืนยันการบันทึกข้อมูล
|
||||||
|
*/
|
||||||
|
function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
() => {
|
||||||
dialogStatus.value === "create" ? addData() : editData(editId.value);
|
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) {
|
function filterSelector(val: string, update: Function, refData: string) {
|
||||||
switch (refData) {
|
switch (refData) {
|
||||||
case "educationOption":
|
case "educationOption":
|
||||||
|
|
@ -528,6 +536,9 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เคลียร์ formData
|
||||||
|
*/
|
||||||
function clearForm() {
|
function clearForm() {
|
||||||
isDate.value = "false";
|
isDate.value = "false";
|
||||||
educationData.educationLevel = "";
|
educationData.educationLevel = "";
|
||||||
|
|
@ -549,6 +560,10 @@ function clearForm() {
|
||||||
educationData.note = "";
|
educationData.note = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function แก้ไขข้อมูลประวัติการศึกษา
|
||||||
|
* @param row ข้อมูลประวัติการศึกษา
|
||||||
|
*/
|
||||||
function editForm(row: any) {
|
function editForm(row: any) {
|
||||||
dialogStatus.value = "edit";
|
dialogStatus.value = "edit";
|
||||||
editId.value = row.id;
|
editId.value = row.id;
|
||||||
|
|
@ -579,19 +594,30 @@ function editForm(row: any) {
|
||||||
dialog.value = true;
|
dialog.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ปิด popup มูลประวัติการศึกษา
|
||||||
|
*/
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
clearForm();
|
clearForm();
|
||||||
dialog.value = false;
|
dialog.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* funcitob ปิด popup ประวัติการศึกษา
|
||||||
|
*/
|
||||||
function closeHistoryDialog() {
|
function closeHistoryDialog() {
|
||||||
historyDialog.value = false;
|
historyDialog.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchData(id: string) {
|
/**
|
||||||
|
* function fetch ข้อมูลประวัตืการศึกษา
|
||||||
|
* @param id บุคคล
|
||||||
|
*/
|
||||||
|
function fetchData(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.profileNewEducationByProfileId(id, empType.value))
|
.get(config.API.profileNewEducationByProfileId(id, empType.value))
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
rows.value = res.data.result;
|
rows.value = res.data.result;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -602,9 +628,11 @@ async function fetchData(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchEducationLevel() {
|
/**
|
||||||
showLoader();
|
* function fetch ข้อมูลระดับการศึกษา
|
||||||
await http
|
*/
|
||||||
|
function fetchEducationLevel() {
|
||||||
|
http
|
||||||
.get(config.API.orgEducationLevel)
|
.get(config.API.orgEducationLevel)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
res.data.result.map((r: any) => {
|
res.data.result.map((r: any) => {
|
||||||
|
|
@ -617,15 +645,16 @@ async function fetchEducationLevel() {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchHistoryData(id: string) {
|
/**
|
||||||
|
* function fetch ประวัติการแก้ไขประวัติการศึกษา
|
||||||
|
* @param id ประวัติการศึกษา
|
||||||
|
*/
|
||||||
|
function fetchHistoryData(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.profileNewEducationHisByEducationId(id, empType.value))
|
.get(config.API.profileNewEducationHisByEducationId(id, empType.value))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
historyRows.value = res.data.result;
|
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), {
|
.post(config.API.profileNewEducation(empType.value), {
|
||||||
...educationData,
|
...educationData,
|
||||||
startYear: undefined,
|
startYear: undefined,
|
||||||
|
|
@ -648,9 +681,10 @@ async function addData() {
|
||||||
profileId: empType.value === "" ? id.value : undefined,
|
profileId: empType.value === "" ? id.value : undefined,
|
||||||
profileEmployeeId: empType.value !== "" ? id.value : undefined,
|
profileEmployeeId: empType.value !== "" ? id.value : undefined,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
fetchData(id.value);
|
await fetchData(id.value);
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
closeDialog();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -660,9 +694,12 @@ async function addData() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function บันทึกการแก้ไขข้อมูล
|
||||||
|
* @param idData ประวัติการศึกษา
|
||||||
|
*/
|
||||||
function editData(idData: string) {
|
function editData(idData: string) {
|
||||||
console.log(educationData);
|
showLoader();
|
||||||
|
|
||||||
http
|
http
|
||||||
.patch(config.API.profileNewEducationByEducationId(idData, empType.value), {
|
.patch(config.API.profileNewEducationByEducationId(idData, empType.value), {
|
||||||
...educationData,
|
...educationData,
|
||||||
|
|
@ -673,9 +710,10 @@ function editData(idData: string) {
|
||||||
durationYear:
|
durationYear:
|
||||||
educationData.durationYear === "" ? null : educationData.durationYear,
|
educationData.durationYear === "" ? null : educationData.durationYear,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
fetchData(id.value);
|
await fetchData(id.value);
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
closeDialog();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, 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 () => {
|
onMounted(async () => {
|
||||||
await fetchData(id.value);
|
await fetchData(id.value);
|
||||||
fetchEducationLevel();
|
fetchEducationLevel();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ const mixin = useCounterMixin();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mode = ref<string>("table");
|
const mode = ref<string>("table");
|
||||||
const {
|
const {
|
||||||
dialogRemove,
|
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
showLoader,
|
showLoader,
|
||||||
hideLoader,
|
hideLoader,
|
||||||
|
|
@ -189,6 +188,7 @@ const historyVisibleColumns = ref<string[]>([
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
"lastUpdatedAt",
|
"lastUpdatedAt",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
dialog.value = false;
|
dialog.value = false;
|
||||||
}
|
}
|
||||||
|
|
@ -197,18 +197,23 @@ function closeHistoryDialog() {
|
||||||
historyDialog.value = false;
|
historyDialog.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onSubmit() {
|
/**
|
||||||
|
* function ยืนยันการบันทึกข้อมูล
|
||||||
|
*/
|
||||||
|
function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
() => {
|
||||||
dialogStatus.value === "create" ? addData() : editData(editId.value);
|
dialogStatus.value === "create" ? addData() : editData(editId.value);
|
||||||
closeDialog();
|
|
||||||
},
|
},
|
||||||
"ยืนยันการบันทึกข้อมูล",
|
"ยืนยันการบันทึกข้อมูล",
|
||||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เคลียร์ formData
|
||||||
|
*/
|
||||||
function clearForm() {
|
function clearForm() {
|
||||||
specialSkill.detail = "";
|
specialSkill.detail = "";
|
||||||
specialSkill.field = "";
|
specialSkill.field = "";
|
||||||
|
|
@ -216,6 +221,10 @@ function clearForm() {
|
||||||
specialSkill.remark = "";
|
specialSkill.remark = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function
|
||||||
|
* @param row ข้อมูลความสามารถพิเศษ
|
||||||
|
*/
|
||||||
function editForm(row: any) {
|
function editForm(row: any) {
|
||||||
dialogStatus.value = "edit";
|
dialogStatus.value = "edit";
|
||||||
editId.value = row.id;
|
editId.value = row.id;
|
||||||
|
|
@ -226,11 +235,14 @@ function editForm(row: any) {
|
||||||
dialog.value = true;
|
dialog.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchData(id: string) {
|
/**
|
||||||
|
* function fetch ข้อมูลความสามรรถพิเศษ
|
||||||
|
*/
|
||||||
|
function fetchData(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.profileNewAbilityByProfileId(id, empType.value))
|
.get(config.API.profileNewAbilityByProfileId(id, empType.value))
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
rows.value = res.data.result;
|
rows.value = res.data.result;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.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();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
|
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
historyRows.value = res.data.result;
|
historyRows.value = res.data.result;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.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), {
|
.post(config.API.profileNewAbility(empType.value), {
|
||||||
...specialSkill,
|
...specialSkill,
|
||||||
dateStart: null,
|
dateStart: null,
|
||||||
|
|
@ -265,9 +285,10 @@ async function addData() {
|
||||||
profileId: empType.value === "" ? id.value : undefined,
|
profileId: empType.value === "" ? id.value : undefined,
|
||||||
profileEmployeeId: empType.value !== "" ? id.value : undefined,
|
profileEmployeeId: empType.value !== "" ? id.value : undefined,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
fetchData(id.value);
|
await fetchData(id.value);
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
closeDialog();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, 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), {
|
.patch(config.API.profileNewAbilityByAbilityId(idData, empType.value), {
|
||||||
...specialSkill,
|
...specialSkill,
|
||||||
dateStart: null,
|
dateStart: null,
|
||||||
dateEnd: null,
|
dateEnd: null,
|
||||||
profileId: undefined,
|
profileId: undefined,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
fetchData(id.value);
|
await fetchData(id.value);
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
closeDialog();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -297,25 +324,8 @@ async function editData(idData: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteData(idData: string) {
|
onMounted(() => {
|
||||||
dialogRemove($q, () =>
|
fetchData(id.value);
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ const statusOptionMain = ref<DataOption[]>(
|
||||||
);
|
);
|
||||||
const statusOption = ref<DataOption[]>(statusOptionMain.value);
|
const statusOption = ref<DataOption[]>(statusOptionMain.value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function บันทึกรายการคำร้อง
|
||||||
|
*/
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm($q, () => {
|
dialogConfirm($q, () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -64,6 +67,9 @@ function onSubmit() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ปิด popup
|
||||||
|
*/
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
formData.status = "";
|
formData.status = "";
|
||||||
|
|
@ -77,6 +83,11 @@ function classInput(val: boolean) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ค้นหาคำใน select สถานะคำร้อง
|
||||||
|
* @param val คำค้น
|
||||||
|
* @param update Function
|
||||||
|
*/
|
||||||
function filterOption(val: string, update: Function) {
|
function filterOption(val: string, update: Function) {
|
||||||
update(() => {
|
update(() => {
|
||||||
statusOption.value = statusOptionMain.value.filter(
|
statusOption.value = statusOptionMain.value.filter(
|
||||||
|
|
@ -85,6 +96,9 @@ function filterOption(val: string, update: Function) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch ข้อมูลคำร้องแก้ไข
|
||||||
|
*/
|
||||||
function fetchDataRequest() {
|
function fetchDataRequest() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
|
||||||
|
|
@ -573,9 +573,9 @@ function selectAvatarHistory() {
|
||||||
http
|
http
|
||||||
.get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
|
.get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
closeImage();
|
|
||||||
await fetchDataPersonal();
|
await fetchDataPersonal();
|
||||||
await fetchProfile(profileId.value);
|
await fetchProfile(profileId.value);
|
||||||
|
closeImage();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -942,19 +942,6 @@ onMounted(async () => {
|
||||||
:src="n.downloadUrl"
|
:src="n.downloadUrl"
|
||||||
:class="imageClass(n)"
|
: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
|
<div
|
||||||
class="absolute-bottom col-12 cursor-pointer flex justify-between items-center"
|
class="absolute-bottom col-12 cursor-pointer flex justify-between items-center"
|
||||||
style="padding: 5px"
|
style="padding: 5px"
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,9 @@ const statusOption = ref<DataOption[]>(store.optionStatus);
|
||||||
const modalStatus = ref<boolean>(false);
|
const modalStatus = ref<boolean>(false);
|
||||||
const requestId = ref<string>("");
|
const requestId = ref<string>("");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch รายการคำร้องขอแก้ไขทะเบียนประวัติ
|
||||||
|
*/
|
||||||
function fetchListRequset() {
|
function fetchListRequset() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -157,16 +160,28 @@ function fetchListRequset() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เลือกสถานะคำร้อง
|
||||||
|
*/
|
||||||
function updateStatusValue() {
|
function updateStatusValue() {
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
|
// fetch รายการคำร้องขอแก้ไขทะเบียนประวัติ
|
||||||
fetchListRequset();
|
fetchListRequset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เคลียร์ สถานะคำร้อง
|
||||||
|
*/
|
||||||
function clearStatus() {
|
function clearStatus() {
|
||||||
status.value = "";
|
status.value = "";
|
||||||
statusOption.value = store.optionStatus;
|
statusOption.value = store.optionStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ค้นหาคำใน select สถานะคำร้อง
|
||||||
|
* @param val คำค้น
|
||||||
|
* @param update Function
|
||||||
|
*/
|
||||||
function filterOption(val: string, update: Function) {
|
function filterOption(val: string, update: Function) {
|
||||||
update(() => {
|
update(() => {
|
||||||
status.value = val ? "" : status.value;
|
status.value = val ? "" : status.value;
|
||||||
|
|
@ -176,11 +191,19 @@ function filterOption(val: string, update: Function) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* funciton แก่ไขคำร้อง
|
||||||
|
* @param id รายการคำร้อง
|
||||||
|
*/
|
||||||
function onclickEdit(id: string) {
|
function onclickEdit(id: string) {
|
||||||
modalStatus.value = true;
|
modalStatus.value = true;
|
||||||
requestId.value = id;
|
requestId.value = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เลือกแถวต่อหน้า
|
||||||
|
* @param newPagination
|
||||||
|
*/
|
||||||
function updatePageSizePagination(newPagination: Pagination) {
|
function updatePageSizePagination(newPagination: Pagination) {
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
pageSize.value = newPagination.rowsPerPage;
|
pageSize.value = newPagination.rowsPerPage;
|
||||||
|
|
@ -200,9 +223,9 @@ function onDownloadFile(id: string) {
|
||||||
id
|
id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
if (res.data.length !== 0) {
|
if (res.data.length !== 0) {
|
||||||
downloadUrl(id, res.data[0].fileName);
|
await downloadUrl(id, res.data[0].fileName);
|
||||||
} else {
|
} else {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue