เพิ่มอัตรากำลังลูกจ้างประจำ
This commit is contained in:
parent
a7f3529e56
commit
748a878deb
22 changed files with 6106 additions and 0 deletions
141
src/modules/16_positionEmployee/store/organizational.ts
Normal file
141
src/modules/16_positionEmployee/store/organizational.ts
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { reactive, ref } from "vue";
|
||||
|
||||
/** importType*/
|
||||
import type {
|
||||
DataActive,
|
||||
SumPosition,
|
||||
PosMaster,
|
||||
} from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||
|
||||
export const usePositionEmp = defineStore("positionEmpStore", () => {
|
||||
const typeOrganizational = ref<string>("current");
|
||||
const statusView = ref<string>("list");
|
||||
|
||||
const dataActive = ref<DataActive>();
|
||||
const activeId = ref<string>();
|
||||
const draftId = ref<string>();
|
||||
const historyId = ref<string>();
|
||||
const treeId = ref<string>();
|
||||
const level = ref<number>();
|
||||
const isPublic = ref<boolean>(false);
|
||||
const orgPublishDate = ref<Date | null>(null);
|
||||
const sumPosition = reactive({
|
||||
total: 0,
|
||||
use: 0,
|
||||
vacant: 0,
|
||||
totalRoot: 0,
|
||||
useRoot: 0,
|
||||
vacantRoot: 0,
|
||||
});
|
||||
|
||||
function getSumPosition(data: SumPosition) {
|
||||
sumPosition.total = data.totalPosition;
|
||||
sumPosition.totalRoot = data.totalRootPosition ? data.totalRootPosition : 0;
|
||||
|
||||
if (typeOrganizational.value == "draft") {
|
||||
sumPosition.use = data.totalPositionNextUse;
|
||||
sumPosition.useRoot = data.totalRootPositionNextUse
|
||||
? data.totalRootPositionNextUse
|
||||
: 0;
|
||||
|
||||
sumPosition.vacant = data.totalPositionNextVacant;
|
||||
sumPosition.vacantRoot = data.totalRootPositionNextVacant
|
||||
? data.totalRootPositionNextVacant
|
||||
: 0;
|
||||
} else {
|
||||
sumPosition.use = data.totalPositionCurrentUse;
|
||||
sumPosition.useRoot = data.totalRootPositionCurrentUse
|
||||
? data.totalRootPositionCurrentUse
|
||||
: 0;
|
||||
|
||||
sumPosition.vacant = data.totalPositionCurrentVacant;
|
||||
sumPosition.vacantRoot = data.totalRootPositionCurrentVacant
|
||||
? data.totalRootPositionCurrentVacant
|
||||
: 0;
|
||||
}
|
||||
}
|
||||
|
||||
function fetchDataActive(data: DataActive) {
|
||||
activeId.value = data.activeId;
|
||||
draftId.value = data.draftId;
|
||||
dataActive.value = data;
|
||||
isPublic.value = data.isPublic;
|
||||
orgPublishDate.value = data.orgPublishDate;
|
||||
}
|
||||
|
||||
function fetchPosMaster(data: PosMaster[]) {
|
||||
const newPosMaster = data.map((e: PosMaster) => ({
|
||||
...e,
|
||||
positionIsSelected:
|
||||
typeOrganizational.value === "draft" && e.fullNameNextHolder !== null
|
||||
? e.fullNameNextHolder
|
||||
: typeOrganizational.value !== "draft" &&
|
||||
e.fullNameCurrentHolder !== null
|
||||
? e.fullNameCurrentHolder
|
||||
: "ว่าง",
|
||||
posMasterNo:
|
||||
e.orgShortname +
|
||||
e.posMasterNoPrefix +
|
||||
e.posMasterNo +
|
||||
e.posMasterNoSuffix,
|
||||
positionName: e.isSit ? e.profilePosition : e.positionName,
|
||||
posTypeName: e.isSit ? e.profilePostype : e.posTypeName,
|
||||
posLevelName: e.isSit ? e.profilePoslevel : e.posLevelName,
|
||||
posExecutiveName: e.posExecutiveName,
|
||||
isSit: e.isSit,
|
||||
}));
|
||||
|
||||
return newPosMaster;
|
||||
}
|
||||
|
||||
function checkLevel(type: number) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return "Root";
|
||||
case 1:
|
||||
return "Child1";
|
||||
case 2:
|
||||
return "Child2";
|
||||
case 3:
|
||||
return "Child3";
|
||||
default:
|
||||
return "Child4";
|
||||
}
|
||||
}
|
||||
|
||||
function convertType(type: string) {
|
||||
switch (type) {
|
||||
case "DEPARTMENT":
|
||||
return "ระดับสำนัก";
|
||||
case "OFFICE":
|
||||
return "ระดับกอง/สำนักงาน/ส่วนราชการ/โรงพยาบาล/เทียบเท่ากอง";
|
||||
case "DIVISION":
|
||||
return "ระดับส่วน/กลุ่มภารกิจ";
|
||||
case "SECTION":
|
||||
return "ระดับฝ่าย/กลุ่มงาน";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
typeOrganizational,
|
||||
statusView,
|
||||
|
||||
//
|
||||
fetchDataActive,
|
||||
checkLevel,
|
||||
convertType,
|
||||
draftId,
|
||||
activeId,
|
||||
historyId,
|
||||
treeId,
|
||||
level,
|
||||
isPublic,
|
||||
orgPublishDate,
|
||||
fetchPosMaster,
|
||||
sumPosition,
|
||||
getSumPosition,
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue