Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tinyu5
vue2-tools
提交
7d040942
V
vue2-tools
项目概览
Tinyu5
/
vue2-tools
与 Fork 源项目一致
Fork自
inscode / VueJS
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue2-tools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7d040942
编写于
3月 28, 2024
作者:
T
tinyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:调整配置
上级
23b43487
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
255 addition
and
188 deletion
+255
-188
src/components/ganttchart/useGantt.js
src/components/ganttchart/useGantt.js
+255
-188
未找到文件。
src/components/ganttchart/useGantt.js
浏览文件 @
7d040942
import
*
as
echarts
from
'
echarts
'
;
import
*
as
echarts
from
'
echarts
'
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
export
default
function
(){
const
baseOption
=
{
const
GraphType
=
Object
.
freeze
({
Rect
:
1
,
Img
:
2
,
})
/**
* 获取自定义渲染函数
* 内部设定高度映射 y[1-3] 2:表示竖向中间位置
*/
function
getRenderItem
(
yTick
)
{
return
function
(
params
,
api
)
{
const
data
=
{
start
:
api
.
value
(
0
),
end
:
api
.
value
(
1
)
}
const
status
=
api
.
value
(
2
)
const
[
start
,
pos_y
]
=
api
.
coord
([
data
.
start
,
yTick
])
const
[
end
]
=
api
.
coord
([
data
.
end
,
yTick
])
const
height
=
api
.
size
([
0
,
1
])[
1
]
*
0.15
const
rect
=
echarts
.
graphic
.
clipRectByRect
(
{
x
:
start
,
y
:
pos_y
-
height
/
2
,
width
:
end
-
start
,
height
:
height
},
{
x
:
params
.
coordSys
.
x
,
y
:
params
.
coordSys
.
y
,
width
:
params
.
coordSys
.
width
,
height
:
params
.
coordSys
.
height
}
)
const
childrenImageLine
=
[
{
type
:
'
rect
'
,
shape
:
rect
,
style
:
api
.
style
(),
emphasis
:
{
style
:
api
.
styleEmphasis
()
}
}
]
return
{
type
:
'
group
'
,
children
:
childrenImageLine
}
}
}
export
default
function
()
{
const
baseOption
=
{
backgroundColor
:
'
transparent
'
,
backgroundColor
:
'
transparent
'
,
color
:
[
'
#fc7778
'
,
'
#7481fd
'
,
'
#02d18f
'
,
'
#2cd0ff
'
,
'
#edcf02
'
,
'
#fe8a3d
'
],
color
:
[
'
#fc7778
'
,
'
#7481fd
'
,
'
#02d18f
'
,
'
#2cd0ff
'
,
'
#edcf02
'
,
'
#fe8a3d
'
],
grid
:
{
grid
:
{
...
@@ -112,8 +166,7 @@ export default function(){
...
@@ -112,8 +166,7 @@ export default function(){
fontSize
:
12
fontSize
:
12
},
},
formatter
:
val
=>
{
formatter
:
val
=>
{
return
`
${
return
`
${
typeof
val
.
value
[
2
]
===
'
string
'
?
val
.
value
[
2
]
:
val
.
seriesName
typeof
val
.
value
[
2
]
===
'
string
'
?
val
.
value
[
2
]
:
val
.
seriesName
}
${
moment
(
val
.
value
[
0
]).
format
(
'
MM-DD HH:mm
'
)}
~
${
moment
(
}
${
moment
(
val
.
value
[
0
]).
format
(
'
MM-DD HH:mm
'
)}
~
${
moment
(
val
.
value
[
1
]
val
.
value
[
1
]
).
format
(
'
MM-DD HH:mm
'
)}
`
).
format
(
'
MM-DD HH:mm
'
)}
`
...
@@ -144,52 +197,66 @@ export default function(){
...
@@ -144,52 +197,66 @@ export default function(){
shadowBlur
:
5
shadowBlur
:
5
}
}
},
},
renderItem
:
(
params
,
api
)
=>
{
renderItem
:
getRenderItem
(
2
),
const
data
=
{
data
:
[
start
:
api
.
value
(
0
),
end
:
api
.
value
(
1
)
}
const
status
=
api
.
value
(
2
)
const
[
start
,
pos_y
]
=
api
.
coord
([
data
.
start
,
2
])
const
[
end
]
=
api
.
coord
([
data
.
end
,
2
])
const
height
=
api
.
size
([
0
,
1
])[
1
]
*
0.15
const
rect
=
echarts
.
graphic
.
clipRectByRect
(
{
{
x
:
start
,
value
:
[
'
2020-03-01 12:00:00
'
,
'
2020-03-03 00:00:00
'
]
y
:
pos_y
-
height
/
2
,
},
width
:
end
-
start
,
[
'
2020-03-03 01:00:00
'
,
'
2020-03-14 00:00:00
'
],
height
:
height
[
'
2020-03-14 08:03:00
'
,
'
2020-03-14 08:13:00
'
],
[
'
2020-03-15 02:00:00
'
,
'
2020-04-01 00:00:00
'
]
]
},
},
{
{
x
:
params
.
coordSys
.
x
,
name
:
'
测试2
'
,
y
:
params
.
coordSys
.
y
,
type
:
'
custom
'
,
width
:
params
.
coordSys
.
width
,
colorBy
:
'
data
'
,
height
:
params
.
coordSys
.
height
encode
:
{
}
x
:
[
0
,
1
],
)
y
:
1
const
childrenImageLine
=
[
},
{
itemStyle
:
{
type
:
'
rect
'
,
shape
:
rect
,
style
:
api
.
style
(),
emphasis
:
{
emphasis
:
{
style
:
api
.
styleEmphasis
()
borderColor
:
'
rgba(192, 249, 254, 0.85)
'
,
}
borderType
:
'
solid
'
,
borderWidth
:
1
,
shadowColor
:
'
rgba(192, 249, 254, 0.85)
'
,
shadowOffsetY
:
1
,
shadowOffsetX
:
-
1
,
shadowBlur
:
5
}
}
},
renderItem
:
getRenderItem
(
1.75
),
data
:
[
{
value
:
[
'
2020-02-29 12:00:00
'
,
'
2020-03-02 00:00:00
'
]
},
]
]
return
{
},
type
:
'
group
'
,
{
children
:
childrenImageLine
name
:
'
测试3
'
,
type
:
'
custom
'
,
colorBy
:
'
data
'
,
encode
:
{
x
:
[
0
,
1
],
y
:
1
},
itemStyle
:
{
emphasis
:
{
borderColor
:
'
rgba(192, 249, 254, 0.85)
'
,
borderType
:
'
solid
'
,
borderWidth
:
1
,
shadowColor
:
'
rgba(192, 249, 254, 0.85)
'
,
shadowOffsetY
:
1
,
shadowOffsetX
:
-
1
,
shadowBlur
:
5
}
}
},
},
renderItem
:
getRenderItem
(
2.25
),
data
:
[
data
:
[
{
{
value
:
[
'
2020-03-01 12:00:00
'
,
'
2020-03-03 0
0:00:00
'
]
value
:
[
'
2020-03-02 08:00:00
'
,
'
2020-03-03 2
0:00:00
'
]
},
},
[
'
2020-03-03 01:00:00
'
,
'
2020-03-14 00:00:00
'
],
[
'
2020-03-14 08:03:00
'
,
'
2020-03-14 08:13:00
'
],
[
'
2020-03-15 02:00:00
'
,
'
2020-04-01 00:00:00
'
]
]
]
},
},
]
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录