diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts
index 5ca74825d..b0c28c673 100644
--- a/src/api/02_organizational/api.organization.ts
+++ b/src/api/02_organizational/api.organization.ts
@@ -40,4 +40,7 @@ export default {
orgProfile: `${orgPos}/profile`,
orgDeleteProfile: (id: string) => `${orgPos}/profile/delete/${id}`,
orgSummary: `${orgPos}/summary`,
+
+ /** report*/
+ orgReport: (report: string) => `${organization}/report/${report}`,
};
diff --git a/src/modules/02_organizationalNew/components/DialogFormPosition.vue b/src/modules/02_organizationalNew/components/DialogFormPosition.vue
index ab54ddec8..08dbc21eb 100644
--- a/src/modules/02_organizationalNew/components/DialogFormPosition.vue
+++ b/src/modules/02_organizationalNew/components/DialogFormPosition.vue
@@ -685,6 +685,19 @@ async function emitSearch(keyword: string, typeSelect: string) {
{{ props.rowIndex + 1 }}
+
+ {{ col.value ? col.value : "-" }}
+
+
+
+ {{ col.value ? col.value : "-" }}
+
+
+
+ {{ col.value ? col.value : "-" }}
+
{{ col.value }}
@@ -839,6 +852,19 @@ async function emitSearch(keyword: string, typeSelect: string) {
{{ props.rowIndex + 1 }}
+
+ {{ col.value ? col.value : "-" }}
+
+
+
+ {{ col.value ? col.value : "-" }}
+
+
+
+ {{ col.value ? col.value : "-" }}
+
{{ col.value }}
diff --git a/src/modules/02_organizationalNew/components/DialogHistoryPos.vue b/src/modules/02_organizationalNew/components/DialogHistoryPos.vue
index 62109c5e1..e3d48dd7f 100644
--- a/src/modules/02_organizationalNew/components/DialogHistoryPos.vue
+++ b/src/modules/02_organizationalNew/components/DialogHistoryPos.vue
@@ -86,6 +86,9 @@ async function fetchHistoryPos(id: string) {
const list = data.map((e: HistoryPos) => ({
...e,
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "-",
+ posMasterNoPrefix: e.posMasterNoPrefix ?? "-",
+ posMasterNo: e.posMasterNo ?? "-",
+ posMasterNoSuffix: e.posMasterNoSuffix ?? "-",
}));
rows.value = list;
})
diff --git a/src/modules/02_organizationalNew/components/tableTree.vue b/src/modules/02_organizationalNew/components/tableTree.vue
index 85c5c0ce4..a07497da4 100644
--- a/src/modules/02_organizationalNew/components/tableTree.vue
+++ b/src/modules/02_organizationalNew/components/tableTree.vue
@@ -3,6 +3,7 @@ import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import config from "@/app.config";
import http from "@/plugins/http";
+import axios from "axios";
/** importType*/
import type { QTableProps } from "quasar";
@@ -30,6 +31,9 @@ const store = useOrganizational();
const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin();
+const apiGenReport =
+ "https://report-server.frappet.synology.me/api/v1/report-template/docx";
+
/** prosp*/
const nodeTree = defineModel("nodeTree", { required: true });
const orgLevel = defineModel("orgLevel", { required: true });
@@ -90,15 +94,15 @@ const listMenu = ref([
const document = ref([
{
name: "บัญชี 1",
- val: "1",
+ val: "report1",
},
{
name: "บัญชี 2",
- val: "2",
+ val: "report2",
},
{
name: "บัญชี 3",
- val: "3",
+ val: "report3",
},
]);
@@ -317,6 +321,7 @@ function updatePagination(newPagination: NewPagination) {
reqMaster.value.page = 1;
}
+/** function openPopup เลือกตนครอง*/
function openSelectPerson(data: DataPosition[]) {
modalSelectPerson.value = true;
dataDetailPos.value = data;
@@ -383,6 +388,60 @@ function getSummary() {
hideLoader();
});
}
+
+/** */
+async function onClickDownloadReport(val: string) {
+ showLoader();
+ await http
+ .get(config.API.orgReport(val))
+ .then((res) => {
+ const data = res.data.result;
+ if (data) {
+ genReportDoc(data);
+ }
+ })
+ .catch((err) => {
+ messageError($q, err);
+ })
+ .finally(() => {
+ hideLoader();
+ });
+}
+
+async function genReportDoc(data: any) {
+ await axios
+ .post(apiGenReport, data, {
+ headers: {
+ accept:
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ "content-Type": "application/json",
+ },
+ responseType: "blob",
+ })
+ .then((res) => {
+ const data = res.data;
+ const blob = new Blob([data], {
+ type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ });
+ // สร้าง URL สำหรับไฟล์ Blob
+
+ const url = URL.createObjectURL(blob);
+
+ const link = import.meta.env?.document.createElement("a");
+
+ // // สร้างลิงก์เพื่อดาวน์โหลดไฟล์
+ link.href = url;
+ link.download = `name.docx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
+ import.meta.env?.document.body.appendChild(link.value);
+ link.click();
+
+ // ลบ URL ที่สร้างขึ้นหลังจากใช้งาน
+ URL.revokeObjectURL(url);
+ })
+ .catch((err) => {
+ messageError($q, err);
+ });
+}
@@ -432,7 +491,11 @@ function getSummary() {
v-for="(item, index) in document"
:key="index"
>
-
+
{{ item.name }}
@@ -650,6 +713,26 @@ function getSummary() {
{{ props.rowIndex + 1 }}
+
+ {{ col.value ? col.value : "-" }}
+
+
+
+ {{ col.value ? col.value : "-" }}
+
+
+
+ {{ col.value ? col.value : "-" }}
+
{{ col.value }}