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