fixing route

This commit is contained in:
Warunee Tamkoo 2024-08-13 09:45:59 +07:00
parent 1333e53c63
commit d0ac01b92e
5 changed files with 32 additions and 22 deletions

View file

@ -22,7 +22,7 @@ const retireDate = ref<Date>();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const isEmployee = defineModel("isEmployee", { type: String }); const isEmployee = defineModel("isEmployee", { type: String });
const empType = ref<string>(""); const empType = ref<string>("officer");
/** props*/ /** props*/
const props = defineProps({ const props = defineProps({
id: { id: {
@ -95,7 +95,12 @@ 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, empType.value)) .get(
config.API.orgProfileById(
id,
`${empType.value == "employee" ? `-${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 : "-";
@ -128,7 +133,12 @@ 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, empType.value)) .get(
config.API.profileNewGovernmentById(
id,
`${empType.value == "employee" ? `-${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 : "-";
@ -155,7 +165,7 @@ async function fetchProfileGov(id: string) {
} }
function redirecToRegistry() { function redirecToRegistry() {
router.push(`/registry-officer${empType.value}/${props.id}`); router.push(`/registry-${empType.value}/${props.id}`);
modal.value = false; modal.value = false;
} }
@ -168,8 +178,8 @@ watch(
empType.value = empType.value =
route.name === "appoint-employee-detail" || route.name === "appoint-employee-detail" ||
isEmployee.value == "EMPLOYEE" isEmployee.value == "EMPLOYEE"
? "-employee" ? "employee"
: ""; : "officer";
fetchInformation(props.id); fetchInformation(props.id);
fetchProfileGov(props.id); fetchProfileGov(props.id);

View file

@ -277,7 +277,7 @@ const putData = () => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
router.push(`/exit-Interview`); router.push(`/retirement/exit-interview`);
}); });
}; };
</script> </script>

View file

@ -296,7 +296,7 @@ const openModalCalendar = (rows: any) => {
color="blue-9" color="blue-9"
icon="mdi-square-edit-outline" icon="mdi-square-edit-outline"
outline outline
@click="$router.push('/retirement/exit-Interview/edit-question')" @click="$router.push('/retirement/exit-interview/edit-question')"
><span class="q-pl-sm">แกไขคำถาม</span></q-btn ><span class="q-pl-sm">แกไขคำถาม</span></q-btn
> >
</div> </div>
@ -374,7 +374,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -385,7 +385,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -396,7 +396,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -407,7 +407,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -418,7 +418,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -429,7 +429,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -440,7 +440,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -452,7 +452,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -465,7 +465,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >
@ -478,7 +478,7 @@ const openModalCalendar = (rows: any) => {
:props="props" :props="props"
@click=" @click="
router.push( router.push(
`/retirement/exit-Interview/questionnair/${props.row.id}` `/retirement/exit-interview/questionnair/${props.row.id}`
) )
" "
> >

View file

@ -278,7 +278,7 @@ const putData = () => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
router.push(`/exit-Interview`); router.push(`/retirement/exit-interview`);
}); });
}; };
</script> </script>

View file

@ -83,7 +83,7 @@ export default [
}, },
}, },
{ {
path: "/retirement/exit-Interview", path: "/retirement/exit-interview",
name: "exit-Interview", name: "exit-Interview",
component: exitInterviewMain, component: exitInterviewMain,
meta: { meta: {
@ -93,7 +93,7 @@ export default [
}, },
}, },
{ {
path: "/retirement/exit-Interview/questionnair/:id", path: "/retirement/exit-interview/questionnair/:id",
name: "exit-Interview-details", name: "exit-Interview-details",
component: exitInterviewDetails, component: exitInterviewDetails,
meta: { meta: {
@ -103,7 +103,7 @@ export default [
}, },
}, },
{ {
path: "/retirement/exit-Interview/edit-question", path: "/retirement/exit-interview/edit-question",
name: "ExitInterviewEditQuestion", name: "ExitInterviewEditQuestion",
component: exitInterviewEditQuestion, component: exitInterviewEditQuestion,
meta: { meta: {