This commit is contained in:
Warunee Tamkoo 2024-06-18 17:48:47 +07:00
parent 6d7547d14f
commit d1b1701b58
6 changed files with 56 additions and 48 deletions

View file

@ -130,31 +130,37 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
}
async function checkCompetency() {
const position = await dataEvaluation.value.position;
const executiveName = await dataEvaluation.value.posExecutiveName;
// const position = await dataEvaluation.value.position;
// const executiveName = await dataEvaluation.value.posExecutiveName;
const posTypeName = dataEvaluation.value.posTypeName;
const posLevelName = dataEvaluation.value.posLevelName;
if (
position == "ผู้ตรวจราชการกรุงเทพมหานคร" ||
position == "ผู้ตรวจราชการ"
) {
// if (
// position == "ผู้ตรวจราชการกรุงเทพมหานคร" ||
// position == "ผู้ตรวจราชการ"
// ) {
// competencyType.value = competencyType.value.filter(
// (x: DataOptions) => x.id == "HEAD" || x.id == "INSPECTOR"
// );
// } else if (position == "ผู้อำนวยการเขต") {
// competencyType.value = competencyType.value.filter(
// (x: DataOptions) => x.id == "HEAD" || x.id == "DIRECTOR"
// );
// } else {
if (posTypeName == "อำนวยการ" || posTypeName == "บริหาร") {
competencyType.value = competencyType.value.filter(
(x: DataOptions) => x.id == "HEAD" || x.id == "INSPECTOR"
);
} else if (position == "ผู้อำนวยการเขต") {
competencyType.value = competencyType.value.filter(
(x: DataOptions) => x.id == "HEAD" || x.id == "DIRECTOR"
(x: DataOptions) =>
x.id == "HEAD" ||
x.id == "EXECUTIVE" ||
x.id == "INSPECTOR" ||
x.id == "DIRECTOR"
);
} else {
if (executiveName == null) {
competencyType.value = competencyType.value.filter(
(x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
);
} else {
competencyType.value = competencyType.value.filter(
(x: DataOptions) => x.id == "HEAD" || x.id == "EXECUTIVE"
);
}
competencyType.value = competencyType.value.filter(
(x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
);
}
// }
}
const defaultCompetencyCoreLevel = ref<number>();
@ -231,18 +237,18 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const rolePerson = ref<string>("USER"); //"USER" | "EVALUATOR" | "COMMANDER", "COMMANDERHIGH"
const tabOpen = ref<number>(1);
async function checkStep() {
const role =
dataEvaluation.value.profileId == await dataProfile.value.profileId
? "USER"
: dataEvaluation.value.evaluatorId == await dataProfile.value.profileId
? "EVALUATOR"
: dataEvaluation.value.commanderId == await dataProfile.value.profileId
? "COMMANDER"
: dataEvaluation.value.commanderHighId == await dataProfile.value.profileId
? "COMMANDERHIGH"
: "";
console.log("🚀 ~ checkStep ~ role:", role)
const role = await (dataEvaluation.value.profileId ==
dataProfile.value.profileId
? "USER"
: dataEvaluation.value.evaluatorId == (await dataProfile.value.profileId)
? "EVALUATOR"
: dataEvaluation.value.commanderId == (await dataProfile.value.profileId)
? "COMMANDER"
: dataEvaluation.value.commanderHighId ==
(await dataProfile.value.profileId)
? "COMMANDERHIGH"
: "");
// console.log("🚀 ~ checkStep ~ role:", role);
rolePerson.value = role;
switch (dataEvaluation.value.evaluationStatus) {