no message

This commit is contained in:
STW_TTTY\stwtt 2024-05-21 13:29:53 +07:00
parent fb2b9b4c30
commit 6a763e819b
4 changed files with 18 additions and 10 deletions

View file

@ -86,5 +86,5 @@ export default {
orgProfileEmp: `${orgEmployeePos}/profile`, orgProfileEmp: `${orgEmployeePos}/profile`,
orgSearchProfileEmp: `${orgProfile}-employee/search`, orgSearchProfileEmp: `${orgProfile}-employee/search`,
orgProfileById:(id:string)=>`${orgProfile}/${id}` orgProfileById:(id:string,type:string)=>`${orgProfile}${type}/${id}`
}; };

View file

@ -3,7 +3,7 @@ import { ref, reactive, watch, onMounted } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useRouter } from "vue-router"; import { useRouter,useRoute } from "vue-router";
/** importType*/ /** importType*/
import type { PersonalImformation } from "@/components/information/interface/response/Information"; import type { PersonalImformation } from "@/components/information/interface/response/Information";
@ -14,13 +14,16 @@ import type { Avatar } from "@/components/information/interface/response/avatar"
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const route = useRoute()
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const router = useRouter(); const router = useRouter();
const $q = useQuasar(); const $q = useQuasar();
const retireDate = ref<Date>(); const retireDate = ref<Date>();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const fileName = ref<string>(""); const fileName = ref<string>("");
const empType = ref<string>(
route.name !== "appoint-employee-detail" ? "" : "-employee"
);
/** props*/ /** props*/
const props = defineProps({ const props = defineProps({
id: { id: {
@ -101,7 +104,7 @@ function calculateAge(birthDate: Date | null) {
async function fetchInformation(id: string) { async function fetchInformation(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.orgProfileById(id)) .get(config.API.orgProfileById(id,empType.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
imformation.prefix = data.prefix ? data.prefix : "-"; imformation.prefix = data.prefix ? data.prefix : "-";
@ -115,6 +118,11 @@ async function fetchInformation(id: string) {
avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`; avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`;
avatar.position = data.position ? data.position : "-"; avatar.position = data.position ? data.position : "-";
if(data.avatarName){
fetchProfile(data.id as string)
}else{
statusLoad.value.val = true;
}
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -132,7 +140,7 @@ async function fetchInformation(id: string) {
async function fetchProfileGov(id: string) { async function fetchProfileGov(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewGovernmentById(id, "")) .get(config.API.profileNewGovernmentById(id, empType.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
goverment.oc = data.org !== "" ? data.org : "-"; goverment.oc = data.org !== "" ? data.org : "-";
@ -179,7 +187,7 @@ watch(
fetchInformation(props.id); fetchInformation(props.id);
fetchProfileGov(props.id); fetchProfileGov(props.id);
fileName.value = `profile-${props.id}`; fileName.value = `profile-${props.id}`;
fetchProfile(props.id as string); // fetchProfile(props.id as string);
} }
} }
} }

View file

@ -72,8 +72,8 @@ const fecthappointmentByid = async () => {
const data = res.data.result; const data = res.data.result;
appointment.value = data; appointment.value = data;
profileId.value = data.profileId; profileId.value = data.profileId;
title.value.fullname = `${data.prefix}${data.firstname ?? "-"} ${ title.value.fullname = `${data.prefix}${data.firstName ?? "-"} ${
data.lastname ?? "-" data.lastName ?? "-"
}`; }`;
title.value.organizationPositionOld = data.organizationPositionOld ?? "-"; title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
title.value.positionLevelOld = data.positionLevelOld ?? "-"; title.value.positionLevelOld = data.positionLevelOld ?? "-";

View file

@ -92,8 +92,8 @@ interface ResponseData {
citizenId: string; citizenId: string;
profileId: string; profileId: string;
prefix: string; prefix: string;
firstname: string; firstName: string;
lastname: string; lastName: string;
organizationPositionOld: string; organizationPositionOld: string;
positionLevelOld: string; positionLevelOld: string;
positionTypeOld: string; positionTypeOld: string;