ปรับ Eva

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-04-23 10:29:50 +07:00
parent c3d24fdc33
commit f8cd032c0b
11 changed files with 1254 additions and 798 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive, onMounted, watch } from "vue";
import { ref, reactive, onMounted, watch, nextTick } from "vue";
import { useRouter, useRoute } from "vue-router";
import { useQuasar } from "quasar";
@ -71,7 +71,7 @@ async function onCilckNextStep() {
store.step === 1
? checkSelectForm()
: store.step === 2 || store.step === 6
? validateForm()
? onSubmitFormData()
: store.step == 3 || store.step == 7
? dialogConfirm(
$q,
@ -85,35 +85,44 @@ async function onCilckNextStep() {
}
/** function validateForm Step 2,4*/
async function validateForm() {
async function onSubmitFormData() {
store.checkFileupload = !store.checkFileupload;
const emptyValues = downloadFileRef.value.filter((e: string) => e === "");
const hasError = [];
for (const key in formCommandRef) {
if (Object.prototype.hasOwnProperty.call(formCommandRef, key)) {
const property = formCommandRef[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
if (hasError.every((result) => result === true)) {
if (emptyValues.length > 0 && store.statusUpload === true) {
} else if (store.step === 2) {
if (store.statusUpload === false) {
saveStep2();
} else {
console.log(store.statusUpload6);
if (store.step === 2) {
if (!store.statusUpload) {
saveStep2();
} else {
if (!downloadFile.value.some((e: string) => e === "")) {
nextTostep3();
}
}
} else {
if (!store.statusUpload6) {
saveStep6();
} else {
if (store.statusUpload6 === false) {
saveStep6();
} else {
if (!downloadFile.value.some((e: string) => e === "")) {
nextTostep7();
}
}
}
// const emptyValues = downloadFileRef.value.filter((e: string) => e === "");
// const hasError = [];
// for (const key in formCommandRef) {
// if (Object.prototype.hasOwnProperty.call(formCommandRef, key)) {
// const property = formCommandRef[key];
// if (property.value && typeof property.value.validate === "function") {
// const isValid = property.value.validate();
// hasError.push(isValid);
// }
// }
// }
// if (hasError.every((result) => result === true)) {
// if (emptyValues.length > 0 && store.statusUpload === true) {
// }
// }
}
const pdfSrc = ref<any>();
@ -250,19 +259,7 @@ function checkSelectForm() {
/** function บันทักตรวจสอบคุณสมบัติ*/
async function saveStep1() {
showLoader();
const salaries = formDetail.value.salaries.map((e: any) => ({
// amount: e.amount,
// date: e.date,
// mouthSalaryAmount: e.mouthSalaryAmount ? e.mouthSalaryAmount : 0,
// posNo: e.posNo,
// position: e.position,
// positionSalaryAmount: e.positionSalaryAmount ? e.positionSalaryAmount : 0,
// refCommandDate: e.refCommandDate,
// refCommandNo: e.refCommandNo ? e.refCommandNo : "",
// salaryClass: e.salaryClass ? e.salaryClass : "",
// salaryRef: e.salaryRef ? e.salaryRef : "",
// salaryStatus: e.salaryStatus ? e.salariesStatus : "",
profileId: e.profileId,
commandCode: e.commandCode,
commandNo: e.commandNo,
@ -317,16 +314,32 @@ async function saveStep1() {
startDate: e.startDate,
}));
const assessments = formDetail.value.assessments.map((e: any) => ({
date: e.date,
point1: e.point1,
point1Total: e.point1Total,
point2: e.point2,
point2Total: e.point2Total,
pointSum: e.pointSum,
pointSumTotal: e.pointSumTotal,
const certificates = formDetail.value.certificates.map((e: any) => ({
...e,
}));
const trainings = formDetail.value.trainings.map((e: any) => ({
...e,
}));
const performances = formDetail.value.assessments.map(
({ id, ...rest }: any) => ({
...rest,
})
);
const portfolios = formDetail.value.experience.map(
({
id,
lastUpdatedAt,
lastUpdateFullName,
createdFullName,
createdAt,
...rest
}: any) => ({
...rest,
})
);
const evaluateType = route.params.type.toString();
const form = {
root: formDetail.value.root,
@ -353,10 +366,11 @@ async function saveStep1() {
isHaveMinPeriodOrHoldPos: formSpec.isHaveMinPeriodOrHoldPos,
reason: "",
educations: [...educations],
certificates: [...formDetail.value.certificates],
certificates: [...certificates],
salaries: [...salaries],
trainings: [...formDetail.value.trainings],
assessments: [...assessments],
trainings: [...trainings],
performances: [...performances],
portfolios: [...portfolios],
};
await http
@ -378,41 +392,20 @@ const statusUpload = ref<boolean>(false);
const formCommand = reactive<FormCommand>({
commanderFullname: "",
commanderPosition: "",
commanderPositionOld: "",
commanderOrg: "",
commanderOrgOld: "",
commanderAboveFullname: "",
commanderAbovePosition: "",
commanderAbovePositionOld: "",
commanderAboveOrgOld: "",
commanderAboveOrg: "",
author: "",
subject: "",
subject: [],
assignedPosition: "",
});
const commanderFullnameRef = ref<object | null>(null);
const commanderPositionRef = ref<object | null>(null);
const commanderAboveFullnameRef = ref<object | null>(null);
const commanderAbovePositionRef = ref<object | null>(null);
const fileEvaluation1Ref = ref<object | null>(null);
const fileEvaluation2Ref = ref<object | null>(null);
const fileEvaluation3Ref = ref<object | null>(null);
const fileEvaluation4Ref = ref<object | null>(null);
const fileEvaluation5Ref = ref<object | null>(null);
const fileEvaluation6Ref = ref<object | null>(null);
const performanceRef = ref<object | null>(null);
const performanceOwnerRef = ref<object | null>(null);
const assignedPositionRef = ref<object | null>(null);
const formCommandRef: FormCommandRef = {
commanderFullname: commanderFullnameRef,
commanderPosition: commanderPositionRef,
commanderAboveFullname: commanderAboveFullnameRef,
commanderAbovePosition: commanderAbovePositionRef,
fileEvaluation1: fileEvaluation1Ref,
fileEvaluation2: fileEvaluation2Ref,
fileEvaluation3: fileEvaluation3Ref,
fileEvaluation4: fileEvaluation4Ref,
fileEvaluation5: fileEvaluation5Ref,
fileEvaluation6: fileEvaluation6Ref,
performance: performanceRef,
performanceOwner: performanceOwnerRef,
assignedPosition: assignedPositionRef,
};
const downloadFileRef = ref<any>();
const downloadFile = ref<string[]>([]);
/**
* function ปเดท ผลงาน,เซนเอกสาร, Ref
* @param val เซนเอกสาร
@ -421,38 +414,22 @@ const downloadFileRef = ref<any>();
function updateformCommand(val: any, ref: any) {
formCommand.commanderFullname = val.commanderFullname;
formCommand.commanderPosition = val.commanderPosition;
formCommand.commanderPositionOld = val.commanderPositionOld;
formCommand.commanderOrg = val.commanderOrg;
formCommand.commanderOrgOld = val.commanderOrgOld;
formCommand.commanderAboveFullname = val.commanderAboveFullname;
formCommand.commanderAbovePosition = val.commanderAbovePosition;
formCommand.commanderAbovePositionOld = val.commanderAbovePositionOld;
formCommand.commanderAboveOrgOld = val.commanderAboveOrgOld;
formCommand.commanderAboveOrg = val.commanderAboveOrg;
formCommand.author = val.author;
formCommand.subject = val.subject;
formCommand.assignedPosition = val.assignedPosition;
commanderFullnameRef.value = ref.commanderFullnameRef;
commanderPositionRef.value = ref.commanderPositionRef;
commanderAboveFullnameRef.value = ref.commanderAboveFullnameRef;
commanderAbovePositionRef.value = ref.commanderAbovePositionRef;
fileEvaluation1Ref.value = ref.fileEvaluation1Ref;
fileEvaluation2Ref.value = ref.fileEvaluation2Ref;
fileEvaluation3Ref.value = ref.fileEvaluation3Ref;
fileEvaluation4Ref.value = ref.fileEvaluation4Ref;
fileEvaluation5Ref.value = ref.fileEvaluation5Ref;
fileEvaluation6Ref.value = ref.fileEvaluation6Ref;
downloadFileRef.value = ref.downloadFile;
performanceRef.value = ref.performance;
performanceOwnerRef.value = ref.performanceOwner;
assignedPositionRef.value = ref.assignedPosition;
downloadFile.value = ref.downloadFile;
statusUpload.value = ref.statusUpload;
}
/** function บันทึกข้อมูล ผลงานม,ผู้เซ็นเอกสาร*/
async function saveStep2() {
const body = {
commanderFullname: formCommand.commanderFullname,
commanderPosition: formCommand.commanderPosition,
commanderAboveFullname: formCommand.commanderAboveFullname,
commanderAbovePosition: formCommand.commanderAbovePosition,
author: formCommand.author,
subject: formCommand.subject,
};
dialogConfirm(
$q,
async () => {
@ -465,7 +442,7 @@ async function saveStep2() {
route.params.id.toString(),
"director"
),
body
{ ...formCommand, assignedPosition: undefined }
)
.then(() => {
route.params.id && fetchCheckStep(route.params.id.toString());
@ -530,8 +507,14 @@ async function saveStep6() {
const body = {
commanderAboveFullnameDoc2: formCommand.commanderAboveFullname,
commanderAbovePositionDoc2: formCommand.commanderAbovePosition,
commanderAbovePositionOldDoc2: formCommand.commanderAbovePositionOld,
commanderAboveOrgOldDoc2: formCommand.commanderAboveOrgOld,
commanderAboveOrgDoc2: formCommand.commanderAboveOrg,
commanderFullnameDoc2: formCommand.commanderFullname,
commanderPositionDoc2: formCommand.commanderPosition,
commanderPositionOldDoc2: formCommand.commanderPositionOld,
commanderOrgDoc2: formCommand.commanderOrg,
commanderOrgOldDoc2: formCommand.commanderOrgOld,
authorDoc2: formCommand.author,
subjectDoc2: formCommand.subject,
assignedPosition: formCommand.assignedPosition,
@ -679,164 +662,172 @@ onMounted(async () => {
</div>
</div>
</div>
<div class="col-xs-12 col-sm-9 q-pa-md" v-if="showLoadStatus">
<div class="col-12 row items-center">
<div class="toptitle2">
{{ store.step }}.{{ store.title[store.step - 1] }}
<q-form
class="col-xs-12 col-sm-9"
greedy
@submit.prevent
@validation-success="onCilckNextStep"
>
<div class="col-xs-12 col-sm-9 q-pa-md" v-if="showLoadStatus">
<div class="col-12 row items-center">
<div class="toptitle2">
{{ store.step }}.{{ store.title[store.step - 1] }}
</div>
<q-space />
<div>
<q-btn
v-if="store.step === 1"
:href="externalLink"
target="_blank"
outline
color="blue"
dense
class="q-px-md"
no-caps
>
ตรวจสอบคณสมบ ..
</q-btn>
</div>
</div>
<q-space />
<div>
<q-btn
v-if="store.step === 1"
:href="externalLink"
target="_blank"
outline
color="blue"
dense
class="q-px-md"
no-caps
>
ตรวจสอบคณสมบ ..
</q-btn>
</div>
</div>
<div class="col-12 q-pt-sm">
<div class="q-col-gutter-md col-12 row">
<div
:class="
store.step === 2 ||
store.step === 4 ||
store.step === 5 ||
store.step === 6 ||
store.step === 8 ||
store.step === 9
? 'col-12 row'
: 'col-xs-12 col-sm-5 row'
"
>
<q-card
flat
bordered
class="col-12 shadow-0"
:style="
$q.screen.lt.sm
? ''
: 'max-height: 60vh; overflow: scroll;'
<div class="col-12 q-pt-sm">
<div class="q-col-gutter-md col-12 row">
<div
:class="
store.step === 2 ||
store.step === 4 ||
store.step === 5 ||
store.step === 6 ||
store.step === 8 ||
store.step === 9
? 'col-12 row'
: 'col-xs-12 col-sm-5 row'
"
>
<Step1
v-if="store.step === 1"
@update:spec="updateCheckSpec"
:data="formDataStep1"
:educations="formDetail?.educations"
/>
<Step2
v-if="store.step === 2"
@update:form="updateformCommand"
/>
<Step3
v-if="store.step === 3"
@update:file="updateFilePDF"
/>
<Step4 v-if="store.step === 4" />
<Step5 v-if="store.step === 5" />
<Step6
v-if="store.step === 6"
@update:form="updateformCommand"
/>
<Step7
v-if="store.step === 7"
@update:file="updateFilePDF"
/>
<Step8 v-if="store.step === 8" />
<Step9 v-if="store.step === 9" />
</q-card>
</div>
<div
class="col-xs-12 col-sm-7"
v-if="
store.step === 1 || store.step === 3 || store.step === 7
"
>
<div class="col-12">
<ViewStep1
v-if="store.step === 1"
@update:formDeital="updateFormDetail"
:data="formDataStep1"
/>
<ViewStep3
v-if="store.step === 3 && pdfSrc"
:pdfSrc="pdfSrc"
:urlDownloadFile="urlDownloadFile"
/>
<ViewStep7
v-if="store.step === 7 && pdfSrc"
:pdfSrc="pdfSrc"
:urlDownloadFile="urlDownloadFile"
/>
<q-card
flat
bordered
class="col-12 shadow-0"
:style="
$q.screen.lt.sm
? ''
: 'max-height: 60vh; overflow: scroll;'
"
>
<Step1
v-if="store.step === 1"
@update:spec="updateCheckSpec"
:data="formDataStep1"
:educations="formDetail?.educations"
/>
<Step2
v-if="store.step === 2"
@update:form="updateformCommand"
/>
<Step3
v-if="store.step === 3"
@update:file="updateFilePDF"
/>
<Step4 v-if="store.step === 4" />
<Step5 v-if="store.step === 5" />
<Step6
v-if="store.step === 6"
@update:form="updateformCommand"
/>
<Step7
v-if="store.step === 7"
@update:file="updateFilePDF"
/>
<Step8 v-if="store.step === 8" />
<Step9 v-if="store.step === 9" />
</q-card>
</div>
<div
class="col-xs-12 col-sm-7"
v-if="
store.step === 1 || store.step === 3 || store.step === 7
"
>
<div class="col-12">
<ViewStep1
v-if="store.step === 1"
@update:formDeital="updateFormDetail"
:data="formDataStep1"
/>
<ViewStep3
v-if="store.step === 3 && pdfSrc"
:pdfSrc="pdfSrc"
:urlDownloadFile="urlDownloadFile"
/>
<ViewStep7
v-if="store.step === 7 && pdfSrc"
:pdfSrc="pdfSrc"
:urlDownloadFile="urlDownloadFile"
/>
</div>
</div>
</div>
</div>
<q-card-actions
class="q-pt-sm q-pa-none q-gutter-sm"
align="right"
>
<q-btn
v-if="
store.step >= store.currentStep &&
store.statusUpload === false &&
store.step !== 3 &&
store.step !== 4 &&
store.step !== 5 &&
store.step !== 7 &&
store.step !== 8 &&
store.step !== 9
"
unelevated
:label="
store.step === 2 || store.step === 6
? 'บันทึกข้อมูล'
: 'ดำเนินการต่อ'
"
color="public"
type="submit"
/>
<q-btn
v-else-if="
store.step >= store.currentStep &&
(store.step == 3 || store.step == 7)
"
unelevated
label="ยื่นเอกสาร"
color="public"
type="submit"
/>
<q-btn
v-if="
store.step >= store.currentStep &&
store.step == 2 &&
store.statusUpload
"
unelevated
label="ดำเนินการต่อ"
color="public"
type="submit"
/>
<q-btn
v-if="
store.step >= store.currentStep &&
store.step == 6 &&
store.statusUpload
"
unelevated
label="ดำเนินการต่อ"
color="public"
type="submit"
/>
</q-card-actions>
</div>
<q-card-actions class="q-pt-sm q-pa-none q-gutter-sm" align="right">
<q-btn
v-if="
store.step >= store.currentStep &&
store.statusUpload === false &&
store.step !== 3 &&
store.step !== 4 &&
store.step !== 5 &&
store.step !== 7 &&
store.step !== 8 &&
store.step !== 9
"
unelevated
:label="
store.step === 2 || store.step === 6
? 'บันทึกข้อมูล'
: 'ดำเนินการต่อ'
"
color="public"
@click="onCilckNextStep()"
/>
<q-btn
v-else-if="
store.step >= store.currentStep &&
(store.step == 3 || store.step == 7)
"
unelevated
label="ยื่นเอกสาร"
color="public"
@click="onCilckNextStep()"
/>
<q-btn
v-if="
store.step >= store.currentStep &&
store.step == 2 &&
store.statusUpload
"
unelevated
label="ดำเนินการต่อ"
color="public"
@click="onCilckNextStep()"
/>
<q-btn
v-if="
downloadFileRef &&
store.step >= store.currentStep &&
store.step == 6 &&
store.statusUpload
"
unelevated
label="ดำเนินการต่อ"
color="public"
@click="onCilckNextStep()"
/>
</q-card-actions>
</div>
</q-form>
</q-card>
</div>
</div>