Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IoTSharp
IoTSharp
提交
5e0aac3a
IoTSharp
项目概览
IoTSharp
/
IoTSharp
10 个月 前同步成功
通知
15
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5e0aac3a
编写于
7月 09, 2021
作者:
W
wq1234wq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加注释
上级
0b02ef34
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
68 addition
and
28 deletion
+68
-28
ClientApp/Vue/src/router/routes/modules/iotsharp.ts
ClientApp/Vue/src/router/routes/modules/iotsharp.ts
+2
-1
ClientApp/Vue/src/views/iotsharp/device/devicegraph.vue
ClientApp/Vue/src/views/iotsharp/device/devicegraph.vue
+66
-27
未找到文件。
ClientApp/Vue/src/router/routes/modules/iotsharp.ts
浏览文件 @
5e0aac3a
...
...
@@ -47,7 +47,8 @@ const iotsharp: AppRouteModule = {
name
:
'
devicegraph
'
,
component
:
()
=>
import
(
'
../../../views/iotsharp/device/devicegraph.vue
'
),
meta
:
{
title
:
t
(
'
routes.iotsharp.device
'
),
// title: t('routes.iotsharp.device'),
title
:
t
(
'
设计
'
),
icon
:
'
simple-icons:about-dot-me
'
,
},
},
...
...
ClientApp/Vue/src/views/iotsharp/device/devicegraph.vue
浏览文件 @
5e0aac3a
<
template
>
<div
class=
"x6-graph-wrap"
>
<div
ref=
"container"
class=
"x6-graph"
></div>
</div>
</
template
>
<
script
lang=
"ts"
>
//安装完X6但是报缺少MenuItem的错,是没有安装 @antv/x6-react-components,手动执行 yarn add @antv/x6-react-components,在angular这个不是必要的
import
{
Graph
,
Edge
,
Shape
,
NodeView
}
from
'
@antv/x6
'
;
import
{
defineComponent
,
ref
}
from
'
vue
'
;
// reactive
const
magnetAvailabilityHighlighter
=
{
...
...
@@ -23,18 +22,9 @@
setup
()
{
const
canUndo
=
ref
(
true
);
const
canRedo
=
ref
(
false
);
// eslint-disable-next-line
const
history
=
ref
(
undefined
as
any
);
const
graph
=
ref
(
Graph
);
const
init
:
(
any
)
=>
void
=
(
that
)
=>
{
// const graph = new Graph({
// container: that.$refs.container as HTMLDivElement,
// width: 800,
// height: 600,
// grid: true,
// history: true,
// });
that
.
graph
=
new
Graph
({
grid
:
true
,
container
:
that
.
$refs
.
container
as
HTMLDivElement
,
...
...
@@ -105,12 +95,67 @@
});
that
.
graph
.
addNode
(
new
Device
().
resize
(
120
,
40
).
position
(
200
,
50
).
updateInPorts
(
that
.
graph
)
new
Device
({
attrs
:
{
root
:
{
magnet
:
false
,
},
body
:
{
fill
:
'
#f5f5f5
'
,
stroke
:
'
#d9d9d9
'
,
strokeWidth
:
1
,
},
},
ports
:
{
items
:
[
{
group
:
'
out
'
,
},
],
groups
:
{
in
:
{
position
:
{
name
:
'
top
'
,
},
attrs
:
{
portBody
:
{
magnet
:
'
passive
'
,
r
:
6
,
stroke
:
'
#ffa940
'
,
fill
:
'
#fff
'
,
strokeWidth
:
2
,
},
},
},
out
:
{
position
:
{
name
:
'
bottom
'
,
},
attrs
:
{
portBody
:
{
magnet
:
true
,
r
:
6
,
fill
:
'
#fff
'
,
stroke
:
'
#3199FF
'
,
strokeWidth
:
2
,
},
},
},
},
},
portMarkup
:
[
{
tagName
:
'
circle
'
,
selector
:
'
portBody
'
,
},
],
})
.
resize
(
120
,
40
)
.
position
(
200
,
50
)
.
updateInPorts
(
that
.
graph
)
);
that
.
graph
.
addNode
(
new
Device
().
resize
(
120
,
40
).
position
(
400
,
50
).
updateInPorts
(
that
.
graph
)
);
that
.
graph
.
addNode
(
new
Device
().
resize
(
120
,
40
).
position
(
0
,
0
).
updateInPorts
(
that
.
graph
));
that
.
graph
.
addNode
(
new
GateWay
().
resize
(
120
,
40
).
position
(
300
,
250
).
updateInPorts
(
that
.
graph
)
...
...
@@ -174,24 +219,16 @@
highlighter
:
magnetAvailabilityHighlighter
,
});
});
console
.
log
(
graph
);
cell
.
updateInPorts
(
graph
.
value
);
cell
.
updateInPorts
(
graph
);
}
};
const
onUndo
:
()
=>
void
=
()
=>
{
history
.
value
.
undo
();
};
const
onRedo
:
()
=>
void
=
()
=>
{
history
.
value
.
redo
();
};
return
{
canUndo
,
canRedo
,
history
,
init
,
onUndo
,
onRedo
,
update
,
graph
,
};
...
...
@@ -205,7 +242,7 @@
},
});
class
Device
extends
Shape
.
Rect
{
class
Device
extends
Shape
.
Circle
{
getInPorts
()
{
return
this
.
getPortsByGroup
(
'
in
'
);
}
...
...
@@ -254,6 +291,8 @@
return
this
;
}
}
//只是demo,实际上是这个JSON结构应该从后端传过来,然后在Device的构造方法中传入,参看左上角第一个设备
Device
.
config
({
attrs
:
{
root
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录