API ประเมินบุคคล
This commit is contained in:
parent
fbcd0b8ec0
commit
0e033bffd3
11 changed files with 835 additions and 631 deletions
|
|
@ -92,13 +92,8 @@ async function onCilckNextStep() {
|
|||
}
|
||||
|
||||
async function validateForm() {
|
||||
console.log(downloadFileRef.value);
|
||||
|
||||
store.checkFileupload = !store.checkFileupload;
|
||||
console.log(store.checkFileupload);
|
||||
|
||||
const emptyValues = downloadFileRef.value.filter((e: any) => e === "");
|
||||
|
||||
const hasError = [];
|
||||
for (const key in formCommandRef) {
|
||||
if (Object.prototype.hasOwnProperty.call(formCommandRef, key)) {
|
||||
|
|
@ -109,11 +104,22 @@ async function validateForm() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasError.every((result) => result === true)) {
|
||||
if (emptyValues.length > 0) {
|
||||
if (emptyValues.length > 0 && store.statusUpload === true) {
|
||||
console.log("There are empty values in the array.");
|
||||
} else if (store.step === 2) {
|
||||
if (store.statusUpload === false) {
|
||||
saveStep2();
|
||||
} else {
|
||||
nextTostep3();
|
||||
}
|
||||
} else {
|
||||
store.step === 2 ? saveStep2() : saveStep6();
|
||||
if (store.statusUpload === false) {
|
||||
saveStep6();
|
||||
} else {
|
||||
nextTostep7();
|
||||
}
|
||||
}
|
||||
|
||||
// store.step === 2 && emptyValues.length > 0 ? saveStep2() : saveStep6();
|
||||
|
|
@ -308,11 +314,15 @@ async function saveStep1() {
|
|||
}
|
||||
|
||||
/** STEP 2*/
|
||||
const statusUpload = ref<boolean>(false);
|
||||
const formCommand = reactive<FormCommand>({
|
||||
commanderFullname: "",
|
||||
commanderPosition: "",
|
||||
commanderAboveFullname: "",
|
||||
commanderAbovePosition: "",
|
||||
author: "",
|
||||
subject: "",
|
||||
assignedPosition: "",
|
||||
});
|
||||
const commanderFullnameRef = ref<object | null>(null);
|
||||
const commanderPositionRef = ref<object | null>(null);
|
||||
|
|
@ -324,6 +334,9 @@ 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,
|
||||
|
|
@ -335,6 +348,9 @@ const formCommandRef: FormCommandRef = {
|
|||
fileEvaluation4: fileEvaluation4Ref,
|
||||
fileEvaluation5: fileEvaluation5Ref,
|
||||
fileEvaluation6: fileEvaluation6Ref,
|
||||
performance: performanceRef,
|
||||
performanceOwner: performanceOwnerRef,
|
||||
assignedPosition: assignedPositionRef,
|
||||
};
|
||||
const downloadFileRef = ref<any>();
|
||||
|
||||
|
|
@ -343,6 +359,9 @@ function updateformCommand(val: any, ref: any) {
|
|||
formCommand.commanderPosition = val.commanderPosition;
|
||||
formCommand.commanderAboveFullname = val.commanderAboveFullname;
|
||||
formCommand.commanderAbovePosition = val.commanderAbovePosition;
|
||||
formCommand.author = val.author;
|
||||
formCommand.subject = val.subject;
|
||||
formCommand.assignedPosition = val.assignedPosition;
|
||||
commanderFullnameRef.value = ref.commanderFullnameRef;
|
||||
commanderPositionRef.value = ref.commanderPositionRef;
|
||||
commanderAboveFullnameRef.value = ref.commanderAboveFullnameRef;
|
||||
|
|
@ -354,20 +373,59 @@ function updateformCommand(val: any, ref: any) {
|
|||
fileEvaluation5Ref.value = ref.fileEvaluation5Ref;
|
||||
fileEvaluation6Ref.value = ref.fileEvaluation6Ref;
|
||||
downloadFileRef.value = ref.downloadFile;
|
||||
performanceRef.value = ref.performance;
|
||||
performanceOwnerRef.value = ref.performanceOwner;
|
||||
assignedPositionRef.value = ref.assignedPosition;
|
||||
statusUpload.value = ref.statusUpload;
|
||||
}
|
||||
|
||||
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 () => {
|
||||
statusUpload.value = true;
|
||||
store.statusUpload = statusUpload.value;
|
||||
showLoader();
|
||||
await http
|
||||
.put(
|
||||
config.API.evaluationUpdateAuthor(
|
||||
route.params.id.toString(),
|
||||
"director"
|
||||
),
|
||||
body
|
||||
)
|
||||
.then(() => {
|
||||
route.params.id && fetchCheckStep(route.params.id.toString());
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
|
||||
async function nextTostep3() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(
|
||||
config.API.evaluationPreparedoc(
|
||||
route.params.id.toString(),
|
||||
"approve"
|
||||
),
|
||||
formCommand
|
||||
config.API.evaluationPreparedoc(route.params.id.toString(), "approve")
|
||||
)
|
||||
.then(() => {
|
||||
route.params.id && fetchCheckStep(route.params.id.toString());
|
||||
|
|
@ -384,6 +442,7 @@ async function saveStep2() {
|
|||
);
|
||||
}
|
||||
|
||||
/** STEP3*/
|
||||
async function saveStep3() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -404,19 +463,54 @@ async function saveStep4() {
|
|||
async function saveStep5() {
|
||||
console.log("Save 5");
|
||||
}
|
||||
|
||||
/** STEP 6*/
|
||||
async function saveStep6() {
|
||||
const body = {
|
||||
commanderAboveFullnameDoc2: formCommand.commanderAboveFullname,
|
||||
commanderAbovePositionDoc2: formCommand.commanderAbovePosition,
|
||||
commanderFullnameDoc2: formCommand.commanderFullname,
|
||||
commanderPositionDoc2: formCommand.commanderPosition,
|
||||
authorDoc2: formCommand.author,
|
||||
subjectDoc2: formCommand.subject,
|
||||
assignedPosition: formCommand.assignedPosition,
|
||||
};
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
statusUpload.value = true;
|
||||
store.statusUpload = statusUpload.value;
|
||||
showLoader();
|
||||
await http
|
||||
.put(
|
||||
config.API.evaluationUpdateAuthor(
|
||||
route.params.id.toString(),
|
||||
"director2"
|
||||
),
|
||||
body
|
||||
)
|
||||
.then(() => {
|
||||
route.params.id && fetchCheckStep(route.params.id.toString());
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
|
||||
async function nextTostep7() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.evaluationCheckdocV2(route.params.id.toString()), body)
|
||||
.put(config.API.evaluationCheckdocV2(route.params.id.toString()))
|
||||
.then(() => {
|
||||
route.params.id && fetchCheckStep(route.params.id.toString());
|
||||
})
|
||||
|
|
@ -431,6 +525,7 @@ async function saveStep6() {
|
|||
"ต้องการยืนยันการดำเนินการต่อใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
|
||||
async function saveStep7() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -576,7 +671,6 @@ onMounted(async () => {
|
|||
class="col-xs-12 col-sm-7 row"
|
||||
v-if="store.step === 1 || store.step === 3 || store.step === 7"
|
||||
>
|
||||
<!-- <q-card flat bordered class="col-12"> -->
|
||||
<div class="col-12">
|
||||
<ViewStep1
|
||||
v-if="store.step === 1"
|
||||
|
|
@ -594,14 +688,13 @@ onMounted(async () => {
|
|||
:urlDownloadFile="urlDownloadFile"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- </q-card> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-mt-md q-gutter-md" align="right">
|
||||
<q-btn
|
||||
v-if="
|
||||
store.step >= store.currentStep &&
|
||||
store.statusUpload === false &&
|
||||
store.step !== 3 &&
|
||||
store.step !== 4 &&
|
||||
store.step !== 5 &&
|
||||
|
|
@ -610,10 +703,15 @@ onMounted(async () => {
|
|||
store.step !== 9
|
||||
"
|
||||
unelevated
|
||||
label="ดำเนินการต่อ"
|
||||
:label="
|
||||
store.step === 2 || store.step === 6
|
||||
? 'บันทึกข้อมูล'
|
||||
: 'ดำเนินการต่อ'
|
||||
"
|
||||
color="public"
|
||||
@click="onCilckNextStep()"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
v-else-if="
|
||||
store.step >= store.currentStep &&
|
||||
|
|
@ -624,6 +722,29 @@ onMounted(async () => {
|
|||
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="
|
||||
store.step >= store.currentStep &&
|
||||
store.step == 6 &&
|
||||
store.statusUpload
|
||||
"
|
||||
unelevated
|
||||
label="ดำเนินการต่อ"
|
||||
color="public"
|
||||
@click="onCilckNextStep()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue