Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PQS-Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
65160206
PQS-Frontend
Commits
5f71f8eb
Commit
5f71f8eb
authored
2 months ago
by
65160206
Browse files
Options
Downloads
Patches
Plain Diff
employee fix
parent
f4da665c
No related branches found
No related tags found
No related merge requests found
Pipeline
#660
canceled
2 months ago
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/EmployeeSector.vue
+15
-17
15 additions, 17 deletions
src/components/EmployeeSector.vue
with
15 additions
and
17 deletions
src/components/EmployeeSector.vue
+
15
−
17
View file @
5f71f8eb
...
...
@@ -15,28 +15,31 @@
<
script
setup
lang=
"ts"
>
import
type
{
Employee
}
from
'
@/types/Employee
'
import
{
ref
,
onMounted
}
from
'
vue
'
import
{
listEmployees
}
from
'
@/services/employee
'
;
// ✅ import API
import
{
listEmployees
}
from
'
@/services/employee
'
const
employees
=
ref
<
Employee
[]
>
([]);
const
defaultImage
=
'
/images/noimage.jpg
'
;
// เพิ่ม `/` ข้างหน้าให้เป็น path root
// ✅ ดึง BASE URL จาก ENV
const
IMAGE_BASE_URL
=
import
.
meta
.
env
.
VITE_EMP_IMAGE_BASE
||
''
const
defaultImage
=
'
/images/noimage.jpg
'
const
employees
=
ref
<
Employee
[]
>
([])
const
onDragStart
=
(
event
:
DragEvent
,
employee
:
Employee
)
=>
{
event
.
dataTransfer
?.
setData
(
'
text/plain
'
,
JSON
.
stringify
(
employee
))
;
event
.
dataTransfer
!
.
effectAllowed
=
'
move
'
;
}
;
event
.
dataTransfer
?.
setData
(
'
text/plain
'
,
JSON
.
stringify
(
employee
))
event
.
dataTransfer
!
.
effectAllowed
=
'
move
'
}
// ✅ โหลดข้อมูลพนักงานตอน mount
onMounted
(
async
()
=>
{
try
{
const
res
=
await
listEmployees
()
;
const
res
=
await
listEmployees
()
employees
.
value
=
res
.
map
((
e
)
=>
({
...
e
,
image
:
e
.
image
?
`http://localhost:4000/images/emp/
${
e
.
image
}
`
:
defaultImage
,
}))
;
image
:
e
.
image
?
IMAGE_BASE_URL
+
e
.
image
:
defaultImage
,
}))
}
catch
(
error
)
{
console
.
error
(
'
โหลดพนักงานไม่สำเร็จ
'
,
error
)
;
console
.
error
(
'
โหลดพนักงานไม่สำเร็จ
'
,
error
)
}
})
;
})
</
script
>
<
style
scoped
>
...
...
@@ -46,17 +49,14 @@ onMounted(async () => {
text-align
:
center
;
}
/* ✅ ปรับ Employee Card ให้เป็น Responsive */
.employee-list
{
display
:
grid
;
grid-template-columns
:
repeat
(
auto-fit
,
minmax
(
250px
,
1
fr
));
/* ปรับจำนวนคอลัมน์อัตโนมัติ */
gap
:
15px
;
justify-items
:
center
;
padding
:
10px
;
}
/* ✅ ปรับขนาด Employee Card ตามหน้าจอ */
.employee-card
{
margin
:
5px
;
display
:
flex
;
...
...
@@ -72,11 +72,9 @@ onMounted(async () => {
transition
:
all
0.3s
ease
;
}
/* ✅ Responsive: ถ้าหน้าจอเล็กกว่า 600px */
@media
(
max-width
:
600px
)
{
.employee-list
{
grid-template-columns
:
repeat
(
auto-fit
,
minmax
(
80px
,
1
fr
));
/* ลดขนาด */
}
.employee-card
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment