Commit a27b33aa by Nattana Chaiyamat

แก้ Datagrid ข้อมูลในตารางไม่เปลี่ยน

parent 31dc0ed4
...@@ -203,6 +203,23 @@ export class SupervisorEvaluationComponent { ...@@ -203,6 +203,23 @@ export class SupervisorEvaluationComponent {
this.getBossList() this.getBossList()
} }
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.setSyncfution()
this.setEcharts()
this.cdr.detectChanges()
}
this.searchDataGrid(this.search)
}, error: error => {
this.cdr.detectChanges()
}
})
}
setSyncfution() {
this.syncfution = { this.syncfution = {
dataList: [], dataList: [],
searchSettings: { searchSettings: {
...@@ -219,82 +236,67 @@ export class SupervisorEvaluationComponent { ...@@ -219,82 +236,67 @@ export class SupervisorEvaluationComponent {
}, },
columns: [] columns: []
} }
this.dataSourceSearch = [] if (this.subordinate.select?.showPms) {
this.dataSourceFilter = []; this.setSyncfutionDataList()
this.aggregatesSum = []; this.syncfution.columns =
this.aggregatesCount = []; [{
this.aggregatesAvg = []; field: "employeeId",
this.aggregatesMin = []; headerText: "รหัสพนักงาน",
this.aggregatesMax = []; type: "string",
this.appraisalService.getBossList().subscribe({ isPrimaryKey: true,
next: response => { },
this.subordinate.dataList = JSON.parse(JSON.stringify(response)) {
this.cdr.detectChanges() field: "thFullName",
if (this.subordinate.dataList.length) { headerText: "ชื่อพนักงาน",
this.subordinate.select = JSON.parse(JSON.stringify(this.subordinate.dataList[0])) type: "string"
if (this.subordinate.select?.showPms) { },
this.syncfution.dataList = this.subordinate.select.masfromevaluationassessment.map(e => ({ {
employeeId: e.apsassessy.employeeId, field: "position",
thFullName: e.apsassessy.thFullName, headerText: "ตำเเหน่งงาน",
position: e.apsassessy.position.tdesc, type: "string"
statusType: this.statusCompetencyText(e.statusIdp.statusType), },
statusIdp: e.statusIdp, {
sumScore: e.sumScore, field: "statusType",
grade: e.grade, headerText: "ประเมิน",
apsapproveType: e.apsapproveType.tdesc, type: "string"
apsassessy: e.apsassessy, },
masfromStatusType: e.masfromStatusType {
})) field: "sumScore",
this.syncfution.columns = headerText: "ผลประเมิน",
[{ type: "string"
field: "employeeId", },
headerText: "รหัสพนักงาน", {
type: "string", field: "grade",
isPrimaryKey: true, headerText: "เกรด",
}, type: "string"
{ },
field: "thFullName", {
headerText: "ชื่อพนักงาน", field: "apsapproveType",
type: "string" headerText: "สถานะผู้ประเมิน",
}, type: "string"
{ }]
field: "position", }
headerText: "ตำเเหน่งงาน", }
type: "string" setSyncfutionDataList() {
}, if (this.subordinate.select?.showPms) {
{ this.syncfution.dataList = this.subordinate.select.masfromevaluationassessment.map(e => ({
field: "statusType", employeeId: e.apsassessy.employeeId,
headerText: "ประเมิน", thFullName: e.apsassessy.thFullName,
type: "string" position: e.apsassessy.position.tdesc,
}, statusType: this.statusCompetencyText(e.statusIdp.statusType),
{ statusIdp: e.statusIdp,
field: "sumScore", sumScore: e.sumScore,
headerText: "ผลประเมิน", grade: e.grade,
type: "string" apsapproveType: e.apsapproveType.tdesc,
}, apsassessy: e.apsassessy,
{ masfromStatusType: e.masfromStatusType
field: "grade", }))
headerText: "เกรด", }
type: "string"
},
{
field: "apsapproveType",
headerText: "สถานะผู้ประเมิน",
type: "string"
}]
}
this.setEcharts()
this.cdr.detectChanges()
}
this.searchDataGrid(this.search)
}, error: error => {
this.cdr.detectChanges()
}
})
} }
selectDataList(data?: AppraisalSubordinateModel) { selectDataList(data?: AppraisalSubordinateModel) {
this.selectEmp.clear() this.selectEmp.clear()
this.subordinate.select = JSON.parse(JSON.stringify(data)) this.subordinate.select = JSON.parse(JSON.stringify(data))
this.setSyncfutionDataList()
this.setEcharts() this.setEcharts()
this.cdr.detectChanges() this.cdr.detectChanges()
this.searchDataGrid(this.search) this.searchDataGrid(this.search)
...@@ -592,7 +594,6 @@ export class SupervisorEvaluationComponent { ...@@ -592,7 +594,6 @@ export class SupervisorEvaluationComponent {
if (args.requestType === 'filtering') { if (args.requestType === 'filtering') {
if (this.grid) { if (this.grid) {
this.dataSourceFilter = ((this.grid as GridComponent).getFilteredRecords() as any).length ? ((this.grid as GridComponent).getFilteredRecords() as any) : JSON.parse(JSON.stringify(this.dataSourceSearch || [])); this.dataSourceFilter = ((this.grid as GridComponent).getFilteredRecords() as any).length ? ((this.grid as GridComponent).getFilteredRecords() as any) : JSON.parse(JSON.stringify(this.dataSourceSearch || []));
console.log("🥷🏿 ~ this.dataSourceFilter:", this.dataSourceFilter)
} }
} }
} }
......
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