employee
This commit is contained in:
parent
8390a8ab01
commit
8c989e84b2
23 changed files with 201 additions and 149 deletions
|
|
@ -1,15 +1,30 @@
|
|||
import { ref, computed } from "vue";
|
||||
import { ref, computed, reactive } from "vue";
|
||||
import { defineStore } from "pinia";
|
||||
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
||||
|
||||
export const useDataStore = defineStore("data", () => {
|
||||
const storeRegistry = useRegistryInFormationStore();
|
||||
|
||||
// ref() คือการประกาศ state เหมือน vuex
|
||||
const formData = reactive<any>({
|
||||
prefix: "",
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
position: "",
|
||||
posExecutiveName: "",
|
||||
posTypeName: "",
|
||||
posLevelName: "",
|
||||
posNo: "",
|
||||
});
|
||||
const count = ref<number>(0);
|
||||
const loader = ref<boolean>(false);
|
||||
const isProbation = ref<boolean>(false)
|
||||
|
||||
const isProbation = ref<boolean>(false);
|
||||
const profileImg = ref<string>("");
|
||||
const expandedReport2 = ref<string[]>([]);
|
||||
const selectedReport2 = ref<string>("");
|
||||
const officerType = ref<string>("tets");
|
||||
const officerType = ref<string>("");
|
||||
const officerLink = ref<string>("");
|
||||
|
||||
const expandedRegister = ref<string[]>([]);
|
||||
const selectedRegister = ref<string>("");
|
||||
// computed() คือการประกาศ getters เหมือน vuex
|
||||
|
|
@ -54,6 +69,36 @@ export const useDataStore = defineStore("data", () => {
|
|||
selectedRegister.value = s;
|
||||
};
|
||||
|
||||
async function convertEmType(val: string) {
|
||||
switch (val) {
|
||||
case "OFFICER":
|
||||
return "";
|
||||
case "PERM":
|
||||
case "TEMP":
|
||||
return "-employee";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
async function getData(dataPerson: any) {
|
||||
const data = await dataPerson;
|
||||
isProbation.value = data.isProbation;
|
||||
officerType.value = data.type;
|
||||
officerLink.value = await convertEmType(data.type)
|
||||
formData.prefix = data.prefix;
|
||||
formData.firstName = data.firstName;
|
||||
formData.lastName = data.lastName;
|
||||
formData.position = data.position;
|
||||
|
||||
formData.posTypeName = data.posTypeName;
|
||||
formData.posExecutiveName = data.posExecutiveName;
|
||||
formData.posLevelName = data.posLevelName;
|
||||
formData.posNo = data.rootShortName
|
||||
? `${data.rootShortName}${data.posMaster}`
|
||||
: "";
|
||||
storeRegistry.profileId = data.profileId;
|
||||
}
|
||||
return {
|
||||
count,
|
||||
doubleCount,
|
||||
|
|
@ -69,7 +114,12 @@ export const useDataStore = defineStore("data", () => {
|
|||
selectedRegister,
|
||||
changeTreeRegister,
|
||||
isProbation,
|
||||
officerType
|
||||
officerType,
|
||||
convertEmType,
|
||||
getData,
|
||||
profileImg,
|
||||
formData,
|
||||
officerLink
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue