Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mySkill-x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angular
mySkill-x
Commits
403fc7f2
Commit
403fc7f2
authored
Apr 02, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DEV' of
https://mygit.myhr.co.th/angular/myAppraisal
into DEV
parents
8e5751be
4ce9024f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
170 additions
and
167 deletions
+170
-167
angular.json
angular.json
+4
-4
department-register.component.html
...it/department-register/department-register.component.html
+0
-0
department-register.component.ts
...unit/department-register/department-register.component.ts
+76
-59
sub-employee-registration.component.html
...yee-registration/sub-employee-registration.component.html
+5
-3
sub-employee-registration.component.ts
...loyee-registration/sub-employee-registration.component.ts
+16
-0
datagrid-syncfution.component.html
...ts/datagrid-syncfution/datagrid-syncfution.component.html
+22
-13
datagrid-syncfution.component.ts
...ents/datagrid-syncfution/datagrid-syncfution.component.ts
+46
-87
bu7.service.ts
src/app/shared/services/bu7.service.ts
+1
-1
No files found.
angular.json
View file @
403fc7f2
...
...
@@ -89,13 +89,13 @@
"budgets"
:
[
{
"type"
:
"initial"
,
"maximumWarning"
:
"
5
mb"
,
"maximumError"
:
"
5
mb"
"maximumWarning"
:
"
6
mb"
,
"maximumError"
:
"
6
mb"
},
{
"type"
:
"anyComponentStyle"
,
"maximumWarning"
:
"
5
mb"
,
"maximumError"
:
"
5
mb"
"maximumWarning"
:
"
6
mb"
,
"maximumError"
:
"
6
mb"
}
],
"outputHashing"
:
"all"
...
...
src/app/components/company-components/company-registration/branch-business-unit/department-register/department-register.component.html
View file @
403fc7f2
This diff is collapsed.
Click to expand it.
src/app/components/company-components/company-registration/branch-business-unit/department-register/department-register.component.ts
View file @
403fc7f2
import
{
ChangeDetectorRef
,
Component
,
EventEmitter
,
Input
,
OnInit
,
}
from
'@angular/core'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ar
}
from
'date-fns/locale'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
import
{
Bu1Service
}
from
'src/app/shared/services/bu1.service'
;
...
...
@@ -13,19 +15,34 @@ export class DepartmentRegisterComponent implements OnInit {
currentPage
=
1
pageSize
=
10
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
bu1List
:
{
check
:
boolean
,
data
:
Bu1Model
}[]
=
[]
bu1ListLoading
=
false
bu1
:
Bu1Model
=
new
MyBu1Model
()
search
=
""
selectedFile
:
File
|
null
=
null
;
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
currentModel
:
'add'
|
'edit'
|
'delete'
=
"add"
bu1
:
{
loading
:
boolean
,
select
:
Bu1Model
,
dataList
:
Bu1Model
[]
}
=
{
loading
:
false
,
select
:
new
MyBu1Model
(),
dataList
:
[]
}
columns
:
ColumnModel
[]
=
[{
"field"
:
"bu1id"
,
"headerText"
:
"รหัสกลุ่มการอนุมัติ"
,
isPrimaryKey
:
true
,
},
{
"field"
:
"tdesc"
,
"headerText"
:
"รายละเอียดฝ่าย(ไทย)"
},
{
"field"
:
"edesc"
,
"headerText"
:
"รายละเอียดฝ่าย(อังกฤษ)"
}]
searchSettings
=
{
fields
:
[
'bu1id'
,
'tdesc'
,
'edesc'
],
operator
:
'contains'
,
ignoreCase
:
true
,
// customMatchCase: (cellValue: string, searchValue: string) => {
// return cellValue.toString().toLowerCase() === '00';
// }
currentModel
:
'add'
|
'edit'
|
'delete'
|
'deleteGroup'
=
"add"
numDataListChecked
=
0
isDataListChecked
=
false
isDataListCheckedAll
=
false
};
constructor
(
private
bu1Service
:
Bu1Service
,
private
toastr
:
ToastrService
,
private
cdr
:
ChangeDetectorRef
,
...
...
@@ -46,7 +63,7 @@ export class DepartmentRegisterComponent implements OnInit {
}
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
bu1
ListL
oading
=
true
this
.
bu1
.
l
oading
=
true
this
.
fileService
.
uploadExcel
(
formData
,
'mbu1'
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
...
...
@@ -54,11 +71,11 @@ export class DepartmentRegisterComponent implements OnInit {
this
.
getBu1List
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu1
ListL
oading
=
false
this
.
bu1
.
l
oading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu1
ListL
oading
=
false
this
.
bu1
.
l
oading
=
false
}
})
}
...
...
@@ -84,36 +101,37 @@ export class DepartmentRegisterComponent implements OnInit {
getBu1List
()
{
this
.
bu1
ListL
oading
=
true
this
.
bu1
.
l
oading
=
true
this
.
bu1Service
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
bu1List
=
response
.
map
(
x
=>
({
check
:
false
,
data
:
new
MyBu1Model
(
x
)
}))
this
.
isDataListCheckedAll
=
false
this
.
dataListCheckAll
()
this
.
bu1ListLoading
=
false
this
.
bu1
.
dataList
=
response
.
map
(
x
=>
{
this
.
selectedItems
.
data
.
set
(
x
.
bu1id
,
false
)
return
new
MyBu1Model
(
x
)
})
this
.
selectedItems
.
key
=
'bu1id'
console
.
log
(
" 🐒 this.selectedItems:"
,
this
.
selectedItems
)
this
.
bu1
.
loading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
bu1
ListL
oading
=
false
this
.
bu1
.
l
oading
=
false
this
.
cdr
.
detectChanges
()
}
})
}
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
bu1ListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
this
.
dataListCheck
()
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
bu1ListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
)
}
bu1ListFilter
()
{
return
this
.
bu1List
.
filter
(
x
=>
{
const
data
=
x
.
data
return
data
.
bu1id
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
data
.
edesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
return
this
.
bu1
.
dataList
.
filter
(
x
=>
{
return
x
.
bu1id
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
})
}
selectBu1
(
bu1
?:
Bu1Model
)
{
this
.
bu1
=
new
MyBu1Model
(
bu1
)
this
.
bu1
.
select
=
new
MyBu1Model
(
bu1
)
}
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
...
...
@@ -123,55 +141,53 @@ export class DepartmentRegisterComponent implements OnInit {
})
}
addBu1
()
{
this
.
bu1
ListL
oading
=
true
this
.
bu1Service
.
post
(
this
.
bu1
).
subscribe
({
this
.
bu1
.
l
oading
=
true
this
.
bu1Service
.
post
(
this
.
bu1
.
select
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu1List
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu1
ListL
oading
=
false
this
.
bu1
.
l
oading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu1
ListL
oading
=
false
this
.
bu1
.
l
oading
=
false
}
})
}
deleteBu1
()
{
this
.
bu1ListLoading
=
true
const
body
=
this
.
bu1List
.
filter
(
x
=>
x
.
check
).
map
(
x
=>
new
MyBu1Model
(
x
.
data
))
this
.
bu1Service
.
delete
(
body
).
subscribe
({
next
:
response
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
getBu1List
()
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
bu1ListLoading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
bu1ListLoading
=
false
}
})
}
dataListCheckAll
()
{
const
selectAll
=
this
.
isDataListCheckedAll
;
this
.
bu1ListFilter
().
forEach
(
x
=>
x
.
check
=
selectAll
);
this
.
dataListCheck
();
}
dataListCheck
()
{
const
dataCheck
=
this
.
bu1ListFilter
();
this
.
isDataListCheckedAll
=
dataCheck
.
length
?
dataCheck
.
every
(
x
=>
x
.
check
)
:
false
;
this
.
numDataListChecked
=
this
.
bu1List
.
filter
(
x
=>
x
.
check
).
length
this
.
isDataListChecked
=
Boolean
(
this
.
numDataListChecked
)
this
.
bu1
.
loading
=
true
const
body
=
this
.
bu1
.
dataList
.
filter
(
x
=>
{
if
(
Array
.
from
(
this
.
selectedItems
.
data
.
keys
()).
find
((
y
:
any
)
=>
y
==
x
.
bu1id
)
&&
Array
.
from
(
this
.
selectedItems
.
data
.
values
()).
find
((
y
:
any
)
=>
y
))
{
return
true
}
return
false
}
).
map
(
x
=>
new
MyBu1Model
(
x
))
console
.
log
(
" 🐒 body:"
,
body
)
// this.bu1Service.delete(body).subscribe({
// next: response => {
// if (response.success) {
// this.showAlert(response.message, 'success')
// this.getBu1List()
// } else {
// this.showAlert(response.message, 'error')
// this.bu1.loading = false
// }
// }, error: error => {
// this.showAlert(error.message, 'error')
// this.bu1.loading = false
// }
// })
}
checkPrimary
()
{
return
this
.
bu1
List
.
find
(
x
=>
x
.
data
.
bu1id
==
this
.
bu1
.
bu1id
)
return
this
.
bu1
.
dataList
.
find
(
x
=>
x
.
bu1id
==
this
.
bu1
.
select
.
bu1id
)
}
onSelectItemChange
(
arg
:
any
)
{
this
.
selectedItems
=
arg
}
}
\ No newline at end of file
src/app/components/company-components/employee-registration/sub-employee-registration/sub-employee-registration.component.html
View file @
403fc7f2
...
...
@@ -200,8 +200,9 @@
<label
class=
"col-span-3 ti-form-label text-primary mt-2 align-center"
>
สถานภาพพนักงาน
<span
class=
"text-danger"
>
*
</span></label>
<div
class=
"col-span-4 "
>
<select
class=
"ti-form-select"
[(
ngModel
)]="
employee
.
select
.
status
"
>
<option
*
ngFor=
"let item of empStatus.dataList"
[
value
]="
item
"
>
{{item.tdesc}}
</option>
<select
class=
"ti-form-select"
[(
ngModel
)]="
employee
.
select
.
status
.
statusCode
"
(
ngModelChange
)="
selectStatus
()"
>
<option
*
ngFor=
"let item of empStatus.dataList"
[
ngValue
]="
item
.
statusCode
"
>
{{item.tdesc}}
</option>
</select>
</div>
</div>
...
...
@@ -590,7 +591,8 @@
ย้อนกลับ
</button>
<button
type=
"button"
class=
"ti-btn ti-btn-success"
data-hs-overlay=
"#sub-employee-registration-alert-add-modal"
[
class
.
ti-btn-disabled
]="
checkEmployeeModel
()||(
modalType=
='add'&&checkPrimary())"
data-hs-overlay=
"#sub-employee-registration-alert-add-modal"
[
class
.
ti-btn-disabled
]="
checkEmployeeModel
()||(
modalType=
='add'&&checkPrimary())"
[
disabled
]="
checkEmployeeModel
()||(
modalType=
='add'&&checkPrimary())"
>
บันทึกข้อมูล
</button>
...
...
src/app/components/company-components/employee-registration/sub-employee-registration/sub-employee-registration.component.ts
View file @
403fc7f2
...
...
@@ -598,16 +598,32 @@ export class SubEmployeeRegistrationComponent {
}
}
this
.
getBu1List
()
if
(
this
.
employee
.
select
.
bu1
.
bu1id
)
{
this
.
getBu2List
()
}
if
(
this
.
employee
.
select
.
bu2
.
bu2id
)
{
this
.
getBu3List
()
}
if
(
this
.
employee
.
select
.
bu3
.
bu3id
)
{
this
.
getBu4List
()
}
if
(
this
.
employee
.
select
.
bu4
.
bu4id
)
{
this
.
getBu5List
()
}
if
(
this
.
employee
.
select
.
bu5
.
bu5id
)
{
this
.
getBu6List
()
}
if
(
this
.
employee
.
select
.
bu6
.
bu6id
)
{
this
.
getBu7List
()
}
}
selectBoss
(
data
:
any
)
{
this
.
employee
.
select
.
boss
=
new
MyBossModel
({
...
data
,
empType
:
data
.
empType
.
codeId
})
}
selectStatus
()
{
this
.
employee
.
select
.
status
=
new
MyStatusModel
(
this
.
empStatus
.
dataList
.
find
(
x
=>
x
.
statusCode
==
this
.
employee
.
select
.
status
.
statusCode
)
||
{})
}
changeDate
(
target
:
{
[
key
:
string
]:
any
},
field
:
string
,
dateIso
:
string
)
{
target
[
field
]
=
this
.
toYYYYMMDD
(
dateIso
)
}
...
...
src/app/components/datagrid-syncfution/datagrid-syncfution.component.html
View file @
403fc7f2
<ejs-grid
#
grid
id=
'Grid'
[
dataSource
]="
dataSource
"
[
allowFiltering
]="
allowFiltering
"
[
filterSettings
]="
filterSettings
"
[
groupSettings
]="
groupSettings
"
[
toolbar
]='
toolbarOptions
'
[
editSettings
]="
editSettings
"
(
actionBegin
)="
onActionBegin
($
event
)"
(
actionComplete
)="
onActionComplete
($
event
)"
(
rowSelected
)="
onRowSelectedCheckbox
($
event
.
data
)"
(
rowDeselected
)="
onRowDeselectedCheckbox
($
event
.
data
)"
showColumnMenu=
'true'
allowPaging=
'true'
allowGrouping=
'true'
allowSorting=
'true'
showColumnMenu=
'true'
allowFiltering=
'true'
[
allowPdfExport
]='
true
'
(
toolbarClick
)='
toolbarClick
($
event
)'
[
allowExcelExport
]='
true
'
[
selectionSettings
]="
selectionOptions
"
(
detailDataBound
)='
detailDataBound
($
event
)'
width=
"auto"
allowReordering=
'true'
[
loadingIndicator
]='
loadingIndicator
'
[
query
]="
query
"
rowHeight=
'60'
allowEditing=
'false'
[
pageSettings
]='
initialPage
'
[
allowMultiSorting
]='
true
'
>
[
searchSettings
]="
searchSettings
"
[
groupSettings
]="
groupSettings
"
[
toolbar
]='
toolbarOptions
'
[
editSettings
]="
editSettings
"
showColumnMenu=
'true'
allowPaging=
'true'
allowGrouping=
'true'
allowSorting=
'true'
showColumnMenu=
'true'
allowFiltering=
'true'
[
allowPdfExport
]='
true
'
(
toolbarClick
)='
toolbarClick
($
event
)'
[
allowExcelExport
]='
true
'
[
selectionSettings
]="
selectionOptions
"
(
detailDataBound
)='
detailDataBound
($
event
)'
width=
"auto"
allowReordering=
'true'
[
loadingIndicator
]='
loadingIndicator
'
[
query
]="
query
"
rowHeight=
'60'
allowEditing=
'false'
[
pageSettings
]='
initialPage
'
[
allowMultiSorting
]='
true
'
>
<e-columns>
<e-column
type=
'checkbox'
width=
'50'
*
ngIf=
"checkBoxSetting"
></e-column>
<!-- <e-column type='checkbox' width='50' *ngIf="checkBoxSetting"></e-column> -->
<e-column
[
textAlign
]="'
center
'"
*
ngIf=
"checkBoxSetting"
[
allowEditing
]="
false
"
>
<ng-template
#
headerTemplate
let-data
>
<input
type=
"checkbox"
[
id
]="'
checkbox-all
'"
class=
"ti-form-checkbox cursor-pointer"
[
checked
]="
selectedItemsAll
"
(
click
)="
toggleSelectionAll
()"
>
<label
[
for
]="'
checkbox-all
'"
class=
"text-sm text-gray-500 mx-2"
>
{{selectedItems.count}} Selected
</label>
</ng-template>
<ng-template
#
template
let-data
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
[
checked
]="
selectedItems
.
data
.
get
(
data
[
selectedItems
.
key
])
||
false
"
(
click
)="
toggleSelection
(
data
[
selectedItems
.
key
],
!
selectedItems
.
data
.
get
(
data
[
selectedItems
.
key
]))"
>
</ng-template>
</e-column>
<e-column
*
ngFor=
"let col of columns"
[
field
]="
col
.
field
"
[
headerText
]="
col
.
headerText
"
[
width
]="
col
.
width
"
[
format
]="
col
.
format
"
[
textAlign
]="'
center
'"
[
isPrimaryKey
]="
col
.
isPrimaryKey
"
[
editType
]="
col
.
editType
"
[
validationRules
]="
col
.
validationRules
"
[
allowEditing
]="'
true
'"
[
allowSorting
]="'
true
'"
[
allowFiltering
]="
true
"
...
...
@@ -24,10 +35,8 @@
</ng-template>
<ng-template
#
template
let-data
>
<i
class=
"ti ti-eye cursor-pointer i-gray fs-l px-1"
(
click
)="
onNextPage
(
data
)"
*
ngIf=
"canChild"
></i>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#modal-detail"
*
ngIf=
"canEdit"
(
click
)="
onViewSelected
(
data
)"
></i>
<i
class=
"ti ti-trash cursor-pointer i-gray fs-l px-1"
data-hs-overlay=
"#modal-delete"
*
ngIf=
"canDelete"
(
click
)="
onRemoveSelected
(
data
)"
></i>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
[
attr
.
data-hs-overlay
]="
modalName
"
*
ngIf=
"canEdit"
(
click
)="
onSelectData
(
data
)"
></i>
</ng-template>
</e-column>
</e-columns>
...
...
src/app/components/datagrid-syncfution/datagrid-syncfution.component.ts
View file @
403fc7f2
...
...
@@ -10,8 +10,9 @@ import {
}
from
'@angular/core'
;
import
{
EditService
,
ReorderService
,
SortService
,
GroupService
,
ColumnMenuService
,
PageService
,
FilterService
,
SelectionSettingsModel
,
ToolbarItems
,
ToolbarService
,
GridComponent
,
PdfExportService
,
ExcelExportService
,
DetailRowService
,
DetailDataBoundEventArgs
,
Grid
,
AggregateService
,
PdfExportProperties
,
LoadingIndicatorModel
}
from
'@syncfusion/ej2-angular-grids'
;
import
{
GroupSettingsModel
,
FilterSettingsModel
,
ColumnModel
}
from
'@syncfusion/ej2-angular-grids'
;
import
{
Query
}
from
'@syncfusion/ej2-data'
;
import
{
DataManager
,
Query
}
from
'@syncfusion/ej2-data'
;
import
{
L10n
,
setCulture
}
from
'@syncfusion/ej2-base'
;
setCulture
(
'th-TH'
);
L10n
.
load
({
...
...
@@ -51,28 +52,31 @@ L10n.load({
encapsulation
:
ViewEncapsulation
.
None
})
export
class
DatagridSyncfutionComponent
implements
OnInit
{
/**
* ======================
* @Input() ส่วนรับค่า
* ======================
*/
@
ViewChild
(
'grid'
)
public
grid
?:
GridComponent
;
@
Input
()
dataSource
:
any
[]
=
[];
@
Output
()
sendSelectData
=
new
EventEmitter
<
any
>
();
@
Input
()
columns
:
ColumnModel
[]
=
[];
// @Input() toolbarOptions?: ToolbarItems[]
@
Input
()
toolbarOptions
?:
ToolbarItems
[]
=
[
'Print'
,
'ExcelExport'
,
'CsvExport'
];
@
Input
()
searchSettings
=
{}
@
Input
()
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
selectedItemsAll
=
false
@
Output
()
sendSelectedItems
=
new
EventEmitter
<
any
>
();
@
Input
()
modalName
=
''
@
Input
()
checkBoxSetting
=
true
@
Input
()
actionSetting
=
true
@
Input
()
detailSetting
=
false
@
Input
()
childList
=
''
@
Input
()
searchText
=
''
@
Input
()
dataSource
:
any
[]
=
[];
// ข้อมูลที่จะแสดงในตาราง
@
Input
()
columns
:
ColumnModel
[]
=
[];
// กำหนดโครงสร้างของคอลัมน์
@
Input
()
childColumns
:
ColumnModel
[]
=
[];
@
Input
()
allowSorting
=
true
;
@
Input
()
allowFiltering
=
true
;
@
Input
()
filterSettings
?:
FilterSettingsModel
=
{
type
:
'Excel'
};;
@
Input
()
groupSettings
?:
GroupSettingsModel
=
{
allowReordering
:
true
,
showGroupedColumn
:
true
,
showDropArea
:
false
};
public
selectionOptions
?:
SelectionSettingsModel
=
{
checkboxOnly
:
true
};
// ตัวอย่างการตั้งค่าอื่น ๆ ตามต้องการ
@
Input
()
toolbarOptions
?:
ToolbarItems
[]
=
[
'Print'
,
'ExcelExport'
,
'CsvExport'
];
@
Input
()
editSettings
?
=
{
allowEditing
:
true
,
mode
:
'Batch'
};
@
Input
()
initialPage
?
=
{
pageSizes
:
true
,
pageSize
:
10
};
@
Input
()
canDelete
=
true
...
...
@@ -80,23 +84,13 @@ export class DatagridSyncfutionComponent implements OnInit {
@
Input
()
canEdit
=
true
// ... เป็นต้น
public
query
:
Query
=
new
Query
().
addParams
(
'dataCount'
,
'1000'
);
loadingIndicator
:
LoadingIndicatorModel
=
{
indicatorType
:
'Shimmer'
};
/**
* ======================
* @Output() ส่วนส่ง Event
* ======================
*/
// ตัวอย่าง event เมื่อเลือกแถว
@
Output
()
rowSelected
=
new
EventEmitter
<
any
>
();
@
Output
()
childSelected
=
new
EventEmitter
<
any
>
();
@
Output
()
rowRemoveSelected
=
new
EventEmitter
<
any
>
();
@
Output
()
rowSelectedCheckbox
=
new
EventEmitter
<
any
>
();
@
Output
()
rowDeselectedCheckbox
=
new
EventEmitter
<
any
>
();
loadingIndicator
:
LoadingIndicatorModel
=
{
indicatorType
:
'Shimmer'
};
// ตัวอย่าง event เมื่อมีการลบ / แก้ไข
@
Output
()
actionBegin
=
new
EventEmitter
<
any
>
();
@
Output
()
actionComplete
=
new
EventEmitter
<
any
>
();
public
selectedRecord
?:
any
;
// อาจมี event อื่น ๆ เช่น pageChange, filterChange, ฯลฯ
// แล้วแต่ logic ที่ต้องการให้ parent รู้
// @Output() pageChanged = new EventEmitter<number>();
...
...
@@ -111,93 +105,45 @@ export class DatagridSyncfutionComponent implements OnInit {
}
ngOnChanges
(
changes
:
SimpleChanges
):
void
{
console
.
log
(
changes
)
this
.
query
=
new
Query
().
addParams
(
'dataCount'
,
'1000'
);
this
.
loadingIndicator
=
{
indicatorType
:
'Shimmer'
};
this
.
loadingIndicator
=
{
indicatorType
:
'Shimmer'
};
if
(
changes
)
{
console
.
log
(
'this.dataSource'
,
this
.
dataSource
)
if
(
changes
[
'searchText'
])
{
this
.
search
(
changes
[
'searchText'
].
currentValue
)
}
}
//Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.
//Add '${implements OnChanges}' to the class.
}
/**
* =============================
* ฟังก์ชันที่ผูกกับ Event ของ <ejs-grid>
* =============================
*/
public
onViewSelected
(
args
:
any
)
{
// เมื่อมีการ select row
this
.
rowSelected
.
emit
(
args
);
}
public
onNextPage
(
args
:
any
)
{
// เมื่อมีการ select row
this
.
childSelected
.
emit
(
args
);
}
public
onRemoveSelected
(
args
:
any
)
{
// เมื่อมีการ select row
this
.
rowRemoveSelected
.
emit
(
args
);
}
public
onRowSelectedCheckbox
(
args
:
any
)
{
// เมื่อมีการ select row
this
.
rowSelectedCheckbox
.
emit
(
args
);
}
public
onRowDeselectedCheckbox
(
args
:
any
)
{
// เมื่อมีการ select row
this
.
rowDeselectedCheckbox
.
emit
(
args
);
}
public
onActionBegin
(
args
:
any
)
{
this
.
actionBegin
.
emit
(
args
);
onSelectData
(
args
:
any
)
{
this
.
sendSelectData
.
emit
(
args
);
}
public
onActionComplet
e
(
args
:
any
)
{
this
.
actionComplete
.
emit
(
args
);
onNextPag
e
(
args
:
any
)
{
console
.
log
(
args
)
}
toolbarClick
(
args
:
any
):
void
{
// if (args.item.id === 'Grid_pdfexport') { // 'Grid_pdfexport' -> Grid component id + _ + toolbar item name
// const pdfExportProperties: PdfExportProperties = {
// exportType: 'CurrentPage'
// };
// this.grid/pdfExport(pdfExportProperties);
// }
if
(
args
.
item
.
id
===
'Grid_excelexport'
)
{
// 'Grid_excelexport' -> Grid component id + _ + toolbar item name
this
.
grid
?.
excelExport
();
}
else
if
(
args
.
item
.
id
===
'Grid_csvexport'
)
{
// 'Grid_csvexport' -> Grid component id + _ + toolbar item name
this
.
grid
?.
csvExport
();
}
// (this.grid as GridComponent).excelExport();
}
showDetails
(
data
:
any
)
{
console
.
log
(
data
)
this
.
selectedRecord
=
data
;
this
.
rowSelected
.
emit
(
this
.
selectedRecord
);
}
search
(
text
?:
string
)
{
if
(
text
){
(
this
.
grid
as
GridComponent
).
search
(
text
);
search
(
text
:
string
)
{
if
(
this
.
grid
)
{
(
this
.
grid
as
GridComponent
).
search
(
this
.
searchText
);
// let filteredData = (this.grid as GridComponent).getCurrentViewRecords();
// console.log(filteredData);
// const clonedData = JSON.parse(JSON.stringify(this.dataSource));
// new DataManager(clonedData).executeQuery(new Query().search(this.searchText, [], undefined, true)).then((e: any) => {
// console.log('Searched Records:', e.result)
// });
}
}
detailDataBound
(
e
:
DetailDataBoundEventArgs
)
{
console
.
log
(
e
)
let
detail
=
new
Grid
({
// ─────────────────────────────────────────────────────────────
// เดิมเป็น data.filter(...) เทียบ EmployeeID
...
...
@@ -219,5 +165,18 @@ export class DatagridSyncfutionComponent implements OnInit {
// detail.appendTo((e.detailElement as HTMLElement).querySelector('.custom-grid') as HTMLElement);
}
toggleSelection
(
key
:
string
,
value
:
boolean
)
{
this
.
selectedItems
.
data
.
set
(
key
,
value
);
this
.
selectedItems
.
count
=
Array
.
from
(
this
.
selectedItems
.
data
.
values
()).
filter
(
v
=>
v
).
length
;
this
.
sendSelectedItems
.
emit
(
this
.
selectedItems
);
}
toggleSelectionAll
()
{
this
.
selectedItemsAll
=
!
this
.
selectedItemsAll
;
this
.
selectedItems
.
data
.
forEach
((
_
,
key
)
=>
{
this
.
selectedItems
.
data
.
set
(
key
,
this
.
selectedItemsAll
);
});
this
.
selectedItems
.
count
=
this
.
selectedItemsAll
?
this
.
selectedItems
.
data
.
size
:
0
;
this
.
sendSelectedItems
.
emit
(
this
.
selectedItems
);
}
}
src/app/shared/services/bu7.service.ts
View file @
403fc7f2
...
...
@@ -16,7 +16,7 @@ export class Bu7Service {
return
this
.
http
.
get
<
Bu7Model
[]
>
(
this
.
urlApi
+
"/lists"
)
}
getListByParent
(
bu6id
:
string
):
Observable
<
Bu7Model
[]
>
{
return
this
.
http
.
get
<
Bu7Model
[]
>
(
environment
.
baseUrl
+
"/parent/"
+
bu6id
)
return
this
.
http
.
get
<
Bu7Model
[]
>
(
environment
.
baseUrl
+
"/
bu6/
parent/"
+
bu6id
)
}
getById
(
bu7id
:
string
):
Observable
<
Bu7Model
>
{
return
this
.
http
.
get
<
Bu7Model
>
(
environment
.
baseUrl
+
"/bu6/"
+
bu7id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment