Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myAppraisal
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
myAppraisal
Commits
9b29ce0c
Commit
9b29ce0c
authored
Feb 19, 2025
by
Nakarin Luankla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE การจัดการรายละเอียดงาน
รายละเอียดของงาน
parent
0c874d39
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
59 deletions
+188
-59
import-data.component.ts
...ob-detail-management/import-data/import-data.component.ts
+1
-1
work-detail.component.html
...ponents/job-detail/work-detail/work-detail.component.html
+0
-0
work-detail.component.ts
...omponents/job-detail/work-detail/work-detail.component.ts
+157
-57
job-code.model.ts
src/app/shared/model/job-code.model.ts
+30
-1
No files found.
src/app/components/job-detail-components/job-detail-management/import-data/import-data.component.ts
View file @
9b29ce0c
...
@@ -236,7 +236,7 @@ export class ImportDataComponent {
...
@@ -236,7 +236,7 @@ export class ImportDataComponent {
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
selectedFile
);
formData
.
append
(
'file'
,
this
.
selectedFile
);
this
.
loading
=
true
this
.
loading
=
true
this
.
fileService
.
uploadExcel
(
formData
,
'MJOBCODE_
COMPETENCY
'
).
subscribe
({
this
.
fileService
.
uploadExcel
(
formData
,
'MJOBCODE_
GENERAL
'
).
subscribe
({
next
:
response
=>
{
next
:
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
showAlert
(
response
.
message
,
'success'
)
...
...
src/app/components/job-detail-components/job-detail/work-detail/work-detail.component.html
View file @
9b29ce0c
This diff is collapsed.
Click to expand it.
src/app/components/job-detail-components/job-detail/work-detail/work-detail.component.ts
View file @
9b29ce0c
import
{
C
omponent
}
from
'@angular/core'
;
import
{
C
hangeDetectorRef
,
Component
}
from
'@angular/core'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
JobModel
,
MyJobModel
}
from
'src/app/shared/model/job.model'
;
import
{
JobCodeModel
,
MyJobCodeModel
}
from
'src/app/shared/model/job-code.model'
;
import
{
FileService
}
from
'src/app/shared/services/file.service'
;
import
{
JobCodeService
}
from
'src/app/shared/services/job-code.service'
;
@
Component
({
@
Component
({
selector
:
'app-work-detail'
,
selector
:
'app-work-detail'
,
...
@@ -8,64 +12,160 @@ import { JobModel, MyJobModel } from 'src/app/shared/model/job.model';
...
@@ -8,64 +12,160 @@ import { JobModel, MyJobModel } from 'src/app/shared/model/job.model';
styleUrls
:
[
'./work-detail.component.scss'
]
styleUrls
:
[
'./work-detail.component.scss'
]
})
})
export
class
WorkDetailComponent
{
export
class
WorkDetailComponent
{
currentPage
=
1
currentPage
=
1
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
page
=
Array
.
from
({
length
:
1
},
(
_
,
i
)
=>
i
+
1
);
jobList
:
JobModel
[]
=
[]
pageSize
=
10
job
:
JobModel
=
new
MyJobModel
({})
search
=
""
search
=
""
jobCodeList
:
JobCodeModel
[]
=
[]
constructor
(
loading
=
false
private
toastr
:
ToastrService
)
{
}
selectedFile
:
File
|
null
=
null
;
ngOnInit
():
void
{
selectedFileName
:
string
=
'กรุณาเลือกไฟล์'
;
}
selectJob
:
JobCodeModel
=
new
MyJobCodeModel
({})
modalStatus
=
''
constructor
(
private
toastr
:
ToastrService
,
private
fileService
:
FileService
,
private
jobcodeService
:
JobCodeService
,
private
cdr
:
ChangeDetectorRef
,
)
{
}
ngOnInit
():
void
{
this
.
getListJob
();
}
getListJob
(){
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
.
loading
=
false
this
.
searchChange
()
this
.
cdr
.
detectChanges
()
},
error
:
error
=>
{
this
.
loading
=
false
this
.
cdr
.
detectChanges
()
}
})
}
searchChange
()
{
this
.
currentPage
=
1
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
jobcodeFilter
().
length
/
this
.
pageSize
)
},
(
_
,
i
)
=>
i
+
1
);
}
edit
(
item
:
JobCodeModel
){
this
.
selectJob
=
new
MyJobCodeModel
({})
this
.
selectJob
=
new
MyJobCodeModel
(
item
)
}
clearValue
(){
this
.
selectJob
.
competencyWorkText
=
''
this
.
selectJob
.
serviceWorkText
=
''
this
.
selectJob
.
serviceWorkPercent
=
0
this
.
selectJob
.
responsibleWorkText
=
''
this
.
selectJob
.
responsibleWorkPercent
=
0
this
.
selectJob
.
specialWorkText
=
''
this
.
selectJob
.
specialWorkPercent
=
0
this
.
selectJob
.
allPositionWorkText
=
''
this
.
selectJob
.
allPositionWorkPercent
=
0
this
.
selectJob
.
otherWorkText
=
''
this
.
selectJob
.
otherWorkPercent
=
0
}
toNumber
(
value
:
string
|
number
):
number
{
return
typeof
value
===
'string'
?
parseInt
(
value
)
:
value
;
}
save
(){
this
.
selectJob
.
serviceWorkPercent
=
this
.
toNumber
(
this
.
selectJob
.
serviceWorkPercent
)
this
.
selectJob
.
responsibleWorkPercent
=
this
.
toNumber
(
this
.
selectJob
.
responsibleWorkPercent
)
this
.
selectJob
.
specialWorkPercent
=
this
.
toNumber
(
this
.
selectJob
.
specialWorkPercent
)
this
.
selectJob
.
allPositionWorkPercent
=
this
.
toNumber
(
this
.
selectJob
.
allPositionWorkPercent
)
this
.
selectJob
.
otherWorkPercent
=
this
.
toNumber
(
this
.
selectJob
.
otherWorkPercent
)
this
.
jobcodeService
.
post
(
this
.
selectJob
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
selectJob
=
new
MyJobCodeModel
({})
this
.
getListJob
();
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
this
.
cdr
.
detectChanges
()
})
}
deleteJob
(){
this
.
jobcodeService
.
delete
(
this
.
selectJob
).
subscribe
((
response
:
any
)
=>
{
if
(
response
.
success
)
{
this
.
showAlert
(
response
.
message
,
'success'
)
this
.
selectJob
=
new
MyJobCodeModel
({})
this
.
getListJob
();
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
}
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
||
"กรุณาเลือกไฟล์"
}
searchChange
()
{
uploadFile
()
{
this
.
currentPage
=
1
if
(
!
this
.
selectedFile
)
{
this
.
page
=
Array
.
from
({
length
:
Math
.
ceil
(
this
.
jobListFilter
().
length
/
10
)
},
(
_
,
i
)
=>
i
+
1
);
alert
(
'กรุณาเลือกไฟล์ก่อนอัปโหลด'
)
}
return
jobListFilter
()
{
}
return
this
.
jobList
.
filter
(
x
=>
x
.
jobid
.
includes
(
this
.
search
)
||
const
formData
=
new
FormData
();
x
.
tdesc
.
includes
(
this
.
search
)
||
formData
.
append
(
'file'
,
this
.
selectedFile
);
x
.
edesc
.
includes
(
this
.
search
))
this
.
loading
=
true
}
this
.
fileService
.
uploadExcel
(
formData
,
'MJOBCODE_COMPETENCY'
).
subscribe
({
selectJob
(
job
:
JobModel
)
{
next
:
response
=>
{
// this.showSuccess()
if
(
response
.
success
)
{
this
.
job
=
new
MyJobModel
(
job
)
this
.
showAlert
(
response
.
message
,
'success'
)
}
this
.
getListJob
();
}
else
{
this
.
showAlert
(
response
.
message
,
'error'
)
this
.
loading
=
false
}
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
this
.
loading
=
false
}
})
}
showSuccessAdd
()
{
downloadFile
()
{
this
.
toastr
.
success
(
'บันทึกข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
const
fileName
=
'IMPORT_MJOBCODEV2.xlsx'
timeOut
:
3000
,
this
.
fileService
.
downloadTemplate
(
fileName
).
subscribe
({
positionClass
:
'toast-top-right'
,
next
:
response
=>
{
});
const
url
=
window
.
URL
.
createObjectURL
(
response
);
}
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
fileName
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
window
.
URL
.
revokeObjectURL
(
url
);
},
error
:
error
=>
{
this
.
showAlert
(
error
.
message
,
'error'
)
}
})
}
showSuccessEdit
(
)
{
showAlert
(
text
:
string
,
type
:
'success'
|
'error'
)
{
this
.
toastr
.
success
(
'เเก้ไขข้อมูลสำเร็จ'
,
'เเ
จ้งเตือน'
,
{
this
.
toastr
[
type
](
text
,
'แ
จ้งเตือน'
,
{
timeOut
:
3000
,
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
positionClass
:
'toast-top-right'
,
});
})
}
}
showSuccessDelete
()
{
this
.
toastr
.
success
(
'ลบข้อมูลสำเร็จ'
,
'เเจ้งเตือน'
,
{
timeOut
:
3000
,
positionClass
:
'toast-top-right'
,
});
}
addBu1
()
{
// this.bu1Service.post(this.bu1).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
}
deleteJob
(
job
:
JobModel
)
{
// this.bu1Service.delete(new MyBu1Model(bu1)).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
}
}
}
src/app/shared/model/job-code.model.ts
View file @
9b29ce0c
...
@@ -34,6 +34,16 @@ export interface JobCodeModel {
...
@@ -34,6 +34,16 @@ export interface JobCodeModel {
supervisor
:
string
supervisor
:
string
competencyWorkText
:
string
competencyWorkText
:
string
supervisorPosition
:
PositionModel
supervisorPosition
:
PositionModel
serviceWorkText
:
string
serviceWorkPercent
:
number
responsibleWorkText
:
string
responsibleWorkPercent
:
number
specialWorkText
:
string
specialWorkPercent
:
number
allPositionWorkText
:
string
allPositionWorkPercent
:
number
otherWorkText
:
string
otherWorkPercent
:
number
}
}
export
class
MyJobCodeModel
implements
JobCodeModel
{
export
class
MyJobCodeModel
implements
JobCodeModel
{
...
@@ -62,6 +72,16 @@ export class MyJobCodeModel implements JobCodeModel {
...
@@ -62,6 +72,16 @@ export class MyJobCodeModel implements JobCodeModel {
supervisor
:
string
supervisor
:
string
competencyWorkText
:
string
competencyWorkText
:
string
supervisorPosition
:
PositionModel
supervisorPosition
:
PositionModel
serviceWorkText
:
string
serviceWorkPercent
:
number
responsibleWorkText
:
string
responsibleWorkPercent
:
number
specialWorkText
:
string
specialWorkPercent
:
number
allPositionWorkText
:
string
allPositionWorkPercent
:
number
otherWorkText
:
string
otherWorkPercent
:
number
constructor
(
data
:
Partial
<
JobCodeModel
>
)
{
constructor
(
data
:
Partial
<
JobCodeModel
>
)
{
this
.
jobcodeId
=
data
.
jobcodeId
||
""
this
.
jobcodeId
=
data
.
jobcodeId
||
""
this
.
tdesc
=
data
.
tdesc
||
""
this
.
tdesc
=
data
.
tdesc
||
""
...
@@ -88,7 +108,16 @@ export class MyJobCodeModel implements JobCodeModel {
...
@@ -88,7 +108,16 @@ export class MyJobCodeModel implements JobCodeModel {
this
.
supervisor
=
data
.
supervisor
||
""
this
.
supervisor
=
data
.
supervisor
||
""
this
.
competencyWorkText
=
data
.
competencyWorkText
||
""
this
.
competencyWorkText
=
data
.
competencyWorkText
||
""
this
.
supervisorPosition
=
new
MyPositionModel
(
data
.
supervisorPosition
||
{})
this
.
supervisorPosition
=
new
MyPositionModel
(
data
.
supervisorPosition
||
{})
this
.
serviceWorkText
=
data
.
serviceWorkText
||
""
this
.
serviceWorkPercent
=
data
.
serviceWorkPercent
??
0
this
.
responsibleWorkText
=
data
.
responsibleWorkText
||
""
this
.
responsibleWorkPercent
=
data
.
responsibleWorkPercent
??
0
this
.
specialWorkText
=
data
.
specialWorkText
||
""
this
.
specialWorkPercent
=
data
.
specialWorkPercent
??
0
this
.
allPositionWorkText
=
data
.
allPositionWorkText
||
""
this
.
allPositionWorkPercent
=
data
.
allPositionWorkPercent
??
0
this
.
otherWorkText
=
data
.
otherWorkText
||
""
this
.
otherWorkPercent
=
data
.
otherWorkPercent
??
0
}
}
}
}
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