ปรับ Code ประเมืน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-11 13:26:46 +07:00
parent f9c4bb3b80
commit 5b2be2af2b
24 changed files with 603 additions and 1398 deletions

View file

@ -5,11 +5,13 @@ import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/
import type {
FormCommand,
FormCommandRef,
} from "@/modules/12_evaluatePersonal/interface/index/evalute";
/** importComponents*/
import Stepper from "@/modules/12_evaluatePersonal/components/Detail/Stepper.vue";
import Step1 from "@/modules/12_evaluatePersonal/components/Detail/step/step1.vue";
import Step2 from "@/modules/12_evaluatePersonal/components/Detail/step/step2.vue";
@ -20,24 +22,23 @@ import Step6 from "@/modules/12_evaluatePersonal/components/Detail/step/step6.vu
import Step7 from "@/modules/12_evaluatePersonal/components/Detail/step/step7.vue";
import Step8 from "@/modules/12_evaluatePersonal/components/Detail/step/step8.vue";
import Step9 from "@/modules/12_evaluatePersonal/components/Detail/step/step9.vue";
import ViewStep1 from "@/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep1.vue";
import ViewStep3 from "@/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep3.vue";
import ViewStep7 from "@/modules/12_evaluatePersonal/components/Detail/viewstep/viewStep7.vue";
import PopupHistory from "@/modules/12_evaluatePersonal/components/Detail/popupHistory.vue";
/** importStor*/
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
import { useCounterMixin } from "@/stores/mixin";
import PopupHistory from "@/modules/12_evaluatePersonal/components/Detail/popupHistory.vue";
const router = useRouter();
/** use*/
const route = useRoute();
const store = useEvaluateDetailStore();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, messageError } = mixin;
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = mixin;
const props = defineProps({
data: {
type: Object,
@ -45,10 +46,9 @@ const props = defineProps({
},
});
const id = ref<string>(route.params.id as string); // id
const modalHistory = ref<boolean>(false);
const externalLink =
"https://accreditation.ocsc.go.th/accreditation/search/curriculum";
const id = ref<string>(route.params.id as string);
const formCommand = reactive<FormCommand>({
elementaryFullName: "",
elementaryPosition: "",
@ -61,63 +61,6 @@ const elementaryPositonRef = ref<object | null>(null);
const abovelevelFullnameRef = ref<object | null>(null);
const abovelevelPositionRef = ref<object | null>(null);
const formCommandRef: FormCommandRef = {
elementaryFullName: elementaryFullNameRef,
elementaryPosition: elementaryPositonRef,
abovelevelFullname: abovelevelFullnameRef,
abovelevelPosition: abovelevelPositionRef,
};
async function onCilckNextStep() {
const functionCreateDoc: (() => Promise<void>) | null =
store.step === 1
? await saveStep1
: store.step === 3
? await saveStep3
: store.step === 4
? await saveStep4
: store.step === 5
? await saveStep5
: store.step === 5
? await saveStep5
: store.step === 6
? await saveStep6
: store.step === 7
? await saveStep7
: store.step === 8
? await saveStep8
: store.step === 9
? await saveStep9
: null;
store.step === 2
? validateStep2()
: store.step < 9 &&
dialogConfirm(
$q,
() => {
functionCreateDoc?.();
store.step++;
},
"ยืนยันการดำเนินการ",
"ต้องการยืนยันการดำเนินการต่อใช่หรือไม่?"
);
// functionCreateDoc?.();
// store.step < 9 &&
}
function onCilckprPeviousStep() {
store.step > 1 &&
dialogConfirm(
$q,
() => {
store.step--;
},
"ยืนยันการย้อนกลับ",
"ต้องการย้อนกลับใช่หรือไม่?"
);
}
function updateformCommand(val: any, ref: any) {
formCommand.elementaryFullName = val.elementaryFullName;
formCommand.elementaryPosition = val.elementaryPosition;
@ -130,70 +73,13 @@ function updateformCommand(val: any, ref: any) {
abovelevelPositionRef.value = ref.abovelevelPositionRef;
}
async function validateStep2() {
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)) {
saveStep2();
} else {
console.log("ไม่ผ่าน");
}
}
async function saveStep1() {
console.log("Save 1");
}
async function saveStep2() {
dialogConfirm(
$q,
() => {
store.step++;
},
"ยืนยันการดำเนินการ",
"ต้องการยืนยันการดำเนินการต่อใช่หรือไม่?"
);
}
async function saveStep3() {
console.log("Save 3");
}
async function saveStep4() {
console.log("Save 4");
}
async function saveStep5() {
console.log("Save 5");
}
async function saveStep6() {
console.log("Save 6");
}
async function saveStep7() {
console.log("Save 7");
}
async function saveStep8() {
console.log("Save 8");
}
async function saveStep9() {
console.log("Save 9");
}
function onClickPopupHistory() {
modalHistory.value = !modalHistory.value;
}
function getStep() {
/** function เช็คขั้นตอน*/
async function fetchCheckStep() {
showLoader();
http
await http
.get(config.API.evaluateGetStep(id.value))
.then((res: any) => {
.then((res) => {
const data = res.data.result;
let step =
data.step === "CHECK_SPEC"
? 1
@ -226,9 +112,13 @@ function getStep() {
});
}
onMounted(() => {
getStep();
store.step = 1;
/** function เปิด,ปิด ประวัติการประเมิน*/
function onClickPopupHistory() {
modalHistory.value = !modalHistory.value;
}
onMounted(async () => {
await fetchCheckStep();
});
</script>