แก้ไข 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

@ -245,7 +245,6 @@ import HeaderTop from "@/modules/03_recruiting/components/top.vue";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useDataStore } from "@/stores/data";
const props = defineProps({
provinceOptions: {
@ -266,15 +265,14 @@ const route = useRoute();
const candidateId = ref<string>(route.params.candidateId.toString());
const edit = ref<boolean>(true);
const myform = ref<any>({});
const loader = ref<boolean>(false);
const districtOptions = ref<DataOption[]>([]);
const districtCOptions = ref<DataOption[]>([]);
const subdistrictOptions = ref<DataOption[]>([]);
const subdistrictCOptions = ref<DataOption[]>([]);
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const emit = defineEmits(["update:form"]);
watch(myform, async (count: any, prevCount: any) => {
@ -319,7 +317,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -362,7 +360,7 @@ const selectSubDistrict = (e: string, name: string) => {
};
const fetchDistrict = async (id: string, position: string) => {
loader.value = true;
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -381,12 +379,12 @@ const fetchDistrict = async (id: string, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchSubDistrict = async (id: string, position: string) => {
loader.value = true;
showLoader();
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
@ -409,7 +407,7 @@ const fetchSubDistrict = async (id: string, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -202,7 +202,6 @@ import Table from "@/modules/03_recruiting/components/TableCan.vue";
import DialogHeader from "@/modules/03_recruiting/components/DialogHeader.vue";
import DialogFooter from "@/modules/03_recruiting/components/DialogFooter.vue";
import { useRoute } from "vue-router";
import { useDataStore } from "@/stores/data";
const props = defineProps({
status: {
@ -229,7 +228,7 @@ const modalEdit = ref<boolean>(false); //modal ที่แสดงใช้ส
const rawItem = ref<RequestItemsObject>(); // row
const rowIndex = ref<number>(0); //index row
const previous = ref<boolean>(); //
const dataStore = useDataStore();
const next = ref<boolean>(); //
const editRow = ref<boolean>(false); //
const checkValidate = ref<boolean>(false); //validate data
@ -237,8 +236,8 @@ const route = useRoute();
const candidateId = ref<string>(route.params.candidateId.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const { messageError } = mixin;
const { loaderPage } = dataStore;
const { messageError, showLoader, hideLoader } = mixin;
const visibleColumns = ref<String[]>([]);
examData.career.columns.length == 0
@ -318,7 +317,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateCareer(candidateId.value))
.then((res) => {
@ -336,7 +335,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -415,7 +414,7 @@ const checkDelete = (row: RequestItemsObject) => {
*/
const clickDeleteRow = async () => {
if (rawItem.value != null) {
loaderPage(true);
showLoader();
await http
.delete(config.API.candidateAdminCareer(rawItem.value.id))
.then(() => {
@ -451,7 +450,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.candidateAdminCareer(candidateId.value), {
name: location.value,
@ -477,7 +476,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateAdminCareer(id.value), {
name: location.value,

View file

@ -146,7 +146,7 @@ import HeaderTop from "@/modules/03_recruiting/components/top.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRoute } from "vue-router";
import { useDataStore } from "@/stores/data";
import type { UploadType } from "@/modules/03_recruiting/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
@ -161,14 +161,13 @@ const $q = useQuasar();
const route = useRoute();
const candidateId = ref<string>(route.params.candidateId.toString());
const uploader = ref<any>();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const edit = ref<boolean>(props.status == "checkRegister");
const name = ref<string>("");
const files = ref<UploadType[]>([]);
const file = ref<File[]>([]);
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
onMounted(async () => {
await getData();
@ -180,7 +179,7 @@ const fileAdd = async (val: any) => {
};
const getData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateUpload(candidateId.value))
.then((res) => {
@ -191,7 +190,7 @@ const getData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -199,7 +198,7 @@ const deleteData = async (id: string) => {
const params = {
documentId: id,
};
loaderPage(true);
showLoader();
await http
.delete(config.API.candidateUpload(candidateId.value), {
params,
@ -211,7 +210,7 @@ const deleteData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
await getData();
});
};
@ -223,7 +222,7 @@ const uploadData = async () => {
});
const formData = new FormData();
formData.append("", newFile);
loaderPage(true);
showLoader();
await http
.put(config.API.candidateUpload(candidateId.value), formData)
.then((res) => {
@ -233,7 +232,7 @@ const uploadData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
name.value = "";
uploader.value.reset();
await getData();

View file

@ -193,7 +193,7 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import { useExamDataStore } from "@/modules/03_recruiting/store";
import type {
RequestItemsObject,
@ -238,9 +238,8 @@ const editRow = ref<boolean>(false); //เช็คมีการแก้ไ
const checkValidate = ref<boolean>(false); //validate data
const rows = ref<RequestItemsObject[]>([]);
const route = useRoute();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const candidateId = ref<string>(route.params.candidateId.toString());
const filter = ref<string>(""); //search data table
@ -324,7 +323,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateEducation(candidateId.value))
.then((res) => {
@ -343,12 +342,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetcheducationLevel = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.educationLevel)
.then((res) => {
@ -363,7 +362,7 @@ const fetcheducationLevel = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -444,7 +443,7 @@ const checkDelete = (row: RequestItemsObject) => {
*/
const clickDeleteRow = async () => {
if (rawItem.value != null) {
loaderPage(true);
showLoader();
await http
.delete(config.API.candidateAdminEducation(rawItem.value.id))
.then(() => {
@ -480,7 +479,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.candidateAdminEducation(candidateId.value), {
educationLevelId: educationLevelId.value,
@ -506,7 +505,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateAdminEducation(id.value), {
educationLevelId: educationLevelId.value,

View file

@ -113,7 +113,7 @@ import { onMounted, ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
const props = defineProps({
@ -129,9 +129,8 @@ const props = defineProps({
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { messageError, date2Thai } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const { messageError, date2Thai, showLoader, hideLoader } = mixin;
const fullName = ref<string>("");
const examNumber = ref<string>("");
const citizenId = ref<string>("");
@ -152,7 +151,7 @@ onMounted(async () => {
});
const fetchCard = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateCard(props.candidateId))
.then((res) => {
@ -194,7 +193,7 @@ const fetchCard = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
</script>

View file

@ -282,7 +282,7 @@ import {
import HeaderTop from "@/modules/03_recruiting/components/top.vue";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
const props = defineProps({
@ -300,10 +300,9 @@ const props = defineProps({
},
});
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(true);
const myform = ref<any>({});
const route = useRoute();
@ -324,7 +323,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateFamily(candidateId.value))
.then((res) => {
@ -351,7 +350,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -403,7 +403,6 @@ import HeaderTop from "@/modules/03_recruiting/components/top.vue";
import { useRoute } from "vue-router";
import keycloak from "@/plugins/keycloak";
import { useQuasar } from "quasar";
import { useDataStore } from "@/stores/data";
const props = defineProps({
prefixOptions: {
@ -438,9 +437,8 @@ const edit = ref<boolean>(true);
const myform = ref<any>({});
const img = ref<string>("");
const fileProfile = ref<File[]>([]);
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const emit = defineEmits(["update:form"]);
@ -463,7 +461,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateInformation(candidateId.value))
.then((res) => {
@ -494,12 +492,12 @@ const fetchData = async () => {
keycloak.tokenParsed == null ? "" : keycloak.tokenParsed.family_name;
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchImgData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateProfile(candidateId.value))
.then((res) => {
@ -510,7 +508,7 @@ const fetchImgData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -542,7 +540,7 @@ const selectProvince = (val: string) => {
};
const fetchDistrict = async (id: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -557,7 +555,7 @@ const fetchDistrict = async (id: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -260,7 +260,7 @@ import {
} from "@/modules/03_recruiting/interface/index/Main";
import HeaderTop from "@/modules/03_recruiting/components/top.vue";
import { useRoute } from "vue-router";
import { useDataStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
@ -280,10 +280,9 @@ const edit = ref<boolean>(true);
const myform = ref<any>({});
const route = useRoute();
const candidateId = ref<string>(route.params.candidateId.toString());
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const emit = defineEmits(["update:form"]);
@ -300,7 +299,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateOccupation(candidateId.value))
.then((res) => {
@ -327,7 +326,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -21,7 +21,11 @@
<q-separator class="q-my-lg bg-gray" size="5px" />
<div class="q-px-sm">
<Family :prefixOptions="prefixOptions" :status="status" v-model:form="formFamily" />
<Family
:prefixOptions="prefixOptions"
:status="status"
v-model:form="formFamily"
/>
</div>
<q-separator class="q-my-lg bg-gray" size="5px" />
@ -56,7 +60,7 @@ import Occupation from "@/modules/03_recruiting/components/Occupation.vue";
import Education from "@/modules/03_recruiting/components/Education.vue";
import Career from "@/modules/03_recruiting/components/Career.vue";
import Document from "@/modules/03_recruiting/components/Document.vue";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@ -84,8 +88,7 @@ const props = defineProps({
});
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const prefixOptions = ref<DataOption[]>([]);
const relationshipOptions = ref<DataOption[]>([]);
const provinceOptions = ref<DataOption[]>([]);
@ -94,7 +97,7 @@ const formAddress = ref<any>({});
const formFamily = ref<any>({});
const formOccupation = ref<any>({});
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const emit = defineEmits([
"update:formInformation",
@ -120,14 +123,14 @@ watch(formOccupation, async (count: Object, prevCount: Object) => {
});
onMounted(() => {
loaderPage(false);
hideLoader();
fetchPrefix();
fetchRelationship();
fetchProvince();
});
const fetchPrefix = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.prefix)
.then((res) => {
@ -142,12 +145,12 @@ const fetchPrefix = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchRelationship = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.relationship)
.then((res) => {
@ -162,12 +165,12 @@ const fetchRelationship = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchProvince = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.province)
.then((res) => {
@ -182,7 +185,7 @@ const fetchProvince = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
</script>

View file

@ -149,7 +149,7 @@
<script setup lang="ts">
import { ref, useAttrs } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useDataStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
@ -157,8 +157,7 @@ import { useQuasar } from "quasar";
const route = useRoute();
const router = useRouter();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { dateToISO, success, modalError, dialogMessage } = mixin;
const $q = useQuasar(); // show dialog
@ -167,7 +166,7 @@ const table = ref<any>(null);
const files = ref<File[]>([]);
const filterRef = ref<any>(null);
const examId = ref<string>(route.params.examId.toString());
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const props = defineProps({
inputfilter: String,
inputvisible: Array,
@ -309,7 +308,7 @@ const candidateToPlacement = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
router.go(-1);
});
})
@ -318,7 +317,7 @@ const candidateToPlacement = async () => {
};
const uploadDataSeat = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("", files.value[0]);
await http
@ -330,14 +329,14 @@ const uploadDataSeat = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
files.value = [];
props.fetchData();
});
};
const uploadDataPoint = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("", files.value[0]);
await http
@ -350,14 +349,14 @@ const uploadDataPoint = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
files.value = [];
props.fetchData();
});
};
const downloadFile = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamDownload(examId.value), {
responseType: "blob",
@ -370,12 +369,12 @@ const downloadFile = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadFileDetail = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamDownloadDetail(examId.value), {
responseType: "blob",
@ -388,7 +387,7 @@ const downloadFileDetail = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};