This commit is contained in:
STW_TTTY\stwtt 2024-06-28 17:52:30 +07:00
parent 1739f5bae3
commit 6291dfea77

View file

@ -40,7 +40,7 @@ const props = defineProps({
const emit = defineEmits(["update:formDeital"]); const emit = defineEmits(["update:formDeital"]);
const formDetail = reactive({ const formDetail = reactive<any>({
userId: "", userId: "",
citizenId: "", citizenId: "",
prefix: "", prefix: "",
@ -52,6 +52,11 @@ const formDetail = reactive({
posNo: "", posNo: "",
birthDate: "", birthDate: "",
govAge: "", govAge: "",
govAgeMap: {
year: 0,
month: 0,
day: 0,
},
educations: [] as EducationForm[], educations: [] as EducationForm[],
certificates: [], certificates: [],
salaries: [], salaries: [],
@ -72,7 +77,6 @@ async function fetchDetail() {
formDetail.fullName = `${data.firstName} ${data.lastName}`; formDetail.fullName = `${data.firstName} ${data.lastName}`;
formDetail.position = data.position; formDetail.position = data.position;
formDetail.oc = data.rootShortName; formDetail.oc = data.rootShortName;
// formDetail.salary = data.salary ? formattedNumber(data.salary) : ""; //
formDetail.positionLevel = data.posLevelName; formDetail.positionLevel = data.posLevelName;
formDetail.posNo = data.rootShortName + data.posMasterNo; formDetail.posNo = data.rootShortName + data.posMasterNo;
formDetail.birthDate = data.birthDate && date2Thai(data.birthDate); formDetail.birthDate = data.birthDate && date2Thai(data.birthDate);
@ -111,14 +115,26 @@ async function fetchDetail() {
salaryRef: e.salaryRef ? e.salaryRef : "", salaryRef: e.salaryRef ? e.salaryRef : "",
salaryStatus: e.salaryStatus ? e.salariesStatus : "", salaryStatus: e.salaryStatus ? e.salariesStatus : "",
// //
oc: "-", oc: "-",//
lineWork: "-", lineWork: e.positionLine ? e.positionLine : "-",
side: "-", side: e.positionPathSide ? e.positionPathSide : "-",
positionType: "-", positionType: e.positionType ? e.positionType : "-",
level: "-", level: e.positionLevel ? e.positionLevel : "-",
positionsAdministrative: "-", positionsAdministrative: e.positionExecutive
aspectAdministrative: "-", ? e.positionExecutive
: "-",
aspectAdministrative: "-",//
})); }));
console.log(
"🚀 ~ formDetail.salaries=res.data.result.map ~ formDetail.salaries:",
formDetail.salaries
);
formDetail.salary = formDetail.salaries
? formattedNumber(
formDetail.salaries[formDetail.salaries.length - 1].amount
)
: "";
}); });
http.get(config.API.dataUserCertificate("training")).then((res) => { http.get(config.API.dataUserCertificate("training")).then((res) => {
@ -163,7 +179,6 @@ async function fetchCheckSpec(data: any) {
formDetail.positionLevel = data.positionLevel; formDetail.positionLevel = data.positionLevel;
formDetail.posNo = data.posNo; formDetail.posNo = data.posNo;
formDetail.birthDate = data.birthDate && date2Thai(data.birthDate); formDetail.birthDate = data.birthDate && date2Thai(data.birthDate);
formDetail.govAge = data.govAge;
formDetail.educations = data.educations; formDetail.educations = data.educations;
formDetail.certificates = data.certificates.map((e: CertificatesForm) => ({ formDetail.certificates = data.certificates.map((e: CertificatesForm) => ({
@ -222,9 +237,29 @@ function formattedNumber(x: number) {
} }
} }
/** get data */
function getData() {
showLoader();
http
.get(config.API.dataUserGovernment)
.then((res) => {
const data = res.data.result;
formDetail.govAge = data.govAge
? `${data.govAge.year} วัน ${data.govAge.month} เดือน ${data.govAge.year} ปี`
: "";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(async () => { onMounted(async () => {
route.name === "evaluate-add" && (await fetchDetail()); route.name === "evaluate-add" && (await fetchDetail());
props.data && fetchCheckSpec(props.data); props.data && fetchCheckSpec(props.data);
getData();
}); });
</script> </script>
@ -315,7 +350,7 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="formDetail.govAge" :model-value="formDetail.govAge ? formDetail.govAge : '-'"
label="อายุราชการ" label="อายุราชการ"
/> />
</div> </div>
@ -350,7 +385,9 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="education.educationLevel" :model-value="
education.educationLevel ? education.educationLevel : '-'
"
label="ระดับศึกษา" label="ระดับศึกษา"
/> />
</div> </div>
@ -359,7 +396,7 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="education.institute" :model-value="education.institute ? education.institute : '-'"
label="สถานศึกษา" label="สถานศึกษา"
/> />
</div> </div>
@ -367,7 +404,9 @@ onMounted(async () => {
<div class="col-xs-6 col-sm-4 col-md-3"> <div class="col-xs-6 col-sm-4 col-md-3">
<q-input <q-input
borderless borderless
:model-value="date2Thai(education.startDate)" :model-value="
education.startDate ? date2Thai(education.startDate) : '-'
"
readonly readonly
label="ตั้งแต่" label="ตั้งแต่"
> >
@ -377,7 +416,9 @@ onMounted(async () => {
<div class="col-xs-6 col-sm-4 col-md-3"> <div class="col-xs-6 col-sm-4 col-md-3">
<q-input <q-input
borderless borderless
:model-value="date2Thai(education.endDate)" :model-value="
education.endDate ? date2Thai(education.endDate) : '-'
"
readonly readonly
label="ถึง" label="ถึง"
> >
@ -386,7 +427,9 @@ onMounted(async () => {
<div class="col-xs-6 col-sm-4 col-md-3"> <div class="col-xs-6 col-sm-4 col-md-3">
<q-input <q-input
borderless borderless
:model-value="date2Thai(education.finishDate)" :model-value="
education.finishDate ? date2Thai(education.finishDate) : '-'
"
readonly readonly
label="วันที่สำเร็จการศึกษา" label="วันที่สำเร็จการศึกษา"
> >
@ -406,7 +449,7 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="education.degree" :model-value="education.degree ? education.degree : '-'"
label="วุฒิการศึกษา" label="วุฒิการศึกษา"
/> />
</div> </div>
@ -415,7 +458,7 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="education.field" :model-value="education.field ? education.field : '-'"
label="สาขาวิชา/ทาง" label="สาขาวิชา/ทาง"
/> />
</div> </div>
@ -423,7 +466,7 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="education.fundName" :model-value="education.fundName ? education.fundName : '-'"
label="ทุน" label="ทุน"
/> />
</div> </div>
@ -432,7 +475,7 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="education.gpa" :model-value="education.gpa ? education.gpa : '-'"
label="เกรดเฉลี่ย" label="เกรดเฉลี่ย"
/> />
</div> </div>
@ -441,7 +484,7 @@ onMounted(async () => {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="education.country" :model-value="education.country ? education.country : '-'"
label="ประเทศ" label="ประเทศ"
/> />
</div> </div>