diff --git a/src/api/07_insignia/api.insignia.ts b/src/api/07_insignia/api.insignia.ts index 5cb39c626..c436efde8 100644 --- a/src/api/07_insignia/api.insignia.ts +++ b/src/api/07_insignia/api.insignia.ts @@ -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) => diff --git a/src/modules/07_insignia/components/1_Proposals/listProposals.vue b/src/modules/07_insignia/components/1_Proposals/listProposals.vue index 794662ec3..23ec979d9 100644 --- a/src/modules/07_insignia/components/1_Proposals/listProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/listProposals.vue @@ -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([ - "round", - "year", - "startDate", - "endDate", + "period_name", + "period_year", + "period_start", + "period_end", // "status", "statusRoyal", ]); //ค้นหา คอลัมน์ คอลัมน์ที่แสดง @@ -32,60 +32,49 @@ const visibleColumns = ref([ // หัวตาราง const columns = ref([ { - 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([ ]); // ข้อมูลตาราง (จำลอง) -const rows = ref([ - { - 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([]); 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) => {