fix env report
This commit is contained in:
parent
c9d1d1e4ee
commit
7343405d19
7 changed files with 56 additions and 59 deletions
|
|
@ -10,4 +10,6 @@ VITE_URL_SSO: VITE_URL_SSO
|
||||||
# VITE_CLIENTID_KEYCLOAK: "bma-ehr-exam-vue3"
|
# VITE_CLIENTID_KEYCLOAK: "bma-ehr-exam-vue3"
|
||||||
# VITE_URL_KEYCLOAK: "https://id.frappet.synology.me/"
|
# VITE_URL_KEYCLOAK: "https://id.frappet.synology.me/"
|
||||||
# VITE_API_URI_CONFIG: "https://bma-ehr.frappet.synology.me/api/v1"
|
# VITE_API_URI_CONFIG: "https://bma-ehr.frappet.synology.me/api/v1"
|
||||||
# VITE_API_PUBLISH_URL: "https://bma-ehr-publish.frappet.synology.me"
|
# VITE_API_PUBLISH_URL: "https://bma-ehr-publish.frappet.synology.me"
|
||||||
|
VITE_API_REPORT_URL=VITE_API_REPORT_URL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ do
|
||||||
sed -i 's|VITE_CLIENTSECRET_KEYCLOAK|'${VITE_CLIENTSECRET_KEYCLOAK}'|g' $file
|
sed -i 's|VITE_CLIENTSECRET_KEYCLOAK|'${VITE_CLIENTSECRET_KEYCLOAK}'|g' $file
|
||||||
sed -i 's|VITE_MANUAL_URL|'${VITE_MANUAL_URL}'|g' $file
|
sed -i 's|VITE_MANUAL_URL|'${VITE_MANUAL_URL}'|g' $file
|
||||||
sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file
|
sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file
|
||||||
|
sed -i 's|VITE_API_REPORT_URL|'${VITE_API_REPORT_URL}'|g' $file
|
||||||
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { ref } from "vue";
|
||||||
const env = ref<string>(process.env.NODE_ENV || "development");
|
const env = ref<string>(process.env.NODE_ENV || "development");
|
||||||
export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG;
|
export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG;
|
||||||
export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL;
|
export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL;
|
||||||
|
export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL;
|
||||||
|
|
||||||
// if (process.env.VUE_APP_TEST) {
|
// if (process.env.VUE_APP_TEST) {
|
||||||
// env = "test";
|
// env = "test";
|
||||||
|
|
@ -15,6 +16,8 @@ const config = ref<any>({
|
||||||
API_URL_SUPPORT: "https://bma-ehr.frappet.synology.me/api/v1/support",
|
API_URL_SUPPORT: "https://bma-ehr.frappet.synology.me/api/v1/support",
|
||||||
MEET_URI: "meet.frappet.com",
|
MEET_URI: "meet.frappet.com",
|
||||||
LINK_EVALUATE_PUBLISH: "https://bma-ehr-publish.frappet.synology.me",
|
LINK_EVALUATE_PUBLISH: "https://bma-ehr-publish.frappet.synology.me",
|
||||||
|
API_REPORT_TEMPLATE_URI:
|
||||||
|
"https://report-server.frappet.synology.me/api/v1/report-template",
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
API_URI: "http://localhost:5010/api/v1",
|
API_URI: "http://localhost:5010/api/v1",
|
||||||
|
|
@ -27,6 +30,7 @@ const config = ref<any>({
|
||||||
"https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230707_115124.json",
|
"https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230707_115124.json",
|
||||||
MEET_URI: "meet.frappet.com",
|
MEET_URI: "meet.frappet.com",
|
||||||
LINK_EVALUATE_PUBLISH: apiUrlConfigPublish,
|
LINK_EVALUATE_PUBLISH: apiUrlConfigPublish,
|
||||||
|
API_REPORT_TEMPLATE_URI: apiUrlConfigReport,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -36,6 +40,9 @@ const MEET_URI = ref<string>(config.value[env.value].MEET_URI);
|
||||||
const LINK_EVALUATE_PUBLISH = ref<string>(
|
const LINK_EVALUATE_PUBLISH = ref<string>(
|
||||||
config.value[env.value].LINK_EVALUATE_PUBLISH
|
config.value[env.value].LINK_EVALUATE_PUBLISH
|
||||||
);
|
);
|
||||||
|
const API_REPORT_TEMPLATE_URI = ref<string>(
|
||||||
|
config.value[env.value].API_REPORT_TEMPLATE_URI
|
||||||
|
);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
env: env.value,
|
env: env.value,
|
||||||
|
|
@ -44,4 +51,5 @@ export default {
|
||||||
API_URL_SUPPORT: API_URL_SUPPORT.value,
|
API_URL_SUPPORT: API_URL_SUPPORT.value,
|
||||||
MEET_URI: MEET_URI.value,
|
MEET_URI: MEET_URI.value,
|
||||||
LINK_EVALUATE_PUBLISH: LINK_EVALUATE_PUBLISH.value,
|
LINK_EVALUATE_PUBLISH: LINK_EVALUATE_PUBLISH.value,
|
||||||
|
API_REPORT_TEMPLATE_URI: API_REPORT_TEMPLATE_URI.value,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
7
src/api/reports/api.report.ts
Normal file
7
src/api/reports/api.report.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import env from "../index";
|
||||||
|
|
||||||
|
const reportTemplate = `${env.API_REPORT_TEMPLATE_URI}`;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
reportTemplate,
|
||||||
|
};
|
||||||
|
|
@ -14,6 +14,9 @@ import kpi from "./api/KPI/api.kpis";
|
||||||
import probation from "./api/probation/api.probation";
|
import probation from "./api/probation/api.probation";
|
||||||
import development from "./api/api.development";
|
import development from "./api/api.development";
|
||||||
|
|
||||||
|
/** API reports */
|
||||||
|
import reports from "./api/reports/api.report";
|
||||||
|
|
||||||
const API = {
|
const API = {
|
||||||
...testtest,
|
...testtest,
|
||||||
...retirementResign,
|
...retirementResign,
|
||||||
|
|
@ -27,6 +30,8 @@ const API = {
|
||||||
...kpi,
|
...kpi,
|
||||||
...probation,
|
...probation,
|
||||||
...development,
|
...development,
|
||||||
|
//reports
|
||||||
|
...reports,
|
||||||
};
|
};
|
||||||
|
|
||||||
const path =
|
const path =
|
||||||
|
|
@ -61,7 +66,9 @@ const generatePopupPath = (routeName: any, type: string) => {
|
||||||
return `${path}/manual/chapter-6-user-transfer`;
|
return `${path}/manual/chapter-6-user-transfer`;
|
||||||
}
|
}
|
||||||
if (routeName.includes("appealComplain")) {
|
if (routeName.includes("appealComplain")) {
|
||||||
return `${path}/manual/chapter-${type ? "4" : "7"}-user${type}-appeal-complain`;
|
return `${path}/manual/chapter-${
|
||||||
|
type ? "4" : "7"
|
||||||
|
}-user${type}-appeal-complain`;
|
||||||
}
|
}
|
||||||
if (routeName.includes("KPI-evaluator")) {
|
if (routeName.includes("KPI-evaluator")) {
|
||||||
return `${path}/manual/chapter-9-user-KPI-evaluator`;
|
return `${path}/manual/chapter-9-user-KPI-evaluator`;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import avatar from "@/assets/avatar_user.jpg";
|
import avatar from "@/assets/avatar_user.jpg";
|
||||||
import { ref, reactive, onMounted } from "vue";
|
import { ref, reactive, onMounted } from "vue";
|
||||||
|
import axios from "axios";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useDataStore } from "@/stores/data";
|
import { useDataStore } from "@/stores/data";
|
||||||
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
||||||
import axios from "axios";
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
||||||
//หน้าเมนู
|
//หน้าเมนู
|
||||||
import InformationPage from "@/modules/10_registry/tabs/01_information.vue";
|
import InformationPage from "@/modules/10_registry/tabs/01_information.vue";
|
||||||
import GovernmentPage from "@/modules/10_registry/tabs/02_government.vue";
|
import GovernmentPage from "@/modules/10_registry/tabs/02_government.vue";
|
||||||
|
|
@ -18,8 +20,6 @@ import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
const apiGenReport =
|
|
||||||
"https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
||||||
const store = useRegistryInFormationStore();
|
const store = useRegistryInFormationStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const dataStore = useDataStore();
|
const dataStore = useDataStore();
|
||||||
|
|
@ -42,14 +42,20 @@ async function onClickDownloadKp7(type: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
const url =
|
const url =
|
||||||
type === "FULL"
|
type === "FULL"
|
||||||
? config.API.profileReportId(store.profileId, dataStore.officerType == "OFFICER" ? 'profile':'profile-employee')
|
? config.API.profileReportId(
|
||||||
: config.API.profileKp7ShortId(store.profileId, dataStore.officerType == "OFFICER" ? 'profile':'profile-employee');
|
store.profileId,
|
||||||
|
dataStore.officerType == "OFFICER" ? "profile" : "profile-employee"
|
||||||
|
)
|
||||||
|
: config.API.profileKp7ShortId(
|
||||||
|
store.profileId,
|
||||||
|
dataStore.officerType == "OFFICER" ? "profile" : "profile-employee"
|
||||||
|
);
|
||||||
const fileName = type === "FULL" ? "ก.พ.7/ก.ก.1" : "ประวัติแบบย่อ";
|
const fileName = type === "FULL" ? "ก.พ.7/ก.ก.1" : "ประวัติแบบย่อ";
|
||||||
await http
|
await http
|
||||||
.get(url)
|
.get(url)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result;
|
||||||
await genReport(data, fileName);
|
await genReport(data, fileName, "pdf");
|
||||||
hideLoader();
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -59,46 +65,6 @@ async function onClickDownloadKp7(type: string) {
|
||||||
.finally(() => {});
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function genReport(data: any, fileName: string) {
|
|
||||||
showLoader();
|
|
||||||
await axios
|
|
||||||
.post(apiGenReport, data, {
|
|
||||||
headers: {
|
|
||||||
accept: "application/pdf",
|
|
||||||
"content-Type": "application/json",
|
|
||||||
},
|
|
||||||
responseType: "arraybuffer",
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
const data = res.data;
|
|
||||||
if (data) {
|
|
||||||
// สร้าง Blob จาก array buffer
|
|
||||||
const blob = new Blob([data], {
|
|
||||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
||||||
});
|
|
||||||
|
|
||||||
// สร้าง URL สำหรับไฟล์ Blob
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
|
|
||||||
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
|
||||||
const link = document.createElement("a");
|
|
||||||
link.href = url;
|
|
||||||
link.download = `${fileName}.pdf`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
|
|
||||||
// ลบ URL ที่สร้างขึ้นหลังจากใช้งาน
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
messageError($q, e);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังชั่นกลับหน้าหลัก
|
* ฟังชั่นกลับหน้าหลัก
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
|
@ -7,18 +9,21 @@ const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { showLoader, hideLoader, messageError } = mixin;
|
const { showLoader, hideLoader, messageError } = mixin;
|
||||||
|
|
||||||
const apiGenReport =
|
async function genReport(data: any, fileName: string, type: string = "docx") {
|
||||||
"https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
||||||
|
|
||||||
async function genReport(data: any, fileName: string) {
|
|
||||||
showLoader();
|
showLoader();
|
||||||
await axios
|
await axios
|
||||||
.post(apiGenReport, data, {
|
.post(config.API.reportTemplate + `/docx`, data, {
|
||||||
headers: {
|
headers:
|
||||||
accept:
|
type == "docx"
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
? {
|
||||||
"content-Type": "application/json",
|
accept:
|
||||||
},
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
|
"content-Type": "application/json",
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
accept: "application/pdf",
|
||||||
|
"content-Type": "application/json",
|
||||||
|
},
|
||||||
responseType: "arraybuffer",
|
responseType: "arraybuffer",
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -35,7 +40,7 @@ async function genReport(data: any, fileName: string) {
|
||||||
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = `${fileName}.docx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
link.download = `${fileName}.${type === "docx" ? "docx" : "pdf"}`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue