diff --git a/src/api/manage/api.person.ts b/src/api/manage/api.person.ts index 06059c2a8..f5139ad58 100644 --- a/src/api/manage/api.person.ts +++ b/src/api/manage/api.person.ts @@ -3,16 +3,16 @@ * เมนูย่อย: ข้อมูลเกี่ยวกับบุคคล */ import env from "../index"; -const person = `${env.API_URI}/metadata/main/`; -const province = `${env.API_URI}/metadata/province/`; -const district = `${env.API_URI}/metadata/district/`; -const subDistrict = `${env.API_URI}/metadata/sub-district/`; -const prefix = `${env.API_URI}/metadata/prefix/`; -const bloodGroup = `${env.API_URI}/metadata/blood-group/`; -const educationLevel = `${env.API_URI}/metadata/education-level/`; -const gender = `${env.API_URI}/metadata/gender/`; -const relationship = `${env.API_URI}/metadata/relationship/`; -const religion = `${env.API_URI}/metadata/religion/`; +const person = `${env.API_URI}/org/metadata/main/person/`; +const province = `${env.API_URI}/org/metadata/province/`; +const district = `${env.API_URI}/org/metadata/district/`; +const subDistrict = `${env.API_URI}/org/metadata/subDistrict/`; +const prefix = `${env.API_URI}/org/metadata/prefix/`; +const bloodGroup = `${env.API_URI}/org/metadata/bloodGroup/`; +const educationLevel = `${env.API_URI}/org/metadata/educationLevel/`; +const gender = `${env.API_URI}/org/metadata/gender/`; +const relationship = `${env.API_URI}/org/metadata/relationship/`; +const religion = `${env.API_URI}/org/metadata/religion/`; const orgRelationship = `${env.API_URI}/org/metadata/relationship/`; const orgPrefix = `${env.API_URI}/org/metadata/prefix/`; @@ -41,7 +41,7 @@ export default { /** * api เขต */ - listDistrict: (id: string) => `${district}${id}`, + listDistrict: (id: string) => `${province}${id}`, listDistrictHistory: `${district}history`, listDistrictHistoryId: (id: string | string[]) => `${district}history/${id}`, listDistrictPublishedId: (id: string) => `${district}history/published/${id}`, @@ -51,7 +51,7 @@ export default { /** * api แขวง */ - listSubDistrict: (id: string) => `${subDistrict}${id}`, + listSubDistrict: (id: string) => `${district}${id}`, listSubDistrictHistory: `${subDistrict}history`, listSubDistrictHistoryProvinceId: ( provinceId: string | string[], diff --git a/src/components/information/Address.vue b/src/components/information/Address.vue index 884ccbd70..def60b1de 100644 --- a/src/components/information/Address.vue +++ b/src/components/information/Address.vue @@ -798,7 +798,7 @@ const fetchDistrict = async (id: string | null, position: string) => { await http .get(config.API.listDistrict(id)) .then((res) => { - const data = res.data.result; + const data = res.data.result.districts; let option: DataOption[] = []; data.map((r: any) => { option.push({ id: r.id.toString(), name: r.name.toString() }); @@ -826,7 +826,7 @@ const fetchSubDistrict = async (id: string | null, position: string) => { await http .get(config.API.listSubDistrict(id)) .then((res) => { - const data = res.data.result; + const data = res.data.result.subDistricts; let option: zipCodeOption[] = []; data.map((r: any) => { option.push({ diff --git a/src/modules/03_recruiting/components/Address.vue b/src/modules/03_recruiting/components/Address.vue index 6544ace9d..cc296f502 100644 --- a/src/modules/03_recruiting/components/Address.vue +++ b/src/modules/03_recruiting/components/Address.vue @@ -134,7 +134,7 @@ const fetchDistrict = async (id: string, position: string) => { await http .get(config.API.listDistrict(id)) .then((res) => { - const data = res.data.result; + const data = res.data.result.districts; let option: DataOption[] = []; data.map((r: DataOption) => { option.push({ id: r.id.toString(), name: r.name.toString() }); @@ -158,7 +158,7 @@ const fetchSubDistrict = async (id: string, position: string) => { await http .get(config.API.listSubDistrict(id)) .then((res) => { - const data = res.data.result; + const data = res.data.result.subDistricts; let option: DataOption[] = []; data.map((r: DataOption) => { option.push({ diff --git a/src/modules/03_recruiting/components/Information.vue b/src/modules/03_recruiting/components/Information.vue index bbe96b925..42c8a2995 100644 --- a/src/modules/03_recruiting/components/Information.vue +++ b/src/modules/03_recruiting/components/Information.vue @@ -142,7 +142,7 @@ async function fetchDistrict(id: string) { await http .get(config.API.listDistrict(id)) .then((res) => { - const data = res.data.result; + const data = res.data.result.districts; let option: DataOption[] = []; data.map((r: DataOption) => { option.push({ id: r.id.toString(), name: r.name.toString() }); diff --git a/src/modules/03_recruiting/views/01_compete/Detail.vue b/src/modules/03_recruiting/views/01_compete/Detail.vue index 5d865a1b5..f6d0667a3 100644 --- a/src/modules/03_recruiting/views/01_compete/Detail.vue +++ b/src/modules/03_recruiting/views/01_compete/Detail.vue @@ -11,6 +11,7 @@ import { useQuasar } from "quasar"; import type { RecruitDetailResponse } from "@/modules/03_recruiting/interface/response/Period"; import Table from "@/modules/03_recruiting/components/Table.vue"; +import genReportXLSX from "@/plugins/genreportxlsx"; const $q = useQuasar(); const router = useRouter(); @@ -34,6 +35,8 @@ const visibleColumns = ref([ "dateOfBirth", "gender", "position_name", + "position_type", + "position_level", "university", "degree", "major", @@ -120,6 +123,34 @@ const columns = ref([ sensitivity: "base", }), }, + { + name: "position_type", + align: "left", + label: "ประเภทที่สมัคร", + sortable: true, + field: "position_type", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { + numeric: true, + sensitivity: "base", + }), + }, + { + name: "position_level", + align: "left", + label: "ระดับที่สมัคร", + sortable: true, + field: "position_level", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { + numeric: true, + sensitivity: "base", + }), + }, { name: "university", align: "left", @@ -250,15 +281,10 @@ function clickDetail(examID: string) { async function downloadExam() { showLoader(); await http - .get(config.API.exportExam(importId.value), { - responseType: "blob", - }) - .then((res) => { - var a = document.createElement("a"); - a.href = URL.createObjectURL(res.data); - a.download = `รายชื่อผู้มีสิทธิ์สอบ.xlsx`; - // start download - a.click(); + .get(config.API.exportExam(importId.value)) + .then(async (res) => { + const dataList = res.data.result; + await genReportXLSX(dataList, "ส่งออกข้อมูลผู้มีสิทธิ์สอบ"); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -272,15 +298,10 @@ async function downloadExam() { async function downloadPassExam() { showLoader(); await http - .get(config.API.exportPassExam(importId.value), { - responseType: "blob", - }) - .then((res) => { - var a = document.createElement("a"); - a.href = URL.createObjectURL(res.data); - a.download = `รายชื่อสอบผ่านภาค_ก.xlsx`; - // start download - a.click(); + .get(config.API.exportPassExam(importId.value)) + .then(async (res) => { + const dataList = res.data.result; + await genReportXLSX(dataList, "ส่งออกข้อมูลผู้สอบผ่านภาค ก."); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -294,15 +315,10 @@ async function downloadPassExam() { async function downloadPassResultExam() { showLoader(); await http - .get(config.API.exportPassResultExam(importId.value), { - responseType: "blob", - }) - .then((res) => { - var a = document.createElement("a"); - a.href = URL.createObjectURL(res.data); - a.download = `รายชื่อสอบแข่งขันได้.xlsx`; - // start download - a.click(); + .get(config.API.exportPassResultExam(importId.value)) + .then(async (res) => { + const dataList = res.data.result; + await genReportXLSX(dataList, "ส่งออกข้อมูลผู้สอบแข่งขันได้"); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); diff --git a/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue b/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue index 6eada7e1a..59473d064 100644 --- a/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue +++ b/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue @@ -11,6 +11,7 @@ import { useCounterMixin } from "@/stores/mixin"; import type { RecruitDetailResponse } from "@/modules/03_recruiting/interface/response/Period"; import Table from "@/modules/03_recruiting/components/Table.vue"; +import genReportXLSX from "@/plugins/genreportxlsx"; const $q = useQuasar(); const router = useRouter(); @@ -220,15 +221,10 @@ function clickDetail(examID: string) { async function downloadExam() { showLoader(); await http - .get(config.API.exportDisableExam(importId.value), { - responseType: "blob", - }) - .then((res) => { - var a = document.createElement("a"); - a.href = URL.createObjectURL(res.data); - a.download = `รายชื่อผู้มีสิทธิ์สอบ.xlsx`; - // start download - a.click(); + .get(config.API.exportDisableExam(importId.value)) + .then(async (res) => { + const dataList = res.data.result; + await genReportXLSX(dataList, "ส่งออกข้อมูลผู้มีสิทธิ์สอบ"); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -242,15 +238,10 @@ async function downloadExam() { async function downloadPassExam() { showLoader(); await http - .get(config.API.exportDisablePassExam(importId.value), { - responseType: "blob", - }) - .then((res) => { - var a = document.createElement("a"); - a.href = URL.createObjectURL(res.data); - a.download = `รายชื่อสอบผ่านภาค_ก.xlsx`; - // start download - a.click(); + .get(config.API.exportDisablePassExam(importId.value)) + .then(async (res) => { + const dataList = res.data.result; + await genReportXLSX(dataList, "ส่งออกข้อมูลผู้สอบผ่านภาค"); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -264,15 +255,10 @@ async function downloadPassExam() { async function downloadPassResultExam() { showLoader(); await http - .get(config.API.exportDisablePassResultExam(importId.value), { - responseType: "blob", - }) - .then((res) => { - var a = document.createElement("a"); - a.href = URL.createObjectURL(res.data); - a.download = `รายชื่อคัดเลือกคนพิการได้.xlsx`; - // start download - a.click(); + .get(config.API.exportDisablePassResultExam(importId.value)) + .then(async (res) => { + const dataList = res.data.result; + await genReportXLSX(dataList, "ส่งออกข้อมูลผู้คัดเลือกคนพิการได้"); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text()));