diff --git a/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue b/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue index 717d57e..8f414ff 100644 --- a/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue +++ b/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue @@ -293,9 +293,13 @@ function onLevel(num: number, list: any) { } watch( - () => store.dataEvaluation.posTypeName, // ตรวจจับค่า posTypeName + () => [store.dataEvaluation.posTypeName, store.dataEvaluation.posExecutiveName, store.dataEvaluation.position, store.dataEvaluation.posLevelName], // ตรวจจับค่า posTypeName และ posExecutiveName (newValue) => { if (!newValue) return; // ถ้ายังไม่มีค่า ไม่ต้องทำอะไร + const posTypeName = newValue[0]; + const posExecutiveName = newValue[1]; + const position = newValue[2]; + const posLevelName = newValue[3]; const competencyTypeList = [ { @@ -321,17 +325,27 @@ watch( ]; competencyType.value = - newValue === "อำนวยการ" || newValue === "บริหาร" - ? competencyTypeList.filter( - (x: DataOptions) => - x.id === "HEAD" || - x.id === "EXECUTIVE" || - x.id === "INSPECTOR" || - x.id === "DIRECTOR" - ) - : competencyTypeList.filter( - (x: DataOptions) => x.id === "HEAD" || x.id === "GROUP" - ); + position === "ผู้ตรวจราชการกรุงเทพมหานคร" || position === "ผู้ตรวจราชการ" + ? competencyTypeList.filter( + (x: DataOptions) => x.id === "HEAD" || x.id === "INSPECTOR" + ) + : posExecutiveName === "ผู้อำนวยการเขต" + ? competencyTypeList.filter( + (x: DataOptions) => x.id === "HEAD" || x.id === "DIRECTOR" + ) + : posTypeName === "อำนวยการ" || + posTypeName === "บริหาร" || + (posTypeName === "ทั่วไป" && + posLevelName === "อาวุโส" && + posExecutiveName != null) || + (posTypeName === "วิชาการ" && + posExecutiveName != null) + ? competencyTypeList.filter( + (x: DataOptions) => x.id === "HEAD" || x.id === "EXECUTIVE" + ) + : competencyTypeList.filter( + (x: DataOptions) => x.id === "HEAD" || x.id === "GROUP" + ); for (let index = 0; index < competencyType.value.length; index++) { const element = competencyType.value[index];