อัตรากำลังลูกจ้างประจำ ฯ => refactor code
This commit is contained in:
parent
7e2350eef8
commit
81e0a82b0e
18 changed files with 377 additions and 188 deletions
|
|
@ -5,20 +5,21 @@ import config from "@/app.config";
|
|||
import http from "@/plugins/http";
|
||||
import genreport from "@/plugins/genreportxlsx";
|
||||
|
||||
/** importType*/
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
ListMenu,
|
||||
NewPagination,
|
||||
} from "@/modules/16_positionEmployee/interface/index/Main";
|
||||
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
|
||||
import type {
|
||||
PosMaster2,
|
||||
OrgTree,
|
||||
} from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||
import type { PosMaster2 } from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||
import type { DataPosition } from "@/modules/16_positionEmployee/interface/index/organizational";
|
||||
|
||||
/** importComponents*/
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import DialogFormPosotion from "@/modules/16_positionEmployee/components/DialogFormPosition.vue";
|
||||
import DialogPositionDetail from "@/modules/16_positionEmployee/components/DialogPositionDetail.vue";
|
||||
import DialogSort from "@/modules/16_positionEmployee/components/DialogSortPosition.vue";
|
||||
|
|
@ -27,23 +28,29 @@ import DialogHistoryPos from "@/modules/16_positionEmployee/components/DialogHis
|
|||
import DialogSelectPerson from "@/modules/16_positionEmployee/components/DialogSelectPerson.vue";
|
||||
import DialogSuccession from "@/modules/16_positionEmployee/components/DialogSuccession.vue";
|
||||
|
||||
/** importStore*/
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/**
|
||||
* ues
|
||||
*/
|
||||
const $q = useQuasar();
|
||||
const store = usePositionEmp();
|
||||
const { showLoader, hideLoader, messageError, success, dialogRemove } =
|
||||
useCounterMixin();
|
||||
|
||||
/** prosp*/
|
||||
/**
|
||||
* prosp
|
||||
*/
|
||||
const nodeTree = defineModel<any>("nodeTree", { required: true });
|
||||
const orgLevel = defineModel<number>("orgLevel", { required: true });
|
||||
const treeId = defineModel<string>("treeId", { required: true });
|
||||
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
||||
const totalPage = defineModel<number>("totalPage", { required: true });
|
||||
const posMaster = defineModel<PosMaster2[]>("posMaster", { required: true });
|
||||
// const shortName = defineModel<string>("shortName", { required: true });
|
||||
const props = defineProps({
|
||||
filterKeyword: { type: Function, require: true, default: () => {} },
|
||||
fetchDataTable: {
|
||||
|
|
@ -63,7 +70,17 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const modalSelectPerson = ref<boolean>(false);
|
||||
/**
|
||||
* modal popup
|
||||
*/
|
||||
const dialogDetail = ref<boolean>(false); // รายละเอียดตำแหน่ง
|
||||
const modalSelectPerson = ref<boolean>(false); // เลือกคนครอง
|
||||
const dialogPosition = ref<boolean>(false); // อัตรากำลัง
|
||||
const modalSort = ref<boolean>(false); // จัดลำดับ
|
||||
const modalDialogMMove = ref<boolean>(false); // ย้ายตำแหน่ง
|
||||
const modalDialogSuccession = ref<boolean>(false); // สืบทอดตำแหน่ง
|
||||
const modalDialogHistoryPos = ref<boolean>(false); // ประวัติตำแหน่ง
|
||||
|
||||
const rowId = ref<string>("");
|
||||
const actionType = ref<string>("");
|
||||
/** ListMenu Table*/
|
||||
|
|
@ -86,32 +103,6 @@ const listMenu = ref<ListMenu[]>([
|
|||
type: "MOVE",
|
||||
color: "blue-10",
|
||||
},
|
||||
// {
|
||||
// label: "สืบทอดตำแหน่ง",
|
||||
// icon: "mdi-account-multiple-outline",
|
||||
// type: "INHERIT",
|
||||
// color: "deep-orange",
|
||||
// },
|
||||
// {
|
||||
// label: "ประวัติตำแหน่ง",
|
||||
// icon: "history",
|
||||
// type: "HISTORY",
|
||||
// color: "deep-purple",
|
||||
// },
|
||||
]);
|
||||
const document = ref<any>([
|
||||
{
|
||||
name: "บัญชี 1",
|
||||
val: "report1",
|
||||
},
|
||||
{
|
||||
name: "บัญชี 2",
|
||||
val: "report2",
|
||||
},
|
||||
{
|
||||
name: "บัญชี 3",
|
||||
val: "report3",
|
||||
},
|
||||
]);
|
||||
|
||||
/** columns*/
|
||||
|
|
@ -172,7 +163,6 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
|
||||
const dialogPosition = ref<boolean>(false);
|
||||
/**
|
||||
* function openPopup เพิ่มอัตรากำลัง
|
||||
* @param type ประเภท
|
||||
|
|
@ -184,7 +174,6 @@ function onClickPosition(type: string, id: string) {
|
|||
dialogPosition.value = !dialogPosition.value;
|
||||
}
|
||||
|
||||
const dialogDetail = ref<boolean>(false);
|
||||
const dataDetailPos = ref<DataPosition[]>([]);
|
||||
/**
|
||||
* function ดูรายละเอียดประวัติตำแหน่ง
|
||||
|
|
@ -218,13 +207,13 @@ function onClickDelete(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
const modalSort = ref<boolean>(false);
|
||||
/** fdunction จัดลำดับตำแหน่ง */
|
||||
/**
|
||||
* fdunction จัดลำดับตำแหน่ง
|
||||
*/
|
||||
function onClickSort() {
|
||||
modalSort.value = true;
|
||||
}
|
||||
|
||||
const modalDialogMMove = ref<boolean>(false);
|
||||
const typeMove = ref<string>("");
|
||||
/**
|
||||
* function openPopup ย้ายตำแหน่ง
|
||||
|
|
@ -237,7 +226,6 @@ function onClickMovePos(id: string, type: string) {
|
|||
rowId.value = id;
|
||||
}
|
||||
|
||||
const modalDialogHistoryPos = ref<boolean>(false);
|
||||
/**
|
||||
* function ดูประวัติตำแหน่ง
|
||||
* @param id ID ตำแหน่ง
|
||||
|
|
@ -256,13 +244,17 @@ function updatePagination(newPagination: NewPagination) {
|
|||
reqMaster.value.page = 1;
|
||||
}
|
||||
|
||||
/** function openPopup เลือกตนครอง*/
|
||||
/**
|
||||
* function openPopup เลือกตนครอง
|
||||
*/
|
||||
function openSelectPerson(data: DataPosition[]) {
|
||||
modalSelectPerson.value = true;
|
||||
dataDetailPos.value = data;
|
||||
}
|
||||
|
||||
/** ลบคนครอง */
|
||||
/**
|
||||
* ลบคนครอง
|
||||
*/
|
||||
function removePerson(id: string) {
|
||||
dialogRemove(
|
||||
$q,
|
||||
|
|
@ -291,14 +283,17 @@ function removePerson(id: string) {
|
|||
);
|
||||
}
|
||||
|
||||
const modalDialogSuccession = ref<boolean>(false);
|
||||
/** function openPopup สืบทอดตำแหน่ง*/
|
||||
/**
|
||||
* function openPopup สืบทอดตำแหน่ง
|
||||
*/
|
||||
function onClickInherit(id: string) {
|
||||
modalDialogSuccession.value = !modalDialogSuccession.value;
|
||||
rowId.value = id;
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลสถิติจำนวนด้านบน*/
|
||||
/**
|
||||
* ดึงข้อมูลสถิติจำนวนด้านบน
|
||||
*/
|
||||
function getSummary() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -331,22 +326,6 @@ function getSummary() {
|
|||
});
|
||||
}
|
||||
|
||||
/** function DownloadReport*/
|
||||
async function onClickDownloadReport(val: string, name: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgReportEmp(val))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
if (data) {
|
||||
genreport(data, name);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
const pagination = ref({
|
||||
page: reqMaster.value.page,
|
||||
rowsPerPage: reqMaster.value.pageSize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue