refactor code ส่วนของเครื่องราชฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-21 14:21:26 +07:00
parent 33c2b338a2
commit 1ed9faebf2
11 changed files with 326 additions and 149 deletions

View file

@ -33,7 +33,7 @@ const stat = ref<any>({
contain: 0,
disclaim: 0,
});
// Stat
const getStat = async () => {
const examIdString = Array.isArray(examId) ? examId[0] : examId;
await http
@ -76,7 +76,7 @@ onMounted(async () => {
const fetchPlacementData = async () => {
showLoader();
http
await http
.get(config.API.MainDetail(0))
.then(async (res) => {
DataStore.DataMainOrig = res.data.result;

View file

@ -199,7 +199,7 @@ const closeModal = () => {
closeAndClear();
}
};
// clean
const closeAndClear = async () => {
await props.close();
editDataStatus.value = false;
@ -346,7 +346,7 @@ const checkPosition = (val: string) => {
};
const personal = ref<any>();
const expanded = ref<string[]>([]);
// props
watch(props, () => {
expanded.value = [];
const dataPersonal = props.personal;
@ -361,10 +361,10 @@ watch(props, () => {
personal.value.draft === false &&
personal.value.positionNumber !== null
) {
let findData: any = null;
let findData: any = null;
dataRespone.value.map((x: any) => {
findData = findByPerson(x);
// expandedTree
if (findData != null) {
selectedPosition(findData);
for (let i = 3; i <= findData.keyId.length; i += 2) {
@ -374,7 +374,7 @@ watch(props, () => {
});
}
});
//
//
function findByPerson(element: any): any {
if (
element.positionNumId &&

View file

@ -7,7 +7,7 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin(); //
const { showLoader, hideLoader, date2Thai } = mixin;
const { showLoader, hideLoader, date2Thai, messageError } = mixin;
const $q = useQuasar();
const props = defineProps({
@ -78,13 +78,13 @@ const columns = ref<QTableProps["columns"]>([
const myForm = ref<any>([]);
const personalForm = ref<any>([]);
const selection = ref<any>([]);
// props.Modal
watch(props, () => {
if (props.Modal === true) {
fetchData();
}
});
//
const fetchData = async () => {
showLoader();
await http
@ -101,7 +101,7 @@ const fetchData = async () => {
});
})
.catch((e) => {
console.log("e", e);
messageError($q, e);
})
.finally(() => {
hideLoader();
@ -120,7 +120,7 @@ const formBmaofficer = (val: string) => {
return "";
}
};
// POPUP
const close = async () => {
props.close();
selection.value = [];