Commit a57fbb61 by Nattana Chaiyamat

แบบประเมินสมรรถนะ

parent 30016591
import { ViewportScroller } from '@angular/common';
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Competency, MasfromEvaluationAssessment2List } from 'src/app/shared/model/competency.model';
import { EmployeeModel, MyEmployeeModel } from 'src/app/shared/model/employee.model';
import { SettingAssessmentModel, MySettingAssessmentModel } from 'src/app/shared/model/setting-assessment.model';
......@@ -13,7 +13,7 @@ import Swal from 'sweetalert2';
styleUrls: ['./pms-competency.component.scss']
})
export class PmsCompetencyComponent {
@Input() currentTap = ""
currentPart = ""
@Input() evaluateeId = ""
@Input() evaluaterId = ""
@Input() appraisalCompentencyList: Competency[] = []
......@@ -21,6 +21,9 @@ export class PmsCompetencyComponent {
@Output() sendReturnPath: EventEmitter<any> = new EventEmitter<any>();
@Output() compentencyFormRemain: EventEmitter<any> = new EventEmitter<any>();
@Output() compentencyForm: EventEmitter<any> = new EventEmitter<any>();
@Output() compentencyScore: EventEmitter<any> = new EventEmitter<any>();
@Output() compentencyWeightScore: EventEmitter<any> = new EventEmitter<any>();
@Output() compentencyGap: EventEmitter<any> = new EventEmitter<any>();
@Input() canEdit = false
@Input() currentStep = ""
@Input() dateIso = ""
......@@ -38,6 +41,7 @@ export class PmsCompetencyComponent {
}]
scoreDescriptions = [
'',
'ไม่มีความรู้พื้นฐานเลย ขาดทักษะในงาน',
'มีความรู้ในงานบ้างแต่ยังไม่สามารถ ประยุกต์ใช้ในงานได้',
'นำความรู้มาประยุกต์ใช้ในงานได้ ปฏิบัติงานเองได้ด้วยตัวเองแก้ไขปัญหาหน้างานได้',
......@@ -47,6 +51,8 @@ export class PmsCompetencyComponent {
evaluatee: { loading: boolean, data: EmployeeModel } = { loading: false, data: new MyEmployeeModel() }
biOpen: Map<string, boolean> = new Map<string, boolean>()
biScore: Map<string, number> = new Map<string, number>()
@ViewChild('scrollContainer') scrollContainer!: ElementRef;
constructor(private appraisalService: AppraisalService,
private employeeService: EmployeeService,
private cdr: ChangeDetectorRef,
......@@ -56,7 +62,7 @@ export class PmsCompetencyComponent {
}
ngOnInit(): void {
if (this.appraisalCompentencyList.length) {
this.currentTap = this.currentTap == '' ? this.appraisalCompentencyList[0].comType : this.currentTap
this.currentPart = this.currentPart == '' ? this.appraisalCompentencyList[0].comType : this.currentPart
}
this.getAppraisalCompentencyForm(0)
this.getSettingList()
......@@ -93,10 +99,14 @@ export class PmsCompetencyComponent {
getAppraisalCompentencyForm(index: number) {
if (this.appraisalCompentencyList.length) {
this.appraisalCompentencyIndex = index
this.currentTap = this.appraisalCompentencyList[this.appraisalCompentencyIndex].comType
this.currentPart = this.appraisalCompentencyList[this.appraisalCompentencyIndex].comType
this.biOpen.clear()
this.appraisalCompentencyFilter().forEach(x => {
this.appraisalCompentencyFilter().forEach((x, i) => {
this.biOpen.set(x.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId, false)
const isLast = i === this.appraisalCompentencyFilter().length - 1;
if (isLast) {
this.biOpen.set("สรุป", false)
}
})
this.cdr.detectChanges()
switch (this.currentStep) {
......@@ -268,22 +278,39 @@ export class PmsCompetencyComponent {
this.inFormRemain(data)
).filter(data => data != 0).length
).filter(data => data != 0).length
const score = [1, 2, 3, 4, 5]
this.compentencyScore.emit(score.map(x => this.calWeightScore(x)))
this.compentencyWeightScore.emit(this.showNumber(this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].averageScore))
this.compentencyGap.emit(this.calGap(this.appraisalCompentencyList[this.appraisalCompentencyIndex].masfromEvaluationAssessment1lList[0].averageScore))
this.compentencyForm.emit(this.appraisalCompentencyList)
this.compentencyFormRemain.emit(remain)
}
scrollToTable(event: MouseEvent) {
const target = event.target as HTMLElement;
const position = target.getBoundingClientRect();
window.scrollTo({
top: position.top + window.scrollY - 100,
behavior: 'smooth'
});
}
allBiOpen(status: boolean) {
allBiOpen(status: boolean, part?: string) {
this.biOpen.forEach((_, key) => {
this.biOpen.set(key, status)
if (part) {
if (part == key) {
this.biOpen.set(key, status)
} else {
if (status) {
this.biOpen.set(key, false)
}
}
} else {
this.biOpen.set(key, status)
}
})
}
scrollToMenu(index: number) {
setTimeout(() => {
const container = this.scrollContainer?.nativeElement as HTMLElement;
const target = container.querySelector('#menu-' + index) as HTMLElement;
if (container && target) {
container.scrollTop = target.offsetTop;
}
}, 0);
}
}
......@@ -50,28 +50,46 @@ export class PmsFormEmployeeComponent {
currentDate = new Date()
comment = ""
compentencyScore: String[] = []
compentencyWeightScore = ""
compentencyGap = ""
kpiScorePart: { text: string, score: string }[] = []
currentStepText = () => {
if (this.compentency.data) {
if (this.compentency.data.apsassessy.employeeId == this.evaluaterId) {
return "ผู้รับการประเมิน"
} else if (this.compentency.data.apsapprove1.employeeId == this.evaluaterId) {
if (this.compentency.data.apsapprove2.employeeId) {
return "ผู้ประเมิน"
}
return "ผู้อนุมัติลำดับที่ 1"
} else if (this.compentency.data.apsapprove2.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 1"
} else if (this.compentency.data.apsapprove3.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 2"
} else if (this.compentency.data.apsapprove4.employeeId == this.evaluaterId) {
} else if (this.compentency.data.apsapprove3.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 3"
} else if (this.compentency.data.apsapprove5.employeeId == this.evaluaterId) {
} else if (this.compentency.data.apsapprove4.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 4"
} else if (this.compentency.data.apsapprove5.employeeId == this.evaluaterId) {
return "ผู้อนุมัติลำดับที่ 5"
}
}
return ""
}
gradeStar = (grade: string) => {
if (grade == 'A') {
return 5
} else if (grade == 'B') {
return 4
} else if (grade == 'C') {
return 3
} else if (grade == 'D') {
return 2
} else if (grade == 'E') {
return 1
}
return 0
}
statusCompetencyText = (status: string) => {
if (status === "no access") {
return "ยังไม่ถึงขั้นตอนดำเนินการ"
......@@ -487,4 +505,30 @@ export class PmsFormEmployeeComponent {
}
}
showNumber(text: number | string) {
const num = Number(text);
return isNaN(num) ? 0 : +(+num.toFixed(2));
}
calWeightScore(numberCheck: number) {
switch (numberCheck) {
case (1): {
return 1
}
case (2): {
return 2
}
case (3): {
return 3
}
case (4): {
return 4
}
case (5): {
return 5
}
default: { return }
}
}
}
import { ChangeDetectorRef, Component, EventEmitter, Input, Output, SimpleChanges } from '@angular/core';
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, SimpleChanges, ViewChild } from '@angular/core';
import { CompetencyGradeModel, MyCompetencyGradeModel } from 'src/app/shared/model/competency-grades.model';
import { AppraisalService } from 'src/app/shared/services/appraisal.service';
import { EmployeeService } from 'src/app/shared/services/employee.service';
import { PmsGroupGradeService } from 'src/app/shared/services/pms-group-grade.service';
import { SettingAssessmentService } from 'src/app/shared/services/setting-assessment.service';
import { Pms } from 'src/app/shared/model/competency.model';
import { Part5Detail, Pms, PmsTopic } from 'src/app/shared/model/competency.model';
export interface Part8Model {
id: number
......@@ -27,14 +27,6 @@ export interface LevelStarModel {
styleUrls: ['./pms-kpi.component.scss']
})
export class PmsKpiComponent {
part1show = true
part2show = true
part3show = true
part4show = true
part5show = true
part6show = true
part7show = true
part8show = true
data8List: Part8Model[] = [{
id: 1,
evaluationFactor: "Part 1 : ประเมินผลการปฏิบัติงานตามนโยบายบริษัท (Corporate KPI)",
......@@ -85,18 +77,23 @@ export class PmsKpiComponent {
scoreObtained: 0,
netScore: 0,
}]
part9show = true
part10show = true
partShow: string[] = []
partOpen: Map<string, boolean> = new Map<string, boolean>()
partScore: Map<string, number> = new Map<string, number>()
@Input() evaluateeId = ""
@Input() evaluaterId = ""
@Input() appraisalPms?: Pms
@Input() canEdit = false
@Input() currentStep = ""
@Input() currentTap = ""
@Input() currentPart = ""
@Input() dateIso = ""
@Output() kpiFormRemain: EventEmitter<any> = new EventEmitter<any>();
@Output() kpiForm: EventEmitter<any> = new EventEmitter<any>();
@Output() scorePart: EventEmitter<any> = new EventEmitter<any>();
groupGrade: { loading: boolean, dataList: CompetencyGradeModel[] } = { loading: false, dataList: [] }
@ViewChild('scrollContainer') scrollContainer!: ElementRef;
constructor(private appraisalService: AppraisalService,
private pmsGroupGradeService: PmsGroupGradeService,
private employeeService: EmployeeService,
......@@ -104,12 +101,30 @@ export class PmsKpiComponent {
private settingAssessmentService: SettingAssessmentService
) {
}
getTargetDetailValue(item: any): string {
const targetDetail = ['', 'targetEdetail', 'targetDdetail', 'targetCdetail', 'targetBdetail', 'targetAdetail']
const index = this.partScore.get(item.groupAssessment1.pmsTopic.pmsTopicId) ?? item.scoreTopicExpectation;
const key = targetDetail[index ?? 0] as keyof PmsTopic;
return item.groupAssessment1.pmsTopic[key];
}
getTargetDetailValuePart5(item: any): string {
const targetDetail = ['', 'targetEDetail', 'targetDDetail', 'targetCDetail', 'targetBDetail', 'targetADetail']
const index = this.partScore.get(item.tdesc) ?? item.pmsWorkingTimScore;
const key = targetDetail[index ?? 0] as keyof Part5Detail;
return item[key];
}
// ngOnChanges(changes: SimpleChanges): void {
// if (changes['evaluateeId']?.currentValue || changes['evaluaterId']?.currentValue) {
// this.toggleAllParts(this.evaluateeId == this.evaluaterId)
// }
// }
ngOnInit(): void {
this.partOpen.clear()
this.partShow = this.currentTap == 'ประเมินผลการปฏิบัติงาน' ? ['PART 1', 'PART 2', 'PART 3', 'PART 4', 'PART 5', 'PART 6', 'PART 7'] : ['PART 8', 'PART 9', 'PART 10']
this.partShow.forEach(x => {
this.partOpen.set(x, false)
})
this.getPmsGroupGradeList()
this.getAppraisalPmsForm()
this.allFormRemain()
......@@ -412,26 +427,24 @@ export class PmsKpiComponent {
toggleAllParts(check: boolean) {
this.part1show = check
this.part2show = check
this.part3show = check
this.part4show = check
this.part5show = check
this.part6show = check
this.part7show = check
this.part8show = check
this.part9show = check
this.part10show = check
}
scrollToTable(event: MouseEvent) {
const target = event.target as HTMLElement;
const position = target.getBoundingClientRect();
window.scrollTo({
top: position.top + window.scrollY - 100,
behavior: 'smooth'
});
toggleAllParts(check: boolean, part?: string) {
this.partOpen.forEach((_, key) => {
if (part) {
if (part == key) {
this.partOpen.set(key, check)
} else {
if (check) {
this.currentPart = part
this.partOpen.set(key, false)
} else {
this.currentPart = ''
}
}
} else {
this.partOpen.set(key, check)
this.currentPart = ''
}
})
}
part1Remain() {
......@@ -500,4 +513,37 @@ export class PmsKpiComponent {
this.kpiFormRemain.emit(remain)
}
remainList() {
return [
this.part1Remain(),
this.part2Remain(),
this.part3Remain(),
-1,
this.part5Remain(),
this.part6Remain(),
this.part7Remain()
];
}
sendScorePart() {
if (this.appraisalPms) {
const score = this.data8List.map((x, i) => ({ text: "PART " + (i + 1), score: this.numberFixed2(x.netScore) })).concat([{ text: "สุทธิ", score: this.calNetScore() + '' }, { text: "Grade", score: this.appraisalPms.gradeScore }])
this.scorePart.emit(score)
}
}
scrollToMenu(id: string) {
setTimeout(() => {
const container = this.scrollContainer?.nativeElement as HTMLElement;
const target = document.getElementById(id);
if (container && target) {
const containerTop = container.getBoundingClientRect().top;
const targetTop = target.getBoundingClientRect().top;
const scrollOffset = targetTop - containerTop;
container.scrollTop += scrollOffset;
}
}, 0);
}
}
<ng-container *ngIf="!onEdit">
<app-page-header [pathTitle]="pathTitle"></app-page-header>
<!-- <app-page-header [pathTitle]="pathTitle"></app-page-header> -->
<ng-container *ngTemplateOutlet="selfEvaluation"></ng-container>
</ng-container>
<ng-template #selfEvaluation>
......
<ng-container *ngIf="pageEvalution==''">
<app-page-header [pathTitle]="pathTitle"></app-page-header>
<div class="bg-card-white">
</div>
<div class="block-main-content">
......
......@@ -17,7 +17,7 @@
<!-- End::main-sidebar-header -->
<!-- ::main-sidebar -->
<ngx-simplebar [options]="options" style="background-color: #154C9C;">
<ngx-simplebar [options]="options" style="background-color: #174dd3;">
<div class="main-sidebar" id="sidebar-scroll">
<!-- Start::nav -->
<nav class="main-menu-container nav nav-pills flex-column sub-open active open">
......
......@@ -3457,7 +3457,7 @@ export interface GroupAssessment1 {
companyId: string
personalLevelModel: PersonalLevelModel
pmsGroupAssessment0: PmsGroupAssessment0
pmsTopic: PmsTopic2
pmsTopic: PmsTopic
}
export interface PersonalLevelModel {
......@@ -3508,24 +3508,6 @@ export interface PmsType {
weight: number
}
export interface PmsTopic2 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType2
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType2 {
companyId: string
......@@ -3549,7 +3531,7 @@ export interface GroupAssessment12 {
companyId: string
personalLevelModel: PersonalLevelModel2
pmsGroupAssessment0: PmsGroupAssessment02
pmsTopic: PmsTopic4
pmsTopic: PmsTopic
}
export interface PersonalLevelModel2 {
......@@ -3562,7 +3544,7 @@ export interface PersonalLevelModel2 {
export interface PmsGroupAssessment02 {
companyId: string
personalLevel: PersonalLevel7
pmsTopic: PmsTopic3
pmsTopic: PmsTopic
}
export interface PersonalLevel7 {
......@@ -3572,24 +3554,6 @@ export interface PersonalLevel7 {
tdesc: string
}
export interface PmsTopic3 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType3
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType3 {
companyId: string
......@@ -3600,24 +3564,7 @@ export interface PmsType3 {
weight: number
}
export interface PmsTopic4 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType4
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType4 {
companyId: string
......@@ -3641,7 +3588,7 @@ export interface GroupAssessment13 {
companyId: string
personalLevelModel: PersonalLevelModel3
pmsGroupAssessment0: PmsGroupAssessment03
pmsTopic: PmsTopic6
pmsTopic: PmsTopic
}
export interface PersonalLevelModel3 {
......@@ -3654,7 +3601,7 @@ export interface PersonalLevelModel3 {
export interface PmsGroupAssessment03 {
companyId: string
personalLevel: PersonalLevel8
pmsTopic: PmsTopic5
pmsTopic: PmsTopic
}
export interface PersonalLevel8 {
......@@ -3664,24 +3611,6 @@ export interface PersonalLevel8 {
tdesc: string
}
export interface PmsTopic5 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType5
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType5 {
companyId: string
......@@ -3692,24 +3621,6 @@ export interface PmsType5 {
weight: number
}
export interface PmsTopic6 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType6
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType6 {
companyId: string
......@@ -3804,7 +3715,7 @@ export interface GroupAssessment14 {
companyId: string
personalLevelModel: PersonalLevelModel4
pmsGroupAssessment0: PmsGroupAssessment04
pmsTopic: PmsTopic8
pmsTopic: PmsTopic
}
export interface PersonalLevelModel4 {
......@@ -3817,7 +3728,7 @@ export interface PersonalLevelModel4 {
export interface PmsGroupAssessment04 {
companyId: string
personalLevel: PersonalLevel9
pmsTopic: PmsTopic7
pmsTopic: PmsTopic
}
export interface PersonalLevel9 {
......@@ -3827,25 +3738,6 @@ export interface PersonalLevel9 {
tdesc: string
}
export interface PmsTopic7 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType7
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType7 {
companyId: string
edesc: string
......@@ -3855,24 +3747,6 @@ export interface PmsType7 {
weight: number
}
export interface PmsTopic8 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType8
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType8 {
companyId: string
......@@ -3896,7 +3770,7 @@ export interface GroupAssessment15 {
companyId: string
personalLevelModel: PersonalLevelModel5
pmsGroupAssessment0: PmsGroupAssessment05
pmsTopic: PmsTopic10
pmsTopic: PmsTopic
}
export interface PersonalLevelModel5 {
......@@ -3909,7 +3783,7 @@ export interface PersonalLevelModel5 {
export interface PmsGroupAssessment05 {
companyId: string
personalLevel: PersonalLevel10
pmsTopic: PmsTopic9
pmsTopic: PmsTopic
}
export interface PersonalLevel10 {
......@@ -3919,24 +3793,7 @@ export interface PersonalLevel10 {
tdesc: string
}
export interface PmsTopic9 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType9
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType9 {
companyId: string
......@@ -3947,24 +3804,7 @@ export interface PmsType9 {
weight: number
}
export interface PmsTopic10 {
companyId: string
completionDate: string
detailUnit: string
edesc: string
indicatorsDetail: string
lineNo: number
performanceGoalsDetail: string
pmsTopicId: string
pmsType: PmsType10
targetAdetail: string
targetBdetail: string
targetCdetail: string
targetDdetail: string
targetEdetail: string
tdesc: string
weight: number
}
export interface PmsType10 {
companyId: string
......
......@@ -7069,8 +7069,8 @@ select option:focus {
/* End Tailwind Styles */
/* Start Variables Styles */
:root {
--color-primary: 21 76 156;
--color-primary-rgb: 21, 76, 156;
--color-primary: 23 77 211;
--color-primary-rgb: 23 77 211;
--color-secondary: 96 165 250;
--color-success: 29 190 90;
--color-info: 159 73 241;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment