โครงสร้างอัตรากำลัง
This commit is contained in:
parent
addf03eaf3
commit
131583f89f
5 changed files with 82 additions and 59 deletions
|
|
@ -351,7 +351,7 @@ function onSubmit() {
|
||||||
posTypeId: e.posTypeId, //*ประเภทตำแหน่ง
|
posTypeId: e.posTypeId, //*ประเภทตำแหน่ง
|
||||||
posLevelId: e.posLevelId, //*ระดับตำแหน่ง
|
posLevelId: e.posLevelId, //*ระดับตำแหน่ง
|
||||||
posExecutiveId: e.posExecutiveId, //ตำแหน่งทางการบริหาร
|
posExecutiveId: e.posExecutiveId, //ตำแหน่งทางการบริหาร
|
||||||
posDictExecutiveField: e.positionName, //ด้านทางการบริหาร
|
posDictExecutiveField: e.positionExecutiveField, //ด้านทางการบริหาร
|
||||||
posDictArea: e.positionArea, //ด้าน/สาขา
|
posDictArea: e.positionArea, //ด้าน/สาขา
|
||||||
}));
|
}));
|
||||||
const body = {
|
const body = {
|
||||||
|
|
@ -366,6 +366,7 @@ function onSubmit() {
|
||||||
positions: positionsData,
|
positions: positionsData,
|
||||||
// succession: succession.value,
|
// succession: succession.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
props.actionType === "ADD"
|
props.actionType === "ADD"
|
||||||
? await http
|
? await http
|
||||||
|
|
@ -446,7 +447,6 @@ function onSubmit() {
|
||||||
/** input ค้นหา */
|
/** input ค้นหา */
|
||||||
const searchRef = ref<any>(null);
|
const searchRef = ref<any>(null);
|
||||||
async function searchInput() {
|
async function searchInput() {
|
||||||
console.log(1);
|
|
||||||
searchRef.value.validate();
|
searchRef.value.validate();
|
||||||
if (!searchRef.value.hasError) {
|
if (!searchRef.value.hasError) {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -524,7 +524,8 @@ function addPosition(data: RowDetailPositions) {
|
||||||
const isIdExist = rows.value.some((item: any) => item.id === data.id);
|
const isIdExist = rows.value.some((item: any) => item.id === data.id);
|
||||||
|
|
||||||
if (!isIdExist) {
|
if (!isIdExist) {
|
||||||
rows.value = [data, ...rows.value];
|
// rows.value = [data, ...rows.value];
|
||||||
|
rows.value.push(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -635,6 +636,7 @@ async function emitSearch(keyword: string, typeSelect: string) {
|
||||||
lazy-rules
|
lazy-rules
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่ตำแหน่ง'}`]"
|
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่ตำแหน่ง'}`]"
|
||||||
|
mask="########################"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,13 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
mainTree: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const title = ref<string>("ย้ายตำแหน่ง");
|
const title = ref<string>("ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน");
|
||||||
const filterTree = ref<string>("");
|
const filterTree = ref<string>("");
|
||||||
const filterRef = ref();
|
const filterRef = ref();
|
||||||
const selectedTree = ref<string>("");
|
const selectedTree = ref<string>("");
|
||||||
|
|
@ -116,60 +120,11 @@ function onClickMovePos() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* function fetch ข้อรายการตำแหน่ง
|
|
||||||
* @param id idTree
|
|
||||||
* @param level levelTree
|
|
||||||
*/
|
|
||||||
async function fetchDataTable(id: string, level: number, action: boolean) {
|
|
||||||
// orgLevel.value = level;
|
|
||||||
// reqMaster.id = id;
|
|
||||||
// reqMaster.type = level;
|
|
||||||
// action1.value = action;
|
|
||||||
// if (action) {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// action1.value = false;
|
|
||||||
// }, 1000);
|
|
||||||
// reqMaster.isAll = false;
|
|
||||||
// reqMaster.page = 1;
|
|
||||||
// reqMaster.pageSize = 10;
|
|
||||||
// reqMaster.keyword = "";
|
|
||||||
// }
|
|
||||||
// if (action === true) {
|
|
||||||
// isLoad.value = true;
|
|
||||||
// }
|
|
||||||
// await http
|
|
||||||
// .post(config.API.orgPosMasterList, reqMaster)
|
|
||||||
// .then((res) => {
|
|
||||||
// posMaster.value = [];
|
|
||||||
// const dataMain: PosMaster[] = [];
|
|
||||||
// totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
|
|
||||||
// res.data.result.data.forEach((e: PosMaster) => {
|
|
||||||
// const p = e.positions;
|
|
||||||
// if (p.length !== 0) {
|
|
||||||
// const a = p.find((el: Position) => el.positionIsSelected === true);
|
|
||||||
// const { id, ...rest } = a ? a : p[0];
|
|
||||||
// const test = { ...e, ...rest };
|
|
||||||
// dataMain.push(test);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// posMaster.value = store.fetchPosMaster(dataMain);
|
|
||||||
// })
|
|
||||||
// .catch((err) => {
|
|
||||||
// messageError($q, err);
|
|
||||||
// posMaster.value = [];
|
|
||||||
// })
|
|
||||||
// .finally(() => {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// isLoad.value = false;
|
|
||||||
// }, 500);
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
() => {
|
() => {
|
||||||
reqMaster.value.page = 1;
|
reqMaster.value.page = 1;
|
||||||
|
title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`;
|
||||||
if (modal.value && props.type === "SINGER") {
|
if (modal.value && props.type === "SINGER") {
|
||||||
const data = rows.value.filter((e: PosMaster2) => e.id === props.rowId);
|
const data = rows.value.filter((e: PosMaster2) => e.id === props.rowId);
|
||||||
selectedFilter.value = data;
|
selectedFilter.value = data;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ 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 genReport from "@/plugins/genreport";
|
import genreport from "@/plugins/genreportxlsx";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
|
@ -12,7 +12,10 @@ import type {
|
||||||
NewPagination,
|
NewPagination,
|
||||||
} from "@/modules/02_organizationalNew/interface/index/Main";
|
} from "@/modules/02_organizationalNew/interface/index/Main";
|
||||||
import type { FilterMaster } from "@/modules/02_organizationalNew/interface/request/organizational";
|
import type { FilterMaster } from "@/modules/02_organizationalNew/interface/request/organizational";
|
||||||
import type { PosMaster2 } from "@/modules/02_organizationalNew/interface/response/organizational";
|
import type {
|
||||||
|
PosMaster2,
|
||||||
|
OrgTree,
|
||||||
|
} from "@/modules/02_organizationalNew/interface/response/organizational";
|
||||||
import type { DataPosition } from "@/modules/02_organizationalNew/interface/index/organizational";
|
import type { DataPosition } from "@/modules/02_organizationalNew/interface/index/organizational";
|
||||||
|
|
||||||
/** importComponents*/
|
/** importComponents*/
|
||||||
|
|
@ -52,6 +55,10 @@ const props = defineProps({
|
||||||
require: true,
|
require: true,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
|
mainTree: {
|
||||||
|
type: Object,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const modalSelectPerson = ref<boolean>(false);
|
const modalSelectPerson = ref<boolean>(false);
|
||||||
|
|
@ -396,14 +403,14 @@ function getSummary() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function DownloadReport*/
|
/** function DownloadReport*/
|
||||||
async function onClickDownloadReport(val: string) {
|
async function onClickDownloadReport(val: string, name: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.orgReport(val))
|
.get(config.API.orgReport(val))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
if (data) {
|
if (data) {
|
||||||
genReport(data, "name");
|
genreport(data, name);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -462,7 +469,7 @@ async function onClickDownloadReport(val: string) {
|
||||||
<q-item
|
<q-item
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click.stop="onClickDownloadReport(item.val)"
|
@click.stop="onClickDownloadReport(item.val, item.name)"
|
||||||
>
|
>
|
||||||
<q-item-section>{{ item.name }}</q-item-section>
|
<q-item-section>{{ item.name }}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
@ -774,6 +781,7 @@ async function onClickDownloadReport(val: string) {
|
||||||
:fetchDataTree="props.fetchDataTree"
|
:fetchDataTree="props.fetchDataTree"
|
||||||
:type="typeMove"
|
:type="typeMove"
|
||||||
:rowId="rowId"
|
:rowId="rowId"
|
||||||
|
:mainTree="props.mainTree ? props.mainTree : []"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- ประวัติตำแหน่ง -->
|
<!-- ประวัติตำแหน่ง -->
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ const nodeId = ref<string>(""); // id ของ Tree
|
||||||
const orgLevel = ref<number>(0); // levelTree
|
const orgLevel = ref<number>(0); // levelTree
|
||||||
const isLoad = ref<boolean>(false); // loadTable
|
const isLoad = ref<boolean>(false); // loadTable
|
||||||
const isLoadTree = ref<boolean>(false); // loadTable
|
const isLoadTree = ref<boolean>(false); // loadTable
|
||||||
|
const mainTree = ref<OrgTree>();
|
||||||
|
|
||||||
const selected = ref<string>("");
|
const selected = ref<string>("");
|
||||||
|
|
||||||
|
|
@ -79,6 +80,7 @@ async function fetchDataTree(id: string) {
|
||||||
* @param level levelTree
|
* @param level levelTree
|
||||||
*/
|
*/
|
||||||
async function fetchDataTable(id: string, level: number, action: boolean) {
|
async function fetchDataTable(id: string, level: number, action: boolean) {
|
||||||
|
mainTree.value = nodeTree.value?.find((e) => e.orgTreeId === id);
|
||||||
orgLevel.value = level;
|
orgLevel.value = level;
|
||||||
reqMaster.id = id;
|
reqMaster.id = id;
|
||||||
reqMaster.type = level;
|
reqMaster.type = level;
|
||||||
|
|
@ -291,6 +293,7 @@ watch(
|
||||||
v-model:reqMaster="reqMaster"
|
v-model:reqMaster="reqMaster"
|
||||||
v-model:totalPage="totalPage"
|
v-model:totalPage="totalPage"
|
||||||
v-model:posMaster="posMaster"
|
v-model:posMaster="posMaster"
|
||||||
|
:mainTree="mainTree"
|
||||||
:fetchDataTable="fetchDataTable"
|
:fetchDataTable="fetchDataTable"
|
||||||
:filterKeyword="filterKeyword"
|
:filterKeyword="filterKeyword"
|
||||||
:fetchDataTree="fetchDataTree"
|
:fetchDataTree="fetchDataTree"
|
||||||
|
|
|
||||||
55
src/plugins/genreportxlsx.ts
Normal file
55
src/plugins/genreportxlsx.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
import axios from "axios";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { showLoader, hideLoader, messageError } = mixin;
|
||||||
|
|
||||||
|
async function genReportXLSX(
|
||||||
|
data: any,
|
||||||
|
fileName: string,
|
||||||
|
type: string = "xlsx"
|
||||||
|
) {
|
||||||
|
showLoader();
|
||||||
|
await axios
|
||||||
|
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||||
|
headers: {
|
||||||
|
accept:
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
|
"content-Type": "application/json",
|
||||||
|
},
|
||||||
|
responseType: "blob",
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
const data = res.data;
|
||||||
|
if (data) {
|
||||||
|
// สร้าง Blob จาก array buffer
|
||||||
|
const blob = new Blob([data]);
|
||||||
|
|
||||||
|
// สร้าง URL สำหรับไฟล์ Blob
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.download = `${fileName}.${type}`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
|
||||||
|
// ลบ URL ที่สร้างขึ้นหลังจากใช้งาน
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default genReportXLSX;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue