โครงสร้างอัตรากำลัง
This commit is contained in:
parent
aff250139c
commit
f6352c8b81
3 changed files with 86 additions and 127 deletions
|
|
@ -1,9 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
import axios from "axios";
|
||||
import genReport from "@/plugins/genreport";
|
||||
|
||||
/** importType*/
|
||||
import type { QTableProps } from "quasar";
|
||||
|
|
@ -22,7 +22,7 @@ import DialogSort from "@/modules/02_organizationalNew/components/DialogSortPosi
|
|||
import DialogMovePos from "@/modules/02_organizationalNew/components/DialogMovePos.vue";
|
||||
import DialogHistoryPos from "@/modules/02_organizationalNew/components/DialogHistoryPos.vue";
|
||||
import DialogSelectPerson from "@/modules/02_organizationalNew/components/DialogSelectPerson.vue";
|
||||
import DialogInherit from "@/modules/02_organizationalNew/components/DialogInherit.vue";
|
||||
import DialogSuccession from "@/modules/02_organizationalNew/components/DialogSuccession.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
|
||||
|
|
@ -33,9 +33,6 @@ 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 });
|
||||
|
|
@ -364,9 +361,10 @@ function removePerson(id: string) {
|
|||
);
|
||||
}
|
||||
|
||||
const modalDialogInherit = ref<boolean>(false);
|
||||
const modalDialogSuccession = ref<boolean>(false);
|
||||
/** function openPopup สืบทอดตำแหน่ง*/
|
||||
function onClickInherit(id: string) {
|
||||
modalDialogInherit.value = !modalDialogInherit.value;
|
||||
modalDialogSuccession.value = !modalDialogSuccession.value;
|
||||
rowId.value = id;
|
||||
}
|
||||
|
||||
|
|
@ -403,7 +401,7 @@ function getSummary() {
|
|||
});
|
||||
}
|
||||
|
||||
/** */
|
||||
/** function DownloadReport*/
|
||||
async function onClickDownloadReport(val: string) {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -411,48 +409,9 @@ async function onClickDownloadReport(val: string) {
|
|||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
if (data) {
|
||||
genReportDoc(data);
|
||||
genReport(data, "name");
|
||||
}
|
||||
})
|
||||
.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);
|
||||
document.body.appendChild(link.value);
|
||||
link.click();
|
||||
|
||||
// ลบ URL ที่สร้างขึ้นหลังจากใช้งาน
|
||||
URL.revokeObjectURL(url);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
|
|
@ -826,7 +785,7 @@ async function genReportDoc(data: any) {
|
|||
/>
|
||||
|
||||
<!-- สืบทอดตำแหน่ง -->
|
||||
<DialogInherit v-model:modal="modalDialogInherit" :rowId="rowId" />
|
||||
<DialogSuccession v-model:modal="modalDialogSuccession" :rowId="rowId" />
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue