Merge commit '50a4a8d182' into develop

This commit is contained in:
Tanyalak 2023-09-04 11:29:53 +07:00
commit 5f9a0089df
3 changed files with 51 additions and 95 deletions

View file

@ -7,7 +7,7 @@ const report = `${env.API_REPORT2_URI}/report`;
const Organization = `${env.API_URI}/Organization`;
export default {
getRoundInsignia: (id: string) => `${insignia}/period/${id}`,
listRoundInsignia: () => `${insignia}/period/`,
listRoundInsignia: () => `${insignia}/period`,
editRoundInsignia: (id: string) => `${insignia}/period/${id}`,
RoundInsignia: (id: string) => `${insignia}/period/${id}`,
requestInsignia: (insigniaPeriodId: string) =>

View file

@ -4,7 +4,7 @@ import type { QTableProps } from "quasar";
import router from "@/router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { FormProprsalsRound } from " @/modules/07_insignia/interface/request/Main.ts";
import type { FormProprsalsRound2 } from "@/modules/07_insignia/interface/request/Main";
import config from "@/app.config";
import http from "@/plugins/http";
@ -21,10 +21,10 @@ const {
const $q = useQuasar(); // noti quasar
const visibleColumns = ref<string[]>([
"round",
"year",
"startDate",
"endDate",
"period_name",
"period_year",
"period_start",
"period_end",
// "status",
"statusRoyal",
]); //
@ -32,60 +32,49 @@ const visibleColumns = ref<string[]>([
//
const columns = ref<QTableProps["columns"]>([
{
name: "round",
name: "period_name",
align: "left",
label: "รอบการเสนอขอพระราชทานเครื่องราชฯ",
sortable: true,
field: "no",
field: "period_name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "year",
name: "period_year",
align: "left",
label: "ปีที่เสนอ",
sortable: true,
field: "name",
field: "period_year",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "startDate",
name: "period_start",
align: "left",
label: "วันที่เริ่มต้น",
sortable: true,
field: "position",
field: "period_start",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "endDate",
name: "period_end",
align: "left",
label: "วันที่สิ้นสุด",
sortable: true,
field: "level",
field: "period_end",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "institution",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "statusRoyal",
align: "center",
@ -100,75 +89,29 @@ const columns = ref<QTableProps["columns"]>([
]);
// ()
const rows = ref<FormProprsalsRound[]>([
{
round: "รอบการเสนอขอพระราชทานเครื่องราชฯ",
year: "2566",
startDate: "2566",
endDate: "31 พ.ค. 2566",
status: true,
statusRoyal: "เสนอเเล้ว",
},
{
round: "รอบการเสนอขอพระราชทานเครื่องราชฯ",
year: "2566",
startDate: "2566",
endDate: "31 พ.ค. 2566",
status: true,
statusRoyal: "เสนอเเล้ว",
},
{
round: "รอบการเสนอขอพระราชทานเครื่องราชฯ",
year: "2566",
startDate: "2566",
endDate: "31 พ.ค. 2566",
status: true,
statusRoyal: "เสนอเเล้ว",
},
{
round: "รอบการเสนอขอพระราชทานเครื่องราชฯ",
year: "2566",
startDate: "2566",
endDate: "31 พ.ค. 2566",
status: "ไม่ใช้งาน",
statusRoyal: "ยังไม่ได้เสนอ",
},
{
round: "รอบการเสนอขอพระราชทานเครื่องราชฯ",
year: "2566",
startDate: "2566",
endDate: "31 พ.ค. 2566",
status: true,
statusRoyal: "ยังไม่ได้เสนอ",
},
]);
const rows = ref<FormProprsalsRound2[]>([]);
onMounted(async () => {
await fetchData();
});
const fetchData = async () => {
rows.value = [];
showLoader();
await http
.get(config.API.listRoundInsignia("insignia"))
.get(config.API.listRoundInsignia())
.then((res) => {
const data = res.data.result;
console.log(data);
data.map((e: any) => {
rows.value.push({
id: e.period_id,
round: e.period_name,
year: e.period_year + 543,
amount: e.period_amount,
startDate:
e.period_start == null ? null : date2Thai(new Date(e.period_start)),
endDate:
e.period_end == null ? null : date2Thai(new Date(e.period_end)),
status: e.period_isActive,
file: e.period_doc,
});
});
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,
})
);
})
.catch((e) => {
messageError($q, e);
@ -342,25 +285,25 @@ const paginationLabel = (start: string, end: string, total: string) => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="round" :props="props" @click="clickEdit(props.row)">
{{ props.row.round }}
<q-td key="period_name" :props="props" @click="clickEdit(props.row)">
{{ props.row.period_name }}
</q-td>
<q-td key="year" :props="props" @click="clickEdit(props.row)">
{{ props.row.year }}
<q-td key="period_year" :props="props" @click="clickEdit(props.row)">
{{ props.row.period_year }}
</q-td>
<q-td
key="startDate"
key="period_start"
:props="props"
@click="clickEdit(props.row)"
>
{{ props.row.startDate }}
{{ props.row.period_start }}
</q-td>
<q-td key="endDate" :props="props" @click="clickEdit(props.row)">
{{ props.row.endDate }}
<q-td key="period_end" :props="props" @click="clickEdit(props.row)">
{{ props.row.period_end }}
</q-td>
<q-td key="status" :props="props" @click="clickEdit(props.row)">
<q-icon
v-if="props.row.status == true"
v-if="props.row.period_isActive == true"
name="mdi-close"
color="grey-5"
class="text-h5"
@ -406,11 +349,13 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-td auto-width>
<q-btn
dense
type="a"
size="12px"
flat
target="_blank"
round
color="light-blue-8"
@click.stop.prevent="clickProposals(props.row.file)"
:href="props.row.period_doc"
icon="mdi-file-download"
>
<q-tooltip>ดาวนโหลดเอกสารประกอบ </q-tooltip>

View file

@ -5,4 +5,15 @@ interface FormProprsalsRound {
done: number;
remain: number;
}
export type { FormProprsalsRound };
interface FormProprsalsRound2 {
period_id: string;
period_name: string;
period_year: string;
period_amount: number;
period_start: any;
period_end: any;
period_isActive: boolean;
period_doc: any;
}
export type { FormProprsalsRound, FormProprsalsRound2 };