fix bug send profileId to registry

This commit is contained in:
Warunee Tamkoo 2023-08-19 13:36:39 +07:00
parent f829dc2098
commit a646ad3d6d
19 changed files with 205 additions and 1052 deletions

View file

@ -1,30 +1,14 @@
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
/>
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="router.go(-1)" />
รายละเอยดการสงตวกล {{ fullname }}
</div>
<q-card bordered class="row col-12 text-dark">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-subtitle2">{{ fullname }}</div>
<q-space />
<q-btn
outline
color="blue"
dense
icon-right="mdi-open-in-new"
class="q-px-sm"
label="ดูข้อมูลทะเบียนประวัติ"
@click="router.push(`/registry/${personId}`)"
/>
<q-btn outline color="blue" dense icon-right="mdi-open-in-new" class="q-px-sm" label="ดูข้อมูลทะเบียนประวัติ"
@click="router.push(`/registry/${personId}`)" />
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
@ -79,24 +63,8 @@
/> -->
</div>
<div class="q-gutter-sm" v-else>
<q-btn
outline
color="public"
dense
class="q-px-sm"
label="บันทึก"
style="width: 80px"
@click="conditionSave"
/>
<q-btn
outline
color="red"
dense
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="cancelBtn"
/>
<q-btn outline color="public" dense class="q-px-sm" label="บันทึก" style="width: 80px" @click="conditionSave" />
<q-btn outline color="red" dense class="q-px-sm" label="ยกเลิก" style="width: 80px" @click="cancelBtn" />
</div>
</div>
<div class="col-12"><q-separator /></div>
@ -110,140 +78,64 @@
</div>
</div>
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="organizationPositionOld"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
hide-bottom-space
:label="`${'ตำแหน่ง/สังกัด'}`"
type="textarea"
/>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" :borderless="!edit"
v-model="organizationPositionOld" :rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
hide-bottom-space :label="`${'ตำแหน่ง/สังกัด'}`" type="textarea" />
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionTypeOld"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งประเภท'}`]"
hide-bottom-space
:label="`${'ตำแหน่งประเภท'}`"
/>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" :borderless="!edit"
v-model="positionTypeOld" :rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งประเภท'}`]" hide-bottom-space
:label="`${'ตำแหน่งประเภท'}`" />
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionLevelOld"
:rules="[(val) => !!val || `${'กรุณากรอกระดับ'}`]"
hide-bottom-space
:label="`${'ระดับ'}`"
/>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" :borderless="!edit"
v-model="positionLevelOld" :rules="[(val) => !!val || `${'กรุณากรอกระดับ'}`]" hide-bottom-space
:label="`${'ระดับ'}`" />
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="posNo"
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่'}`]"
hide-bottom-space
:label="`${'เลขที่'}`"
/>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" :borderless="!edit"
v-model="posNo" :rules="[(val) => !!val || `${'กรุณากรอกเลขที่'}`]" hide-bottom-space
:label="`${'เลขที่'}`" />
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="salary"
:rules="[(val) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
hide-bottom-space
:label="`${'เงินเดือน'}`"
type="number"
/>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" :borderless="!edit"
v-model="salary" :rules="[(val) => !!val || `${'กรุณากรอกเงินเดือน'}`]" hide-bottom-space
:label="`${'เงินเดือน'}`" type="number" />
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="col-xs-6 col-sm-6 row items-center">
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="organization"
:rules="[(val) => !!val || `${'กรุณากรอกโอนไปสังกัด'}`]"
hide-bottom-space
:label="`${'โอนไปสังกัด'}`"
/>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" :borderless="!edit"
v-model="organization" :rules="[(val) => !!val || `${'กรุณากรอกโอนไปสังกัด'}`]" hide-bottom-space
:label="`${'โอนไปสังกัด'}`" />
</div>
</div>
<div class="col-xs-6 col-sm-6 row items-center">
<div class="col-12">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="date"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
>
<datepicker menu-class-name="modalfix" :readonly="!edit" v-model="date" :locale="'th'" autoApply
:enableTimePicker="false" week-start="0">
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :borderless="!edit"
:model-value="date !== null ? date2Thai(date) : null"
:rules="[(val) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
hide-bottom-space
:label="`${'ตั้งแต่วัน'}`"
>
:rules="[(val) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]" hide-bottom-space :label="`${'ตั้งแต่วัน'}`">
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
<q-icon name="event" class="cursor-pointer" :style="edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
">
</q-icon>
</template>
</q-input>
@ -252,19 +144,9 @@
</div>
</div>
<div class="col-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="reason"
:rules="[(val) => !!val || `${'กรุณากรอกหมายเหตุ '}`]"
hide-bottom-space
:label="`${'หมายเหตุ '}`"
type="textarea"
/>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" :borderless="!edit"
v-model="reason" :rules="[(val) => !!val || `${'กรุณากรอกหมายเหตุ '}`]" hide-bottom-space
:label="`${'หมายเหตุ '}`" type="textarea" />
</div>
</div>
</div>
@ -282,17 +164,13 @@ import config from "@/app.config";
import keycloak from "@/plugins/keycloak";
import type { QTableProps, QForm } from "quasar";
// import type {
// TypeFile,
// ResponseDataDetail,
// } from "@/modules/05_placement/interface/response/Transfer";
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin();
const edit = ref<boolean>(false);
const personId = route.params.id as string;
const dataId = route.params.id as string;
const {
date2Thai,
dialogMessage,
@ -303,11 +181,9 @@ const {
dialogConfirm,
} = mixin;
const roleAdmin = ref<boolean>(false);
const myForm = ref<QForm | null>(null);
const name = ref<string>("นายสมคิด ยอดใจ");
const level = ref<string>("ชำนาญการพิเศษ");
const institution = ref<string>("ฝ่ายบริหารงานทั่วไป");
const personId = ref<string>("");
const fullname = ref<string>("");
const id = ref<string>("");
const prefix = ref<string>("");
@ -327,59 +203,16 @@ const positionLevelOld = ref<string>("");
const positionNumberOld = ref<string>("");
const organizationPositionOld = ref<string>("");
const isActive = ref<string>("");
// const responseData = ref<ResponseDataDetail>({
// createdAt: new Date(),
// date: new Date(),
// id: "",
// organization: "",
// organizationPositionOld: "",
// positionLevelOld: "",
// positionNumberOld: "",
// positionTypeOld: "",
// reason: "",
// salary: 0,
// status: "",
// });
// const rows = ref<TypeFile[]>([]);
// const columns = ref<QTableProps["columns"]>([
// {
// name: "no",
// align: "left",
// label: "",
// sortable: true,
// field: "no",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
// {
// name: "fileName",
// align: "left",
// label: "",
// sortable: true,
// field: "fileName",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
// {
// name: "btnMicrosoft",
// align: "right",
// label: "",
// sortable: true,
// field: "btnMicrosoft",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
// ]);
const getData = async () => {
showLoader();
await http
.get(config.API.repatriationDetail(personId))
.get(config.API.repatriationDetail(dataId))
.then((res: any) => {
const data = res.data.result;
(fullname.value = `${data.prefix}${data.firstName} ${data.lastName}`),
(id.value = data.id);
personId.value = data.profileId;
prefix.value = data.prefix;
firstName.value = data.firstName;
lastName.value = data.lastName;
@ -399,19 +232,20 @@ const getData = async () => {
isActive.value = data.isActive;
})
.catch((e) => {
// messageError($q, e);
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
//
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success: any) => {
@ -443,7 +277,7 @@ const saveData = async () => {
};
showLoader();
await http
.put(config.API.repatriationMainEdit(personId.toString()), body)
.put(config.API.repatriationMainEdit(dataId), body)
.then((res: any) => {
// const data = res.data.result;
// console.log(data);
@ -459,35 +293,6 @@ const saveData = async () => {
});
};
// const confirmMessage = async () => {
// dialogMessage(
// $q,
// " ?",
// " ",
// "mdi-help-circle-outline",
// "",
// "primary",
// () => sendConfirm(),
// undefined
// );
// };
// const sendConfirm = async () => {
// showLoader();
// await http
// .get(config.API.transferConfirmId(personId.toString()))
// .then((res: any) => {
// // const data = res.data.result;
// // console.log(data);
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// await getData();
// hideLoader();
// });
// };
onMounted(async () => {
await getData();
});
@ -497,11 +302,13 @@ onMounted(async () => {
border-radius: 5px;
height: 70px;
}
.text-top {
color: gray;
font-weight: 400;
padding-bottom: 3px;
}
.text-detail {
font-weight: 500;
}