2023-08-29 11:28:58 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, ref } from "vue";
|
|
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
2023-09-21 10:49:05 +07:00
|
|
|
import type { QForm } from "quasar";
|
2023-09-22 16:10:30 +07:00
|
|
|
import type { resHelpDetail } from "@/modules/05_placement/interface/response/officer";
|
2023-08-29 11:28:58 +07:00
|
|
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const mixin = useCounterMixin();
|
|
|
|
|
const edit = ref<boolean>(false);
|
|
|
|
|
const dataId = route.params.id as string;
|
|
|
|
|
const {
|
|
|
|
|
date2Thai,
|
|
|
|
|
dialogConfirm,
|
|
|
|
|
messageError,
|
|
|
|
|
showLoader,
|
|
|
|
|
hideLoader,
|
|
|
|
|
success,
|
|
|
|
|
} = mixin;
|
|
|
|
|
|
2023-09-21 10:49:05 +07:00
|
|
|
|
2023-08-29 11:28:58 +07:00
|
|
|
const myForm = ref<QForm | null>(null);
|
|
|
|
|
const fullname = ref<string>("");
|
|
|
|
|
const id = ref<string>("");
|
|
|
|
|
const profileId = ref<string>("");
|
|
|
|
|
const prefix = ref<string>("");
|
|
|
|
|
const firstName = ref<string>("");
|
|
|
|
|
const lastName = ref<string>("");
|
|
|
|
|
const position = ref<string>("");
|
|
|
|
|
const posNo = ref<string>("");
|
|
|
|
|
const positionLevel = ref<string>("");
|
|
|
|
|
const createdAt = ref<string>("");
|
|
|
|
|
const organization = ref<string>("");
|
|
|
|
|
const reason = ref<string>("");
|
|
|
|
|
const status = ref<string>("");
|
|
|
|
|
const dateStart = ref<Date | null>(null);
|
|
|
|
|
const dateEnd = ref<Date | null>(null);
|
|
|
|
|
const salary = ref<string>("");
|
|
|
|
|
const positionTypeOld = ref<string>("");
|
|
|
|
|
const positionLevelOld = ref<string>("");
|
|
|
|
|
const positionNumberOld = ref<string>("");
|
|
|
|
|
const organizationPositionOld = ref<string>("");
|
|
|
|
|
const isActive = ref<string>("");
|
2023-09-06 15:13:07 +07:00
|
|
|
const avatar = ref<string>("");
|
2023-08-29 11:28:58 +07:00
|
|
|
|
|
|
|
|
const getData = async () => {
|
|
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.officerDetail(dataId))
|
2023-09-22 16:10:30 +07:00
|
|
|
.then((res: resHelpDetail) => {
|
2023-08-29 11:28:58 +07:00
|
|
|
const data = res.data.result;
|
|
|
|
|
(fullname.value = `${data.prefix}${data.firstName} ${data.lastName}`),
|
|
|
|
|
(id.value = data.id);
|
|
|
|
|
profileId.value = data.profileId;
|
|
|
|
|
prefix.value = data.prefix;
|
2023-09-06 15:13:07 +07:00
|
|
|
avatar.value = data.avatar ?? "";
|
2023-08-29 11:28:58 +07:00
|
|
|
firstName.value = data.firstName;
|
|
|
|
|
lastName.value = data.lastName;
|
|
|
|
|
position.value = data.position;
|
|
|
|
|
posNo.value = data.posNo;
|
|
|
|
|
positionLevel.value = data.positionLevel;
|
|
|
|
|
createdAt.value = data.createdAt;
|
|
|
|
|
organization.value = data.organization;
|
|
|
|
|
reason.value = data.reason;
|
|
|
|
|
status.value = data.status;
|
|
|
|
|
dateStart.value = data.dateStart;
|
|
|
|
|
dateEnd.value = data.dateEnd;
|
|
|
|
|
positionTypeOld.value = data.positionTypeOld;
|
|
|
|
|
positionLevelOld.value = data.positionLevelOld;
|
|
|
|
|
positionNumberOld.value = data.positionNumberOld;
|
|
|
|
|
organizationPositionOld.value = data.organizationPositionOld;
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const getClass = (val: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
"full-width inputgreen cursor-pointer": val,
|
|
|
|
|
"full-width cursor-pointer": !val,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
//
|
|
|
|
|
const conditionSave = async () => {
|
|
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
async () => await saveData(),
|
|
|
|
|
"ต้องการแก้ไขข้อมูลหรือไม่?",
|
|
|
|
|
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
|
|
|
|
|
);
|
|
|
|
|
};
|
2023-09-21 10:49:05 +07:00
|
|
|
|
2023-08-29 11:28:58 +07:00
|
|
|
const cancelBtn = () => {
|
|
|
|
|
edit.value = !edit;
|
|
|
|
|
getData();
|
|
|
|
|
};
|
|
|
|
|
const saveData = async () => {
|
|
|
|
|
const body = {
|
|
|
|
|
organization: organization.value,
|
|
|
|
|
reason: reason.value,
|
|
|
|
|
organizationPositionOld: organizationPositionOld.value,
|
|
|
|
|
dateStart: dateStart.value,
|
|
|
|
|
dateEnd: dateEnd.value,
|
|
|
|
|
positionTypeOld: positionTypeOld.value,
|
|
|
|
|
positionLevelOld: positionLevelOld.value,
|
|
|
|
|
positionNumberOld: posNo.value,
|
|
|
|
|
amountOld: salary.value,
|
|
|
|
|
};
|
|
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.put(config.API.officerMainEdit(dataId), body)
|
|
|
|
|
.then((res: any) => {
|
|
|
|
|
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
|
|
|
|
|
edit.value = false;
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(async () => {
|
|
|
|
|
await getData();
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await getData();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2023-08-11 15:11:36 +07:00
|
|
|
<template>
|
|
|
|
|
<div class="toptitle text-dark col-12 row items-center">
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary"
|
|
|
|
|
class="q-mr-sm" @click="router.push(`/help-government`)" />
|
2023-08-11 17:09:10 +07:00
|
|
|
รายละเอียดการช่วยราชการ {{ fullname }}
|
2023-08-11 15:11:36 +07:00
|
|
|
</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 />
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-btn outline color="blue" dense icon-right="mdi-open-in-new" class="q-px-sm"
|
|
|
|
|
label="ดูข้อมูลทะเบียนประวัติ" @click="router.push(`/registry/${profileId}`)" />
|
2023-08-11 15:11:36 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col-12"><q-separator /></div>
|
|
|
|
|
<div class="row col-12 q-pa-md">
|
|
|
|
|
<div class="col-12 row bg-white q-col-gutter-md">
|
|
|
|
|
<div class="col-xs-3 col-sm-2 col-md-1 row">
|
2023-09-06 15:13:07 +07:00
|
|
|
<q-img :src="avatar" v-if="avatar !== ''" />
|
|
|
|
|
<q-img src="@/assets/avatar_user.jpg" v-else />
|
2023-08-11 15:11:36 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 col-sm-3 row items-center">
|
|
|
|
|
<div class="col-12 q-pl-md">
|
|
|
|
|
<div class="col-12 text-top">ตำแหน่งในสายงาน</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ positionTypeOld }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-6 col-sm-3 row items-center">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="col-12 text-top">ระดับ</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ positionLevelOld }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-08-11 17:09:10 +07:00
|
|
|
<div class="col-xs-6 col-sm-3 row items-center">
|
2023-08-11 15:11:36 +07:00
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="col-12 text-top">สังกัด</div>
|
|
|
|
|
<div class="col-12 text-detail">
|
|
|
|
|
{{ organizationPositionOld }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
|
|
|
|
|
<q-card bordered class="row col-12 text-dark q-mt-sm">
|
|
|
|
|
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
|
|
|
|
|
<div class="q-pl-sm text-weight-bold text-dark">
|
2023-08-11 17:09:10 +07:00
|
|
|
แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย
|
2023-08-11 15:11:36 +07:00
|
|
|
</div>
|
|
|
|
|
<q-space />
|
2023-08-11 17:09:10 +07:00
|
|
|
<div class="q-gutter-sm" v-if="!edit">
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-btn outline color="primary" dense icon-right="mdi-file-edit-outline"
|
|
|
|
|
class="q-px-sm" label="แก้ไข" style="width: 80px" @click="edit = !edit"
|
|
|
|
|
v-if="!(status == 'REPORT' || status == 'DONE')" />
|
2023-08-11 17:09:10 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="q-gutter-sm" v-else>
|
2023-09-21 10:49:05 +07:00
|
|
|
<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" />
|
2023-08-11 17:09:10 +07:00
|
|
|
</div>
|
2023-08-11 15:11:36 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col-12"><q-separator /></div>
|
2023-08-18 17:34:37 +07:00
|
|
|
<q-form ref="myForm " class="window-width">
|
2023-08-11 17:09:10 +07:00
|
|
|
<div class="row col-12 q-pa-md">
|
|
|
|
|
<div class="col-12 row bg-white q-col-gutter-md">
|
|
|
|
|
<div class="col-xs-12 row items-center">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="text-weight-bold text-grey">
|
|
|
|
|
ตำแหน่งและหน่วยงานเดิม
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12">
|
2023-09-21 10:49:05 +07:00
|
|
|
<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" />
|
2023-08-11 17:09:10 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12"><q-separator /></div>
|
2023-09-13 14:57:30 +07:00
|
|
|
<div class="col-xs-6 col-sm-4 row ">
|
2023-08-11 17:09:10 +07:00
|
|
|
<div class="col-12">
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit"
|
|
|
|
|
:borderless="!edit" v-model="organization" :rules="[(val) => !!val || `${'กรุณากรอกโอนไปสังกัด'}`]" hide-bottom-space
|
|
|
|
|
:label="`${'หน่วยงานที่ให้ช่วยราชการ'}`" />
|
2023-08-11 17:09:10 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-09-13 14:57:30 +07:00
|
|
|
<div class="col-xs-6 col-sm-4 row ">
|
2023-08-11 17:09:10 +07:00
|
|
|
<div class="col-12">
|
2023-09-21 10:49:05 +07:00
|
|
|
<datepicker menu-class-name="modalfix" :readonly="!edit" v-model="dateStart" :locale="'th'"
|
|
|
|
|
autoApply :enableTimePicker="false" week-start="0" >
|
2023-08-11 17:09:10 +07:00
|
|
|
<template #year="{ year }">{{ year + 543 }}</template>
|
|
|
|
|
<template #year-overlay-value="{ value }">{{
|
|
|
|
|
parseInt(value + 543)
|
|
|
|
|
}}</template>
|
|
|
|
|
<template #trigger>
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-input :class="getClass(edit)" :outlined="edit" dense :readonly="!edit"
|
|
|
|
|
lazy-rules :borderless="!edit" :rules="[(val) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
|
|
|
|
|
:model-value=" dateStart !== null ? date2Thai(dateStart) : null "
|
|
|
|
|
hide-bottom-space :label="`${'ตั้งแต่วัน'}`" >
|
2023-08-11 17:09:10 +07:00
|
|
|
<template v-slot:prepend>
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-icon name="event" class="cursor-pointer"
|
|
|
|
|
:style=" edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)' " >
|
2023-08-11 17:09:10 +07:00
|
|
|
</q-icon>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</template>
|
|
|
|
|
</datepicker>
|
2023-08-11 15:11:36 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-09-13 14:57:30 +07:00
|
|
|
<div class="col-xs-6 col-sm-4 row ">
|
2023-08-18 17:34:37 +07:00
|
|
|
<div class="col-12">
|
2023-09-21 10:49:05 +07:00
|
|
|
<datepicker menu-class-name="modalfix" :readonly="!edit" v-model="dateEnd" :locale="'th'"
|
|
|
|
|
autoApply :enableTimePicker="false" week-start="0" >
|
2023-08-18 17:34:37 +07:00
|
|
|
<template #year="{ year }">{{ year + 543 }}</template>
|
|
|
|
|
<template #year-overlay-value="{ value }">{{
|
|
|
|
|
parseInt(value + 543)
|
|
|
|
|
}}</template>
|
|
|
|
|
<template #trigger>
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-input :readonly="!edit" :class="getClass(edit)" :outlined="edit" dense
|
|
|
|
|
lazy-rules :borderless="!edit" :model-value="dateEnd !== null ? date2Thai(dateEnd) : null"
|
|
|
|
|
:rules="[(val) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]" hide-bottom-space :label="`${'ถึงวันที่'}`" >
|
2023-08-18 17:34:37 +07:00
|
|
|
<template v-slot:prepend>
|
2023-09-21 10:49:05 +07:00
|
|
|
<q-icon name="event" class="cursor-pointer"
|
|
|
|
|
:style=" edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)' "
|
2023-08-22 15:24:49 +07:00
|
|
|
>
|
2023-08-18 17:34:37 +07:00
|
|
|
</q-icon>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</template>
|
|
|
|
|
</datepicker>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-08-11 17:09:10 +07:00
|
|
|
<div class="col-12">
|
2023-09-21 10:49:05 +07:00
|
|
|
<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" />
|
2023-08-11 17:09:10 +07:00
|
|
|
</div>
|
2023-08-11 15:11:36 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-08-11 17:09:10 +07:00
|
|
|
</q-form>
|
2023-08-11 15:11:36 +07:00
|
|
|
</q-card>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scope>
|
|
|
|
|
.q-img {
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
height: 70px;
|
|
|
|
|
}
|
2023-08-19 13:36:39 +07:00
|
|
|
|
2023-08-11 15:11:36 +07:00
|
|
|
.text-top {
|
|
|
|
|
color: gray;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
padding-bottom: 3px;
|
|
|
|
|
}
|
2023-08-19 13:36:39 +07:00
|
|
|
|
2023-08-11 15:11:36 +07:00
|
|
|
.text-detail {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
</style>
|