เครื่องราชฯ

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

@ -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>