diff --git a/src/modules/22_issues/components/DialogViewIssue.vue b/src/modules/22_issues/components/DialogViewIssue.vue index fd19ed9c3..d23394fcb 100644 --- a/src/modules/22_issues/components/DialogViewIssue.vue +++ b/src/modules/22_issues/components/DialogViewIssue.vue @@ -1,7 +1,6 @@ - + @@ -210,46 +213,50 @@ const splitterModel = computed({ - + - รหัส: - - {{ data?.codeIssue }} + รหัส: + + {{ data?.codeIssue || "-" }} - - หัวข้อ: - {{ data?.title }} + + หัวข้อ: + {{ data?.title || "-" }} - - รายละเอียด: - {{ data?.description }} + + รายละเอียด: + {{ data?.description || "-" }} - - ระบบ/เมนู: - - {{ convertSystem(data?.system) }} / {{ data?.menu }} + + ระบบ/เมนู: + + {{ convertSystem(data?.system || "") }} / {{ data?.menu }} - - ผู้แจ้ง: - {{ data?.createdFullName }} + + ผู้แจ้ง: + {{ data?.createdFullName || "-" }} - - วันที่แจ้ง: - - {{ date2Thai(data?.createdAt, false, true) }} + + วันที่แจ้ง: + + {{ + data?.createdAt + ? date2Thai(data?.createdAt, false, true) + : "" + }} - - สถานะ: - - {{ convertStatus(data?.status) }} + + สถานะ: + + {{ convertStatus(data?.status || "") }} ไฟล์เอกสารแนบ - + @@ -389,7 +396,7 @@ const splitterModel = computed({ - + - + diff --git a/src/modules/22_issues/interface/Main.ts b/src/modules/22_issues/interface/Main.ts new file mode 100644 index 000000000..cdb6c7cd1 --- /dev/null +++ b/src/modules/22_issues/interface/Main.ts @@ -0,0 +1,42 @@ +import type { D } from "@fullcalendar/core/internal-common"; + +interface Options { + label: string; + value: string; +} + +interface IssueData { + codeIssue: string; + createdAt: Date; + createdFullName: string; + createdUserId: string; + description: string; + id: string; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: Date; + menu: string; + org: string; + remark: string; + status: "IN_PROGRESS" | "RESOLVED" | "CLOSED" | "NEW"; + system: "mgt" | "user" | "checkin"; + title: string; +} + +interface IssueAttachment { + fileName: string; + path: string; + pathname: string; + title: string; +} + +interface IssueAttachmentWithDownloadUrl extends IssueAttachment { + downloadUrl: string; +} + +export type { + Options, + IssueData, + IssueAttachment, + IssueAttachmentWithDownloadUrl, +}; diff --git a/src/modules/22_issues/store.ts b/src/modules/22_issues/store.ts index fb7c52372..f7d19d0a6 100644 --- a/src/modules/22_issues/store.ts +++ b/src/modules/22_issues/store.ts @@ -1,15 +1,16 @@ import { ref } from "vue"; import { defineStore } from "pinia"; +import type { Options } from "@/modules/22_issues/interface/Main"; export const useIssueStore = defineStore("issue", () => { - const systemOptions = ref([ + const systemOptions = ref([ { label: "ทั้งหมด", value: "" }, { label: "ระบบบริหารจัดการ", value: "MGT" }, { label: "ระบบผู้ใช้งาน", value: "USER" }, { label: "ระบบลงเวลา", value: "CHECKIN" }, ]); - const statusOptions = ref([ + const statusOptions = ref([ { label: "ทั้งหมด", value: "" }, { label: "ใหม่", value: "NEW" }, { label: "กำลังดำเนินการ", value: "IN_PROGRESS" }, @@ -29,7 +30,7 @@ export const useIssueStore = defineStore("issue", () => { case "CLOSED": return "ปิดแล้ว"; default: - return status; + return "-"; } } @@ -42,6 +43,8 @@ export const useIssueStore = defineStore("issue", () => { return "ระบบผู้ใช้งาน"; case "CHECKIN": return "ระบบลงเวลา"; + default: + return "-"; } } diff --git a/src/modules/22_issues/views/Main.vue b/src/modules/22_issues/views/Main.vue index 0e1e837fd..31b0209bb 100644 --- a/src/modules/22_issues/views/Main.vue +++ b/src/modules/22_issues/views/Main.vue @@ -10,6 +10,7 @@ import { useCounterMixin } from "@/stores/mixin"; import { useIssueStore } from "@/modules/22_issues/store"; import type { QTableProps } from "quasar"; +import type { IssueData } from "@/modules/22_issues/interface/Main"; import DialogViewIssue from "@/modules/22_issues/components/DialogViewIssue.vue"; @@ -98,16 +99,17 @@ const columns = ref([ format: (val: string) => convertStatus(val), }, ]); -const filterKeyword = ref(""); -const systemFilter = ref(""); -const statusFilter = ref("NEW"); -const rows = ref([]); -const rowsData = ref([]); +const filterKeyword = ref(""); // ค้นหา +const systemFilter = ref(""); // กรองระบบ +const statusFilter = ref("NEW"); // กรองสถานะ +const rows = ref([]); // ข้อมูลตาราง +const rowsData = ref([]); // ข้อมูลตารางทั้งหมด -const modal = ref(false); -const typeModal = ref("view"); -const dataIssue = ref(null); +const modal = ref(false); // modal แสดงรายละเอียด +const typeModal = ref("view"); // ประเภท modal +const dataIssue = ref(null); // ข้อมูลรายงานปัญหา +/** fetch รายการรายงานปัญหา */ async function fetchListIssues() { try { showLoader(); @@ -121,6 +123,7 @@ async function fetchListIssues() { } } +/** ค้นหารายการรายงานปัญหา*/ function onSearch() { let filtered = onSearchDataTable( filterKeyword.value, @@ -144,12 +147,18 @@ function onSearch() { rows.value = filtered; } -function onViewDetail(row: any, type: string) { +/** + * แสดงรายละเอียดรายงานปัญหา + * @param row ข้อมูลรายงานปัญหา + * @param type ประเภทของ modal + */ +function onViewDetail(row: IssueData, type: string) { typeModal.value = type; dataIssue.value = row; modal.value = true; } +/** โหลดข้อมูลเมื่อเข้าหน้า */ onMounted(async () => { await fetchListIssues(); }); @@ -300,7 +309,9 @@ onMounted(async () => { - + {{ col.value ? col.value : "-" }} @@ -311,7 +322,12 @@ onMounted(async () => { - +