new loader

This commit is contained in:
Thanit Konmek 2023-06-09 14:25:41 +07:00
parent fd7aae2f5d
commit fe6c712a18
95 changed files with 1189 additions and 950 deletions

View file

@ -431,7 +431,14 @@ const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const { success, modalConfirm, modalError, modalDelete } = mixin;
const {
success,
modalConfirm,
modalError,
modalDelete,
showLoader,
hideLoader,
} = mixin;
const { date2Thai } = mixin;
const store = useOrganizationalDataStore();
const { organizationalData, changeOrganizationalColumns } = store;
@ -809,7 +816,7 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
});
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchPosition();
await fetchData();
await fetchHistory();
@ -819,7 +826,7 @@ onMounted(async () => {
* งก get data าส
*/
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getPostionMasterDraft(true))
.then((res) => {
@ -862,7 +869,7 @@ const fetchData = async () => {
})
.finally(() => {
// updateData.value = false;
loaderPage(false);
hideLoader();
});
};
@ -870,7 +877,7 @@ const fetchData = async () => {
* งชนดอมลประวแกไขขอมลทงหมด
*/
const fetchHistory = async () => {
// loaderPage(true);
// showLoader();
// await http
// .get(config.API.listxxxxxxxxPublishedHistory)
// .then((res) => {
@ -902,7 +909,7 @@ const fetchHistory = async () => {
// statusCode.value = e.response.data.status;
// })
// .finally(async () => {
// loaderPage(false);
// hideLoader();
// });
};
@ -910,7 +917,7 @@ const fetchHistory = async () => {
* get รายการ ตำแหน
*/
const fetchPosition = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.position)
.then((res) => {
@ -1001,7 +1008,7 @@ const fetchPosition = async () => {
})
.catch((e: any) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1150,7 +1157,7 @@ const clickSave = async () => {
*/
const saveData = async () => {
modal.value = false;
loaderPage(true);
showLoader();
await http
.post(config.API.getPositionMaster, {
positionTypeId: positionTypeId.value,
@ -1182,7 +1189,7 @@ const saveData = async () => {
*/
const editData = async () => {
modal.value = false;
loaderPage(true);
showLoader();
await http
.put(config.API.getPositionMasterId(positionMasterId.value), {
positionMasterId: positionMasterId.value,
@ -1215,7 +1222,7 @@ const editData = async () => {
* เมอเรยก api เสรจแลวจะ get data มาใหม
*/
const clearPublishedData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.getPositionMasterSync)
.then((res) => {
@ -1228,7 +1235,7 @@ const clearPublishedData = async () => {
statusCode.value = e.response.data.status;
})
.finally(async () => {
loaderPage(false);
hideLoader();
await fetchHistory();
await fetchData();
});
@ -1240,7 +1247,7 @@ const clearPublishedData = async () => {
*/
const publishedData = async () => {
// editvisible.value = false;
loaderPage(true);
showLoader();
await http
.put(config.API.getPositionMasterPublish)
.then((res) => {
@ -1250,7 +1257,7 @@ const publishedData = async () => {
statusCode.value = e.response.data.status;
})
.finally(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
};
@ -1344,7 +1351,7 @@ const clickAdd = () => {
* @param row อม row ประวการแกไข
*/
const clickHistory = async (row: RequestItemsObject) => {
loaderPage(true);
showLoader();
await http
.get(config.API.getPositionMasterHistoryId(row.id))
.then((res) => {
@ -1387,7 +1394,7 @@ const clickHistory = async (row: RequestItemsObject) => {
})
.finally(async () => {
modalHistory.value = true;
loaderPage(false);
hideLoader();
});
};
@ -1430,7 +1437,7 @@ const clickIsActive = async (val: string, status: boolean) => {
})
.onOk(async () => {
// edit.value = false;
loaderPage(true);
showLoader();
await http
.delete(config.API.getPositionMasterId(val) + `?Id=${val}`)
.then((res) => {

View file

@ -240,10 +240,14 @@ import { useDataStore } from "@/stores/data";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataOption } from "../../interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
const ddNoResultMsg = defineAsyncComponent(
() => import("@/components/DropDownNoResultMsg.vue")
); // Dropdown Filter
const mixin = useCounterMixin();
const { showLoader, hideLoader } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
@ -286,12 +290,12 @@ const positionFilter = ref<Array<any>>([]); //for DropDown
const position = ref<Array<any>>([]); //for DropDown
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchPositionMaster();
});
const fetchPositionMaster = async () => {
loaderPage(true);
showLoader();
await http
// .get(config.API.getPostionMasterDraft(false))
.get(config.API.getPostionMaster(false))
@ -329,7 +333,7 @@ const fetchPositionMaster = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -339,6 +339,8 @@ import type {
} from "../../interface/index/Main";
import { log } from "console";
import { useDataStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin";
// import { organizationSet } from "../interface/index/Main";
const props = defineProps({
@ -348,6 +350,8 @@ const props = defineProps({
const emit = defineEmits(["update:organizprops", "update:formprops"]);
const mixin = useCounterMixin();
const {showLoader, hideLoader } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
@ -386,7 +390,7 @@ const organizationAgencyCode = ref<GovermentOption[]>([]);
const organizationAgencyCodeFilter = ref<GovermentOption[]>([]);
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchOrganizationOri();
await fetchOrganizationAgencyCode();
await fetchOrganizationGovernmentCode();
@ -405,7 +409,7 @@ onMounted(async () => {
* หนวยงาน
*/
const fetchOrganizationOri = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -421,14 +425,14 @@ const fetchOrganizationOri = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* รหสหนวยงาน
*/
const fetchOrganizationAgencyCode = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationCode)
.then((res) => {
@ -450,14 +454,14 @@ const fetchOrganizationAgencyCode = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* รหสสวนราชการ
*/
const fetchOrganizationGovernmentCode = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationShortName)
.then((res) => {
@ -479,14 +483,14 @@ const fetchOrganizationGovernmentCode = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
// /**
// *
// */
// const fetchOrganizationShortName = async () => {
// loaderPage(true);
// showLoader();
// await http
// .get(config.API.organizationShortName)
// .then((res) => {
@ -508,14 +512,14 @@ const fetchOrganizationGovernmentCode = async () => {
// console.log(e);
// })
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
// };
/**
* หนวยงานตนสงก
*/
const fetchOrganizationAgency = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.listOrganizationAgency("หน่วยงาน"))
.then((res) => {
@ -534,14 +538,14 @@ const fetchOrganizationAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* วนราชการตนสงก
*/
const fetchOrganizationGovernmentAgency = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.listOrganizationAgency("ส่วนราชการ"))
.then((res) => {
@ -560,14 +564,14 @@ const fetchOrganizationGovernmentAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* ประเภทหนวยงาน
*/
const fetchOrganizationType = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationType)
.then((res) => {
@ -583,14 +587,14 @@ const fetchOrganizationType = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* ระดบหนวยงาน
*/
const fetchOrganizationLevel = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationLevel)
.then((res) => {
@ -606,14 +610,14 @@ const fetchOrganizationLevel = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรดตอภายใน
*/
const fetchOrganizationTelInternal = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationTelInternal)
.then((res) => {
@ -629,14 +633,14 @@ const fetchOrganizationTelInternal = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรดตอภายนอก
*/
const fetchOrganizationTelExternal = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationTelExternal)
.then((res) => {
@ -652,14 +656,14 @@ const fetchOrganizationTelExternal = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรโทรสาร
*/
const fetchOrganizationFax = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationFax)
.then((res) => {
@ -675,7 +679,7 @@ const fetchOrganizationFax = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -776,7 +780,7 @@ const addOrganizationItem = async () => {
const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
let option: GovermentOption[] = [];
loaderPage(true);
showLoader();
await http
.get(config.API.organizationGovernmentCode(val))
.then((res) => {
@ -796,14 +800,14 @@ const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};
const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
let option: GovermentOption[] = [];
loaderPage(true);
showLoader();
await http
.get(config.API.organizationAgencyCode(val))
.then((res) => {
@ -823,7 +827,7 @@ const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};

View file

@ -318,6 +318,7 @@ import { log } from "console";
import { useDataStore } from "@/stores/data";
import type { EnumStringMember } from "@babel/types";
// import { organizationSet } from "../interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
const props = defineProps({
organizprops: Object as PropType<OrganizaOption>,
@ -328,6 +329,8 @@ const props = defineProps({
},
});
const mixin = useCounterMixin();
const { showLoader, hideLoader } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const emit = defineEmits(["update:organizprops", "update:formprops"]);
@ -397,7 +400,7 @@ const organization = ref<OrganizaOption>({
emit("update:organizprops", organization.value);
onMounted(async () => {
loaderPage(false);
hideLoader();
// await fillOrgEdit(); // selector(q-select)
await fetchOrganizationOri();
// await fetchOrganizationShortName();
@ -431,7 +434,7 @@ const getClass = (val: boolean) => {
* @param node node that you want to edit data
*/
const fillOrgEdit = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getOrgDraft(props.org.organizationId))
.then((res) => {
@ -503,7 +506,7 @@ const fillOrgEdit = async () => {
console.log(e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
console.log("success");
};
@ -512,7 +515,7 @@ const fillOrgEdit = async () => {
* หนวยงาน
*/
const fetchOrganizationOri = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -528,14 +531,14 @@ const fetchOrganizationOri = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* รหสหนวยงาน
*/
const fetchOrganizationAgencyCode = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationCode)
.then((res) => {
@ -557,14 +560,14 @@ const fetchOrganizationAgencyCode = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* รหสสวนราชการ
*/
const fetchOrganizationGovernmentCode = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationShortName)
.then((res) => {
@ -589,14 +592,14 @@ const fetchOrganizationGovernmentCode = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
// /**
// *
// */
// const fetchOrganizationShortName = async () => {
// loaderPage(true);
// showLoader();
// await http
// .get(config.API.organizationShortName)
// .then((res) => {
@ -618,14 +621,14 @@ const fetchOrganizationGovernmentCode = async () => {
// console.log(e);
// })
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
// };
/**
* หนวยงานตนสงก
*/
const fetchOrganizationAgency = async () => {
loaderPage(true);
showLoader();
await http
// .get(config.API.organizationAgency)
.get(config.API.listOrganizationAgency("หน่วยงาน"))
@ -645,14 +648,14 @@ const fetchOrganizationAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* วนราชการตนสงก
*/
const fetchOrganizationGovernmentAgency = async () => {
loaderPage(true);
showLoader();
await http
// .get(config.API.organizationGovernmentAgency)
.get(config.API.listOrganizationAgency("ส่วนราชการ"))
@ -673,14 +676,14 @@ const fetchOrganizationGovernmentAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* ประเภทหนวยงาน
*/
const fetchOrganizationType = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationType)
.then((res) => {
@ -696,7 +699,7 @@ const fetchOrganizationType = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -704,7 +707,7 @@ const fetchOrganizationType = async () => {
* สถานะหนวยงาน
*/
const fetchOrganizationStatus = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationStatus)
.then((res) => {
@ -720,7 +723,7 @@ const fetchOrganizationStatus = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -728,7 +731,7 @@ const fetchOrganizationStatus = async () => {
* ระดบหนวยงาน
*/
const fetchOrganizationLevel = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationLevel)
.then((res) => {
@ -744,14 +747,14 @@ const fetchOrganizationLevel = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรดตอภายใน
*/
const fetchOrganizationTelInternal = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationTelInternal)
.then((res) => {
@ -767,14 +770,14 @@ const fetchOrganizationTelInternal = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรดตอภายนอก
*/
const fetchOrganizationTelExternal = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationTelExternal)
.then((res) => {
@ -790,14 +793,14 @@ const fetchOrganizationTelExternal = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรโทรสาร
*/
const fetchOrganizationFax = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationFax)
.then((res) => {
@ -813,13 +816,13 @@ const fetchOrganizationFax = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
let option: GovermentOption[] = [];
loaderPage(true);
showLoader();
await http
.get(config.API.organizationGovernmentCode(val))
.then((res) => {
@ -839,14 +842,14 @@ const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};
const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
let option: GovermentOption[] = [];
loaderPage(true);
showLoader();
await http
.get(config.API.organizationAgencyCode(val))
.then((res) => {
@ -866,7 +869,7 @@ const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};

View file

@ -146,7 +146,7 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO } = mixin;
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
const govermentOP = ref<DataOption[]>([]);
const govermentOPfilter = ref<DataOption[]>([]);
@ -166,7 +166,7 @@ const clickAccount3 = async () => {
};
const fetchOrganizationAgency = async () => {
loaderPage(true);
showLoader();
await http
// .get(config.API.organizationAgency)
.get(config.API.getOCType)
@ -186,12 +186,12 @@ const fetchOrganizationAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchOrganizationAgency();
});
</script>

View file

@ -706,7 +706,7 @@ const store = useDataStore();
const mixin = useCounterMixin();
const { loaderPage } = store; // load windows api
const { success, messageError, dialogMessage } = mixin;
const { success, messageError, dialogMessage, showLoader, hideLoader } = mixin;
//Notification Component Variable
const $q = useQuasar(); // show dialog
@ -868,12 +868,12 @@ const loadFileServer = async (node: any) => {
manageApiErrorMsg(e);
})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
const isTreeHasDraft = async () => {
// loaderPage(true);
// showLoader();
let orgHasDraft = false;
let orgPoHasDraft = false;
await http
@ -889,7 +889,7 @@ const isTreeHasDraft = async () => {
messageError($q, e);
})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
await http
@ -905,7 +905,7 @@ const isTreeHasDraft = async () => {
messageError($q, e);
})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
if (orgHasDraft || orgPoHasDraft) {
@ -920,7 +920,7 @@ const isTreeHasDraft = async () => {
*/
const fetchTreeRoot = async (isDraft: boolean) => {
// console.log(isDraft);
loaderPage(true);
showLoader();
console.log("Call API14 GetTreeRoot");
isShowEditTree.value = isDraft; // to show same tree that we fetch
let request = "";
@ -947,7 +947,7 @@ const fetchTreeRoot = async (isDraft: boolean) => {
// messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
// if (isDraft) {
// node root on first load
// .then error tree render
@ -964,7 +964,7 @@ const fetchTreeRoot = async (isDraft: boolean) => {
const fetchChildrenByParentId = async (node: any) => {
// console.log(isDraft);
console.log("Call API4");
loaderPage(true);
showLoader();
let request = "";
if (isShowEditTree.value) {
request = config.API.getDraftTreeNode(node.organizationId, node.keyId);
@ -984,7 +984,7 @@ const fetchChildrenByParentId = async (node: any) => {
manageApiErrorMsg(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1000,7 +1000,7 @@ const onLazyLoad = (node: any) => {
*/
console.log("Call LazyLoad");
await fetchChildrenByParentId(node.node);
/** loaderPage(true);
/** showLoader();
let request = "";
if (isShowEditTree.value) {
request = config.API.getDraftTreeNode(
@ -1037,7 +1037,7 @@ const onLazyLoad = (node: any) => {
// messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});*/
node.done(node.node.children); //return q-tree generate children
@ -1092,7 +1092,7 @@ const apiDeleteOrg = () => {
// console.log("isShowEditTree", isShowEditTree.value);
setTimeout(async () => {
//delay for lazyLoad to be able to tricker again
loaderPage(true);
showLoader();
isShowEditTree.value = true;
await http
.delete(config.API.delTreeOrgDraft(delStructureId.value))
@ -1111,7 +1111,7 @@ const apiDeleteOrg = () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
await isTreeHasDraft();
});
}, 20);
@ -1140,7 +1140,7 @@ const apiDeletePosition = () => {
isShowEditTree.value = false;
setTimeout(async () => {
//delay for lazyLoad to be able to tricker again
loaderPage(true);
showLoader();
isShowEditTree.value = true;
await http
.delete(config.API.delTreePositionDraft(delStructureId.value))
@ -1157,7 +1157,7 @@ const apiDeletePosition = () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
await isTreeHasDraft();
});
}, 20);
@ -1170,7 +1170,7 @@ const apiDeletePosition = () => {
* งก clear data แบบราง
*/
const deleteDraft = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.delTreeOrgPoDraft)
.then((res) => {
@ -1182,7 +1182,7 @@ const deleteDraft = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
router.go(0);
await isTreeHasDraft();
});
@ -1192,7 +1192,7 @@ const deleteDraft = async () => {
* งกนเผยแพรแบบราง
*/
const publishDraft = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.publishOrgPoDraft)
.then((res) => {
@ -1218,7 +1218,7 @@ const publishDraft = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
await isTreeHasDraft();
});
};
@ -1317,7 +1317,7 @@ const addStructure = async (node: any) => {
});
// console.log(node.organizationId);
console.log("Call API1");
loaderPage(true);
showLoader();
isShowEditTree.value = true; // editTree & trigger lazyLoad setExpanded
await http
.post(config.API.addTreeDraft, {
@ -1338,7 +1338,7 @@ const addStructure = async (node: any) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
popupAddOrganization.value = false;
await isTreeHasDraft();
@ -1370,7 +1370,7 @@ const editOrgStructure = async (node: any) => {
if (organizCheck == true) {
// console.log(node.organizationId);
console.log("Call API13");
loaderPage(true);
showLoader();
isShowEditTree.value = true; //end prepare for tricker LazyLoad
await http
.put(config.API.editTreeOrgDraft(node.organizationId), {
@ -1409,7 +1409,7 @@ const editOrgStructure = async (node: any) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
popupEditSelectedOrganization.value = false;
await isTreeHasDraft();
});
@ -1435,7 +1435,7 @@ const editPositionStructure = async (node: any) => {
if (positionCheck == true) {
console.log("Call API3");
loaderPage(true);
showLoader();
isShowEditTree.value = true; //end prepare for tricker LazyLoad
await http
.put(config.API.editTreePositionDraft(node.organizationPositionId), {
@ -1457,7 +1457,7 @@ const editPositionStructure = async (node: any) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
popupEditSelectedPosition.value = false;
await isTreeHasDraft();
});
@ -1473,7 +1473,7 @@ const clickHistory = async () => {
modalHistory.value = true;
// rowsHistory.value = rawHistory.value.filter((f: any) => f.id == row.id);
loaderPage(true);
showLoader();
await http
.get(config.API.getTreeHistory)
.then((res) => {
@ -1499,7 +1499,7 @@ const clickHistory = async () => {
// messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -10,7 +10,13 @@
class="shadow-2 rounded-borders page-relative"
style="height: 80vh"
>
<q-drawer v-model="isDrawer" class="bg-grey-1" :width="220" :breakpoint="400" bordered>
<q-drawer
v-model="isDrawer"
class="bg-grey-1"
:width="220"
:breakpoint="400"
bordered
>
<q-btn
size="13px"
class="btn-absolute btnShadow"
@ -114,7 +120,8 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO, modalError } = mixin;
const { date2Thai, success, dateToISO, modalError, showLoader, hideLoader } =
mixin;
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -462,7 +469,7 @@ onMounted(async () => {
});
const nodeTree = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileOrganizRoot)
.then((res: any) => {
@ -481,7 +488,7 @@ const nodeTree = async () => {
})
.catch((e: any) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -495,7 +502,7 @@ const clickTree = () => {
};
const onHistory = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.report2HistoryId(selected.value))
.then((res) => {
@ -518,13 +525,13 @@ const onHistory = async () => {
);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const doSearch = async () => {
// type
loaderPage(true);
showLoader();
await http
.get(config.API.report2TreeId(selected.value))
.then((res) => {
@ -554,7 +561,7 @@ const doSearch = async () => {
})
.catch((e) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -570,7 +577,7 @@ const onConfirm = async () => {
ok: "ยืนยัน",
persistent: true,
}).onOk(async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.report2DoneId(selected.value))
.then((res) => {
@ -578,7 +585,7 @@ const onConfirm = async () => {
})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
await doSearch();
});
});

View file

@ -591,7 +591,7 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO } = mixin;
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
const id = ref<string>("");
const myForm = ref<QForm | null>(null); //form data input
@ -669,10 +669,10 @@ const sideWorkOPfilter = ref<DataOption[]>([]);
const levelOPfilter = ref<DataOption[]>([]);
onMounted(async () => {
loaderPage(false);
hideLoader();
if (route.params.id != undefined) {
id.value = route.params.id.toString();
loaderPage(true);
showLoader();
await fetchGoverment();
// await fetchAgency();
@ -685,12 +685,12 @@ onMounted(async () => {
await fetchLevel();
await fetchData();
loaderPage(false);
hideLoader();
}
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.report2Id(id.value))
.then(async (res) => {
@ -723,7 +723,7 @@ const fetchData = async () => {
})
.catch((e) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -739,7 +739,7 @@ const checkSave = async () => {
const saveData = async () => {
// console.log(myData.value);
loaderPage(true);
showLoader();
const body: RequestReport2 = {
organizationShortNameId: myData.value.goverment2,
organizationOrganizationId: myData.value.agency2,
@ -760,7 +760,7 @@ const saveData = async () => {
})
.catch((e) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -770,7 +770,7 @@ const clickBack = () => {
//
const fetchGoverment = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.organizationShortName)
.then((res) => {
@ -796,12 +796,12 @@ const fetchGoverment = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
const updateGoverment = async (id: string) => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.getPositionMasterPositionNumberId(id))
.then((res) => {
@ -890,13 +890,13 @@ const updateGoverment = async (id: string) => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
// //
const fetchPositionNum = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.getPositionMasterPositionNumber)
.then((res) => {
@ -910,13 +910,13 @@ const fetchPositionNum = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
//
const fetchCategory = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.positionType)
.then((res) => {
@ -930,13 +930,13 @@ const fetchCategory = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
//
const fetchPositionManage = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.positionExecutive)
.then((res) => {
@ -950,13 +950,13 @@ const fetchPositionManage = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
//
const fetchSideManage = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.positionExecutiveSide)
.then((res) => {
@ -970,13 +970,13 @@ const fetchSideManage = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
//
const fetchPositionWork = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.positionPath)
.then((res) => {
@ -990,13 +990,13 @@ const fetchPositionWork = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
///
const fetchSideWork = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.positionSide)
.then((res) => {
@ -1010,13 +1010,13 @@ const fetchSideWork = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};
//
const fetchLevel = async () => {
// loaderPage(true);
// showLoader();
await http
.get(config.API.positionLevel)
.then((res) => {
@ -1030,7 +1030,7 @@ const fetchLevel = async () => {
})
.catch((e) => {})
.finally(() => {
// loaderPage(false);
// hideLoader();
});
};

View file

@ -351,7 +351,7 @@ const router = useRouter();
const route = useRoute();
const { loaderPage } = dataStore;
const { date2Thai, success, dateToISO } = mixin;
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
const id = ref<string>("");
const previous = ref<boolean>(false);
const next = ref<boolean>(false);
@ -360,7 +360,7 @@ const historyHead = ref<ResponseHistoryHead[]>([]);
const historyData = ref<ResponseHistory[]>([]);
onMounted(async () => {
loaderPage(false);
hideLoader();
if (route.params.id != undefined) {
id.value = route.params.id.toString();
@ -386,7 +386,7 @@ const clickPreviousNext = async (page: string) => {
};
const fetchHistory = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.report2HistoryId(id.value))
.then((res) => {
@ -402,7 +402,7 @@ const fetchHistory = async () => {
})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
if (historyHead.value.length > 1) {
next.value = true;
previous.value = false;
@ -414,7 +414,7 @@ const fetchHistory = async () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(
config.API.report2HistoryDetailId(
@ -455,7 +455,7 @@ const fetchData = async () => {
})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
</script>

View file

@ -109,7 +109,7 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO } = mixin;
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
const govermentOP = ref<DataOption[]>([]);
const govermentOPfilter = ref<DataOption[]>([]);
@ -117,7 +117,7 @@ const goverment = ref<string>("");
const tab = ref<string>("audit1");
const fetchOrganizationAgency = async () => {
loaderPage(true);
showLoader();
await http
// .get(config.API.organizationAgency)
.get(config.API.listOrganizationAgency("หน่วยงาน"))
@ -137,12 +137,12 @@ const fetchOrganizationAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchOrganizationAgency();
});
</script>