แก้ไข loader

This commit is contained in:
Thanit Konmek 2023-08-04 10:04:59 +07:00
parent f072224851
commit b663eedb09
147 changed files with 3095 additions and 3256 deletions

View file

@ -432,15 +432,19 @@ import type { DataOption } from "@/modules/02_organizational/interface/index/Mai
import HistoryTable from "@/components/TableHistory.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import type { QTableProps } from "quasar";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
import type { QTableProps } from "quasar";
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;
@ -843,7 +847,7 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
});
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchPosition();
await fetchData();
await fetchHistory();
@ -853,7 +857,7 @@ onMounted(async () => {
* งก get data าส
*/
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getPostionMasterDraft(true))
.then((res) => {
@ -897,7 +901,7 @@ const fetchData = async () => {
})
.finally(() => {
// updateData.value = false;
loaderPage(false);
hideLoader();
});
};
@ -905,7 +909,7 @@ const fetchData = async () => {
* งชนดอมลประวแกไขขอมลทงหมด
*/
const fetchHistory = async () => {
// loaderPage(true);
// showLoader();
// await http
// .get(config.API.listxxxxxxxxPublishedHistory)
// .then((res) => {
@ -937,7 +941,7 @@ const fetchHistory = async () => {
// statusCode.value = e.response.data.status;
// })
// .finally(async () => {
// loaderPage(false);
// hideLoader();
// });
};
@ -945,7 +949,7 @@ const fetchHistory = async () => {
* get รายการ ตำแหน
*/
const fetchPosition = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.position)
.then((res) => {
@ -1036,7 +1040,7 @@ const fetchPosition = async () => {
})
.catch((e: any) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1185,7 +1189,7 @@ const clickSave = async () => {
*/
const saveData = async () => {
modal.value = false;
loaderPage(true);
showLoader();
await http
.post(config.API.getPositionMaster, {
positionTypeId: positionTypeId.value,
@ -1218,7 +1222,7 @@ const saveData = async () => {
*/
const editData = async () => {
modal.value = false;
loaderPage(true);
showLoader();
await http
.put(config.API.getPositionMasterId(positionMasterId.value), {
positionMasterId: positionMasterId.value,
@ -1252,7 +1256,7 @@ const editData = async () => {
* เมอเรยก api เสรจแลวจะ get data มาใหม
*/
const clearPublishedData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.getPositionMasterSync)
.then((res) => {
@ -1265,7 +1269,7 @@ const clearPublishedData = async () => {
statusCode.value = e.response.data.status;
})
.finally(async () => {
loaderPage(false);
hideLoader();
await fetchHistory();
await fetchData();
});
@ -1277,7 +1281,7 @@ const clearPublishedData = async () => {
*/
const publishedData = async () => {
// editvisible.value = false;
loaderPage(true);
showLoader();
await http
.put(config.API.getPositionMasterPublish)
.then((res) => {
@ -1287,7 +1291,7 @@ const publishedData = async () => {
statusCode.value = e.response.data.status;
})
.finally(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
};
@ -1383,7 +1387,7 @@ const clickAdd = () => {
* @param row อม row ประวการแกไข
*/
const clickHistory = async (row: RequestItemsObject) => {
loaderPage(true);
showLoader();
await http
.get(config.API.getPositionMasterHistoryId(row.id))
.then((res) => {
@ -1427,7 +1431,7 @@ const clickHistory = async (row: RequestItemsObject) => {
})
.finally(async () => {
modalHistory.value = true;
loaderPage(false);
hideLoader();
});
};
@ -1470,7 +1474,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

@ -374,7 +374,8 @@
import { ref, defineAsyncComponent, watch, onMounted } from "vue";
import { useQuasar, QForm } from "quasar";
import type { PropType } from "vue";
import { useDataStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataOption } from "../../interface/index/Main";
@ -382,8 +383,9 @@ import type { DataOption } from "../../interface/index/Main";
const ddNoResultMsg = defineAsyncComponent(
() => import("@/components/DropDownNoResultMsg.vue")
); // Dropdown Filter
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { showLoader, hideLoader } = mixin;
const $q = useQuasar(); // show dialog
const emit = defineEmits(["update:positions", "update:formprops"]);
const props = defineProps({
@ -430,12 +432,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))
@ -476,7 +478,7 @@ const fetchPositionMaster = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -333,8 +333,9 @@ import type {
GovermentOption,
} from "../../interface/index/Main";
import { log } from "console";
import { useDataStore } from "@/stores/data";
// import { organizationSet } from "../interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
const props = defineProps({
organizprops: Array as PropType<OrganizaOption[]>,
@ -343,8 +344,9 @@ const props = defineProps({
const emit = defineEmits(["update:organizprops", "update:formprops"]);
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { showLoader, hideLoader } = mixin;
const $q = useQuasar(); // show dialog
const myForm = ref<QForm | null>(null);
@ -381,7 +383,7 @@ const organizationAgencyCode = ref<GovermentOption[]>([]);
const organizationAgencyCodeFilter = ref<GovermentOption[]>([]);
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchOrganizationOri();
await fetchOrganizationAgencyCode();
await fetchOrganizationGovernmentCode();
@ -400,7 +402,7 @@ onMounted(async () => {
* หนวยงาน
*/
const fetchOrganizationOri = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -416,14 +418,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) => {
@ -445,14 +447,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) => {
@ -474,14 +476,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) => {
@ -503,14 +505,14 @@ const fetchOrganizationGovernmentCode = async () => {
// console.log(e);
// })
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
// };
/**
* หนวยงานตนสงก
*/
const fetchOrganizationAgency = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.listOrganizationHistoryAgency("หน่วยงาน"))
.then((res) => {
@ -529,14 +531,14 @@ const fetchOrganizationAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* วนราชการตนสงก
*/
const fetchOrganizationGovernmentAgency = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.listOrganizationHistoryAgency("ส่วนราชการ"))
.then((res) => {
@ -555,14 +557,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) => {
@ -578,14 +580,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) => {
@ -601,14 +603,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) => {
@ -624,14 +626,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) => {
@ -647,14 +649,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) => {
@ -670,7 +672,7 @@ const fetchOrganizationFax = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -772,7 +774,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) => {
@ -792,14 +794,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) => {
@ -819,7 +821,7 @@ const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};

View file

@ -310,9 +310,13 @@ import type {
GovermentOption,
} from "../../interface/index/Main";
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 mixin = useCounterMixin();
const { showLoader, hideLoader } = mixin;
const props = defineProps({
organizprops: Object as PropType<OrganizaOption>,
@ -323,8 +327,6 @@ const props = defineProps({
},
});
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const emit = defineEmits(["update:organizprops", "update:formprops"]);
const $q = useQuasar(); // show dialog
@ -393,7 +395,7 @@ const organization = ref<OrganizaOption>({
emit("update:organizprops", organization.value);
onMounted(async () => {
loaderPage(false);
hideLoader();
// await fillOrgEdit(); // selector(q-select)
await fetchOrganizationOri();
// await fetchOrganizationShortName();
@ -427,7 +429,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) => {
@ -499,7 +501,7 @@ const fillOrgEdit = async () => {
console.log(e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
console.log("success");
};
@ -508,7 +510,7 @@ const fillOrgEdit = async () => {
* หนวยงาน
*/
const fetchOrganizationOri = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -524,14 +526,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) => {
@ -553,14 +555,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) => {
@ -585,14 +587,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) => {
@ -614,14 +616,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.listOrganizationHistoryAgency("หน่วยงาน"))
@ -641,14 +643,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.listOrganizationHistoryAgency("ส่วนราชการ"))
@ -669,14 +671,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) => {
@ -692,7 +694,7 @@ const fetchOrganizationType = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -700,7 +702,7 @@ const fetchOrganizationType = async () => {
* สถานะหนวยงาน
*/
const fetchOrganizationStatus = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationStatus)
.then((res) => {
@ -716,7 +718,7 @@ const fetchOrganizationStatus = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -724,7 +726,7 @@ const fetchOrganizationStatus = async () => {
* ระดบหนวยงาน
*/
const fetchOrganizationLevel = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationLevel)
.then((res) => {
@ -740,14 +742,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) => {
@ -763,14 +765,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) => {
@ -786,14 +788,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) => {
@ -809,13 +811,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) => {
@ -835,14 +837,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) => {
@ -862,7 +864,7 @@ const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};