โครงสร้างอัตรากำลัง
This commit is contained in:
parent
aff250139c
commit
f6352c8b81
3 changed files with 86 additions and 127 deletions
|
|
@ -164,8 +164,8 @@ function onClickConfirm() {
|
|||
async () => {
|
||||
console.log(props.rowId, selectedPos.value[0].id);
|
||||
const body: Inherit = {
|
||||
currentId: props.rowId,
|
||||
nextId: selectedPos.value[0].id,
|
||||
draftPositionId: selectedPos.value[0].id,
|
||||
publishPositionId: props.rowId,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -313,81 +313,81 @@ function clearForm() {
|
|||
/>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
flat
|
||||
bordered
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
no-data-label="ไม่มีข้อมูล"
|
||||
ref="table"
|
||||
:paging="true"
|
||||
dense
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
@update:pagination="updatePagination"
|
||||
selection="single"
|
||||
v-model:selected="selectedPos"
|
||||
>
|
||||
<template v-slot:header-selection="scope">
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="scope.selected"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width></q-th>
|
||||
<q-th
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td>
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="props.selected"
|
||||
/>
|
||||
</q-td>
|
||||
|
||||
<d-table
|
||||
flat
|
||||
bordered
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
no-data-label="ไม่มีข้อมูล"
|
||||
ref="table"
|
||||
:paging="true"
|
||||
dense
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
@update:pagination="updatePagination"
|
||||
class="tableTb"
|
||||
selection="single"
|
||||
v-model:selected="selectedPos"
|
||||
>
|
||||
<template v-slot:header-selection="scope">
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="scope.selected"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width></q-th>
|
||||
<q-th
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td>
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="props.selected"
|
||||
/>
|
||||
</q-td>
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="reqMaster.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="totalRow"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="reqMaster.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="totalRow"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ interface MovePos {
|
|||
}
|
||||
|
||||
interface Inherit {
|
||||
currentId: string;
|
||||
nextId: string;
|
||||
draftPositionId: string;
|
||||
publishPositionId: string;
|
||||
}
|
||||
|
||||
export type { FilterMaster, MovePos, Inherit };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue