import { defineStore } from "pinia"; import { ref } from 'vue' import { useCounterMixin } from "@/stores/mixin"; import type { DataOption } from "@/modules/07_appealComplain/interface/index/main"; import type { QTableProps } from "quasar"; import type { RowList, MainList } from '@/modules/07_appealComplain/interface/response/mainType' export const useAppealComplainStore = defineStore("appealComplainStore", () => { const mixin = useCounterMixin() const { date2Thai } = mixin const rows = ref([]); const visibleColumns = ref([]); const columns = ref([]); const typeOptions = ref([ { id: "APPEAL", name: "อุทธรณ์" }, { id: "COMPLAIN", name: "ร้องทุกข์" }, ]); const statusOptions = ref([ { id: "ALL", name: "ทั้งหมด" }, { id: "NEW", name: "ใหม่" }, { id: "RECEIVE_DOC", name: "ได้รับเอกสารแล้ว" }, { id: "RECEIVE_APPEAL", name: "รับอุทธรณ์/ร้องทุกข์" }, { id: "NO_RECEIVE_APPEAL", name: "ไม่รับอุทธรณ์/ร้องทุกข์" }, { id: "DIAGNOSTIC", name: "ตั้งองค์คณะวินิจฉัย" }, { id: "SUMMARY", name: "สรุปผลการพิจารณา" }, { id: "DONE", name: "ปิดคำร้อง" }, ]); function fetchAppealComplain(data: MainList[]) { let dataList: RowList[] = data.map((e: MainList) => ({ id: e.id, profileId: e.profileId, type: typeConvert(e.type), title: e.title, description: e.description, year: e.year + 543, fullname: e.fullname, citizenId: e.citizenId, caseType: e.caseType, caseNumber: e.caseNumber, lastUpdatedAt: date2Thai(e.lastUpdatedAt), status: statusTothai(e.status), })); rows.value = dataList; } const typeConvert = (val: string) => { switch (val) { case "APPEAL": return "อุทธรณ์"; case "COMPLAIN": return "ร้องทุกข์"; default: return "-"; } }; const statusTothai = (val: string) => { switch (val) { case "NEW": return "ใหม่"; case "RECEIVE_DOC": return "ได้รับเอกสารแล้ว"; case "RECEIVE_APPEAL": return "รับอุทธรณ์/ร้องทุกข์"; case "NO_RECEIVE_APPEAL": return "ไม่รับอุทธรณ์/ร้องทุกข์"; case "DIAGNOSTIC": return "ตั้งองค์คณะวินิจฉัย"; case "SUMMARY": return "สรุปผลการพิจารณา"; case "DONE": return "ปิดคำร้อง"; default: return "-"; } }; return { visibleColumns, columns, fetchAppealComplain, rows, typeOptions, statusOptions }; });