Commit e251e6f8 by Nattana Chaiyamat

คะแนนลูกน้อง

parent 2b8f3a2d
...@@ -54,6 +54,8 @@ import { ReportPms2Component } from '../report-component/report-pms/report-pms-2 ...@@ -54,6 +54,8 @@ import { ReportPms2Component } from '../report-component/report-pms/report-pms-2
import { ReportPms3Component } from '../report-component/report-pms/report-pms-3/report-pms-3.component'; import { ReportPms3Component } from '../report-component/report-pms/report-pms-3/report-pms-3.component';
import { EssProfileComponent } from '../ess-profile/ess-profile.component'; import { EssProfileComponent } from '../ess-profile/ess-profile.component';
import { ExcelReportComponent } from '../excel-report/excel-report.component'; import { ExcelReportComponent } from '../excel-report/excel-report.component';
import { SettingIndividualKpiComponent } from '../setting-individual-kpi/setting-individual-kpi.component';
import { SettingIndividualKpiSupervisorComponent } from '../setting-individual-kpi-supervisor/setting-individual-kpi-supervisor.component';
...@@ -119,7 +121,10 @@ const routes: Routes = [ ...@@ -119,7 +121,10 @@ const routes: Routes = [
{ path: "admin/report-pms-1", title: 'report-pms-1', component: ReportPms1Component }, { path: "admin/report-pms-1", title: 'report-pms-1', component: ReportPms1Component },
{ path: "admin/report-pms-2", title: 'report-pms-2', component: ReportPms2Component }, { path: "admin/report-pms-2", title: 'report-pms-2', component: ReportPms2Component },
{ path: "admin/report-pms-3", title: 'report-pms-3', component: ReportPms3Component }, { path: "admin/report-pms-3", title: 'report-pms-3', component: ReportPms3Component },
{ path: "admin/excel-export/:id", title: 'รายงาน Excel', component: ExcelReportComponent } { path: "admin/excel-export/:id", title: 'รายงาน Excel', component: ExcelReportComponent },
{ path: "ess/self-setting-individual-kpi", title: 'แก้ไข Individual KPI ตนเอง', component: SettingIndividualKpiComponent },
{ path: "ess/supervisor-setting-individual-kpi", title: 'แก้ไข Individual KPI โดยหัวหน้า', component: SettingIndividualKpiSupervisorComponent },
] ]
} }
]; ];
......
...@@ -204,6 +204,8 @@ import { ...@@ -204,6 +204,8 @@ import {
PageService, PageService,
FilterService, FilterService,
} from '@syncfusion/ej2-angular-grids'; } from '@syncfusion/ej2-angular-grids';
import { SettingIndividualKpiComponent } from '../setting-individual-kpi/setting-individual-kpi.component';
import { SettingIndividualKpiSupervisorComponent } from '../setting-individual-kpi-supervisor/setting-individual-kpi-supervisor.component';
export const MY_DATE_FORMATS = { export const MY_DATE_FORMATS = {
parse: { parse: {
...@@ -349,7 +351,9 @@ export class CustomDateAdapter extends NativeDateAdapter { ...@@ -349,7 +351,9 @@ export class CustomDateAdapter extends NativeDateAdapter {
ReportPms3Component, ReportPms3Component,
EssProfileComponent, EssProfileComponent,
ExcelReportComponent, ExcelReportComponent,
PivotSyncfutionComponent PivotSyncfutionComponent,
SettingIndividualKpiComponent,
SettingIndividualKpiSupervisorComponent
], ],
imports: [ imports: [
CommonModule, CommonModule,
......
...@@ -252,6 +252,12 @@ export class PmsKpiComponent { ...@@ -252,6 +252,12 @@ export class PmsKpiComponent {
} }
calExpectationTotalScore(data?: any) { calExpectationTotalScore(data?: any) {
if (data) { if (data) {
return data.reduce((sum: number, item: any) => sum + (item.scoreTopicExpectation * item.weight), 0).toFixed(2);
}
return "0.00"
}
calExpectationTotalScoreBoss(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + (item.scoreTopicExpectationBoss * item.weight), 0).toFixed(2); return data.reduce((sum: number, item: any) => sum + (item.scoreTopicExpectationBoss * item.weight), 0).toFixed(2);
} }
return "0.00" return "0.00"
...@@ -265,37 +271,37 @@ export class PmsKpiComponent { ...@@ -265,37 +271,37 @@ export class PmsKpiComponent {
changePercentage() { changePercentage() {
this.data8List.forEach(x => { this.data8List.forEach(x => {
if (x.id == 1 && this.appraisalPms?.part1Detail) { if (x.id == 1 && this.appraisalPms?.part1Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part1Detail), this.calRawScore(this.appraisalPms?.part1Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part1SumScore = x.scoreObtained this.appraisalPms.part1SumScore = x.scoreObtained
} }
} else if (x.id == 2 && this.appraisalPms?.part2Detail) { } else if (x.id == 2 && this.appraisalPms?.part2Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part2Detail), this.calRawScore(this.appraisalPms?.part2Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part2SumScore = x.scoreObtained this.appraisalPms.part2SumScore = x.scoreObtained
} }
} else if (x.id == 3 && this.appraisalPms?.part3Detail) { } else if (x.id == 3 && this.appraisalPms?.part3Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part3Detail), this.calRawScore(this.appraisalPms?.part3Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part3SumScore = x.scoreObtained this.appraisalPms.part3SumScore = x.scoreObtained
} }
} else if (x.id == 4 && this.appraisalPms?.part4Detail) { } else if (x.id == 4 && this.appraisalPms?.part4Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBossPart4(this.appraisalPms?.part4Detail), this.calRawScorePart4(this.appraisalPms?.part4Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part4SumScore = x.scoreObtained this.appraisalPms.part4SumScore = x.scoreObtained
} }
} else if (x.id == 5 && this.appraisalPms?.part5Detail) { } else if (x.id == 5 && this.appraisalPms?.part5Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScorePart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBossPart5(this.appraisalPms?.part5Detail), this.calRawScorePart5(this.appraisalPms?.part5Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part5SumScore = x.scoreObtained this.appraisalPms.part5SumScore = x.scoreObtained
} }
} else if (x.id == 6 && this.appraisalPms?.part6Detail) { } else if (x.id == 6 && this.appraisalPms?.part6Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part6Detail), this.calRawScore(this.appraisalPms?.part6Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part6SumScore = x.scoreObtained this.appraisalPms.part6SumScore = x.scoreObtained
} }
} else if (x.id == 7 && this.appraisalPms?.part7Detail) { } else if (x.id == 7 && this.appraisalPms?.part7Detail) {
x.scoreObtained = +this.calPercentage(this.calExpectationTotalScore(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail)) x.scoreObtained = +this.calPercentage(this.calExpectationTotalScoreBoss(this.appraisalPms?.part7Detail), this.calRawScore(this.appraisalPms?.part7Detail))
if (this.appraisalPms) { if (this.appraisalPms) {
this.appraisalPms.part7SumScore = x.scoreObtained this.appraisalPms.part7SumScore = x.scoreObtained
} }
...@@ -363,7 +369,7 @@ export class PmsKpiComponent { ...@@ -363,7 +369,7 @@ export class PmsKpiComponent {
} }
return "0.00" return "0.00"
} }
calExpectationTotalScorePart4(data?: any) { calExpectationTotalScoreBossPart4(data?: any) {
if (data) { if (data) {
return data.reduce((sum: number, item: any) => sum + (item.competencyType.weight * this.calAverage(this.convertToNumber(this.inforWeight.get(item.competencyType.shortName) return data.reduce((sum: number, item: any) => sum + (item.competencyType.weight * this.calAverage(this.convertToNumber(this.inforWeight.get(item.competencyType.shortName)
!== 'null' ? this.inforWeight.get(item.competencyType.shortName) : '0'))), 0).toFixed(2); !== 'null' ? this.inforWeight.get(item.competencyType.shortName) : '0'))), 0).toFixed(2);
...@@ -392,6 +398,12 @@ export class PmsKpiComponent { ...@@ -392,6 +398,12 @@ export class PmsKpiComponent {
} }
calExpectationTotalScorePart5(data?: any) { calExpectationTotalScorePart5(data?: any) {
if (data) { if (data) {
return data.reduce((sum: number, item: any) => sum + (item.pmsWorkingTimScore * item.weight), 0).toFixed(2);
}
return "0.00"
}
calExpectationTotalScoreBossPart5(data?: any) {
if (data) {
return data.reduce((sum: number, item: any) => sum + (item.pmsWorkingTimScoreBoss * item.weight), 0).toFixed(2); return data.reduce((sum: number, item: any) => sum + (item.pmsWorkingTimScoreBoss * item.weight), 0).toFixed(2);
} }
return "0.00" return "0.00"
......
...@@ -187,13 +187,13 @@ ...@@ -187,13 +187,13 @@
<thead> <thead>
<tr> <tr>
<ng-container <ng-container
*ngFor="let item of subordinate.select?.showPms?['','รหัสพนักงาน','ชื่อพนักงาน','ตำเเหน่งงาน','ประเมิน','ผลประเมิน','เกรด' ,'สถานะผู้ประเมิน']: *ngFor="let item of subordinate.select?.showPms?['รหัสพนักงาน','ชื่อพนักงาน','ตำเเหน่งงาน','ประเมิน','ผลประเมิน','เกรด' ,'สถานะผู้ประเมิน']:
['','รหัสพนักงาน','ชื่อพนักงาน','ตำเเหน่งงาน','ประเมิน','เเผนพัฒนา','สถานะผู้ประเมิน']; let f = first; let l = last; let i = index"> ['รหัสพนักงาน','ชื่อพนักงาน','ตำเเหน่งงาน','ประเมิน','เเผนพัฒนา','สถานะผู้ประเมิน']; let f = first; let l = last; let i = index">
<th scope="col" <th scope="col"
class="relative px-10px py-10px bg-soft-secondary text-primary !text-center" class="relative px-10px py-10px bg-soft-secondary text-primary !text-center"
[ngClass]="{'!p-0':f, '!pl-0':i==1}"> [ngClass]="{'!p-0':f, '!pl-0':i==1}" [colSpan]="f?2:1">
<span class="text-sm">{{ item }}</span> <span class="text-sm">{{ item }}</span>
<div *ngIf="!f" <div *ngIf="!l"
class="absolute top-1/2 transform -translate-y-1/2 right-0"> class="absolute top-1/2 transform -translate-y-1/2 right-0">
<svg class="head-table-icon" <svg class="head-table-icon"
xmlns="http://www.w3.org/2000/svg" width="50" xmlns="http://www.w3.org/2000/svg" width="50"
...@@ -254,7 +254,8 @@ ...@@ -254,7 +254,8 @@
</ng-container> </ng-container>
</div> </div>
</td> </td>
<td class="text-center !pl-0" style="font-size: 12px; width: 150px;"> <td class="text-left"
style="font-size: 12px;width: 90px;min-width: 90px;max-width: 90px;padding-left: 10px;">
{{item.apsassessy.employeeId}} {{item.apsassessy.employeeId}}
</td> </td>
<td style="font-size: 12px; width: 175px;"> <td style="font-size: 12px; width: 175px;">
......
import { ChangeDetectorRef, Component, Input } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { AppraisalSubordinateModel, Masfromevaluationassessment } from 'src/app/shared/model/appraisal-subordinate.model';
import { EmployeeModel, MyEmployeeModel } from 'src/app/shared/model/employee.model';
import { AppraisalService } from 'src/app/shared/services/appraisal.service';
import { EmployeeService } from 'src/app/shared/services/employee.service';
import { FileService } from 'src/app/shared/services/file.service';
import { TokenService } from 'src/app/shared/services/token.service';
interface Row { label: string; value: number | string; }
@Component({
selector: 'app-setting-individual-kpi-supervisor',
templateUrl: './setting-individual-kpi-supervisor.component.html',
styleUrls: ['./setting-individual-kpi-supervisor.component.scss']
})
export class SettingIndividualKpiSupervisorComponent {
subordinate: { loading: false, select?: AppraisalSubordinateModel, dataList: AppraisalSubordinateModel[] } = { loading: false, select: undefined, dataList: [] }
selectEmp: Map<string, boolean> = new Map<string, boolean>()
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1)
search = ""
settingIndividualKpi = false
constructor(private appraisalService: AppraisalService,
private fileService: FileService,
private cdr: ChangeDetectorRef) {
}
ngOnInit(): void {
this.getBossList()
}
getBossList() {
this.appraisalService.getBossList().subscribe({
next: response => {
this.subordinate.dataList = JSON.parse(JSON.stringify(response))
this.cdr.detectChanges()
if (this.subordinate.dataList.length) {
this.subordinate.select = JSON.parse(JSON.stringify(this.subordinate.dataList[0]))
this.cdr.detectChanges()
}
this.searchChange()
}, error: error => {
this.cdr.detectChanges()
}
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.subordinateFilter().length / 10) }, (_, i) => i + 1);
}
toggleSelectAll() {
if (this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length > 0) {
if (!this.selectEmp.get('selectAll')) {
this.selectEmp.set('selectAll', true)
this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).forEach(e => {
this.selectEmp.set(e.apsassessy.employeeId, true)
})
} else {
this.selectEmp.set('selectAll', false)
this.selectEmp.clear()
}
}
}
subordinateFilter() {
if (this.subordinate.select) {
return this.subordinate.select.masfromevaluationassessment.filter(x => {
return x.apsassessy.employeeId.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.thFullName.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsassessy.position.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
this.statusCompetencyText(x.apsassessy.position.tdesc).toLowerCase().includes(this.search.toLowerCase()) ||
x.grade.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsapproveType.tdesc.toLowerCase().includes(this.search.toLowerCase())
})
}
return []
}
statusCompetencyText = (status: string) => {
if (status === "no access") {
return "ยังไม่ถึงขั้นตอนดำเนินการ"
} else if (status === "pending") {
return "รอดำเนินการ"
} else if (status === "evaluating") {
return "อยู่ระหว่างดำเนินการ"
} else if (status === "completed") {
return "ดำเนินการเสร็จสิ้น"
} else if (status === "rejected") {
return "ส่งกลับ"
} else {
return ""
}
}
statusButtonClass = (status: string) => {
if (status === "no access") {
return "ti-btn-soft-mute"
} else if (status === "pending") {
return "ti-btn-soft-secondary"
} else if (status === "evaluating") {
return "ti-btn-soft-warning"
} else if (status === "completed") {
return "ti-btn-soft-success"
} else if (status === "rejected") {
return "ti-btn-soft-danger"
} else {
return ""
}
}
getImg(text: string) {
return this.fileService.getImg(text)
}
onImageError(event: Event) {
const imgElement = event.target as HTMLImageElement;
imgElement.src = './assets/img/users/defaultperson.jpg';
}
checkSelectAll() {
this.selectEmp.set('selectAll', (this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length > 0 && this.subordinateFilter().filter(e => e.apsapproveType.code != 'Apsapprove1' && (e.masfromStatusType.code == 'evaluating' || e.masfromStatusType.code == 'pending')).length == this.selectEmp.size - 1))
}
selectSubordinate(data: Masfromevaluationassessment, competencyTypeId: string, evaluationRoundId?: string, masfromStatusType?: string) {
if (data && evaluationRoundId) {
// this.formEvaluation.evaluateeId = data.apsassessy.employeeId
// this.formEvaluation.competencyTypeId = competencyTypeId
// this.formEvaluation.evaluationRoundId = evaluationRoundId
// this.formEvaluation.masfromStatusType = masfromStatusType || ''
// this.formEvaluation.allCompetencyTypeId = data.typeList
this.cdr.detectChanges()
}
}
}
.hover-visible {
.hover-show {
opacity: 0;
}
}
.hover-visible:hover {
.hover-show {
opacity: 1;
}
}
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { EmployeeModel, MyEmployeeModel } from 'src/app/shared/model/employee.model';
import { MyPmsGroupAssessment1Model } from 'src/app/shared/model/pms-group-assessment1.model';
import { MyPmstopicModel, PmstopicModel } from 'src/app/shared/model/pmstopic.model';
import { AppraisalService } from 'src/app/shared/services/appraisal.service';
import { EmployeeService } from 'src/app/shared/services/employee.service';
import { FileService } from 'src/app/shared/services/file.service';
import { PmstopicService } from 'src/app/shared/services/pmstopic.service';
import { TokenService } from 'src/app/shared/services/token.service';
export interface DataModal {
search: string,
currentPage: number,
page: number[]
}
@Component({
selector: 'app-setting-individual-kpi',
templateUrl: './setting-individual-kpi.component.html',
styleUrls: ['./setting-individual-kpi.component.scss']
})
export class SettingIndividualKpiComponent {
@Input() evaluateeId = ""
individualKPI: { loading: boolean, list: any[] } = { loading: false, list: [] }
@Input() evaluationForm: 'self' | 'sup' = "self"
menuClose: Map<string, boolean> = new Map<string, boolean>()
tableHover: Map<string, boolean> = new Map<string, boolean>()
evaluatee: { loading: boolean, data: EmployeeModel } = { loading: false, data: new MyEmployeeModel() }
@Output() sendReturnPath: EventEmitter<any> = new EventEmitter<any>();
modal: DataModal = {
search: "",
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1)
}
pmstopic: { loading: boolean, select: PmstopicModel, dataList: { check: boolean, data: PmstopicModel }[] } = { loading: false, select: new MyPmstopicModel(), dataList: [] }
constructor(
private router: Router,
private employeeService: EmployeeService,
private appraisalService: AppraisalService,
private cdr: ChangeDetectorRef,
private tokenService: TokenService,
private route: ActivatedRoute,
private fileService: FileService,
private pmstopicService: PmstopicService
) {
}
ngOnInit(): void {
this.getEvaluatee()
this.getPmstopicList()
}
getEvaluatee() {
this.evaluatee.loading = true
this.employeeService.getWorkingById(this.evaluateeId).subscribe({
next: response => {
this.evaluatee.data = new MyEmployeeModel(response)
this.evaluatee.loading = false
this.cdr.detectChanges()
}, error: error => {
this.evaluatee.loading = false
this.cdr.detectChanges()
}
})
}
returnPath() {
this.sendReturnPath.emit()
}
getImg(text: string) {
return this.fileService.getImg(text)
}
onImageError(event: Event) {
const imgElement = event.target as HTMLImageElement;
imgElement.src = './assets/img/users/defaultperson.jpg';
}
searchModalChange(dataList: any[]) {
this.modal.currentPage = 1
this.modal.page = Array.from({ length: Math.ceil(dataList.length / 10) }, (_, i) => i + 1);
this.cdr.markForCheck()
}
getPmstopicList() {
this.pmstopic.loading = true
this.pmstopicService.getList().subscribe({
next: response => {
this.pmstopic.dataList = response.map(x => ({ check: false, data: new MyPmstopicModel(x) }))
this.pmstopic.loading = false
this.cdr.detectChanges()
}, error: error => {
this.pmstopic.loading = false
this.cdr.detectChanges()
}
})
}
pmstopicListFilter() {
return this.pmstopic.dataList.filter(x => {
const data = x.data
const match = data.pmsTopicId.toLowerCase().includes(this.modal.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
data.pmsType.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
(data.weight + "").toLowerCase().includes(this.modal.search.toLowerCase())
return match
})
}
selectPmstopic(data?: PmstopicModel) {
this.cdr.markForCheck()
}
}
...@@ -114,7 +114,7 @@ export class NavService implements OnDestroy { ...@@ -114,7 +114,7 @@ export class NavService implements OnDestroy {
selected: false, selected: false,
active: false, active: false,
path: 'ess/supervisor-evaluation', path: 'ess/supervisor-evaluation',
id: 'm1', id: 'm2',
show: true, show: true,
icon: 'assets/img/icons-menu/com-boss.png' icon: 'assets/img/icons-menu/com-boss.png'
// children: [ // children: [
...@@ -122,6 +122,26 @@ export class NavService implements OnDestroy { ...@@ -122,6 +122,26 @@ export class NavService implements OnDestroy {
// { id: 'm12', path: 'ess/supervisor-evaluation', title: 'ประเมินโดยหัวหน้า', type: 'link', show: true }, // { id: 'm12', path: 'ess/supervisor-evaluation', title: 'ประเมินโดยหัวหน้า', type: 'link', show: true },
// ], // ],
}, },
// {
// title: 'แก้ไข Individual KPI ตนเอง',
// type: 'link',
// selected: false,
// active: false,
// path: 'ess/self-setting-individual-kpi',
// id: 'm3',
// show: false,
// icon: ''
// },
// {
// title: 'แก้ไข Individual KPI โดยหัวหน้า',
// type: 'link',
// selected: false,
// active: false,
// path: 'ess/supervisor-setting-individual-kpi',
// id: 'm4',
// show: false,
// icon: ''
// },
]; ];
} }
......
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