เครื่องราชฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-07-08 16:01:15 +07:00
parent ff7b22f1d6
commit 2c924d24d5
7 changed files with 310 additions and 312 deletions

View file

@ -287,7 +287,7 @@ onMounted(async () => {
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<!-- <q-th auto-width /> -->
<q-th auto-width />
<q-th auto-width />
<q-th auto-width />
</q-tr>
@ -323,7 +323,7 @@ onMounted(async () => {
@click="clickEdit(props.row)"
/>
</q-td>
<!-- <q-td auto-width>
<q-td auto-width>
<q-btn
dense
size="12px"
@ -335,7 +335,7 @@ onMounted(async () => {
>
<q-tooltip>ไดบเครองราชฯ</q-tooltip>
</q-btn>
</q-td> -->
</q-td>
<q-td auto-width v-if="props.row.period_doc !== null">
<q-btn
dense

View file

@ -1061,7 +1061,7 @@ onMounted(async () => {
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="citizenId" :props="props">
{{ props.row.citizenId }}
{{ props.row.citizenId ?? "-" }}
</q-td>
<q-td key="name" :props="props">
{{ props.row.name }}

View file

@ -16,14 +16,17 @@ import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //หม
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
/**use sToer */
/**use */
const $q = useQuasar(); // noti quasar
const roleDataStore = useroleUserDataStore();
const DataStore = useInsigniaDataStore();
const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
const $q = useQuasar(); // noti quasar
/**
* วแปร
*/
const loading = ref<boolean>(false);
const loadview = ref<boolean>(false);
const hideBottom = ref<boolean>(false);
@ -38,12 +41,19 @@ const stat = ref<any>({
orgNoSendCount: 0,
orgSendCount: 0,
});
const requestNote = ref<string>("");
const requestStatus = ref<string>("");
const requestId = ref<string>("");
const document = ref<string>("");
const fileUpload = ref<any>(null);
const modalPopupBackToEdit = ref<boolean>(false); //model
const modalbackInsignia2Role = ref<boolean>(false);
/** function เรียกรอบการเสนอขอพระราชทานเครื่อง*/
async function fecthlistRound() {
// showLoader();
await http
/**
* function เรยกรอบการเสนอขอพระราชทานเครอง
*/
function fecthlistRound() {
http
.get(config.API.listRoundInsignia())
.then(async (res: any) => {
optionRound.value = res.data.result.map((e: any) => ({
@ -53,8 +63,6 @@ async function fecthlistRound() {
}));
// UI
if (optionRound.value.length !== 0) {
loadview.value = true;
loading.value = true;
DataStore.optionRound = optionRound.value;
const lastValue = optionRound.value[0];
if (DataStore.roundId) {
@ -72,13 +80,14 @@ async function fecthlistRound() {
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
}
/** function เรียกดู Stat ของรอบการเสนอขอพระราชทานเครื่อง*/
const fecthStat = async (id: string) => {
await http
/**
* function เรยกด Stat ของรอบการเสนอขอพระราชทานเครอง
*/
function fecthStat(id: string) {
http
.get(config.API.insigniaDashboard(id))
.then((res) => {
stat.value = res.data.result;
@ -86,24 +95,28 @@ const fecthStat = async (id: string) => {
.catch((err) => {
messageError($q, err);
});
};
}
/** funcion เช็คหน่วยงาน*/
async function fecthAgency() {
await http
/**
* funcion เชคหนวยงาน
*/
function fecthAgency() {
http
.get(config.API.keycloakPosition())
.then(async (res) => {
// loadview.value = true;
.then((res) => {
loadview.value = true;
DataStore.agency = res.data.result.rootId;
DataStore.typeOc = DataStore.agency;
// loading.value = true;
loading.value = true;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {});
});
}
/**
* function fetch โครองสรางปจจ
*/
function fetchActiveId() {
http
.get(config.API.activeOrganization)
@ -115,6 +128,11 @@ function fetchActiveId() {
messageError($q, err);
});
}
/**
* function fetch อมลโครองสรางปจจ
* @param id โครงสรางปจจ
*/
function fetchListOrg(id: string) {
showLoader();
http
@ -126,22 +144,22 @@ function fetchListOrg(id: string) {
}));
optiontypeOc.value = data;
DataStore.fetchOption(optiontypeOc.value); // DataStore
fecthAgency();
await fecthAgency();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**function เรียกประเภทเครื่องราช*/
async function fecthInsignia() {
await http
/**
* function เรยกประเภทเครองราช
*/
function fecthInsignia() {
http
.get(config.API.insigniaOrg)
.then((res) => {
let data = res.data.result;
const data = res.data.result;
DataStore.fetchInsigniaType(data);
})
.catch((err) => {
@ -149,7 +167,9 @@ async function fecthInsignia() {
});
}
/** function เลือกรอบการแสดง*/
/**
* function เปลยนรอบการแสดง
*/
async function changround() {
DataStore.roundId = round.value;
fecthStat(round.value); // Stat
@ -165,10 +185,6 @@ async function changround() {
roundFilter.year + 543
}`;
}
const requestNote = ref<string>("");
const requestStatus = ref<string>("");
const requestId = ref<string>("");
const document = ref<string>("");
/**
* function เรยกขอมลรายชอขาราชการสามญฯ ทธนขอพระราชทานเครองราชอสรยาภรณ ตามรอบการเสนอขอ
@ -177,7 +193,7 @@ const document = ref<string>("");
* @param role ประเภท officer,employee
* @param status สถานะ
*/
async function fecthInsigniaByOc(
function fecthInsigniaByOc(
roundId: string,
ocId: string,
role: string,
@ -185,7 +201,7 @@ async function fecthInsigniaByOc(
) {
if (roundId && ocId && role && status) {
showLoader();
await http
http
.get(config.API.insigniaList(roundId, ocId, role, status))
.then(async (res) => {
requestNote.value = res.data.result.requestNote;
@ -194,7 +210,7 @@ async function fecthInsigniaByOc(
document.value = res.data.result.document;
await DataStore.fetchData(res.data.result.items); //
await DataStore.fetchDataInsignia(res.data.result); //
// loading.value = true;
loading.value = true;
//
if (res.data.result.items !== null) {
if (res.data.result.items.length !== 0) {
@ -203,7 +219,7 @@ async function fecthInsigniaByOc(
}
})
.catch((err) => {
// messageError($q, err);
messageError($q, err);
})
.finally(() => {
hideLoader();
@ -211,11 +227,13 @@ async function fecthInsigniaByOc(
}
}
/**function ยืนยันการส่งรอบการเสนอขอต่อ เฉพาะ รอบที่ requestStatus st1 และ st4 */
async function sendToDirector() {
dialogConfirm($q, async () => {
/**
* function นยนการสงรอบการเสนอขอต เฉพาะ รอบท requestStatus st1 และ st4
*/
function sendToDirector() {
dialogConfirm($q, () => {
showLoader();
await http
http
.get(config.API.insigniaSendToDirector(round.value, DataStore.agency))
.then(async () => {
await fecthStat(round.value);
@ -229,34 +247,35 @@ async function sendToDirector() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/** function open popup แก้ไข*/
async function popupBackToEdit() {
/**
* function open popup แกไข*
*/
function popupBackToEdit() {
modalPopupBackToEdit.value = true;
}
const modalbackInsignia2Role = ref<boolean>(false);
/**function open popup ตีกลับ admin*/
const popupBackToInsignia2Role = async () => {
/**
* function open popup กล admin
*/
function popupBackToInsignia2Role() {
modalbackInsignia2Role.value = true;
};
}
/**
* funtion นยนการ กลบรอบการเสนอขอ เฉพาะ รอบท requestStatus st3 และ insignia2Role
* @param reason หมายเหตการตกล
*/
async function backToEdit(reason: string) {
function backToEdit(reason: string) {
dialogConfirm(
$q,
async () => {
() => {
showLoader();
await http
http
.put(
config.API.insigniaDirectorBackToEdit(round.value, DataStore.agency),
{
@ -283,13 +302,15 @@ async function backToEdit(reason: string) {
);
}
/**function ยืนยันการอนุมัติรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st3 และ insignia2Role */
async function directorApproved() {
/**
* function นยนการอนรอบการเสนอขอ เฉพาะ รอบท requestStatus st3 และ insignia2Role
*/
function directorApproved() {
dialogConfirm(
$q,
async () => {
() => {
showLoader();
await http
http
.get(config.API.insigniaDirectorApproved(round.value, DataStore.agency))
.then(async () => {
await fecthInsigniaByOc(
@ -315,9 +336,9 @@ async function directorApproved() {
* function นยนการตกลบรอบการเสนอขอ เฉพาะ รอบท requestStatus st5 และ adminRole
* @param reason หมายเหตการตกล
*/
async function backToEditinsignia2Role(reason: string) {
dialogConfirm($q, async () => {
await http
function backToEditinsignia2Role(reason: string) {
dialogConfirm($q, () => {
http
.put(config.API.rejectRequest(round.value, DataStore.typeOc), {
reason: reason,
})
@ -337,11 +358,13 @@ async function backToEditinsignia2Role(reason: string) {
});
}
/**function ยืนยันการล็อกข้อมูล*/
async function requestSendNote() {
dialogConfirm($q, async () => {
/**
* function นยนการลอกขอม
*/
function requestSendNote() {
dialogConfirm($q, () => {
showLoader();
await http
http
.post(config.API.insigniaRequestSendNote(round.value), {
name: roundName.value,
})
@ -362,7 +385,6 @@ async function requestSendNote() {
});
}
const fileUpload = ref<any>(null);
/**
* function ปโหลดไฟลเจาหนาท
* @param event file
@ -392,12 +414,14 @@ async function uploadFile(event: any) {
});
}
/** hook*/
/**
* hook
*/
onMounted(async () => {
tab.value = DataStore.mainTab;
await fecthlistRound();
await fetchActiveId();
DataStore.dataInsigniaType.length === 0 && (await fecthInsignia());
fecthlistRound();
fetchActiveId();
});
</script>

View file

@ -4,14 +4,23 @@ import { QForm, useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/** import Type*/
/**
* import Type
*/
import type { DataOption } from "@/modules/04_registry/components/profileType";
import DialogHeader from "@/components/DialogHeader.vue";
/** import Stores */
/**
* import Stores
*/
import { useCounterMixin } from "@/stores/mixin";
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
/** useStore*/
/**
* use
*/
const $q = useQuasar();
const myForm = ref<QForm>();
const DataStore = useResultDataStore();
const mixin = useCounterMixin();
const {
@ -24,9 +33,35 @@ const {
notifyError,
} = mixin;
const $q = useQuasar();
const myForm = ref<QForm>();
/**
* Props
*/
const props = defineProps({
modal: Boolean,
save: {
type: Function,
},
close: {
type: Function,
},
roundId: {
type: String,
},
action: {
type: String,
},
personId: {
type: String,
},
profileType: {
type: String,
},
fecthlistInsignia: { type: Function, required: true },
});
/**
* วแปร
*/
const status = ref<string>("");
const Advertise = ref<string>("");
const issue = ref<string>("");
@ -51,49 +86,25 @@ const employeeClassOps = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการ กทม.สามัญ" },
{ id: "employee", name: "ลูกจ้างประจำ" },
]);
const listPerson = ref<any>([]);
const paymentOp = [
{ label: "จัดส่งทางไปรษณีย์", value: "จัดส่งทางไปรษณีย์" },
{ label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" },
];
function clearAnnounceExam() {
announceDate.value = null;
}
/** function reset วันที่ได้รับพระราชทานเครื่องราชอิสริยาภรณ์*/
function clearDateReceivedate() {
receivedate.value = null;
}
const formFilter = reactive({
page: 1,
pageSize: 10,
searchField: "citizenId",
searchKeyword: "",
});
/** function reset วันที่จ่ายใบกำกับ*/
function clearDateInvoiceDate() {
invoiceDate.value = null;
}
const props = defineProps({
modal: Boolean,
save: {
type: Function,
},
close: {
type: Function,
},
roundId: {
type: String,
},
action: {
type: String,
},
personId: {
type: String,
},
profileType: {
type: String,
},
});
/** callback function จำทำงานเมื่อ props.modal = true เปิด popup เพิ่มรายชื่อบันทึกผล*/
/**
* callback function จำทำงานเม props.modal = true เป popup เพมรายชอบนทกผล
*/
watch(props, () => {
if (props.modal === true) {
employeeClass.value = "";
@ -120,20 +131,23 @@ watch(props, () => {
}
} else {
status.value = "";
selectType();
}
});
/** disbleStatus */
/**
* disbleStatus
*/
const disbleStatus = computed(() => {
if (employeeClass.value !== "") {
return false;
} else return true;
});
//
/** function เลือกประเภทลูกจ้าง */
async function selectType() {
// showLoader();
/**
* function เลอกประเภทลกจาง
*/
function selectType() {
cardid.value = "";
fullName.value = "";
position.value = "";
@ -150,36 +164,13 @@ async function selectType() {
announced.value = "";
invoiceDate.value = null;
payment.value = "";
// await fecthlistPerson();
}
/** function เรียกหน่วยงาน*/
// async function fecthlistPerson() {
// await http
// .get(config.API.profileOrganizRoot)
// .then((res) => {
// const id = res.data.result[0].id;
// if (id !== "") {
// findlist(id); // id
// }
// })
// .catch((e) => {
// messageError($q, e);
// });
// }
const formFilter = reactive({
page: 1,
pageSize: 10,
searchField: "citizenId",
searchKeyword: "",
});
/**
* function เรยกรายชอลกจางตาม id หนวยงาน
* @param id id หนวยงาน
*/
async function findlist(id: string = "", idCard: string) {
function findlist(id: string = "", idCard: string) {
formFilter.searchKeyword = idCard;
http
.get(
@ -207,43 +198,18 @@ async function findlist(id: string = "", idCard: string) {
.finally(() => {
hideLoader();
});
// 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) => {
// listPerson.value = res.data.result;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
}
/**
* function เรยกขอมลบนทกผลตาม id
* @param id
* @param id personId
*/
async function fectDataByid(id: string) {
function fectDataByid(id: string) {
showLoader();
if (props.profileType !== undefined) {
// employeeClass.value = props.profileType.toString();
employeeClass.value = "officer";
}
await http
http
.get(config.API.noteByid(id))
.then((res) => {
let data = res.data.result;
@ -275,7 +241,7 @@ async function fectDataByid(id: string) {
}
/** function บักทึกผล*/
async function onSubmit() {
function onSubmit() {
dialogConfirm($q, () => {
if (props.roundId !== undefined) {
showLoader();
@ -299,9 +265,9 @@ async function onSubmit() {
http
.put(config.API.noteAdd(props.roundId), body)
.then(async () => {
await props.fecthlistInsignia?.();
await props.close?.();
await success($q, "บันทึกข้อมูลสำเร็จ");
await showLoader();
})
.catch((err) => {
messageError($q, err);
@ -311,7 +277,9 @@ async function onSubmit() {
});
}
/** function หาเลขประจำตัวประชาชน*/
/**
* function หาเลขประจำตวประชาชน
*/
function searchcardid() {
if (cardid.value.length === 13) {
findlist("", cardid.value);

View file

@ -7,8 +7,14 @@ import config from "@/app.config";
/** import Type*/
import type { DataOption } from "@/modules/04_registry/components/profileType";
/**
* import Components
*/
import DialogHeader from "../DialogHeader.vue";
/** import Stores */
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
const mixin = useCounterMixin();
const {
@ -48,11 +54,6 @@ const props = defineProps({
dataModal: Object,
});
/** function reset วันที่ประกาศราชกิจจานุเบกษา*/
function clearReceiveDate() {
Datereceive.value = null;
}
/** function clearDate */
function clearReturnDate() {
Datereturn.value = null;
@ -74,17 +75,17 @@ function close() {
* @param type receive,return
* @param id personId
*/
async function onSubmit(type: string, id: string) {
function onSubmit(type: string, id: string) {
dialogConfirm($q, () => {
const formData = new FormData();
if (props.dateCheckReceive === null) {
formData.append("Date", dateToISO((Datereceive.value as Date) ?? nullii));
formData.append("File", files.value);
// formData.append("OrgId", OrganazationId.value);
formData.append("OrgId", OrganazationId.value);
} else {
formData.append("Date", dateToISO((Datereturn.value as Date) ?? nullii));
formData.append("File", filesReturn.value);
// formData.append("OrgId", OrganazationId2.value);
formData.append("OrgId", OrganazationId2.value);
}
showLoader();
http
@ -117,7 +118,7 @@ watch(
);
/** function เรียกหน่วยงาน*/
async function fetchOrgList() {
function fetchOrgList() {
showLoader();
http
.get(config.API.activeOrganization)
@ -144,30 +145,6 @@ async function fetchOrgList() {
.finally(() => {
hideLoader();
});
// showLoader();
// await http
// .get(config.API.insigniaOrg)
// .then(async (response: any) => {
// const orgArr = response.data.result.map((e: any) => ({
// id: e.id,
// name: e.name + `(${e.shortName})`,
// }));
// OrgList.value = orgArr;
// OrgList2.value = orgArr;
// // [
// // {
// // id: "00000000-0000-0000-0000-000000000000",
// // name: "",
// // },
// // ...orgArr,
// // ];
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
}
/** callback function จำทำงานเมื่อ props มีการเปลี่ยนแปลง*/
@ -203,19 +180,8 @@ watch(props, () => {
)
"
>
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold"
>-นเครองราชฯ</q-toolbar-title
>
<q-btn
icon="close"
unelevated
round
dense
@click="close"
style="color: #ff8080; background-color: #ffdede"
/>
</q-toolbar>
<DialogHeader :tittle="'รับ-คืนเครื่องราชฯ'" :close="close" />
<q-separator />
<q-card-section>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">

View file

@ -39,7 +39,7 @@ const returndate = ref<Date | null>();
const reason = ref<string>("");
const listPerson = ref<any>([]);
const OrgList = ref<DataOption[]>([]);
const filterOrgList = ref<any>([]);
const filterOrgList = ref<DataOption[]>([]);
const insigniaNoteProfileId = ref<string>("");
const filterSelectRound = ref<any>();
const selectRound = ref<any>();
@ -124,25 +124,32 @@ async function fecthlistInsignia() {
}
/** function ดึงข้อมูลรายการหน่วยงาน */
// async function fetchOrgList() {
// 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,
// }));
// OrgList.value = orgArr;
// filterOrgList.value = OrgList.value;
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
// }
/** funcion เรียกข้อมูลหน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ */
async function fetchOrgList() {
http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
http
.get(config.API.orgByid(data.activeId))
.then(async (res) => {
const data = await res.data.result.map((item: any) => ({
id: item.orgTreeId,
name: item.orgName,
}));
OrgList.value = data;
filterOrgList.value = data;
})
.catch((err) => {
messageError($q, err);
});
})
.catch((err) => {
messageError($q, err);
});
}
// -
// const fetchData = async () => {
@ -172,7 +179,6 @@ async function onSubmit() {
.then(async () => {
await props.closeAndFecth();
await clearData();
// await hideLoader();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@ -189,7 +195,6 @@ async function onSubmit() {
.then(async () => {
await props.closeAndFecth();
await clearData();
// await hideLoader();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@ -215,7 +220,6 @@ async function searchcardid() {
?.shortName || ""
})`;
insigniaNoteProfileId.value = node.id;
insigniaNoteProfileId.value = node.id;
hideLoader();
} else {
notifyError($q, "ไม่พบข้อมูลการได้รับในรอบนี้");
@ -229,7 +233,6 @@ async function searchcardid() {
fullName.value = "";
brand.value = "";
receivedate.value = null;
// OrganazationId.value = "";
}
}
@ -281,11 +284,13 @@ onMounted(() => {
/** function callback เช็ค props ถ้าเปิด dialog ให้ดึงรายการข้อมูล */
watch(props, () => {
// type.value = props.type;
if (props.modal == true && props.roundId != "all") {
roundNo.value = props.roundId;
fecthlistInsignia();
// fetchOrgList();
if (props.action === "editData") {
fetchOrgList();
} else {
fecthlistInsignia();
}
}
});
</script>
@ -484,27 +489,27 @@ watch(props, () => {
</datepicker>
</div>
<!-- <div class="col-xs-12 col-sm-6">
<q-select
hide-bottom-space
:options="filterOrgList"
dense
lazy-rules
borderless
option-label="name"
option-value="id"
emit-value
map-options
outlined
use-input
v-model="OrganazationId"
:label="`เลือกหน่วยงานที่ส่งคืน`"
:rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่คืน']"
@filter="(inputValue:any,
<div class="col-xs-12 col-sm-6">
<q-select
hide-bottom-space
:options="filterOrgList"
dense
lazy-rules
borderless
option-label="name"
option-value="id"
emit-value
map-options
outlined
use-input
v-model="OrganazationId"
:label="`เลือกหน่วยงานที่ส่งคืน`"
:rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่คืน']"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterOrgList'
) "
/>
</div> -->
/>
</div>
<div class="col-12">
<q-input

View file

@ -4,19 +4,30 @@ import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
/** import Type*/
/**
* import Typฃ
*/
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type { QTableProps, QInput } from "quasar";
/** import Components*/
/**
* import Components
*/
import DialogHeader from "@/components/DialogHeader.vue";
import Dialogbody from "@/modules/07_insignia/components/3_result/Dialogbody.vue";
import DialogForm from "@/modules/07_insignia/components/3_result/DialogForm.vue";
import fileUploadview from "../components/3_result/fileUpload.vue";
/** import Stores */
/**
* import Stores
*/
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
/**
* use
*/
const $q = useQuasar();
const DataStore = useResultDataStore();
const mixin = useCounterMixin();
const {
@ -28,8 +39,9 @@ const {
success,
} = mixin;
const $q = useQuasar();
/**
* วแปร
*/
const tab = ref<string>("");
const selectRound = ref<string>("");
const selectRoundOption = ref<OptionData[]>([]);
@ -51,7 +63,9 @@ const dateCheckReceive = ref<any>();
const dateCheckReturn = ref<any>();
const dataModal = ref<any>([]);
/** ข้อมูล Tabla*/
/**
* อม Tabla
*/
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -222,14 +236,15 @@ const visibleColumns = ref<String[]>([
"address",
"action",
]);
const filterRef = ref<QInput>();
const filter = ref<string>("");
/** function เรียกรอบการเสนอขอพระราชทานเครื่องราช*/
async function fecthRound() {
/**
*function เรยกรอบการเสนอขอพระราชทานเครองราช
*/
function fecthRound() {
showLoader();
await http
http
.get(config.API.noteround())
.then(async (res) => {
let data = res.data.result;
@ -252,9 +267,11 @@ async function fecthRound() {
});
}
/** function เรียกประเภทเครื่องราช*/
async function fecthInsignia() {
await http
/**
* function เรยกประเภทเครองราช
*/
function fecthInsignia() {
http
.get(config.API.insigniaOrg)
.then((res) => {
let data = res.data.result;
@ -265,9 +282,11 @@ async function fecthInsignia() {
});
}
/** function เรียกระดับเครื่องราช*/
async function fecthInsigniaType() {
await http(config.API.insigniaTypeOrg)
/**
* function เรยกระดบเครองราช
*/
function fecthInsigniaType() {
http(config.API.insigniaTypeOrg)
.then((res) => {
let data = res.data.result;
DataStore.fetchDatainsigniaType(data);
@ -279,7 +298,9 @@ async function fecthInsigniaType() {
});
}
/** function เลือกประเภทเครื่องราช*/
/**
* function เลอกประเภทเครองราช
*/
function selectorInsignia() {
fecthlistInsignia();
}
@ -295,7 +316,9 @@ function selectorRound(round: string) {
fecthlistInsignia();
}
/** callback function จำทำงานเมื่อ tab มีการเปลี่ยนแปลง*/
/**
* callback function จำทำงานเม tab การเปลยนแปลง
*/
watch(tab, () => {
if (tab.value !== "doc") {
DataStore.insignia = "";
@ -308,22 +331,26 @@ watch(tab, () => {
}
});
/** callback function จำทำงานเมื่อ modal มีการเปลี่ยนแปลง*/
watch(modal, () => {
if (modal.value == false) {
fecthlistInsignia();
}
});
/**
* callback function จำทำงานเม modal การเปลยนแปลง
*/
// watch(modal, () => {
// if (modal.value == false) {
// fecthlistInsignia();
// }
// });
/** function เรียกรายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์/การจ่ายใบกำกับ */
async function fecthlistInsignia() {
/**
* function เรยกรายชอบนทกผลการไดบพระราชทานเครองราชอสรยาภรณ/การจายใบกำก
*/
function fecthlistInsignia() {
showLoader();
let data = {
insigniaTypeId: tab.value,
insigniaNoteId: selectRound.value,
insigniaId: DataStore.insignia,
};
await http
http
.post(config.API.noteSearch(), data)
.then((res) => {
let data = res.data.result;
@ -342,21 +369,16 @@ async function fecthlistInsignia() {
* @param event file
* @param action typepreview
*/
async function uploadFile(event: any, action: string) {
function uploadFile(event: any, action: string) {
if (selectRound.value !== undefined) {
let id = selectRound.value;
dialogConfirm($q, async () => {
dialogConfirm($q, () => {
showLoader();
const formdata = new FormData();
formdata.append("file", event);
await http
http
.put(config.API.uploadfileInsignia(action, id), formdata)
.then(() => {
success($q, "อัพโหลดไฟล์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
.then(async () => {
await fecthlistInsignia();
if (action === "receice") {
fileResult.value = null;
@ -364,7 +386,12 @@ async function uploadFile(event: any, action: string) {
fileinvoice.value = null;
}
modelPerview.value = false;
await success($q, "อัพโหลดไฟล์สำเร็จ");
modelPerview.value = await false;
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
}),
"ยืนยันการบันทึกรายการข้อมูล",
@ -396,7 +423,9 @@ const save = () => {
console.log("save function");
};
/** ข้อมูล ไฟล์*/
/**
* อม ไฟล
*/
const modelPerview = ref<boolean>(false);
const rowspreview = ref<any>([]);
const typepreview = ref<string>("");
@ -407,7 +436,7 @@ const fileInsignia = ref<any>(null);
* @param event ไฟล
* @param actionType ประเภทไฟล receice,invoice
*/
async function perviewfile(event: any, actionType: string) {
function perviewfile(event: any, actionType: string) {
showLoader();
typepreview.value = actionType;
fileInsignia.value = event;
@ -415,7 +444,7 @@ async function perviewfile(event: any, actionType: string) {
let id = selectRound.value.toString();
const formdata = new FormData();
formdata.append("file", event);
await http
http
.put(config.API.previewfileInsignia(actionType, id), formdata)
.then((res) => {
let data = res.data.result;
@ -448,8 +477,11 @@ async function perviewfile(event: any, actionType: string) {
}
}
function closeDialogPerview() {
modelPerview.value = false;
}
const resetFilter = () => {
// reset X
filter.value = "";
filterRef.value!.focus();
};
@ -465,7 +497,9 @@ const paginationLabel = (start: number, end: number, total: number) => {
else return start + "-" + end + " ใน " + total;
};
/** function openPopup */
/**
* function openPopup
*/
function OpenModal(data: any) {
dataModal.value = data;
ModalDialog.value = true;
@ -520,8 +554,8 @@ function clearInsigniaFilters(name: string) {
}
/** hook*/
onMounted(async () => {
await fecthRound();
onMounted(() => {
fecthRound();
});
</script>
@ -937,6 +971,7 @@ onMounted(async () => {
:action="action"
:personId="personId"
:profileType="profileType"
:fecthlistInsignia="fecthlistInsignia"
/>
</q-card>
<q-card v-else>
@ -949,7 +984,8 @@ onMounted(async () => {
<q-dialog v-model="modelPerview">
<q-card style="width: 850px; max-width: 80vw">
<q-card-section>
<DialogHeader tittle="ยืนยันรายการข้อมูล" :close="closeDialogPerview" />
<!-- <q-card-section>
<q-toolbar class="q-py-md">
<q-toolbar-title class="header-text">
นยนรายการขอม
@ -963,8 +999,7 @@ onMounted(async () => {
style="color: #ff8080; background-color: #ffdede"
/>
</q-toolbar>
<!-- <div class="text-h6">นยนรายการขอม</div> -->
</q-card-section>
</q-card-section> -->
<q-card-section class="q-pt-none">
<d-table
@ -980,7 +1015,7 @@ onMounted(async () => {
{{ props.rowIndex + 1 }}
</div>
<div v-else>
{{ props.value }}
{{ props.value ?? "-" }}
</div>
</q-td>
</template>