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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
65160206
PQS-Frontend
Commits
bb6881ca
Commit
bb6881ca
authored
5 months ago
by
Atchara Bunserm
Browse files
Options
Downloads
Patches
Plain Diff
OrderDrag up down
parent
ad4e7fed
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/views/ProductQueueView.vue
+64
-13
64 additions, 13 deletions
src/views/ProductQueueView.vue
with
64 additions
and
13 deletions
src/views/ProductQueueView.vue
+
64
−
13
View file @
bb6881ca
<
script
setup
>
import
{
ref
}
from
'
vue
'
import
GanttChart
from
'
@/components/GanttChart.vue
'
const
selectedDate
=
ref
(
'
1/1/2024
'
)
const
employees
=
Array
.
from
({
length
:
10
},
(
_
,
i
)
=>
`EM
${
i
+
1
}
`
)
const
orders
=
[
'
Order1
'
,
'
Order2
'
]
const
orders
=
ref
([
{
id
:
1
,
name
:
'
ORDER1
'
},
{
id
:
2
,
name
:
'
ORDER2
'
}
])
// Drag and drop functionality
const
draggedOrder
=
ref
(
null
)
const
handleDragStart
=
(
order
)
=>
{
draggedOrder
.
value
=
order
}
const
handleDragOver
=
(
event
)
=>
{
event
.
preventDefault
()
}
const
handleDrop
=
(
targetOrder
)
=>
{
if
(
!
draggedOrder
.
value
||
draggedOrder
.
value
===
targetOrder
)
return
// Find the indices of the dragged and target orders
const
draggedIndex
=
orders
.
value
.
findIndex
((
o
)
=>
o
.
id
===
draggedOrder
.
value
.
id
)
const
targetIndex
=
orders
.
value
.
findIndex
((
o
)
=>
o
.
id
===
targetOrder
.
id
)
// Remove the dragged order from its original position
const
[
removed
]
=
orders
.
value
.
splice
(
draggedIndex
,
1
)
// Insert the dragged order at the target position
orders
.
value
.
splice
(
targetIndex
,
0
,
removed
)
// Reset the dragged order
draggedOrder
.
value
=
null
}
</
script
>
<
template
>
<v-container
class=
"pa-0"
>
<!-- Gantt chart -->
<v-sheet
class=
"pa-1 mb-3"
style=
"border-radius: 15px; max-width: 98%; margin-left: auto; margin-right: auto; min-height: 500px;"
>
<v-sheet
class=
"pa-1 mb-3"
style=
"border-radius: 15px; max-width: 98%; margin-left: auto; margin-right: auto; min-height: 500px;"
>
<!-- Timeline -->
<v-sheet
class=
"pa-3 mb-3"
>
<v-col
cols=
"auto"
class=
"d-flex align-center"
>
<v-col
cols=
"auto"
class=
"d-flex align-center"
style=
"background-color: #7E9CD3; border-radius: 15px; "
>
<v-btn
class=
"mr-2"
style=
"background-color: #2B2E3F; color: white; border-radius: 10px;"
>
<
Back
</v-btn>
<v-btn
style=
"background-color: white; color: black; min-width: 200px; border-radius: 15px;"
>
{{
selectedDate
}}
</v-btn>
<v-btn
style=
"background-color: white; color: black; min-width: 200px; border-radius: 15px;"
>
{{
selectedDate
}}
</v-btn>
<v-btn
class=
"ml-2"
style=
"background-color: #2B2E3F; color: white; border-radius: 10px;"
>
Next
>
</v-btn>
<v-btn
class=
"ml-2"
style=
"background-color: white; color: black; border-radius: 10px;"
><v-icon>
mdi-dots-horizontal
</v-icon></v-btn>
<v-btn
class=
"ml-2"
style=
"background-color: white; color: black; border-radius: 10px;"
><v-icon>
mdi-dots-horizontal
</v-icon></v-btn>
</v-col>
<v-btn
class=
"ml-auto"
style=
"background-color: #0077D8; font-weight: bold; color: white; border-radius: 12px; padding: 28px; display: flex; align-items: center; justify-content: center; font-size: 18px;"
>
...
...
@@ -50,13 +85,29 @@ const orders = ['Order1', 'Order2']
<!-- Order Priority -->
<v-col
cols=
"6"
>
<v-card
class=
"pa-4"
style=
"background-color: white; border-radius: 15px; min-height: 280px
;"
>
<
!-- ลำดับความสำคัญวางทับตรงนี้ -->
<v-btn
v-for=
"order in
order
s
"
:key=
"order"
block
class=
"mb-2"
color=
"#2B2E3F"
>
<!-- ลบอันนี้ --
>
{{
order
}}
</
v-btn
>
<v-card
class=
"pa-4"
style=
"background-color: white; border-radius: 15px; min-height: 280px
"
>
<
div
v-for=
"order in orders"
:key=
"order.id"
class=
"order-item"
draggable=
"true"
@
dragstart=
"() => handleDragStart(
order
)
"
@
dragover=
"handleDragOver"
@
drop=
"() => handleDrop(order)"
>
{{
order
.
name
}}
</
div
>
</v-card>
</v-col>
</v-row>
</v-container>
</
template
>
<!-- ส่วน UI ของปุ่ม Order1--2 -->
<
style
scoped
>
.order-item
{
background-color
:
#2b2e3f
;
color
:
white
;
padding
:
7px
;
margin-bottom
:
8px
;
text-align
:
center
;
cursor
:
move
;
user-select
:
none
;
}
.order-item
:hover
{
opacity
:
0.9
;
}
</
style
>
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