โครงสร้างอัตรากำลัง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-02-13 09:44:49 +07:00
parent aff250139c
commit f6352c8b81
3 changed files with 86 additions and 127 deletions

View file

@ -164,8 +164,8 @@ function onClickConfirm() {
async () => { async () => {
console.log(props.rowId, selectedPos.value[0].id); console.log(props.rowId, selectedPos.value[0].id);
const body: Inherit = { const body: Inherit = {
currentId: props.rowId, draftPositionId: selectedPos.value[0].id,
nextId: selectedPos.value[0].id, publishPositionId: props.rowId,
}; };
showLoader(); showLoader();
await http await http
@ -313,81 +313,81 @@ function clearForm() {
/> />
</div> </div>
</q-toolbar> </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 <q-td
flat v-for="col in props.cols"
bordered :key="col.name"
:rows="rows" :props="props"
:columns="columns" >
row-key="id" <div v-if="col.name == 'no'">
no-data-label="ไม่มีข้อมูล" {{ props.rowIndex + 1 }}
ref="table" </div>
: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 <div v-else>
v-for="col in props.cols" {{ col.value }}
:key="col.name" </div>
:props="props" </q-td>
> </q-tr>
<div v-if="col.name == 'no'"> </template>
{{ props.rowIndex + 1 }} <template v-slot:pagination="scope">
</div> <q-pagination
v-model="reqMaster.page"
<div v-else> active-color="primary"
{{ col.value }} color="dark"
</div> :max="totalRow"
</q-td> size="sm"
</q-tr> boundary-links
</template> direction-links
<template v-slot:pagination="scope"> ></q-pagination>
<q-pagination </template>
v-model="reqMaster.page" </d-table>
active-color="primary" </div>
color="dark"
:max="totalRow"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table>
</q-card> </q-card>
</div> </div>
</q-card-section> </q-card-section>

View file

@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
import axios from "axios"; import genReport from "@/plugins/genreport";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; 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 DialogMovePos from "@/modules/02_organizationalNew/components/DialogMovePos.vue";
import DialogHistoryPos from "@/modules/02_organizationalNew/components/DialogHistoryPos.vue"; import DialogHistoryPos from "@/modules/02_organizationalNew/components/DialogHistoryPos.vue";
import DialogSelectPerson from "@/modules/02_organizationalNew/components/DialogSelectPerson.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*/ /** importStore*/
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
@ -33,9 +33,6 @@ const store = useOrganizational();
const { showLoader, hideLoader, messageError, success, dialogRemove } = const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin(); useCounterMixin();
const apiGenReport =
"https://report-server.frappet.synology.me/api/v1/report-template/docx";
/** prosp*/ /** prosp*/
const nodeTree = defineModel<any>("nodeTree", { required: true }); const nodeTree = defineModel<any>("nodeTree", { required: true });
const orgLevel = defineModel<number>("orgLevel", { 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) { function onClickInherit(id: string) {
modalDialogInherit.value = !modalDialogInherit.value; modalDialogSuccession.value = !modalDialogSuccession.value;
rowId.value = id; rowId.value = id;
} }
@ -403,7 +401,7 @@ function getSummary() {
}); });
} }
/** */ /** function DownloadReport*/
async function onClickDownloadReport(val: string) { async function onClickDownloadReport(val: string) {
showLoader(); showLoader();
await http await http
@ -411,48 +409,9 @@ async function onClickDownloadReport(val: string) {
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
if (data) { 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) => { .catch((err) => {
messageError($q, 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> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View file

@ -13,8 +13,8 @@ interface MovePos {
} }
interface Inherit { interface Inherit {
currentId: string; draftPositionId: string;
nextId: string; publishPositionId: string;
} }
export type { FilterMaster, MovePos, Inherit }; export type { FilterMaster, MovePos, Inherit };