no message

This commit is contained in:
STW_TTTY\stwtt 2024-03-28 11:59:00 +07:00
parent da809fe9a6
commit 28cdbd4a7e

View file

@ -11,7 +11,7 @@ import type { DataPerson } from "@/modules/04_registryNew/interface/response/Mai
import avatar from "@/assets/avatar_user.jpg"; import avatar from "@/assets/avatar_user.jpg";
import TabMain from "@/modules/04_registryNew/components/detail/TabMain.vue"; import TabMain from "@/modules/04_registryNew/components/detail/TabMain.vue";
import UploadFile from "@/modules/11_discipline/components/UploadFile.vue"; import UploadFile from "@/modules/11_discipline/components/UploadFile.vue";
import { ResponseObject } from "../interface/response/Profile"; import type { ResponseObject } from "@/modules/04_registryNew/interface/response/Profile";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
/** ถึงเเก่กรรม */ /** ถึงเเก่กรรม */
const dialogPassaway = ref<boolean>(false); const dialogPassaway = ref<boolean>(false);
@ -33,7 +33,7 @@ const {
messageError, messageError,
success, success,
date2Thai, date2Thai,
dateToISO dateToISO,
} = mixin; } = mixin;
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
@ -181,7 +181,7 @@ async function helpPost() {
router.push("/help-government"); router.push("/help-government");
}); });
}); });
}; }
/** ส่งตัวกลับ */ /** ส่งตัวกลับ */
async function repatriationPost() { async function repatriationPost() {
@ -202,7 +202,7 @@ async function repatriationPost() {
router.push("/repatriate"); router.push("/repatriate");
}); });
}); });
}; }
/** แต่งตังเลื่อน */ /** แต่งตังเลื่อน */
async function appointPost() { async function appointPost() {
@ -223,12 +223,12 @@ async function appointPost() {
router.push("/appoint-promote"); router.push("/appoint-promote");
}); });
}); });
}; }
/** ถึงเเก่กรรม */ /** ถึงเเก่กรรม */
async function clickPassaway() { async function clickPassaway() {
dialogPassaway.value = true; dialogPassaway.value = true;
}; }
/** ให้ออกจากราชการ */ /** ให้ออกจากราชการ */
async function outPost() { async function outPost() {
@ -249,10 +249,10 @@ async function outPost() {
router.push("/dismiss-order"); router.push("/dismiss-order");
}); });
}); });
}; }
/** อื่นๆ */ /** อื่นๆ */
async function otherPost(){ async function otherPost() {
const formData = new FormData(); const formData = new FormData();
formData.append("id", profileId.value); formData.append("id", profileId.value);
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
@ -270,11 +270,11 @@ async function otherPost(){
router.push("/other"); router.push("/other");
}); });
}); });
}; }
function closePassaway() { function closePassaway() {
dialogPassaway.value = false; dialogPassaway.value = false;
}; }
async function clickSaveDeceased() { async function clickSaveDeceased() {
const formData = new FormData(); const formData = new FormData();
@ -285,18 +285,9 @@ async function clickSaveDeceased() {
formData.append("Reason", reasonDeath.value); formData.append("Reason", reasonDeath.value);
formData.append("ProfileId", profileId.value); formData.append("ProfileId", profileId.value);
$q.dialog({ dialogConfirm($q,()=>{
title: "ยืนยันการบันทึกข้อมูล", showLoader();
message: "ต้องการบันทึกข้อมูลนี้ใช่หรือไม่?", http
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
showLoader();
await http
.post(config.API.listDeceased(), formData) .post(config.API.listDeceased(), formData)
.then(() => { .then(() => {
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
@ -308,10 +299,8 @@ async function clickSaveDeceased() {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}) })
.onCancel(() => { }) }
.onDismiss(() => { });
};
onMounted(async () => { onMounted(async () => {
fileName.value = `profile-${profileId.value}`; fileName.value = `profile-${profileId.value}`;
@ -323,25 +312,61 @@ onMounted(async () => {
<template> <template>
<div class="row items-center q-gutter-sm q-mb-xs"> <div class="row items-center q-gutter-sm q-mb-xs">
<div class="toptitle text-dark row items-center q-py-xs"> <div class="toptitle text-dark row items-center q-py-xs">
<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)"
/>
ทะเบยนประว ทะเบยนประว
</div> </div>
<q-space /> <q-space />
<q-btn-dropdown size="md" rounded unelevated color="grey-4" text-color="red" icon="mdi-home-export-outline" <q-btn-dropdown
dropdown-icon="mdi-chevron-down"> size="md"
rounded
unelevated
color="grey-4"
text-color="red"
icon="mdi-home-export-outline"
dropdown-icon="mdi-chevron-down"
>
<q-list v-for="(item, index) in itemsMenu" key="index"> <q-list v-for="(item, index) in itemsMenu" key="index">
<q-item clickable @click="item.name == 'ช่วยราชการ' ? helpPost() <q-item
: item.name == 'ส่งตัวกลับ' ? repatriationPost() clickable
: item.name == 'แต่งตั้ง-เลื่อน-ย้าย' ? appointPost() @click="
: item.name == 'ถึงแก่กรรม' ? clickPassaway() item.name == 'ช่วยราชการ'
: item.name == 'ให้ออกจากราชการ' ? outPost() ? helpPost()
: item.name == 'อื่นๆ' ? otherPost() : null" v-close-popup> : item.name == 'ส่งตัวกลับ'
? repatriationPost()
: item.name == 'แต่งตั้ง-เลื่อน-ย้าย'
? appointPost()
: item.name == 'ถึงแก่กรรม'
? clickPassaway()
: item.name == 'ให้ออกจากราชการ'
? outPost()
: item.name == 'อื่นๆ'
? otherPost()
: null
"
v-close-popup
>
<q-item-section>{{ item.name }}</q-item-section> <q-item-section>{{ item.name }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
</q-btn-dropdown> </q-btn-dropdown>
<q-btn unelevated round color="grey-4" text-color="primary" icon="mdi-file-eye-outline" size="md"> <q-btn
unelevated
round
color="grey-4"
text-color="primary"
icon="mdi-file-eye-outline"
size="md"
>
<q-tooltip>ดาวนไฟล</q-tooltip> <q-tooltip>ดาวนไฟล</q-tooltip>
<q-menu> <q-menu>
<q-list style="min-width: 120px"> <q-list style="min-width: 120px">
@ -363,10 +388,13 @@ onMounted(async () => {
<div class="col-sm-3 col-md-2"></div> <div class="col-sm-3 col-md-2"></div>
<div class="col"> <div class="col">
<div class="col-12 text-primary"> <div class="col-12 text-primary">
<h2 class="title q-ma-none q-pa-none" v-if="formDetail && formDetail.firstName && formDetail.lastName"> <h2
class="title q-ma-none q-pa-none"
v-if="formDetail && formDetail.firstName && formDetail.lastName"
>
{{ {{
`${formDetail?.prefix}${formDetail?.firstName} ${formDetail?.lastName}` `${formDetail?.prefix}${formDetail?.firstName} ${formDetail?.lastName}`
}} }}
</h2> </h2>
</div> </div>
<div class="col-12 subtitle">{{ formDetail?.position }}</div> <div class="col-12 subtitle">{{ formDetail?.position }}</div>
@ -378,8 +406,14 @@ onMounted(async () => {
<q-avatar size="130px"> <q-avatar size="130px">
<img :src="profilePicture" /> <img :src="profilePicture" />
</q-avatar> </q-avatar>
<q-btn round color="white" text-color="primary" icon="mdi-pencil-outline" <q-btn
style="position: absolute; bottom: 0; right: 0" @click="selectFile"> round
color="white"
text-color="primary"
icon="mdi-pencil-outline"
style="position: absolute; bottom: 0; right: 0"
@click="selectFile"
>
</q-btn> </q-btn>
</div> </div>
@ -419,66 +453,114 @@ onMounted(async () => {
<!-- Dialog แนบใบมรณบตร --> <!-- Dialog แนบใบมรณบตร -->
<q-dialog v-model="dialogPassaway" persistent> <q-dialog v-model="dialogPassaway" persistent>
<div class="col-12"> <q-card style="min-width: 600px">
<q-card style="width: 100vw; max-width: 60vw"> <q-form ref="myForm">
<q-form ref="myForm"> <q-card-section class="flex justify-between" style="padding: 0">
<q-card-section class="q-py-sm row"> <DialogHeader tittle="ถึงแก่กรรม" :close="closePassaway" />
<DialogHeader tittle="ถึงแก่กรรม" :close="closePassaway" /> </q-card-section>
<div class="col-12 row q-pa-sm q-col-gutter-sm"> <q-separator />
<q-file class="col-12 col-sm-6 col-md-5" outlined dense v-model="filePassaway" label="แนบใบมรณบัตร" <q-card-section class="q-pa-md row q-col-gutter-sm">
hide-bottom-space lazy-rules accept=".pdf"> <q-file
<q-separator /> class="col-12 col-sm-6 col-md-5"
outlined
dense
v-model="filePassaway"
label="แนบใบมรณบัตร"
hide-bottom-space
lazy-rules
accept=".pdf"
>
<q-separator />
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
<q-input
class="col-12 col-sm-6 col-md-7"
dense
outlined
v-model="deathCertificateNo"
label="เลขที่ใบมรณบัตร"
/>
<datepicker
class="col-12 col-sm-6 col-md-5"
menu-class-name="modalfix"
v-model="dateDeath"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
outlined
dense
hide-bottom-space
class="full-width datepicker"
:model-value="dateDeath != null ? date2Thai(dateDeath) : null"
:label="`${'วันที่เสียชีวิต'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เสียชีวิต'}`]"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="attach_file" /> <q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template> </template>
</q-file> </q-input>
<q-input class="col-12 col-sm-6 col-md-7" dense outlined v-model="deathCertificateNo" </template>
label="เลขที่ใบมรณบัตร" /> </datepicker>
<datepicker class="col-12 col-sm-6 col-md-5" menu-class-name="modalfix" v-model="dateDeath" :locale="'th'" <q-input
autoApply borderless :enableTimePicker="false" week-start="0"> class="col-12 col-sm-6 col-md-7"
<template #year="{ year }"> dense
{{ year + 543 }} outlined
</template> v-model="placeDeathCertificate"
<template #year-overlay-value="{ value }"> label="สถานที่ออกใบมรณบัตร"
{{ parseInt(value + 543) }} />
</template> <q-input
<template #trigger> class="col-12"
<q-input outlined dense class="full-width datepicker" :model-value="dateDeath != null ? date2Thai(dateDeath) : null dense
" :label="`${'วันที่เสียชีวิต'}`" :rules="[ outlined
(val) => !!val || `${'กรุณาเลือกวันที่เสียชีวิต'}`, v-model="reasonDeath"
]"> label="เหตุผลการเสียชีวิต"
<template v-slot:prepend> type="textarea"
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> />
</q-icon> </q-card-section>
</template>
</q-input>
</template>
</datepicker>
<q-input class="col-12 col-sm-6 col-md-7" dense outlined v-model="placeDeathCertificate" <q-separator />
label="สถานที่ออกใบมรณบัตร" /> <q-card-actions align="right">
<q-separator /> <q-btn
<q-input class="col-12" dense outlined v-model="reasonDeath" label="เหตุผลการเสียชีวิต" type="textarea" /> unelevated
</div> label="บันทึก"
<q-space /> dense
</q-card-section> color="public"
<q-separator /> class="q-px-md"
<div class="flex justify-end q-pa-sm q-gutter-sm"> @click="clickSaveDeceased"
<q-btn unelevated label="บันทึก" color="public" @click="clickSaveDeceased" :disable="filePassaway === null || :disable="
deathCertificateNo === '' || filePassaway === null ||
placeDeathCertificate === '' || deathCertificateNo === '' ||
reasonDeath === '' placeDeathCertificate === '' ||
"> reasonDeath === ''
<q-tooltip>นท</q-tooltip> "
</q-btn> >
</div> <q-tooltip>นท</q-tooltip>
</q-form> </q-btn>
</q-card> </q-card-actions>
</div> </q-form>
</q-card>
</q-dialog> </q-dialog>
</template> </template>
<style scoped> <style scoped>