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

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,7 +313,7 @@ function clearForm() {
/> />
</div> </div>
</q-toolbar> </q-toolbar>
<div class="col-12">
<d-table <d-table
flat flat
bordered bordered
@ -326,7 +326,6 @@ function clearForm() {
dense dense
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination" @update:pagination="updatePagination"
class="tableTb"
selection="single" selection="single"
v-model:selected="selectedPos" v-model:selected="selectedPos"
> >
@ -388,6 +387,7 @@ function clearForm() {
></q-pagination> ></q-pagination>
</template> </template>
</d-table> </d-table>
</div>
</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 };