ยืม-คืนเครื่องราช

This commit is contained in:
Warunee Tamkoo 2023-08-27 02:53:22 +07:00
parent 8bae20aa2f
commit 6e482172f2
8 changed files with 323 additions and 568 deletions

View file

@ -35,7 +35,7 @@ export default {
insigniaSendToDirector: (roundId: string, ocId: string) => `${insignia}/request/officer/approve/${roundId}/${ocId}`,
insigniaDirectorBackToEdit: (roundId: string, ocId: string) => `${insignia}/request/director/reject/${roundId}/${ocId}`,
insigniaDirectorApproved: (roundId: string, ocId: string) => `${insignia}/request/director/approve/${roundId}/${ocId}`,
insigniaRequestSendNote: (insigniaPeriodId: string) => `${insignia}/insignia/request/send/note/${insigniaPeriodId}`,
insigniaRequestSendNote: (insigniaPeriodId: string) => `${insignia}/request/send/note/${insigniaPeriodId}`,
// uploadfile
uploadfilereceice: (noteId: string) => `${insignia}/request/import/receice/${noteId}`,
@ -53,6 +53,6 @@ export default {
// ยืม-คืนเครื่องราชฯ
insigniaManageBorrow: () => `${insignia}/manage/borrow`,
insigniaManageBorrowReturn: (insigniaManageProfileId: string) => `${insignia}/manage/return/${insigniaManageProfileId}`,
insigniaManageBorrowList: (year: number, insigniaTypeId: string) => `${insignia}/borrow/${year}/${insigniaTypeId}`,
insigniaManageBorrowList: (year: number, insigniaTypeId: string) => `${insignia}/manage/borrow/${year}/${insigniaTypeId}`,
insigniaManageBorrowById: (insigniaManageProfileId: string) => `${insignia}/manage/borrow/${insigniaManageProfileId}`,
};

View file

@ -138,9 +138,6 @@
<q-btn type="a" target="_blank" :href="props.row.pathName" flat dense round color="red" icon="picture_as_pdf">
<q-tooltip>ไฟล PDF</q-tooltip>
</q-btn>
<q-btn flat dense round color="blue" icon="mdi-file-word">
<q-tooltip>ไฟล WORD</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
@ -173,9 +170,9 @@
<q-btn flat dense round color="red" icon="picture_as_pdf">
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<!-- <q-btn flat dense round color="blue" icon="mdi-file-word">
<q-btn flat dense round color="blue" icon="mdi-file-word">
<q-tooltip>ไฟล WORD</q-tooltip>
</q-btn> -->
</q-btn>
</q-td>
</q-tr>
</template>

View file

@ -24,7 +24,7 @@ const {
const redirectToPage = (id: string, name: string) => {
DataStore.insigniaName = name
router.push(`/insignia/allocate/detail/${id}`);
router.push(`/insignia/allocate/org/${id}`);
};
const paging = ref<boolean>(true);
const paginationLabel = (start: string, end: string, total: string) => {
@ -224,13 +224,12 @@ const editData = (data: any) => {
const save = async (insigniaId: string, total: string) => {
showLoader()
const formData = new FormData();
formData.append("Insignia", insigniaId);
formData.append("Year", `${roundYear.value}`);
formData.append("Total", total);
await http
.post(config.API.insigniaManageAdd(), formData)
.post(config.API.insigniaManageAdd(), {
insignia: insigniaId,
year: `${roundYear.value}`,
total: total,
})
.then((res) => {
fecthlistInsignia();
})

View file

@ -42,7 +42,7 @@ onMounted(async () => {
fecthListData();
name.value = DataStore.insigniaName
await fetchTreeRoot()
fetchOrgList()
});
const fecthDashboard = async () => {
@ -70,7 +70,7 @@ const fecthListData = async () => {
// console.log("res===>", res)
rows.value = res.data.result.map((e: any) => ({
id: e.id,
organization: e.organization,
organization: e.organizationOrganization,
total: e.total,
allocate: e.allocate,
remain: e.remain,
@ -82,49 +82,26 @@ const fecthListData = async () => {
.finally(() => hideLoader())
};
const rootOrgID = ref(); // org id root
const fetchTreeRoot = async () => {
// showLoader();
let urlRequest = config.API.chartGetTreeRoot;
const fetchOrgList = async () => {
showLoader();
await http
.get(urlRequest)
.then((response) => {
if (response.data.result.length > 0) {
rootOrgID.value = response.data.result[0].organizationId;
}
})
.catch((e) => {
console.log(e);
})
.finally(async () => {
await fetchOrgChart()
});
};
const fetchOrgChart = async () => {
// showLoader();
let urlRequest = config.API.chartGetOrg(rootOrgID.value);
await http
.get(urlRequest)
.get(config.API.typeOc())
.then(async (response: any) => {
if (response.data.result.length > 0) {
// console.log("response===>", response.data.result[0].children)
orgList.value = await response.data.result[0].children.map((e: any) => ({
id: e.organizationId,
name: e.departmentName
}));
}
orgList.value = response.data.result.map((e: any)=>({
id: e.organizationId,
name: e.organizationName
}))
})
.catch((e) => {
console.log(e);
.catch((err) => {
messageError($q, err)
})
// .finally(() => {
// hideLoader();
// });
.finally(() => {
hideLoader();
});
};
const backHistory = () => {
router.push(`/insignia/allocate/list-allocate`)
router.push(`/insignia/allocate`)
}
const close = () => {
@ -299,7 +276,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
</q-td>
<q-td key="total" :props="props">
<!-- @click="redirectToPage(props.row.id)" -->
{{ props.row.totalInsignia }}
{{ props.row.total }}
</q-td>
<q-td key="allocate" :props="props">
<!-- @click="redirectToPage(props.row.id)" -->

View file

@ -1,84 +0,0 @@
<template>
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle 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)"
/>
<div>เพมรายการเครองราชอสรยาภรณ</div>
</div>
<div class="col-12">
<q-card bordered>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12 row">
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input class="col-2" dense outlined v-model="year" label="ปี" />
<q-input
class="col-8"
dense
outlined
v-model="typeInsig"
label="ประเภทเครื่องราชอิสริยาภรณ์"
/>
<q-input
class="col-2"
dense
outlined
v-model="total"
label="จำนวน"
/>
</div>
</div>
</div>
<q-separator />
<q-separator />
<div class="row col-12 q-pa-sm">
<q-space />
<q-btn
unelevated
dense
class="q-px-md items-center"
color="light-blue-10"
label="บันทึก"
@click="saveData"
/>
</div>
</q-card>
</div>
</div>
</template>
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { ref } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const { date2Thai ,dialogConfirm} = mixin;
const router = useRouter();
const $q = useQuasar();
const dateStart = ref<any>(new Date());
const dateEnd = ref<any>(new Date());
const total = ref<any>("");
const typeInsig = ref<string>("");
const year = ref<string>("");
const datelast = ref<string>("");
const routeName = router.currentRoute.value.name;
const saveData = () => {
dialogConfirm($q,() => DataSave())
}
const DataSave = () => {
router.go(-1)
}
</script>

View file

@ -2,7 +2,7 @@
import { ref, watch, computed } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
import { useResultDataStore } from "@/modules/07_insignia/storeAllocate";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataOption } from "@/modules/04_registry/components/profileType";
@ -20,94 +20,31 @@ const {
hideLoader,
notifyError,
} = mixin;
const status = ref<status>("");
const Advertise = ref<string>("");
const issue = ref<string>("");
const brand = ref<string>("");
const roundNo = ref<string>("");
const roundNo = ref<string | undefined>("");
const cardid = ref<string>("");
const OrganazationId = ref<string>("");
const fullName = ref<string>("");
const volume = ref<string>("");
const episode = ref<string>("");
const duty = ref<string>("");
const announced = ref<string>("");
const firstname = ref<string>("");
const lastname = ref<string>("");
const position = ref<string>("");
const invoice = ref<string | null>(null);
const payment = ref<string>("");
const addressPayment = ref<string | null>(null);
const affiliationRequest = ref<string>("");
const affiliationReceived = ref<string>("");
// const position = ref<string>("");
const receivedate = ref<Date | null>();
const announceDate = ref<Date | null>();
const invoiceDate = ref<Date | null>(null);
const employeeClass = ref<string>("");
const employeeClassOps = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการ กทม.สามัญ" },
{ id: "employee", name: "ลูกจ้างประจำ" },
]);
const returndate = ref<Date | null>();
const reason = ref<string>("");
const listPerson = ref<any>([]);
const OrgList = ref<DataOption[]>([]);
const insigniaNoteProfileId = ref<string>("")
const paymentOp = [
{ label: "จัดส่งทางไปรษณี", value: "จัดส่งทางไปรษณี" },
{ label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" },
];
const volumeOp = [
{ label: "เล่มที่", value: "xx1" },
{ label: "เล่มที่2", value: "xx2" },
{ label: "เล่มที่3", value: "xx3" },
];
const episodeOp = [
{ label: "ตอนที่1", value: "xx1" },
{ label: "ตอนที่2", value: "xx2" },
{ label: "ตอนที่3", value: "xx3" },
];
const dutyOp = [
{ label: "หน้าที่1", value: "xx1" },
{ label: "หน้าที่2", value: "xx2" },
{ label: "หน้าที่3", value: "xx3" },
];
const announcedOp = [
{ label: "ลำดับที่1", value: "xx1" },
{ label: "ลำดับที่2", value: "xx2" },
{ label: "ลำดับที่3", value: "xx3" },
];
const affiliationRequestOp = [
{ label: "สังกัด1", value: "xx1" },
{ label: "สังกัด2", value: "xx2" },
{ label: "สังกัด3", value: "xx3" },
];
const affiliationReceivedOp = [
{ label: "สังกัด4", value: "xx4" },
{ label: "สังกัด5", value: "xx5" },
{ label: "สังกัด6", value: "xx6" },
];
const prefixOp = [
{ label: "นาย", value: "mr" },
{ label: "นางสาว", value: "miss" },
{ label: "นาง", value: "mrs" },
];
const positionOp = [
{ label: "ตำแหน่ง1", value: "xxx1" },
{ label: "ตำแหน่ง2", value: "xxx2" },
{ label: "ตำแหน่ง3", value: "xxx3" },
];
const OrgOp = ref<DataOption[]>([
{ id: "xxx1", name: "หน่วยงาน กทม" },
{ id: "xxx2", name: "หน่วยงาน กทมฯ" },
]);
const clearDateExam = () => {
receivedate.value = null;
announceDate.value = null;
invoiceDate.value = null;
const clearData = () => {
receivedate.value = null
returndate.value = null
OrganazationId.value = ""
roundNo.value = ""
cardid.value = ""
fullName.value = ""
brand.value = ""
reason.value = ""
};
const props = defineProps({
modal: Boolean,
save: {
@ -118,198 +55,154 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
closeAndFecth: {
type: Function,
default: () => console.log("not function"),
},
roundId: {
type: String,
},
action: {
type: String,
},
personId: {
type: String,
},
profileType: {
typeId: {
type: String,
},
selectRoundOption: {
type: Array
},
profileId: {
type: String,
default: ""
}
});
watch(props, () => {
if (props.modal === true) {
employeeClass.value = "";
cardid.value = "";
fullName.value = "";
position.value = "";
Advertise.value = "";
brand.value = "";
receivedate.value = null;
issue.value = "";
affiliationRequest.value = "";
affiliationReceived.value = "";
announceDate.value = null;
volume.value = "";
episode.value = "";
duty.value = "";
announced.value = "";
// invoice.value = "";
invoiceDate.value = null;
payment.value = "";
if (props.action === "editData") {
fectDataByid(props.personId);
watch(props, () => {
if (props.modal == true && props.roundId != 'all') {
roundNo.value = props.roundId
fecthlistInsignia()
fetchOrgList()
if (props.action == 'editData') {
fetchData()
}
}
});
const disbleStatus = computed(() => {
if (employeeClass.value !== "") {
return false;
} else return true;
});
const selectType = async () => {
const fecthlistInsignia = async () => {
showLoader();
cardid.value = "";
fullName.value = "";
position.value = "";
Advertise.value = "";
brand.value = "";
receivedate.value = null;
issue.value = "";
affiliationRequest.value = "";
affiliationReceived.value = "";
announceDate.value = null;
volume.value = "";
episode.value = "";
duty.value = "";
announced.value = "";
invoiceDate.value = null;
payment.value = "";
await fecthlistPerson();
};
const fecthlistPerson = async () => {
let data = {
insigniaTypeId: props.typeId,
insigniaNoteId: props.roundId,
insigniaId: "",
};
await http
.get(config.API.profileOrganizRoot)
.post(config.API.noteSearch(), data)
.then((res) => {
const id = res.data.result[0].id;
if (id !== "") {
findlist(id);
}
})
.catch((e) => {
messageError($q, e);
});
};
const findlist = async (id: string) => {
let data = [{}];
if (employeeClass.value === "officer") {
data = [{ criteriaType: "is_retire", criteriaValue: "false" }];
} else if (employeeClass.value === "employee") {
data = [
{ criteriaType: "is_retire", criteriaValue: "false" },
{ criteriaType: "employee_class", criteriaValue: "perm" },
];
}
await http
.post(config.API.profileSearchNewOcIdType(id, employeeClass.value), {
criterias: data,
})
.then((res) => {
// console.log(res.data.result);
listPerson.value = res.data.result;
})
.catch((e) => {
console.log(e);
})
.finally(() => {
hideLoader();
});
};
const fectDataByid = async (id: string) => {
showLoader();
await http
.get(config.API.noteByid(id))
.then((res) => {
let data = res.data.result;
employeeClass.value = "";
cardid.value = data.citizenId;
fullName.value = data.fullName;
position.value = data.position;
Advertise.value = data.number;
brand.value = data.requestInsigniaId;
receivedate.value = data.dateReceive;
issue.value = data.issue;
affiliationRequest.value = data.organizationOrganizationSend;
affiliationReceived.value = data.organizationOrganizationReceive;
announceDate.value = data.date;
volume.value = data.volumeNo;
episode.value = data.section;
duty.value = data.page;
announced.value = data.no;
invoiceDate.value = data.datePayment;
payment.value = data.typePayment;
addressPayment.value = data.address;
status.value = data.status;
employeeClass.value = props.profileType;
listPerson.value = res.data.result
})
.catch((err) => {
console.log(err);
// console.log(err);
messageError($q, err);
})
.finally(() => {
hideLoader();
});
};
const fetchOrgList = async () => {
showLoader();
await http
.get(config.API.typeOc())
.then(async (response: any) => {
OrgList.value = response.data.result.map((e: any) => ({
id: e.organizationId,
name: e.organizationName
}))
})
.catch((err) => {
messageError($q, err)
})
.finally(() => {
hideLoader();
});
};
const fetchData = async () => {
showLoader();
await http
.get(config.API.insigniaManageBorrowById(props.profileId))
.then(async (response: any) => {
console.log(response.data.result)
})
.catch((err) => {
messageError($q, err)
})
.finally(() => {
hideLoader();
});
};
const clickSave = async () => {
let body = {
citizanId: cardid.value, //
insigniaId: brand.value, // insigniaID
number: Advertise.value,
issue: issue.value,
dateReceive: receivedate.value, //
organizationOrganizationSend: affiliationRequest.value,
organizationOrganizationReceive: affiliationReceived.value,
date: announceDate.value, //
volumeNo: volume.value, //
section: episode.value, //
page: duty.value, //
no: announced.value,
// : invoice.value,
datePayment: invoiceDate.value, //
typePayment: payment.value, //
address: addressPayment.value, //
};
await myForm.value!.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, async () => {
await addNote(body);
if (props.action == 'addData') {
await http
.post(config.API.insigniaManageBorrow(), {
borrowDate: receivedate.value,
borrowOrganizationId: OrganazationId.value,
insigniaNoteProfileId: insigniaNoteProfileId.value
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
clearData()
props.closeAndFecth();
});
} else {
await http
.put(config.API.insigniaManageBorrowReturn(props.profileId), {
returnDate: returndate.value,
returnOrganizationId: OrganazationId.value,
returnReason: reason.value
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
clearData()
props.closeAndFecth();
});
}
});
}
});
};
const addNote = async (body: any) => {
await http
.put(config.API.noteAdd(props.roundId), body)
.then(() => {
success($q, "เพิ่มราชชื่อสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.close();
});
};
const searchcardid = () => {
// console.log(cardid.value);
const searchcardid = async () => {
if (cardid.value.length === 13) {
let data = listPerson.value.find((e: any) => e.citizenId === cardid.value);
if (data) {
fullName.value = data.fullname;
position.value = data.positionEmployeePosition;
} else notifyError($q, "ไม่พบข้อมูลเลขบัตรประชาชนนี้");
const node = await listPerson.value.find((e: any) => e.citizenId === cardid.value);
if (node) {
console.log("node", node)
fullName.value = `${node.prefix} ${node.fullName}`
brand.value = node.requestInsignia
insigniaNoteProfileId.value = node.id
} else notifyError($q, "ไม่พบข้อมูลการได้รับในรอบนี้");
}
};
const closeDialog = () => {
clearData()
props.close()
}
</script>
<template>
@ -317,7 +210,7 @@ const searchcardid = () => {
<q-card style="min-width: 900px" class="q-pb-md">
<q-toolbar class="q-py-md">
<q-toolbar-title class="text-h6">-นเครองราชฯ </q-toolbar-title>
<q-btn icon="close" unelevated round dense @click="props.close"
<q-btn icon="close" unelevated round dense @click="closeDialog"
style="color: #ff8080; background-color: #ffdede" />
</q-toolbar>
<q-separator />
@ -325,89 +218,40 @@ const searchcardid = () => {
<q-form ref="myForm">
<div class="q-pa-md">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-4">
<q-select :rules="[
(val) => !!val || 'กรุณาเลือก ขรก.สามัญ/ลูกจ้างประจำ',
]" hide-bottom-space :options="employeeClassOps" dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="employeeClass" :label="`ขรก.สามัญ/ลูกจ้างประจำ`"
@update:model-value="selectType" :disable="status !== ''" />
</div>
<div class="col-12 text-weight-bold text-grey">
อมลผ
</div>
<div class="col-xs-12 col-sm-4">
<q-input :disable="disbleStatus || status == 'DONE' || status == 'PENDING'" hide-bottom-space outlined
class="inputgreen" v-model="cardid" dense lazy-rules :rules="[
(val: string) => !!val || `${'กรุณากรอก เลขบัตรประจำตัวประชาชน'}`,
(val: string) =>
val.length >= 13 ||
`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,
]" label="เลขบตรประจำตวประชาชน" maxlength="13" mask="#############" @keyup="searchcardid" />
<!-- :rules="[(val:any) =>val.length != 13 ||`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,]" -->
</div>
<div class="col-xs-6 col-sm-4">
<q-input disable hide-bottom-space outlined dense lazy-rules class="inputgreen" borderless
v-model="fullName" :label="`${'ชื่อ-นามสกุล'}`" />
</div>
<div v-if="props.action === 'addData'" class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-6">
<q-select v-model="roundNo" dense outlined lazy-rules hide-bottom-space
:label="`${'รอบการขอเครื่องราชฯ'}`" emit-value map-options option-label="name"
:options="selectRoundOption" option-value="id" :readonly="false" :borderless="false"
style="min-width: 150px" :rules="[
(val) => !!val || 'กรุณาเลือกรอบการขอเครื่องราชฯ',
]" @update:model-value="fecthlistInsignia()" />
</div>
<div class="col-12 text-weight-bold text-grey">
อมลผ
</div>
<div class="col-xs-12 col-sm-6">
<q-input :disable="roundNo == ''" hide-bottom-space outlined class="inputgreen" v-model="cardid" dense
lazy-rules :rules="[
(val: string) => !!val || `${'กรุณากรอก เลขบัตรประจำตัวประชาชน'}`,
(val: string) =>
val.length >= 13 ||
`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,
]" label="เลขบตรประจำตวประชาชน" maxlength="13" mask="#############" @keyup="searchcardid" />
<!-- :rules="[(val:any) =>val.length != 13 ||`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,]" -->
</div>
<div class="col-xs-6 col-sm-6">
<q-input disable hide-bottom-space outlined dense lazy-rules class="inputgreen" borderless
v-model="fullName" :label="`${'ชื่อ-นามสกุล'}`" />
</div>
<div class="col-xs-12 col-sm-4">
<q-input disable hide-bottom-space outlined dense lazy-rules class="inputgreen" borderless
v-model="position" :label="`ตำเเหน่ง`" />
</div>
<div class="col-6"></div>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
รายละเอยดการยมเครองราชฯ
</div>
<div class="col-xs-12 col-sm-6">
<q-select :disable="disbleStatus || status == 'DONE'" v-model="roundNo" dense outlined lazy-rules
hide-bottom-space :label="`${'รอบการขอเครื่องราชฯ'}`" emit-value map-options option-label="name"
:options="selectRoundOption" option-value="id" :readonly="false" :borderless="false"
style="min-width: 150px" :rules="[
(val) => !!val || 'กรุณาเลือกรอบการขอเครื่องราชฯ',
]" />
</div>
<div class="col-xs-12 col-sm-6">
<q-select :disable="disbleStatus || status == 'DONE'" v-model="brand" dense outlined lazy-rules
hide-bottom-space :label="`${'เครื่องราชฯ'}`" emit-value map-options option-label="name"
:options="DataStore.insigniaOp2" option-value="id" :readonly="false" :borderless="false"
style="min-width: 150px" :rules="[
(val) => !!val || 'กรุณาเลือกเครื่องราชฯ',
]" />
</div>
<div class="col-xs-12 col-sm-6">
<datepicker menu-class-name="modalfix" v-model="receivedate" :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 :disable="disbleStatus || status == 'DONE'" dense borderless outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']" hide-bottom-space :model-value="receivedate != null ? date2Thai(receivedate) : undefined
" :label="`${'วันที่ยืม'}`" clearable @clear="clearDateExam">
<template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" color="primary">
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-6">
<q-select hide-bottom-space :options="OrgOp" dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="OrganazationId" :label="`เลือกหน่วยงาน`" />
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs" v-if="props.action === 'editData'">
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
รายละเอยดการคนเครองราชฯ
รายละเอยดการยมเครองราชฯ
</div>
<div class="col-xs-12 col-sm-6">
<q-input v-model="brand" disable dense outlined lazy-rules hide-bottom-space
:label="`${'เครื่องราชฯ'}`" />
</div>
<div class="col-xs-12 col-sm-6">
<datepicker menu-class-name="modalfix" v-model="receivedate" :locale="'th'" autoApply borderless
@ -419,9 +263,9 @@ const searchcardid = () => {
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input :disable="disbleStatus || status == 'DONE'" dense borderless outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']" hide-bottom-space :model-value="receivedate != null ? date2Thai(receivedate) : undefined
" :label="`${'วันที่คืน'}`" clearable @clear="clearDateExam">
<q-input dense borderless outlined :rules="[(val) => !!val || 'กรุณาเลือกวันที่']" hide-bottom-space
:model-value="receivedate != null ? date2Thai(receivedate) : undefined
" :label="`${'วันที่ยืม'}`" clearable>
<template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" color="primary">
</q-icon>
@ -432,14 +276,47 @@ const searchcardid = () => {
</div>
<div class="col-xs-12 col-sm-6">
<q-select hide-bottom-space :options="OrgOp" 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" :label="`เลือกหน่วยงาน`" />
</div>
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs" v-if="props.action === 'editData'">
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
รายละเอยดการคนเครองราชฯ
</div>
<div class="col-xs-12 col-sm-6">
<datepicker menu-class-name="modalfix" v-model="returndate" :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 dense borderless outlined :rules="[(val) => !!val || 'กรุณาเลือกวันที่']" hide-bottom-space
:model-value="returndate != null ? date2Thai(returndate) : undefined
" :label="`${'วันที่คืน'}`" clearable>
<template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" color="primary">
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-6">
<q-select hide-bottom-space :options="OrgList" dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="OrganazationId" :label="`เลือกหน่วยงานที่ส่งคืน`" />
</div>
<div class="col-12">
<q-input type="textarea" hide-bottom-space dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="OrganazationId"
:label="`สาเหตุที่ส่งคืนเครื่องราชอิสริยาภรณ์`" />
emit-value map-options outlined v-model="reason" :label="`สาเหตุที่ส่งคืนเครื่องราชอิสริยาภรณ์`" />
</div>
</div>

View file

@ -1,14 +1,13 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
// import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
import { useResultDataStore } from "@/modules/07_insignia/storeAllocate";
import DialogForm from "@/modules/07_insignia/components/5_Borrow/DialogForm.vue";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main";
import type { QTableProps, QInput } from "quasar";
import { useQuasar } from "quasar";
@ -27,18 +26,19 @@ const $q = useQuasar();
const tab = ref<string>("");
const selectRound = ref<string>();
const selectRoundOption = ref<OptionData[]>([]);
const selectRoundAllOption = ref<OptionData[]>([]);
const selectRoundOption = ref<OptionDataYear[]>([]);
const selectRoundAllOption = ref<OptionDataYear[]>([]);
const modal = ref<boolean>(false);
const action = ref<string>("");
const personId = ref<string>();
const profileType = ref<string>("");
const fileResult = ref<any>(null);
const fileinvoice = ref<any>(null);
const profileId = ref<string>("");
const roundYear = ref<any>();
const insigniaListAll = ref<any>([]);
const insigniaList = ref<any>([]);
onMounted(async () => {
await fecthRound();
await fecthInsignia();
await fecthInsigniaType();
});
const fecthRound = async () => {
@ -49,25 +49,30 @@ const fecthRound = async () => {
selectRoundAllOption.value = [{
name: "ทั้งหมด",
id: "all",
year: 0,
}]
data.map((e: any) => {
selectRoundOption.value = [...selectRoundOption.value, {
name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543),
id: e.id,
year: e.year
}]
selectRoundAllOption.value = [...selectRoundAllOption.value, {
name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543),
id: e.id,
year: e.year
}]
});
});
selectRound.value = data[0].id;
// console.log(selectRound.value);
roundYear.value = data[0].year;
})
.catch((err) => {
console.log(err);
});
};
const fecthInsignia = async () => {
await http
.get(config.API.insignia)
@ -78,23 +83,29 @@ const fecthInsignia = async () => {
})
.catch((err) => {
console.log(err);
});
}).finally(async () => {
insigniaList.value = await DataStore.insigniaOp.filter((x: any) => x.type == tab.value || x.type == '')
})
};
const fecthInsigniaType = async () => {
await http(config.API.insigniaType)
.then((res) => {
.then(async (res) => {
// console.log(res);
let data = res.data.result;
DataStore.fetchDatainsigniaType(data);
tab.value = DataStore.insigniaType[0].name;
await fecthInsignia();
})
.catch((err) => {
console.log(err);
});
};
const visibleColumns = ref<String[]>([
"no",
"status",
"citizenId",
"name",
"type",
"employeeType",
@ -104,6 +115,11 @@ const visibleColumns = ref<String[]>([
"datepay",
"typepay",
"address",
"borrowOrganization",
"borrowDate",
"returnOrganization",
"returnDate",
"returnReason",
"action",
]);
const columns = ref<QTableProps["columns"]>([
@ -116,15 +132,6 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
// {
// name: "status",
// align: "left",
// label: "",
// field: "status",
// sortable: true,
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
// },
{
name: "citizenId",
align: "left",
@ -215,6 +222,51 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "borrowOrganization",
align: "left",
label: "หน่วยงานที่ยืม",
field: "borrowOrganization",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "borrowDate",
align: "left",
label: "วันที่ยืม",
field: "borrowDate",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "returnOrganization",
align: "left",
label: "หน่วยงานที่คืน",
field: "returnOrganization",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "returnDate",
align: "left",
label: "วันที่ยืม",
field: "returnDate",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "returnReason",
align: "left",
label: "เหตุผลการคืน",
field: "returnReason",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "action",
align: "left",
@ -223,32 +275,25 @@ const columns = ref<QTableProps["columns"]>([
},
]);
const rows = ref<any>([]);
watch(tab, () => {
if (tab.value !== "doc") {
fecthlistInsignia();
}
});
watch(modal, () => {
if (modal.value == false) {
fecthlistInsignia();
}
watch(tab, async () => {
insigniaList.value = await DataStore.insigniaOp.filter((x: any) => x.type == tab.value || x.type == '')
fecthlistInsignia();
});
const selectorInsignia = () => {
fecthlistInsignia();
};
const selectorRound = (round: string) => {
selectRound.value = round;
};
const rows = ref<any[]>([]);
const fecthlistInsignia = async () => {
showLoader();
let data = {
insigniaTypeId: tab.value,
insigniaNoteId: selectRound.value,
insigniaId: DataStore.insignia,
};
await http
.post(config.API.noteSearch(), data)
.get(config.API.insigniaManageBorrowList(Number(roundYear.value), tab.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
@ -268,6 +313,11 @@ const fecthlistInsignia = async () => {
datepay: date2Thai(e.datePayment),
typepay: e.typePayment,
address: e.address,
borrowOrganization: e.borrowOrganization,
borrowDate: e.borrowDate !== null ? date2Thai(e.borrowDate) : '-',
returnOrganization: e.returnOrganization,
returnDate: e.returnDate !== null ? date2Thai(e.returnDate) : '-',
returnReason: e.returnReason !== null ? e.returnReason : '-',
}));
})
.catch((err) => {
@ -278,43 +328,6 @@ const fecthlistInsignia = async () => {
hideLoader();
});
};
const uploadFile = async (event: any, action: string) => {
console.log(selectRound.value);
if (selectRound.value !== undefined) {
let id = selectRound.value.toString();
if (action === "result") {
const formdata = new FormData();
formdata.append("file", event);
await http
.put(config.API.uploadfilereceice(id), formdata)
.then(() => {
success($q, "อัพโหลดไฟล์สำเร็จ");
})
.catch((err) => {
console.log(err);
})
.finally(async () => {
await fecthlistInsignia();
fileResult.value = null;
});
} else if (action === "invoice") {
const formdata = new FormData();
formdata.append("file", event);
await http
.put(config.API.uploadfileinvoice(id), formdata)
.then(() => {
success($q, "อัพโหลดไฟล์สำเร็จ");
})
.catch((err) => {
console.log(err);
})
.finally(async () => {
await fecthlistInsignia();
fileinvoice.value = null;
});
}
}
};
const filterRef = ref<QInput>();
const filter = ref<string>("");
@ -323,22 +336,22 @@ const close = () => {
modal.value = false;
};
const closeAndFecth = () => {
modal.value = false;
fecthlistInsignia()
};
const addData = () => {
modal.value = true;
action.value = "addData";
};
const editData = (data: any) => {
personId.value = data.id;
profileType.value = data.profileType;
const editData = (id: any) => {
profileId.value = id;
action.value = "editData";
modal.value = true;
};
const save = () => {
console.log("save function");
};
const resetFilter = () => {
// reset X
filter.value = "";
@ -372,7 +385,7 @@ const resetFilter = () => {
</div>
<div>
<q-select v-model="DataStore.insignia" dense outlined lazy-rules hide-bottom-space
:label="`${'เครื่องราชฯ'}`" emit-value map-options option-label="name" :options="DataStore.insigniaOp"
:label="`${'เครื่องราชฯ'}`" emit-value map-options option-label="name" :options="insigniaList"
option-value="id" :readonly="false" :borderless="false" style="min-width: 150px"
@update:model-value="selectorInsignia" />
</div>
@ -523,8 +536,8 @@ const resetFilter = () => {
</div>
<DialogForm :modal="modal" :save="save" :close="close" :roundId="selectRound" :action="action" :personId="personId"
:profileType="profileType" :selectRoundOption="selectRoundOption" />
<DialogForm :modal="modal" :close="close" :close-and-fecth="closeAndFecth" :round-id="selectRound" :action="action"
:profile-id="profileId" :selectRoundOption="selectRoundOption" :type-id="tab" />
</q-card>
</template>
<style lang="scss" scoped>

View file

@ -18,12 +18,8 @@ const listMange = () =>
import("@/modules/07_insignia/components/2_Manage/listManage.vue");
const listAllocate = () =>
import("@/modules/07_insignia/components/4_Allocate/Main.vue");
const allocateAdd = () =>
import("@/modules/07_insignia/components/4_Allocate/allocateAdd.vue");
const allocateOrdList = () =>
import("@/modules/07_insignia/components/4_Allocate/OrgList.vue");
const allocateOrgAdd = () =>
import("@/modules/07_insignia/components/4_Allocate/OrgAdd.vue");
const VatInsignia = () =>
import("@/modules/07_insignia/components/VatInsignia.vue");
@ -123,7 +119,7 @@ export default [
},
},
{
path: "/insignia/allocate/list-allocate",
path: "/insignia/allocate",
name: "insigniaAllocate",
component: listAllocate,
meta: {
@ -133,17 +129,7 @@ export default [
},
},
{
path: "/insignia/allocate/allocate-add",
name: "allocateAdd",
component: allocateAdd,
meta: {
Auth: true,
Key: [8.8],
Role: "insignia",
},
},
{
path: "/insignia/allocate/detail/:id",
path: "/insignia/allocate/org/:id",
name: "allocateOrdList",
component: allocateOrdList,
meta: {
@ -152,16 +138,6 @@ export default [
Role: "insignia",
},
},
{
path: "/insignia/allocate/detail-add",
name: "allocateOrgAdd",
component: allocateOrgAdd,
meta: {
Auth: true,
Key: [8.10],
Role: "insignia",
},
},
{
path: "/insignia/vat",
name: "VatInsignia",