แก้ ค้นหาคำจาก ข้อความไม่ได้

This commit is contained in:
setthawutttty 2023-09-04 10:46:49 +07:00
parent 267f863205
commit 50a4a8d182
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`; const Organization = `${env.API_URI}/Organization`;
export default { export default {
getRoundInsignia: (id: string) => `${insignia}/period/${id}`, getRoundInsignia: (id: string) => `${insignia}/period/${id}`,
listRoundInsignia: () => `${insignia}/period/`, listRoundInsignia: () => `${insignia}/period`,
editRoundInsignia: (id: string) => `${insignia}/period/${id}`, editRoundInsignia: (id: string) => `${insignia}/period/${id}`,
RoundInsignia: (id: string) => `${insignia}/period/${id}`, RoundInsignia: (id: string) => `${insignia}/period/${id}`,
requestInsignia: (insigniaPeriodId: string) => requestInsignia: (insigniaPeriodId: string) =>

View file

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

View file

@ -5,4 +5,15 @@ interface FormProprsalsRound {
done: number; done: number;
remain: 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 };