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
86f746d2
Commit
86f746d2
authored
Apr 16, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ข้อมูลทั่วไป
parent
7b2e3831
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
98 deletions
+61
-98
import-data.component.html
...-detail-management/import-data/import-data.component.html
+16
-78
import-data.component.ts
...ob-detail-management/import-data/import-data.component.ts
+45
-20
No files found.
src/app/components/job-detail-components/job-detail-management/import-data/import-data.component.html
View file @
86f746d2
This diff is collapsed.
Click to expand it.
src/app/components/job-detail-components/job-detail-management/import-data/import-data.component.ts
View file @
86f746d2
import
{
ChangeDetectorRef
,
Component
}
from
'@angular/core'
;
import
{
ColumnModel
}
from
'@syncfusion/ej2-grids'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Bu1Model
,
MyBu1Model
}
from
'src/app/shared/model/bu1.model'
;
import
{
Bu2Model
,
MyBu2Model
}
from
'src/app/shared/model/bu2.model'
;
...
...
@@ -28,9 +29,6 @@ import { PositionService } from 'src/app/shared/services/position.service';
styleUrls
:
[
'./import-data.component.scss'
]
})
export
class
ImportDataComponent
{
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
pageSize
=
10
search
=
""
jobCodeList
:
JobCodeModel
[]
=
[]
loading
=
false
...
...
@@ -39,7 +37,6 @@ export class ImportDataComponent {
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
selectJob
:
JobCodeModel
=
new
MyJobCodeModel
({})
modalStatus
=
''
positionList
:
PositionModel
[]
=
[]
positionId
=
''
...
...
@@ -68,6 +65,30 @@ export class ImportDataComponent {
supervisorPositionId
=
''
employeeList
:
EmployeeModel
[]
=
[]
checkJobCodeId
=
false
currentModal
:
'add'
|
'edit'
|
'delete'
=
"add"
columns
:
ColumnModel
[]
=
[{
field
:
"jobcodeId"
,
headerText
:
"ชื่อล็อกอิน"
,
type
:
"string"
,
isPrimaryKey
:
true
,
},
{
field
:
"tdesc"
,
headerText
:
"ชื่อลักษณะงาน (ไทย)"
,
type
:
"string"
},
{
field
:
"edesc"
,
headerText
:
"ชื่อลักษณะงาน (อังกฤษ)"
,
type
:
"string"
}]
searchSettings
=
{
fields
:
[
'jobcodeId'
,
'tdesc'
,
'edesc'
],
operator
:
'contains'
,
ignoreCase
:
false
}
selectedItems
:
{
key
:
string
,
count
:
number
,
data
:
Map
<
string
,
boolean
>
}
=
{
key
:
''
,
count
:
0
,
data
:
new
Map
<
string
,
boolean
>
()
};
constructor
(
private
toastr
:
ToastrService
,
private
fileService
:
FileService
,
...
...
@@ -112,10 +133,13 @@ export class ImportDataComponent {
this
.
loading
=
false
this
.
jobcodeService
.
getList
().
subscribe
({
next
:
response
=>
{
this
.
jobCodeList
=
response
.
map
((
x
:
any
)
=>
new
MyJobCodeModel
(
x
))
this
.
jobCodeList
=
this
.
jobCodeList
.
sort
((
a
,
b
)
=>
a
.
jobcodeId
.
localeCompare
(
b
.
jobcodeId
))
this
.
jobCodeList
=
response
.
map
((
x
:
any
)
=>
{
this
.
selectedItems
.
data
.
set
(
x
.
jobcodeId
,
false
)
return
new
MyJobCodeModel
(
x
)
})
this
.
selectedItems
.
key
=
'jobcodeId'
this
.
selectedItems
.
count
=
0
this
.
loading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
loading
=
false
...
...
@@ -141,7 +165,6 @@ export class ImportDataComponent {
this
.
bu5Id
=
item
.
bu5
.
bu5id
this
.
bu6Id
=
item
.
bu6
.
bu6id
this
.
bu7Id
=
item
.
bu7
.
bu7id
console
.
log
(
"🚀 ~ ImportDataComponent ~ edit ~ this.selectJob:"
,
this
.
selectJob
)
}
add
()
{
this
.
selectJob
=
new
MyJobCodeModel
({})
...
...
@@ -157,10 +180,6 @@ export class ImportDataComponent {
this
.
bu7Id
=
''
}
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
jobcodeFilter
().
length
/
this
.
pageSize
)
},
(
_
,
i
)
=>
i
+
1
);
}
clearValue
()
{
this
.
selectJob
.
jobObjective
=
''
...
...
@@ -205,7 +224,9 @@ export class ImportDataComponent {
})
}
deleteJob
()
{
this
.
jobcodeService
.
delete
(
this
.
selectJob
).
subscribe
((
response
:
any
)
=>
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
body
=
this
.
jobCodeList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
jobcodeId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
jobcodeId
)).
map
(
x
=>
new
MyJobCodeModel
(
x
))
this
.
jobcodeService
.
delete
(
body
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
selectJob
=
new
MyJobCodeModel
({})
...
...
@@ -216,13 +237,7 @@ export class ImportDataComponent {
this
.
cdr
.
detectChanges
()
})
}
jobcodeFilter
()
{
return
this
.
jobCodeList
.
filter
(
x
=>
x
.
tdesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
edesc
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
||
x
.
jobcodeId
.
toLowerCase
().
includes
(
this
.
search
.
toLowerCase
())
)
}
onFileSelected
(
event
:
any
)
{
this
.
selectedFile
=
event
.
target
.
files
.
length
>
0
?
event
.
target
.
files
[
0
]
:
null
;
this
.
selectedFileName
=
this
.
selectedFile
?.
name
||
"กรุณาเลือกไฟล์"
...
...
@@ -444,4 +459,14 @@ export class ImportDataComponent {
checkPrimary
()
{
return
this
.
jobCodeList
.
find
(
x
=>
x
.
jobcodeId
==
this
.
selectJob
.
jobcodeId
)
}
numSelectItem
()
{
const
selectedKeys
=
Array
.
from
(
this
.
selectedItems
.
data
.
keys
());
const
num
=
this
.
jobCodeList
.
filter
(
x
=>
selectedKeys
.
includes
(
x
.
jobcodeId
)
&&
this
.
selectedItems
.
data
.
get
(
x
.
jobcodeId
)).
length
return
num
}
onSelectItemChange
(
arg
:
any
)
{
this
.
selectedItems
=
arg
}
}
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