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,32 +236,8 @@ export class SupervisorEvaluationComponent { ...@@ -219,32 +236,8 @@ export class SupervisorEvaluationComponent {
}, },
columns: [] columns: []
} }
this.dataSourceSearch = []
this.dataSourceFilter = [];
this.aggregatesSum = [];
this.aggregatesCount = [];
this.aggregatesAvg = [];
this.aggregatesMin = [];
this.aggregatesMax = [];
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]))
if (this.subordinate.select?.showPms) { if (this.subordinate.select?.showPms) {
this.syncfution.dataList = this.subordinate.select.masfromevaluationassessment.map(e => ({ this.setSyncfutionDataList()
employeeId: e.apsassessy.employeeId,
thFullName: e.apsassessy.thFullName,
position: e.apsassessy.position.tdesc,
statusType: this.statusCompetencyText(e.statusIdp.statusType),
statusIdp: e.statusIdp,
sumScore: e.sumScore,
grade: e.grade,
apsapproveType: e.apsapproveType.tdesc,
apsassessy: e.apsassessy,
masfromStatusType: e.masfromStatusType
}))
this.syncfution.columns = this.syncfution.columns =
[{ [{
field: "employeeId", field: "employeeId",
...@@ -283,18 +276,27 @@ export class SupervisorEvaluationComponent { ...@@ -283,18 +276,27 @@ export class SupervisorEvaluationComponent {
type: "string" type: "string"
}] }]
} }
this.setEcharts()
this.cdr.detectChanges()
} }
this.searchDataGrid(this.search) setSyncfutionDataList() {
}, error: error => { if (this.subordinate.select?.showPms) {
this.cdr.detectChanges() this.syncfution.dataList = this.subordinate.select.masfromevaluationassessment.map(e => ({
employeeId: e.apsassessy.employeeId,
thFullName: e.apsassessy.thFullName,
position: e.apsassessy.position.tdesc,
statusType: this.statusCompetencyText(e.statusIdp.statusType),
statusIdp: e.statusIdp,
sumScore: e.sumScore,
grade: e.grade,
apsapproveType: e.apsapproveType.tdesc,
apsassessy: e.apsassessy,
masfromStatusType: e.masfromStatusType
}))
} }
})
} }
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