Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TF-MOM-WEB
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
TFMOM
TF-MOM-WEB
Commits
8ba6f51c
Commit
8ba6f51c
authored
Aug 10, 2023
by
arvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
装配单元路线
parent
e13caab2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
12 deletions
+105
-12
unit.vue
...-mes/src/privateComponents/components/MBOMConfig/unit.vue
+97
-4
view.vue
...-mes/src/privateComponents/components/MBOMConfig/view.vue
+8
-8
No files found.
applications/dee-mes/src/privateComponents/components/MBOMConfig/unit.vue
View file @
8ba6f51c
...
...
@@ -143,7 +143,31 @@ export default {
}
},
calcCriticalPath
(
link
)
{
// 找出当前link 同级 task link
const
peerTasks
=
this
.
getPeerTasks
(
link
)
const
peerLinks
=
this
.
getPeerLinks
(
peerTasks
)
if
(
peerLinks
.
length
===
0
)
{
return
}
const
peerGroups
=
this
.
getPeerGroups
(
peerLinks
)
// 获取关键路径上的link
const
isCriticalLinks
=
this
.
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
// 取消原有 关键字
peerLinks
.
filter
(
l
=>
!
isCriticalLinks
.
includes
(
l
.
id
+
''
))
.
forEach
(
l
=>
{
if
(
l
.
isCritical
)
{
l
.
isCritical
=
false
this
.
modifyLink
(
l
,
'MODIFY'
)
}
})
// 设置新的 关键字
peerLinks
.
filter
(
l
=>
isCriticalLinks
.
includes
(
l
.
id
+
''
))
.
forEach
(
l
=>
{
if
(
!
l
.
isCritical
)
{
l
.
isCritical
=
true
this
.
modifyLink
(
l
,
'MODIFY'
)
}
})
},
modifyLink
(
link
,
operator
)
{
const
_link
=
{
...
...
@@ -157,11 +181,15 @@ export default {
// 判断是否为恢复旧数据
const
item
=
this
.
modifyData
.
links
.
find
(
l
=>
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
item
)
{
item
.
operator
=
''
if
(
item
.
id
)
{
item
.
operator
=
''
}
else
{
item
.
operator
=
'ADD'
}
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
else
{
}
else
if
(
operator
===
'REMOVE'
)
{
// 判断是为删除新数据
const
itemIdx
=
this
.
modifyData
.
links
.
findIndex
(
l
=>
!
l
.
id
&&
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
itemIdx
>
-
1
)
{
...
...
@@ -174,8 +202,61 @@ export default {
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
else
{
// 判断是为删除新数据
const
itemIdx
=
this
.
modifyData
.
links
.
findIndex
(
l
=>
!
l
.
id
&&
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
itemIdx
>
-
1
)
{
this
.
modifyData
.
links
[
itemIdx
]
=
{
...
_link
}
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
},
getMaxWorkHour
(
peerTasks
)
{
let
maxWorkHour
=
0
peerTasks
.
forEach
(
t
=>
{
if
(
t
.
duration
>
maxWorkHour
)
{
maxWorkHour
=
t
.
duration
}
})
return
maxWorkHour
},
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
{
let
maxWorkHour
=
this
.
getMaxWorkHour
(
peerTasks
)
let
isCriticalLinks
=
[]
peerGroups
.
forEach
(
g
=>
{
let
_max
=
0
g
.
tasks
.
forEach
(
id
=>
{
const
task
=
peerTasks
.
find
(
t
=>
t
.
id
===
id
)
if
(
task
)
{
_max
=
_max
+
task
.
duration
}
})
if
(
_max
>
maxWorkHour
)
{
maxWorkHour
=
_max
isCriticalLinks
=
g
.
links
}
})
return
isCriticalLinks
},
getPeerGroups
(
links
)
{
const
str
=
links
.
map
(
l
=>
l
.
id
).
join
()
const
allGroups
=
this
.
gantt
.
getConnectedGroup
()
return
allGroups
.
filter
(
g
=>
g
.
links
.
find
(
id
=>
str
.
includes
(
id
+
''
)))
},
getPeerTasks
(
link
)
{
const
allTasks
=
this
.
gantt
.
getTableData
().
data
.
data
const
target
=
Number
(
link
.
target
)
const
targetTask
=
allTasks
.
find
(
t
=>
t
.
id
===
target
)
if
(
!
targetTask
)
{
return
[]
}
return
allTasks
.
filter
(
t
=>
t
.
parenId
===
targetTask
.
parenId
)
},
getPeerLinks
(
tasks
)
{
const
allLinks
=
this
.
gantt
.
getTableData
().
data
.
links
return
allLinks
.
filter
(
l
=>
tasks
.
find
(
t
=>
t
.
id
===
Number
(
l
.
target
)))
},
getData
(
flag
)
{
if
(
!
flag
&&
this
.
loading
&&
(
this
.
currentId
===
this
.
node
.
id
))
{
return
...
...
@@ -477,13 +558,15 @@ export default {
return
text
}
ganttAss
.
attachEvent
(
'onAfterLinkAdd'
,
function
(
id
,
item
)
{
that
.
calcCriticalPath
(
item
)
that
.
modifyLink
(
item
,
'ADD'
)
console
.
log
(
'onAfterLinkAdd'
,
id
,
item
)
ganttAss
.
render
(
)
})
// 删除连接后触发
ganttAss
.
attachEvent
(
'onAfterLinkDelete'
,
function
(
id
,
item
)
{
console
.
log
(
'onAfterLinkDelete'
,
id
,
item
)
var
target
=
ganttAss
.
getTask
(
item
.
target
)
that
.
calcCriticalPath
(
item
)
that
.
modifyLink
(
item
,
'REMOVE'
)
var
targetLength
=
target
.
$target
.
length
if
(
!
targetLength
)
{
...
...
@@ -637,5 +720,15 @@ export default {
.gatt
{
height
:
calc
(
100%
-
40px
);
}
.critical_path
{
.gantt_line_wrapper
{
div
{
background-color
:
#e63030
;
}
}
.gantt_link_arrow_right
{
border-left-color
:
#e63030
;
}
}
}
</
style
>
applications/dee-mes/src/privateComponents/components/MBOMConfig/view.vue
View file @
8ba6f51c
...
...
@@ -440,15 +440,15 @@ export default {
.gatt
{
height
:
calc
(
100%
-
40px
);
}
.gantt_critical_task
{
background
:
#f39c4f
;
border
:
1px
solid
#f39c4f
;
}
.gantt_task_line
{
&
.workday_over
{
background
:
#f39c4f
;
border
:
1px
solid
#f39c4f
;
.critical_path
{
.gantt_line_wrapper
{
div
{
background-color
:
#e63030
;
}
}
.gantt_link_arrow_right
{
border-left-color
:
#e63030
;
}
}
}
</
style
>
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