Merge branch 'nice_dev' into develop
This commit is contained in:
commit
937bf4cf7b
4 changed files with 119 additions and 4 deletions
|
|
@ -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}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -685,6 +685,19 @@ async function emitSearch(keyword: string, typeSelect: string) {
|
|||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div v-else-if="col.name === 'posExecutiveName'">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else-if="col.name === 'positionExecutiveField'"
|
||||
>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
||||
<div v-else-if="col.name === 'positionArea'">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
|
|
@ -839,6 +852,19 @@ async function emitSearch(keyword: string, typeSelect: string) {
|
|||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div v-else-if="col.name === 'posExecutiveName'">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else-if="col.name === 'positionExecutiveField'"
|
||||
>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
||||
<div v-else-if="col.name === 'positionArea'">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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<any>("nodeTree", { required: true });
|
||||
const orgLevel = defineModel<number>("orgLevel", { required: true });
|
||||
|
|
@ -90,15 +94,15 @@ const listMenu = ref<ListMenu[]>([
|
|||
const document = ref<any>([
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -432,7 +491,11 @@ function getSummary() {
|
|||
v-for="(item, index) in document"
|
||||
:key="index"
|
||||
>
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="onClickDownloadReport(item.val)"
|
||||
>
|
||||
<q-item-section>{{ item.name }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
|
|
@ -650,6 +713,26 @@ function getSummary() {
|
|||
<div v-if="col.name == 'no'" class="text-body2">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div
|
||||
v-else-if="col.name === 'posExecutiveName'"
|
||||
class="text-body2"
|
||||
>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else-if="col.name === 'positionExecutiveField'"
|
||||
class="text-body2"
|
||||
>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else-if="col.name === 'positionArea'"
|
||||
class="text-body2"
|
||||
>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
||||
<div v-else class="text-body2">
|
||||
{{ col.value }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue