no message

This commit is contained in:
setthawutttty 2023-09-27 15:39:39 +07:00
parent 5a0bf37501
commit 7d4d3d470d
4 changed files with 128 additions and 28 deletions

View file

@ -81,7 +81,8 @@ export default {
`${insignia}/manage/borrow/${year}/${insigniaTypeId}`, `${insignia}/manage/borrow/${year}/${insigniaTypeId}`,
insigniaManageBorrowById: (insigniaManageProfileId: string) => insigniaManageBorrowById: (insigniaManageProfileId: string) =>
`${insignia}/manage/borrow/${insigniaManageProfileId}`, `${insignia}/manage/borrow/${insigniaManageProfileId}`,
requestinsignia: (type: string,id:string) =>
`${insignia}/request/note/${type}/${id}`,
// InsigniaReport API รายงานระบบเครื่องราชอิสริยาภรณ์ // InsigniaReport API รายงานระบบเครื่องราชอิสริยาภรณ์
// ****** // ******
// type = 39 : 39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย // type = 39 : 39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย
@ -96,4 +97,5 @@ export default {
// fileType = pdf, docx หรือ xlsx // fileType = pdf, docx หรือ xlsx
reportInsignia: (type: string, fileType: string, fileId: string) => reportInsignia: (type: string, fileType: string, fileId: string) =>
`${report}/insignia/${type}/${fileType}/${fileId}`, `${report}/insignia/${type}/${fileType}/${fileId}`,
}; };

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { onMounted, ref } from "vue";
import { QForm, useQuasar } from "quasar"; import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -9,20 +9,23 @@ import config from "@/app.config";
import type { DataOption } from "@/modules/04_registry/components/profileType"; import type { DataOption } from "@/modules/04_registry/components/profileType";
const $q = useQuasar(); const $q = useQuasar();
const myForm = ref<QForm>(); const myForm = ref<any>();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai } = mixin; const { date2Thai,showLoader,success,hideLoader,messageError,dialogConfirm } = mixin;
const files = ref<any>(); const files = ref<any>();
const filesReturn = ref<any>(); const filesReturn = ref<any>();
const OrganazationId = ref<string>(""); const OrganazationId = ref<string>("");
const OrgList = ref<DataOption[]>([]); const OrgList = ref<DataOption[]>([]);
const Datereceive = ref<Date | null>(); const Datereceive = ref<Date | null>(null);
const Datereturn = ref<Date | null>(); const Datereturn = ref<Date | null>();
const remark = ref<string>("") const remark = ref<string>("")
const nullii = ref<any>(null)
const props = defineProps({ const props = defineProps({
modal: Boolean, modal: Boolean,
personId: String,
close: Function, close: Function,
fecthlistInsignia: Function,
fileCheck:String
}); });
// reset // reset
const clearReceiveDate = () => { const clearReceiveDate = () => {
@ -33,27 +36,103 @@ const clearReturnDate = () => {
}; };
const close = () => { const close = () => {
props.close?.(); props.close?.();
Datereceive.value = null; Datereceive.value = null
Datereturn.value = null; files.value = null
OrganazationId.value = ''
Datereturn.value = null
filesReturn.value = null
OrganazationId.value = ''
}; };
const SaveData = async (type:string,id:string) => {
await myForm.value.validate().then((result: boolean) => {
console.log(result)
if (result) {
console.log(1)
dialogConfirm($q,() => dataSave(type,id))
}else{
console.log(2)
}
})};
const dataSave = (type:string,id:string) => {
const formData = new FormData();
if(props.fileCheck === null){
formData.append("Datereceiveinsignia", Datereceive.value);
formData.append("Docreceiveinsignia", files.value);
formData.append("Orgreceiveinsignia", nullii.value);
} else {
formData.append("DateReturnInsignia", Datereturn.value);
formData.append("DocReturnInsignia", filesReturn.value);
formData.append("OrgReturnInsignia", nullii.value);
}
showLoader();
http
.put(config.API.requestinsignia(type,id), formData)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
Datereceive.value = null
files.value = null
OrganazationId.value = ''
Datereturn.value = null
filesReturn.value = null
OrganazationId.value = ''
props.close?.();
hideLoader();
props.fecthlistInsignia?.()
});
}
const fetchOrgList = async () => {
showLoader();
await http
.get(config.API.typeOc())
.then(async (response: any) => {
const orgArr = response.data.result.map((e: any) => ({
id: e.organizationId,
name: e.organizationName,
}));
// if (props.action == "editData") {
// OrgList.value = [
// {
// id: "00000000-0000-0000-0000-000000000000",
// name: "",
// },
// ...orgArr,
// ];
// } else {
OrgList.value = orgArr;
// }
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
};
onMounted(()=>{
fetchOrgList()
})
</script> </script>
<template> <template>
<q-dialog v-model="props.modal" persistent> <q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 900px"> <q-card style="min-width: 900px">
<q-toolbar> <q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold">-นเครองราชฯ</q-toolbar-title> <q-toolbar-title v-if="props.fileCheck === null" class="text-subtitle2 text-bold">รับเครื่องราชฯ</q-toolbar-title>
<q-toolbar-title v-else class="text-subtitle2 text-bold">นเครองราชฯ</q-toolbar-title>
<q-btn icon="close" unelevated round dense @click="close" style="color: #ff8080; background-color: #ffdede" /> <q-btn icon="close" unelevated round dense @click="close" style="color: #ff8080; background-color: #ffdede" />
</q-toolbar> </q-toolbar>
<q-separator /> <q-separator />
<q-form ref="myForm"> <q-form ref="myForm">
<div class="q-pa-md bg-grey-1"> <div class="q-pa-md bg-grey-1">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"> <div v-if="props.fileCheck === null" class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-12 text-weight-bold text-grey-7">
บเครองราชฯ
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<datepicker menu-class-name="modalfix" v-model="Datereceive" :locale="'th'" autoApply borderless <datepicker menu-class-name="modalfix" v-model="Datereceive" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0"> :enableTimePicker="false" week-start="0">
@ -77,7 +156,8 @@ const close = () => {
</div> </div>
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<q-file ref="myForm" outlined dense v-model="files" label="ไฟล์หลักฐานการรับ" lazy-rules
<q-file outlined dense v-model="files" label="ไฟล์หลักฐานการรับ" lazy-rules
:rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการรับ']" hide-bottom-space> :rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการรับ']" hide-bottom-space>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="attach_file" color="primary" /> <q-icon name="attach_file" color="primary" />
@ -85,14 +165,14 @@ const close = () => {
</q-file> </q-file>
</div> </div>
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<q-select hide-bottom-space :options="OrgList" dense borderless option-label="name" option-value="id" <q-select hide-bottom-space :options="OrgList" dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="OrganazationId" lazy-rules :label="`หน่วยงานที่รับ`" emit-value map-options outlined v-model="OrganazationId" lazy-rules :label="`หน่วยงานที่รับ`"
:rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่รับ']" /> :rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่รับ']" />
</div> </div>
<div class="col-12 q-mt-md text-weight-bold text-grey-7"> </div>
นเครองราชฯ <div v-if="props.fileCheck !== null" class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
</div>
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<datepicker menu-class-name="modalfix" v-model="Datereturn" :locale="'th'" autoApply borderless <datepicker menu-class-name="modalfix" v-model="Datereturn" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0"> :enableTimePicker="false" week-start="0">
<template #year="{ year }"> <template #year="{ year }">
@ -104,7 +184,7 @@ const close = () => {
<template #trigger> <template #trigger>
<q-input dense borderless outlined lazy-rules :rules="[(val) => !!val || 'กรุณาเลือกวันที่คืน']" <q-input dense borderless outlined lazy-rules :rules="[(val) => !!val || 'กรุณาเลือกวันที่คืน']"
hide-bottom-space :model-value="Datereturn != null ? date2Thai(Datereturn) : undefined hide-bottom-space :model-value="Datereturn != null ? date2Thai(Datereturn) : undefined
" :label="`${'วันที่ได้รับ'}`" clearable @clear="clearReturnDate"> " :label="`${'วันที่คืน'}`" clearable @clear="clearReturnDate">
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" color="primary"> <q-icon name="event" class="cursor-pointer" color="primary">
</q-icon> </q-icon>
@ -114,7 +194,7 @@ const close = () => {
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<q-file ref="myForm" outlined dense v-model="filesReturn" label="ไฟล์หลักฐานการคืน" lazy-rules <q-file outlined dense v-model="filesReturn" label="ไฟล์หลักฐานการคืน" lazy-rules
:rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการคืน']" hide-bottom-space> :rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการคืน']" hide-bottom-space>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="attach_file" color="primary" /> <q-icon name="attach_file" color="primary" />
@ -127,19 +207,19 @@ const close = () => {
:rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่คืน']" /> :rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่คืน']" />
</div> </div>
<div class="col-xs-12 col-sm-12"> <!-- <div class="col-xs-12 col-sm-12">
<q-input type="textarea" v-model="remark" outlined dense rows="3" :label="`${'หมายเหตุ'}`"/> <q-input type="textarea" v-model="remark" outlined dense rows="3" :label="`${'หมายเหตุ'}`"/>
</div> </div> -->
</div> </div>
</div> </div>
</div>
</q-form> </q-form>
<q-separator /> <q-separator />
<div class="q-px-md q-py-sm"> <div class="q-px-md q-py-sm">
<div class="row justify-end"> <div class="row justify-end">
<q-btn label="บันทึก" color="public"> <q-btn label="บันทึก" color="public" @click="SaveData(props.fileCheck === null ? 'receive':'return',props.personId as string)">
<q-tooltip>นท</q-tooltip> <q-tooltip>นท</q-tooltip>
</q-btn> </q-btn>
</div> </div>

View file

@ -58,6 +58,12 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
datepay: date2Thai(e.datePayment), datepay: date2Thai(e.datePayment),
typepay: e.typePayment, typepay: e.typePayment,
address: e.address, address: e.address,
dateReceiveInsignia:e.dateReceiveInsignia,
dateReturnInsignia:e.dateReturnInsignia,
docReceiveInsignia:e.docReceiveInsignia,
docReturnInsignia:e.docReturnInsignia,
orgReceiveInsignia:e.orgReceiveInsignia,
orgReturnInsignia:e.orgReturnInsignia,
})); }));
rows.value = alllist rows.value = alllist
listInsignia.value = alllist listInsignia.value = alllist

