fix fetch profilePosition
This commit is contained in:
parent
efcfda8b0e
commit
7d95116c25
3 changed files with 118 additions and 73 deletions
|
|
@ -36,35 +36,63 @@ interface InformationData {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataProfile {
|
interface DataProfile {
|
||||||
profileId: string | null;
|
amountSpecial: number;
|
||||||
prefix: string;
|
avatar: string;
|
||||||
rank: string;
|
avatarName: string;
|
||||||
firstName: string;
|
birthDate: string;
|
||||||
lastName: string;
|
child1: string;
|
||||||
citizenId: string;
|
child1DnaId: string;
|
||||||
position: string;
|
child1Id: string;
|
||||||
posMaster: string | null;
|
child1ShortName: string;
|
||||||
posLevelName: string | null;
|
child2: string;
|
||||||
posLevelRank: string | null;
|
child2DnaId: string;
|
||||||
posLevelId: string | null;
|
child2Id: string;
|
||||||
posTypeName: string | null;
|
child2ShortName: string;
|
||||||
posTypeRank: string | null;
|
child3: string;
|
||||||
posTypeId: string | null;
|
child3DnaId: string;
|
||||||
posExecutiveName: string;
|
child3Id: string;
|
||||||
posExecutivePriority: string | null;
|
child3ShortName: string;
|
||||||
posExecutiveId: string | null;
|
|
||||||
rootId: string | null;
|
|
||||||
root: string;
|
|
||||||
child1Id: string | null;
|
|
||||||
child1: string | null;
|
|
||||||
child2Id: string | null;
|
|
||||||
child2: string | null;
|
|
||||||
child3Id: string | null;
|
|
||||||
child3: string | null;
|
|
||||||
child4Id: string | null;
|
|
||||||
child4: string | null;
|
child4: string | null;
|
||||||
node: string | null;
|
child4DnaId: string | null;
|
||||||
nodeId: string | null;
|
child4Id: string | null;
|
||||||
|
child4ShortName: string | null;
|
||||||
|
citizenId: string;
|
||||||
|
dateRetireLaw: string;
|
||||||
|
dateStart: string;
|
||||||
|
firstName: string;
|
||||||
|
isDirector: boolean;
|
||||||
|
isProbation: boolean;
|
||||||
|
keycloak: string;
|
||||||
|
lastName: string;
|
||||||
|
leaveDate: string | null;
|
||||||
|
node: number;
|
||||||
|
nodeDnaId: string;
|
||||||
|
nodeId: string;
|
||||||
|
nodeShortName: string;
|
||||||
|
posExecutiveId: string | null;
|
||||||
|
posExecutiveName: string | null;
|
||||||
|
posExecutivePriority: number | null;
|
||||||
|
posLevelId: string;
|
||||||
|
posLevelName: string;
|
||||||
|
posLevelRank: number;
|
||||||
|
posMaster: number;
|
||||||
|
posMasterNo: number;
|
||||||
|
posNo: string;
|
||||||
|
posTypeId: string;
|
||||||
|
posTypeName: string;
|
||||||
|
posTypeRank: number;
|
||||||
|
position: string;
|
||||||
|
positionArea: string | null;
|
||||||
|
positionExecutiveField: string | null;
|
||||||
|
prefix: string;
|
||||||
|
profileId: string;
|
||||||
|
profileType: string;
|
||||||
|
rank: string | null;
|
||||||
|
root: string;
|
||||||
|
rootDnaId: string;
|
||||||
|
rootId: string;
|
||||||
|
rootShortName: string;
|
||||||
|
salary: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { ProfileData, InformationData, DataProfile };
|
export type { ProfileData, InformationData, DataProfile };
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@ import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useEvaluateDetailStore } from "@/modules/06_evaluate/stores/evaluteDetail";
|
import { useEvaluateDetailStore } from "@/modules/06_evaluate/stores/evaluteDetail";
|
||||||
import { useEvaluateStore } from "@/modules/06_evaluate/store";
|
import { useEvaluateStore } from "@/modules/06_evaluate/store";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
|
import type { DataProfile } from "@/interface/Main";
|
||||||
import type {
|
import type {
|
||||||
EducationForm,
|
EducationForm,
|
||||||
CertificatesForm,
|
CertificatesForm,
|
||||||
|
|
@ -24,6 +26,7 @@ import HeaderDialog from "@/components/DialogHeader.vue";
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const store = useEvaluateDetailStore();
|
const store = useEvaluateDetailStore();
|
||||||
const storeEva = useEvaluateStore();
|
const storeEva = useEvaluateStore();
|
||||||
|
const storeData = useDataStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { showLoader, hideLoader, messageError, date2Thai, findOrgNameHtml } =
|
const { showLoader, hideLoader, messageError, date2Thai, findOrgNameHtml } =
|
||||||
|
|
@ -75,34 +78,39 @@ const formDetail = reactive<any>({
|
||||||
|
|
||||||
/** function เรียกข้อมูลตรวจสอบคุณสมบัติ*/
|
/** function เรียกข้อมูลตรวจสอบคุณสมบัติ*/
|
||||||
async function fetchDetail() {
|
async function fetchDetail() {
|
||||||
await http
|
try {
|
||||||
.get(config.API.profilePosition())
|
if (!storeData.dataprofilePosition) {
|
||||||
.then(async (res) => {
|
const res = await http.get(config.API.profilePosition());
|
||||||
const data = await res.data.result;
|
await updateFormDetail(res.data.result);
|
||||||
formDetail.root = data.root;
|
} else {
|
||||||
formDetail.rootId = data.rootId;
|
await updateFormDetail(storeData.dataprofilePosition);
|
||||||
formDetail.userId = data.id;
|
}
|
||||||
formDetail.citizenId = data.citizenId;
|
} catch (error) {
|
||||||
formDetail.prefix = data.prefix;
|
messageError($q, error);
|
||||||
formDetail.fullName = `${data.firstName} ${data.lastName}`;
|
}
|
||||||
formDetail.firstName = data.firstName;
|
}
|
||||||
formDetail.lastName = data.lastName;
|
|
||||||
formDetail.position = data.position;
|
|
||||||
formDetail.oc = data.rootShortName;
|
|
||||||
formDetail.positionLevel = data.posLevelName;
|
|
||||||
formDetail.posNo = data.posNo ?? "";
|
|
||||||
formDetail.birthDate = data.birthDate;
|
|
||||||
// formDetail.govAge = data.govAge; // ยังไม่มี
|
|
||||||
formDetail.salary = data.salary;
|
|
||||||
formDetail.posExecutive = data.posExecutive;
|
|
||||||
formDetail.positionArea = data.positionArea;
|
|
||||||
await fetchDataAllDetail();
|
|
||||||
|
|
||||||
emit("update:formDeital", formDetail);
|
async function updateFormDetail(data: DataProfile) {
|
||||||
})
|
formDetail.root = data.root;
|
||||||
.catch((err) => {
|
formDetail.rootId = data.rootId;
|
||||||
messageError($q, err);
|
formDetail.userId = data.profileId;
|
||||||
});
|
formDetail.citizenId = data.citizenId;
|
||||||
|
formDetail.prefix = data.prefix;
|
||||||
|
formDetail.fullName = `${data.firstName} ${data.lastName}`;
|
||||||
|
formDetail.firstName = data.firstName;
|
||||||
|
formDetail.lastName = data.lastName;
|
||||||
|
formDetail.position = data.position;
|
||||||
|
formDetail.oc = data.rootShortName;
|
||||||
|
formDetail.positionLevel = data.posLevelName;
|
||||||
|
formDetail.posNo = data.posNo ?? "";
|
||||||
|
formDetail.birthDate = data.birthDate;
|
||||||
|
// formDetail.govAge = data.govAge; // ยังไม่มี
|
||||||
|
formDetail.salary = data.salary;
|
||||||
|
formDetail.posExecutive = data.posExecutiveName;
|
||||||
|
formDetail.positionArea = data.positionArea;
|
||||||
|
await fetchDataAllDetail();
|
||||||
|
|
||||||
|
emit("update:formDeital", formDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchDataAllDetail() {
|
async function fetchDataAllDetail() {
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,20 @@ import { useRouter, useRoute } from "vue-router";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
|
|
||||||
import Form from "@/modules/07_appealComplain/views/Form.vue";
|
import Form from "@/modules/07_appealComplain/views/Form.vue";
|
||||||
|
|
||||||
|
import type { DataProfile } from "@/interface/Main";
|
||||||
import type {
|
import type {
|
||||||
FormProfile,
|
FormProfile,
|
||||||
FormDataType,
|
FormDataType,
|
||||||
} from "@/modules/07_appealComplain/interface/response/mainType";
|
} from "@/modules/07_appealComplain/interface/response/mainType";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
|
const storeData = useDataStore();
|
||||||
|
|
||||||
const { findOrgName, success, messageError, showLoader, hideLoader } = mixin;
|
const { findOrgName, success, messageError, showLoader, hideLoader } = mixin;
|
||||||
|
|
||||||
|
|
@ -27,24 +32,28 @@ const formProfile = reactive<FormProfile>({
|
||||||
});
|
});
|
||||||
|
|
||||||
/** ดึงข้อมูลจาก keycloak*/
|
/** ดึงข้อมูลจาก keycloak*/
|
||||||
function getProFile() {
|
async function getProFile() {
|
||||||
showLoader();
|
try {
|
||||||
http
|
showLoader();
|
||||||
.get(config.API.profilePosition())
|
if (!storeData.dataprofilePosition) {
|
||||||
.then((res) => {
|
const res = await http.get(config.API.profilePosition());
|
||||||
const data = res.data.result;
|
await updateFormProfile(res.data.result);
|
||||||
formProfile.profileId = data.profileId;
|
} else {
|
||||||
formProfile.fullname = `${data.prefix}${data.firstName} ${data.lastName}`;
|
await updateFormProfile(storeData.dataprofilePosition);
|
||||||
formProfile.citizenId = data.citizenId;
|
}
|
||||||
formProfile.oc = findOrgName(data);
|
} catch (error) {
|
||||||
formProfile.position = data.position;
|
messageError($q, error);
|
||||||
})
|
} finally {
|
||||||
.catch((e) => {
|
hideLoader();
|
||||||
messageError($q, e);
|
}
|
||||||
})
|
}
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
async function updateFormProfile(data: DataProfile) {
|
||||||
});
|
formProfile.profileId = data.profileId;
|
||||||
|
formProfile.fullname = `${data.prefix}${data.firstName} ${data.lastName}`;
|
||||||
|
formProfile.citizenId = data.citizenId;
|
||||||
|
formProfile.oc = findOrgName(data);
|
||||||
|
formProfile.position = data.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue