From 27340c9ca8182fe35b4cea4ae80b1e35c0dcfc4d Mon Sep 17 00:00:00 2001 From: waruneeta Date: Sat, 26 Aug 2023 15:59:09 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9C=E0=B8=B9=E0=B8=81=20api=20=E0=B8=88?= =?UTF-8?q?=E0=B8=B1=E0=B8=94=E0=B8=AA=E0=B8=A3=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/07_insignia/api.insignia.ts | 10 +- .../07_insignia/components/2_Manage/Tab4.vue | 2 +- .../components/4_Allocate/DialogForm.vue | 132 +-- .../components/4_Allocate/Main.vue | 515 +++++++++++ .../4_Allocate/{addDetail.vue => OrgAdd.vue} | 0 .../4_Allocate/{detail.vue => OrgList.vue} | 419 ++++----- .../components/4_Allocate/listAllocate.vue | 798 ------------------ .../07_insignia/interface/index/Main.ts | 8 +- src/modules/07_insignia/router.ts | 22 +- src/modules/07_insignia/storeAllocate.ts | 109 +++ 10 files changed, 895 insertions(+), 1120 deletions(-) create mode 100644 src/modules/07_insignia/components/4_Allocate/Main.vue rename src/modules/07_insignia/components/4_Allocate/{addDetail.vue => OrgAdd.vue} (100%) rename src/modules/07_insignia/components/4_Allocate/{detail.vue => OrgList.vue} (51%) delete mode 100644 src/modules/07_insignia/components/4_Allocate/listAllocate.vue create mode 100644 src/modules/07_insignia/storeAllocate.ts diff --git a/src/api/07_insignia/api.insignia.ts b/src/api/07_insignia/api.insignia.ts index aa40e3a81..f5f84c34a 100644 --- a/src/api/07_insignia/api.insignia.ts +++ b/src/api/07_insignia/api.insignia.ts @@ -41,4 +41,12 @@ export default { uploadfilereceice: (noteId: string) => `${insignia}/request/import/receice/${noteId}`, uploadfileinvoice: (noteId: string) => `${insignia}/request/import/invoice/${noteId}`, -}; + // จัดสรรเครื่องราช + insigniaManageType: (insigniaTypeId: string, year: number) => `${insignia}/manage/type/${year}/${insigniaTypeId}`, + insigniaManageAdd: () => `${insignia}/manage`, + insigniaManageById: (insigniaManageId: string) => `${insignia}/manage/${insigniaManageId}`, + + insigniaManageOrg: (insigniaManageId: string) => `${insignia}/manage/org/${insigniaManageId}`, + insigniaManageOrgAdd: () => `${insignia}/manage/org`, + insigniaManageOrgDashboard: (insigniaManageId: string) => `${insignia}/manage/org/dashboard/${insigniaManageId}`, +}; \ No newline at end of file diff --git a/src/modules/07_insignia/components/2_Manage/Tab4.vue b/src/modules/07_insignia/components/2_Manage/Tab4.vue index 9f32c39c4..d42a3e9c4 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab4.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab4.vue @@ -86,7 +86,7 @@ const pagination = ref({ rowsPerPage: 10, }); const paging = ref(true); -const paginationLabel = (start: string, end: string, total: string) => { +const paginationLabel = (start: number, end: number, total: number) => { if (paging.value == true) return " " + start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total; }; diff --git a/src/modules/07_insignia/components/4_Allocate/DialogForm.vue b/src/modules/07_insignia/components/4_Allocate/DialogForm.vue index c2189595d..bae0b4ea6 100644 --- a/src/modules/07_insignia/components/4_Allocate/DialogForm.vue +++ b/src/modules/07_insignia/components/4_Allocate/DialogForm.vue @@ -1,45 +1,24 @@ @@ -96,64 +54,22 @@ const dataSave = async () => { จัดสรรเครื่องราชฯ - +
-
+
- - +
- +
diff --git a/src/modules/07_insignia/components/4_Allocate/Main.vue b/src/modules/07_insignia/components/4_Allocate/Main.vue new file mode 100644 index 000000000..05ab65f89 --- /dev/null +++ b/src/modules/07_insignia/components/4_Allocate/Main.vue @@ -0,0 +1,515 @@ + + + + diff --git a/src/modules/07_insignia/components/4_Allocate/addDetail.vue b/src/modules/07_insignia/components/4_Allocate/OrgAdd.vue similarity index 100% rename from src/modules/07_insignia/components/4_Allocate/addDetail.vue rename to src/modules/07_insignia/components/4_Allocate/OrgAdd.vue diff --git a/src/modules/07_insignia/components/4_Allocate/detail.vue b/src/modules/07_insignia/components/4_Allocate/OrgList.vue similarity index 51% rename from src/modules/07_insignia/components/4_Allocate/detail.vue rename to src/modules/07_insignia/components/4_Allocate/OrgList.vue index 0978ded92..9c8d806ca 100644 --- a/src/modules/07_insignia/components/4_Allocate/detail.vue +++ b/src/modules/07_insignia/components/4_Allocate/OrgList.vue @@ -1,173 +1,30 @@ - - + + diff --git a/src/modules/07_insignia/interface/index/Main.ts b/src/modules/07_insignia/interface/index/Main.ts index a90772c1d..1353de759 100644 --- a/src/modules/07_insignia/interface/index/Main.ts +++ b/src/modules/07_insignia/interface/index/Main.ts @@ -3,4 +3,10 @@ interface OptionData { name: string; } -export type { OptionData }; +interface OptionDataYear { + id: string; + name: string; + year: number; +} + +export type { OptionData, OptionDataYear }; diff --git a/src/modules/07_insignia/router.ts b/src/modules/07_insignia/router.ts index 20b2b9793..5257de7b2 100644 --- a/src/modules/07_insignia/router.ts +++ b/src/modules/07_insignia/router.ts @@ -17,15 +17,17 @@ const roundAdd = () => const listMange = () => import("@/modules/07_insignia/components/2_Manage/listManage.vue"); const listAllocate = () => - import("@/modules/07_insignia/components/4_Allocate/listAllocate.vue"); + import("@/modules/07_insignia/components/4_Allocate/Main.vue"); const allocateAdd = () => import("@/modules/07_insignia/components/4_Allocate/allocateAdd.vue"); -const allocateDetail = () => - import("@/modules/07_insignia/components/4_Allocate/detail.vue"); -const allocateDetailAdd = () => - import("@/modules/07_insignia/components/4_Allocate/addDetail.vue"); +const allocateOrdList = () => + import("@/modules/07_insignia/components/4_Allocate/OrgList.vue"); +const allocateOrgAdd = () => + import("@/modules/07_insignia/components/4_Allocate/OrgAdd.vue"); const VatInsignia = () => import("@/modules/07_insignia/components/VatInsignia.vue"); + +// ยืม - คืนเครื่องราช const insigniaBorrow = () => import("@/modules/07_insignia/components/5_Borrow/Main.vue"); export default [ @@ -142,8 +144,8 @@ export default [ }, { path: "/insignia/allocate/detail/:id", - name: "allocateDetail", - component: allocateDetail, + name: "allocateOrdList", + component: allocateOrdList, meta: { Auth: true, Key: [8.9], @@ -152,11 +154,11 @@ export default [ }, { path: "/insignia/allocate/detail-add", - name: "allocateDetailAdd", - component: allocateDetailAdd, + name: "allocateOrgAdd", + component: allocateOrgAdd, meta: { Auth: true, - Key: [8.9], + Key: [8.10], Role: "insignia", }, }, diff --git a/src/modules/07_insignia/storeAllocate.ts b/src/modules/07_insignia/storeAllocate.ts new file mode 100644 index 000000000..9137c446b --- /dev/null +++ b/src/modules/07_insignia/storeAllocate.ts @@ -0,0 +1,109 @@ +import { defineStore } from "pinia"; +import { ref, } from "vue"; +import { useCounterMixin } from "@/stores/mixin"; + +const mixin = useCounterMixin(); +const { + date2Thai, +} = mixin; + +export const useResultDataStore = defineStore("insigniaResult", () => { + const insigniaName = ref('') + const insignia = ref('') + const insigniaOp = ref([{ name: "ทั้งหมด", id: "", type: "" }]) + const insigniaOp2 = ref([]) + const insigniaType = ref() + const invoiceType = ref('all') + const invoiceTypeop = ref([{ name: "ทั้งหมด", id: "all" }, { name: "ใบกำกับที่ค้างจ่าย", id: "noDate" }, { name: "ใบกำกับที่จ่ายแล้ว", id: "haveDate" }]) + const rows = ref([]) + const listInsignia = ref([]) + + const fetchDatainsignia = async (data: any) => { + insignia.value = '' + invoiceType.value = 'all' + insigniaOp.value = [{ name: "ทั้งหมด", id: "", type: "" }] + data.forEach((e: any) => { + insigniaOp.value.push({ name: e.name, id: e.id, type: e.insigniaType.id }) + }); + } + + const fetchDatainsigniaType = async (data: any) => { + insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name })) + } + + const fetchlistinsignia = async (data: any) => { + rows.value = []; + let alllist = await data.map((e: any) => ({ + id: e.id, + citizenId: e.citizenId, + prefix: e.prefix, + position: e.position, + status: status(e.status), + dateReceive: date2Thai(e.dateReceive), + name: e.fullName, + type: e.requestInsignia, + employeeType: profileType(e.profileType), + profileType: e.profileType, + page: e.page, + number: e.no, + vatnumber: e.number, + datepay: date2Thai(e.datePayment), + typepay: e.typePayment, + address: e.address, + })); + rows.value = alllist + listInsignia.value = alllist + selectInvoice(invoiceType.value) + + } + + const selectInvoice = (invoice: string) => { + console.log(invoice); + if (invoice === "noDate") { + let list = listInsignia.value.filter((e: any) => e.datepay === null) + rows.value = list + } else if (invoice === "haveDate") { + let list = listInsignia.value.filter((e: any) => e.datepay !== null) + rows.value = list + } else rows.value = listInsignia.value + } + + const status = (val: string) => { + switch (val) { + case "PENDING": + return "รอบันทึกข้อมูล"; + case "REJECT": + return "ยกเลิก"; + case "DELETE": + return "ลบ"; + case "DONE": + return "บันทึกลง ก.พ. 7 แล้ว"; + } + } + + const profileType = (val: string) => { + switch (val) { + case "officer": + return "ข้าราชการ กทม.สามัญ"; + case "employee": + return "ลูกจ้างประจำ"; + } + } + + return { + rows, + insignia, + insigniaOp, + insigniaOp2, + insigniaType, + invoiceType, + invoiceTypeop, + fetchDatainsignia, + fetchDatainsigniaType, + status, + profileType, + fetchlistinsignia, + selectInvoice, + insigniaName + }; +});