ทะเบียนประวัติ fetch api

This commit is contained in:
Thanit Konmek 2023-06-15 17:22:20 +07:00
parent 67e0f695c1
commit 5fbfaa9a88
3 changed files with 42 additions and 40 deletions

View file

@ -210,8 +210,6 @@ const {
changeManageColumns, changeManageColumns,
getPrefix, getPrefix,
dataPrefix, dataPrefix,
storeIdVersion,
storeVersion,
} = store; } = store;
const rows = ref<RequestItemsHistoryObject[]>(dataPrefix); //list data table const rows = ref<RequestItemsHistoryObject[]>(dataPrefix); //list data table
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history

View file

@ -60,9 +60,9 @@ import Occupation from "@/modules/03_recruiting/components/Occupation.vue";
import Education from "@/modules/03_recruiting/components/Education.vue"; import Education from "@/modules/03_recruiting/components/Education.vue";
import Career from "@/modules/03_recruiting/components/Career.vue"; import Career from "@/modules/03_recruiting/components/Career.vue";
import Document from "@/modules/03_recruiting/components/Document.vue"; import Document from "@/modules/03_recruiting/components/Document.vue";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useManageDataStore } from "@/modules/01_metadata/store";
const props = defineProps({ const props = defineProps({
status: { status: {
@ -88,8 +88,9 @@ const props = defineProps({
}); });
const $q = useQuasar(); const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore; const store = useManageDataStore();
const { getPrefix } = store;
const prefixOptions = ref<DataOption[]>([]); const prefixOptions = ref<DataOption[]>([]);
const relationshipOptions = ref<DataOption[]>([]); const relationshipOptions = ref<DataOption[]>([]);
const provinceOptions = ref<DataOption[]>([]); const provinceOptions = ref<DataOption[]>([]);
@ -131,23 +132,15 @@ onMounted(() => {
}); });
const fetchPrefix = async () => { const fetchPrefix = async () => {
showLoader(); const result = await getPrefix(true, false);
await http const data = result.data;
.get(config.API.prefix) let option: DataOption[] = [];
.then((res) => { if (data.length > 0) {
const data = res.data.result; data.map((r: any) => {
let option: DataOption[] = []; option.push({ id: r.id.toString(), name: r.name.toString() });
data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() });
});
prefixOptions.value = option;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
}
prefixOptions.value = option;
}; };
const fetchRelationship = async () => { const fetchRelationship = async () => {

View file

@ -774,6 +774,7 @@ import type {
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useManageDataStore } from "@/modules/01_metadata/store";
const props = defineProps({ const props = defineProps({
statusEdit: { statusEdit: {
@ -789,8 +790,8 @@ const emit = defineEmits(["update:statusEdit"]);
const route = useRoute(); const route = useRoute();
const $q = useQuasar(); const $q = useQuasar();
const dataStore = useDataStore(); const store = useManageDataStore();
const { loaderPage } = dataStore; const { getPrefix } = store;
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin; const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(false); const edit = ref<boolean>(false);
@ -857,24 +858,34 @@ const refreshData = async () => {
}; };
const fetchPrefix = async () => { const fetchPrefix = async () => {
showLoader(); const result = await getPrefix(true, false);
await http const data = result.data;
.get(config.API.prefix) let option: DataOption[] = [];
.then((res) => { if (data.length > 0) {
const data = res.data.result; data.map((r: any) => {
let option: DataOption[] = []; option.push({ id: r.id.toString(), name: r.name.toString() });
data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() });
});
Ops.value.prefixOps = option;
OpsFilter.value.prefixOps = option;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
}
Ops.value.prefixOps = option;
OpsFilter.value.prefixOps = option;
// showLoader();
// await http
// .get(config.API.prefix)
// .then((res) => {
// const data = res.data.result;
// let option: DataOption[] = [];
// data.map((r: any) => {
// option.push({ id: r.id.toString(), name: r.name.toString() });
// });
// Ops.value.prefixOps = option;
// OpsFilter.value.prefixOps = option;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
}; };
const addChildren = async () => { const addChildren = async () => {