View file

@ -37,6 +37,8 @@ const fileinvoice = ref<any>(null);
const loadView = ref<boolean>(false); const loadView = ref<boolean>(false);
const insigniaTypeOption = ref<any>([]); const insigniaTypeOption = ref<any>([]);
const ModalDialog = ref<boolean>(false); const ModalDialog = ref<boolean>(false);
const dateReceiveInsignia = ref<Date>()
const fileCheck = ref<any>()
onMounted(async () => { onMounted(async () => {
await fecthRound(); await fecthRound();
}); });
@ -426,8 +428,10 @@ const paginationLabel = (start: number, end: number, total: number) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total; if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total;
}; };
const OpenModal = () => { const OpenModal = (data:any) => {
ModalDialog.value = true; ModalDialog.value = true;
fileCheck.value = data.docReceiveInsignia
personId.value = data.id
}; };
</script> </script>
@ -721,7 +725,9 @@ const OpenModal = () => {
</q-item-section> </q-item-section>
<q-item-section>เเกไขขอม</q-item-section> <q-item-section>เเกไขขอม</q-item-section>
</q-item> </q-item>
<q-item clickable v-close-popup @click="OpenModal()"> <q-item
:disable="props.row.docReceiveInsignia !== null && props.row.docReturnInsignia !== null"
clickable v-close-popup @click="OpenModal(props.row)">
<q-item-section <q-item-section
style="min-width: 0px" style="min-width: 0px"
avatar avatar
@ -754,7 +760,13 @@ const OpenModal = () => {
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
<Dialogbody :modal="ModalDialog" :close="close" /> <Dialogbody
:modal="ModalDialog"
:close="close"
:fileCheck="fileCheck"
:personId="personId"
:fecthlistInsignia="fecthlistInsignia"/>
<DialogForm <DialogForm
:modal="modal" :modal="modal"
:save="save" :save="save"