Refactoring code module 12_evaluatePersonal

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-20 13:13:43 +07:00
parent 381ec04492
commit 490f02309e
33 changed files with 598 additions and 1036 deletions

View file

@ -1,7 +1,10 @@
<script setup lang="ts">
import { onMounted, ref, reactive } from "vue";
import { onBeforeMount, ref, reactive } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
@ -25,17 +28,17 @@ import ViewStep7 from "@/modules/12_evaluatePersonal/components/Detail/viewstep/
import PopupHistory from "@/modules/12_evaluatePersonal/components/Detail/popupHistory.vue";
/** importStor*/
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
import { useCounterMixin } from "@/stores/mixin";
/** use*/
const $q = useQuasar();
const route = useRoute();
const store = useEvaluateDetailStore();
const mixin = useCounterMixin();
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = mixin;
/**
* props
*/
const props = defineProps({
data: {
type: Object,
@ -44,34 +47,19 @@ const props = defineProps({
});
const id = ref<string>(route.params.id as string); // id
const isLoadView = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const isLoadView = ref<boolean>(false); // view
const modalHistory = ref<boolean>(false); // popup
//
const formCommand = reactive<FormCommand>({
elementaryFullName: "",
elementaryPosition: "",
abovelevelFullname: "",
abovelevelPosition: "",
elementaryFullName: "", //
elementaryPosition: "", //
abovelevelFullname: "", // 1
abovelevelPosition: "", // 1
});
const elementaryFullNameRef = ref<object | null>(null);
const elementaryPositonRef = ref<object | null>(null);
const abovelevelFullnameRef = ref<object | null>(null);
const abovelevelPositionRef = ref<object | null>(null);
function updateformCommand(val: any, ref: any) {
formCommand.elementaryFullName = val.elementaryFullName;
formCommand.elementaryPosition = val.elementaryPosition;
formCommand.abovelevelFullname = val.abovelevelFullname;
formCommand.abovelevelPosition = val.abovelevelPosition;
elementaryFullNameRef.value = ref.elementaryFullNameRef;
elementaryPositonRef.value = ref.elementaryPositonRef;
abovelevelFullnameRef.value = ref.abovelevelFullnameRef;
abovelevelPositionRef.value = ref.abovelevelPositionRef;
}
/** function เช็คขั้นตอน*/
/**
* งกนเชคขนตอนการประเม
*/
async function fetchCheckStep() {
isLoadView.value = false;
showLoader();
@ -114,12 +102,28 @@ async function fetchCheckStep() {
});
}
/** function เปิด,ปิด ประวัติการประเมิน*/
/**
* งกนเป, popup ประวการประเม
*/
function onClickPopupHistory() {
modalHistory.value = !modalHistory.value;
}
onMounted(async () => {
/**
* งกนอปเดทขอมลผเซนเอกสาร
* @param val อมลผเซนเอกสาร
*/
function updateformCommand(val: FormCommand) {
formCommand.elementaryFullName = val.elementaryFullName;
formCommand.elementaryPosition = val.elementaryPosition;
formCommand.abovelevelFullname = val.abovelevelFullname;
formCommand.abovelevelPosition = val.abovelevelPosition;
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onBeforeMount(async () => {
await fetchCheckStep();
});
</script>
@ -196,14 +200,11 @@ 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" :data="data" />
<ViewStep3 v-if="store.step === 3" />
<ViewStep7 v-if="store.step === 7" />
</div>
<!-- <q-card-section> </q-card-section -->
<!-- ></q-card> -->
</div>
</div>
</div>