ปรับ เครื่องราชฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-06 12:02:13 +07:00
parent 388893395b
commit 981bab8061
4 changed files with 416 additions and 139 deletions

View file

@ -101,20 +101,20 @@ const fetchData = async () => {
.get(config.API.listRoundInsignia())
.then((res) => {
const data = res.data.result;
rows.value = data.map((e: FormProprsalsRound2) =>({
period_id: e.period_id,
period_name: e.period_name,
period_year: e.period_year + 543,
period_amount: e.period_amount,
period_start: e.period_start == null ? null : date2Thai(new Date(e.period_start)),
period_end: e.period_end == null ? null : date2Thai(new Date(e.period_end)),
period_isActive: e.period_isActive,
period_doc: e.period_doc,
period_status: e.period_status.result
})
);
console.log(rows.value)
rows.value = data.map((e: FormProprsalsRound2) => ({
period_id: e.period_id,
period_name: e.period_name,
period_year: e.period_year + 543,
period_amount: e.period_amount,
period_start:
e.period_start == null ? null : date2Thai(new Date(e.period_start)),
period_end:
e.period_end == null ? null : date2Thai(new Date(e.period_end)),
period_isActive: e.period_isActive,
period_doc: e.period_doc,
period_status: e.period_status.result,
}));
console.log(rows.value);
})
.catch((e) => {
messageError($q, e);
@ -179,6 +179,16 @@ const getRequest = async (id: string) => {
await fetchData();
});
};
// filename: string
const downloadFile = (response: any) => {
const link = document.createElement("a");
var fileName = "filename";
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
//
const filterKeyword = ref<string>("");
@ -288,10 +298,18 @@ const paginationLabel = (start: string, end: string, total: string) => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="period_name" :props="props" @click="clickEdit(props.row)">
<q-td
key="period_name"
:props="props"
@click="clickEdit(props.row)"
>
{{ props.row.period_name }}
</q-td>
<q-td key="period_year" :props="props" @click="clickEdit(props.row)">
<q-td
key="period_year"
:props="props"
@click="clickEdit(props.row)"
>
{{ props.row.period_year }}
</q-td>
<q-td
@ -301,10 +319,18 @@ const paginationLabel = (start: string, end: string, total: string) => {
>
{{ props.row.period_start }}
</q-td>
<q-td key="period_end" :props="props" @click="clickEdit(props.row)">
<q-td
key="period_end"
:props="props"
@click="clickEdit(props.row)"
>
{{ props.row.period_end }}
</q-td>
<q-td key="period_isActive" :props="props" @click="clickEdit(props.row)">
<q-td
key="period_isActive"
:props="props"
@click="clickEdit(props.row)"
>
<q-icon
v-if="props.row.period_isActive == true"
name="mdi-close"
@ -358,9 +384,10 @@ const paginationLabel = (start: string, end: string, total: string) => {
target="_blank"
round
color="light-blue-8"
:href="props.row.period_doc"
icon="mdi-file-download"
@click="downloadFile(props.row.period_doc)"
>
<!-- :href="props.row.period_doc" -->
<q-tooltip>ดาวนโหลดเอกสารประกอบ </q-tooltip>
</q-btn>
</q-td>

View file

@ -24,6 +24,7 @@ const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
const $q = useQuasar(); // noti quasar
const loading = ref<boolean>(false);
const loadview = ref<boolean>(false);
const round = ref<string>("");
const roundName = ref<string>("");
const optionRound = ref<any>([]);
@ -39,7 +40,6 @@ const stat = ref<any>({
onMounted(async () => {
await checkRole();
await fecthlistRound();
await fecthAgency();
});
const checkRole = async () => {
@ -60,16 +60,19 @@ const checkRole = async () => {
const fecthlistRound = async () => {
await http
.get(config.API.listRoundInsignia())
.then((res: any) => {
.then(async (res: any) => {
optionRound.value = res.data.result.map((e: any) => ({
id: e.period_id,
year: e.period_year,
name: e.period_name,
}));
const lastValue = optionRound.value[0];
round.value = lastValue.id.toString();
roundName.value = lastValue.name;
fecthStat(round.value);
if (optionRound.value.length !== 0) {
const lastValue = optionRound.value[0];
round.value = lastValue.id.toString();
roundName.value = lastValue.name;
await fecthStat(round.value);
await fecthAgency();
}
})
.catch((err) => {
console.log(err);
@ -120,6 +123,7 @@ const fecthType = async () => {
name: e.organizationName,
}));
DataStore.fetchOption(optiontypeOc.value);
loadview.value = true;
})
.catch((err) => {
messageError($q, err);
@ -294,7 +298,7 @@ const requestSendNote = async () => {
<div class="toptitle text-dark col-12 row items-center">
รายชอขาราชการสามญฯ ทธนขอพระราชทานเครองราชอสรยาภรณ
</div>
<q-card bordered class="row col-12 q-mt-sm">
<q-card bordered class="row col-12 q-mt-sm" v-if="loadview">
<div class="row col-12 items-center bg-grey-1">
<div class="q-pl-md q-pr-sm text-weight-medium text-grey-7">รอบ</div>
<q-select
@ -351,6 +355,13 @@ const requestSendNote = async () => {
</div>
</div>
</q-card>
<q-card v-else>
<div class="q-pa-md q-gutter-sm">
<q-banner inline-actions rounded class="bg-grey-1 text-center">
ไมอมลรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
</q-banner>
</div>
</q-card>
<q-card flat bordered class="col-12 q-mt-sm" v-if="loading">
<div