|
@@ -205,8 +205,8 @@ export default class Process {
|
|
|
.use(new Transform({//图形变换
|
|
.use(new Transform({//图形变换
|
|
|
resizing: {
|
|
resizing: {
|
|
|
enabled:true,
|
|
enabled:true,
|
|
|
- minWidth:64,
|
|
|
|
|
- minHeight:64,
|
|
|
|
|
|
|
+ minWidth:130,
|
|
|
|
|
+ minHeight:60,
|
|
|
},
|
|
},
|
|
|
rotating: true,
|
|
rotating: true,
|
|
|
}))
|
|
}))
|
|
@@ -241,55 +241,48 @@ export default class Process {
|
|
|
const stencil = new Stencil({
|
|
const stencil = new Stencil({
|
|
|
title: '工艺模型',
|
|
title: '工艺模型',
|
|
|
target: this.graph,
|
|
target: this.graph,
|
|
|
- stencilGraphWidth: 200,
|
|
|
|
|
- stencilGraphHeight: 180,
|
|
|
|
|
|
|
+ stencilGraphWidth: 180,
|
|
|
|
|
+ stencilGraphHeight: 800,
|
|
|
collapsable: true,
|
|
collapsable: true,
|
|
|
|
|
+ layoutOptions: {
|
|
|
|
|
+ columns: 1,
|
|
|
|
|
+ dx: 45,
|
|
|
|
|
+ rowHeight:70,
|
|
|
|
|
+ dy: 0,
|
|
|
|
|
+ },
|
|
|
|
|
+ placeholder:'搜索...',
|
|
|
|
|
+ notFoundText:'未搜索到结果',
|
|
|
groups: [
|
|
groups: [
|
|
|
{
|
|
{
|
|
|
title: '节点组',
|
|
title: '节点组',
|
|
|
name: 'group',
|
|
name: 'group',
|
|
|
- graphHeight: 80,
|
|
|
|
|
|
|
+ graphHeight: 60,
|
|
|
layoutOptions: {
|
|
layoutOptions: {
|
|
|
- columns: 1,
|
|
|
|
|
- marginX: 35,
|
|
|
|
|
|
|
+ dy: -5,
|
|
|
},
|
|
},
|
|
|
|
|
+ collapsed:true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '计件模型',
|
|
title: '计件模型',
|
|
|
name: 'count',
|
|
name: 'count',
|
|
|
- graphHeight: 260,
|
|
|
|
|
- layoutOptions: {
|
|
|
|
|
- rowHeight: 80,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ graphHeight: 350,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '检验模型',
|
|
title: '检验模型',
|
|
|
name: 'test',
|
|
name: 'test',
|
|
|
- graphHeight: 100,
|
|
|
|
|
- layoutOptions: {
|
|
|
|
|
- rowHeight: 80,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ graphHeight: 140,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '特殊模型',
|
|
title: '特殊模型',
|
|
|
name: 'special',
|
|
name: 'special',
|
|
|
- graphHeight: 100,
|
|
|
|
|
- layoutOptions: {
|
|
|
|
|
- rowHeight: 80,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ graphHeight: 140,
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- layoutOptions: {
|
|
|
|
|
- columns: 2,
|
|
|
|
|
- columnWidth: 80,
|
|
|
|
|
- rowHeight: 55,
|
|
|
|
|
- },
|
|
|
|
|
- placeholder:'搜索...',
|
|
|
|
|
- notFoundText:'未搜索到结果',
|
|
|
|
|
|
|
+
|
|
|
//搜索方法
|
|
//搜索方法
|
|
|
search: (cell, keyword, groupName, stencil) => {
|
|
search: (cell, keyword, groupName, stencil) => {
|
|
|
if (keyword) {
|
|
if (keyword) {
|
|
|
- return cell.attr("text/text").includes(keyword);
|
|
|
|
|
|
|
+ return cell.getData()?.nodeName?.includes(keyword);
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
},
|
|
},
|
|
@@ -702,9 +695,7 @@ export default class Process {
|
|
|
//节点
|
|
//节点
|
|
|
if(cell.shape=='custom-image'){
|
|
if(cell.shape=='custom-image'){
|
|
|
//添加节点设置业务数据id
|
|
//添加节点设置业务数据id
|
|
|
- cell.setData({'nodeId':cell.id,'ftyId': store.state.user.ftyId,'flowId':parseInt(router.app._route.params.id)})
|
|
|
|
|
- //设置初始未校验样式
|
|
|
|
|
- cell.setAttrs({body: {stroke: 'red',}})
|
|
|
|
|
|
|
+ cell.setData({'nodeId':cell.id,'ftyId': store.state.user.ftyId,'flowId':parseInt(router.app._route.params.id),"isValid":false})
|
|
|
}
|
|
}
|
|
|
//连接线
|
|
//连接线
|
|
|
if(cell.shape=='edge'){
|
|
if(cell.shape=='edge'){
|
|
@@ -798,132 +789,97 @@ export default class Process {
|
|
|
// endregion
|
|
// endregion
|
|
|
|
|
|
|
|
// region 注册自定义节点
|
|
// region 注册自定义节点
|
|
|
- Graph.registerNode(
|
|
|
|
|
- 'custom-rect',
|
|
|
|
|
- {
|
|
|
|
|
- inherit: 'rect',
|
|
|
|
|
- width: 66,
|
|
|
|
|
- height: 36,
|
|
|
|
|
- attrs: {
|
|
|
|
|
- body: {
|
|
|
|
|
- strokeWidth: 1,
|
|
|
|
|
- stroke: '#5F95FF',
|
|
|
|
|
- fill: '#EFF4FF',
|
|
|
|
|
- },
|
|
|
|
|
- text: {
|
|
|
|
|
- fontSize: 12,
|
|
|
|
|
- fill: '#262626',
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- ports: { ...ports },
|
|
|
|
|
- },
|
|
|
|
|
- true,
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- Graph.registerNode(
|
|
|
|
|
- 'custom-polygon',
|
|
|
|
|
- {
|
|
|
|
|
- inherit: 'polygon',
|
|
|
|
|
- width: 66,
|
|
|
|
|
- height: 36,
|
|
|
|
|
- attrs: {
|
|
|
|
|
- body: {
|
|
|
|
|
- strokeWidth: 1,
|
|
|
|
|
- stroke: '#5F95FF',
|
|
|
|
|
- fill: '#EFF4FF',
|
|
|
|
|
- },
|
|
|
|
|
- text: {
|
|
|
|
|
- fontSize: 12,
|
|
|
|
|
- fill: '#262626',
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- ports: {
|
|
|
|
|
- ...ports,
|
|
|
|
|
- items: [
|
|
|
|
|
- {
|
|
|
|
|
- group: 'top',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- group: 'bottom',
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- true,
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- Graph.registerNode(
|
|
|
|
|
- 'custom-circle',
|
|
|
|
|
- {
|
|
|
|
|
- inherit: 'circle',
|
|
|
|
|
- width: 45,
|
|
|
|
|
- height: 45,
|
|
|
|
|
- attrs: {
|
|
|
|
|
- body: {
|
|
|
|
|
- strokeWidth: 1,
|
|
|
|
|
- stroke: '#5F95FF',
|
|
|
|
|
- fill: '#EFF4FF',
|
|
|
|
|
- },
|
|
|
|
|
- text: {
|
|
|
|
|
- fontSize: 12,
|
|
|
|
|
- fill: '#262626',
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- ports: { ...ports },
|
|
|
|
|
- },
|
|
|
|
|
- true,
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- Graph.registerNode(
|
|
|
|
|
- 'custom-image',
|
|
|
|
|
- {
|
|
|
|
|
- inherit: 'rect',
|
|
|
|
|
- width: 64,
|
|
|
|
|
- height: 64,
|
|
|
|
|
- markup: [
|
|
|
|
|
- {
|
|
|
|
|
- tagName: 'rect',
|
|
|
|
|
- selector: 'body',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- tagName: 'image',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- tagName: 'text',
|
|
|
|
|
- selector: 'label',
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- attrs: {
|
|
|
|
|
- body: {
|
|
|
|
|
- stroke: '#5F95FF',
|
|
|
|
|
- strokeWidth: 1,
|
|
|
|
|
- fill: '#FFFFFF',
|
|
|
|
|
- },
|
|
|
|
|
- image: {
|
|
|
|
|
- width: 32,
|
|
|
|
|
- height: 32,
|
|
|
|
|
- refX: 22,
|
|
|
|
|
- refY: 22,
|
|
|
|
|
- },
|
|
|
|
|
- label: {
|
|
|
|
|
- refX:6,
|
|
|
|
|
- refY:6,
|
|
|
|
|
- textAnchor: 'left',
|
|
|
|
|
- textVerticalAnchor: 'top',
|
|
|
|
|
- fontSize: 12,
|
|
|
|
|
- fill: 'black',
|
|
|
|
|
- textWrap:{
|
|
|
|
|
- height: '50%', // 高度为参照元素高度的一半
|
|
|
|
|
- ellipsis: true, // 文本超出显示范围时,自动添加省略号
|
|
|
|
|
- breakWord: true, // 是否截断单词
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- ports: { ...ports },
|
|
|
|
|
- },
|
|
|
|
|
- true,
|
|
|
|
|
- )
|
|
|
|
|
|
|
|
|
|
|
|
+ // region 原节点
|
|
|
|
|
+ // Graph.registerNode(
|
|
|
|
|
+ // 'custom-image',
|
|
|
|
|
+ // {
|
|
|
|
|
+ // inherit: 'rect',
|
|
|
|
|
+ // width: 64,
|
|
|
|
|
+ // height: 64,
|
|
|
|
|
+ // markup: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // tagName: 'rect',
|
|
|
|
|
+ // selector: 'body',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // tagName: 'image',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // tagName: 'text',
|
|
|
|
|
+ // selector: 'label',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ],
|
|
|
|
|
+ // attrs: {
|
|
|
|
|
+ // body: {
|
|
|
|
|
+ // stroke: '#5F95FF',
|
|
|
|
|
+ // strokeWidth: 1,
|
|
|
|
|
+ // fill: '#FFFFFF',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // image: {
|
|
|
|
|
+ // width: 32,
|
|
|
|
|
+ // height: 32,
|
|
|
|
|
+ // refX: 22,
|
|
|
|
|
+ // refY: 22,
|
|
|
|
|
+ // },
|
|
|
|
|
+ // label: {
|
|
|
|
|
+ // refX:6,
|
|
|
|
|
+ // refY:6,
|
|
|
|
|
+ // textAnchor: 'left',
|
|
|
|
|
+ // textVerticalAnchor: 'top',
|
|
|
|
|
+ // fontSize: 12,
|
|
|
|
|
+ // fill: 'black',
|
|
|
|
|
+ // textWrap:{
|
|
|
|
|
+ // height: '50%', // 高度为参照元素高度的一半
|
|
|
|
|
+ // ellipsis: true, // 文本超出显示范围时,自动添加省略号
|
|
|
|
|
+ // breakWord: true, // 是否截断单词
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ports: { ...ports },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // true,
|
|
|
|
|
+ // )
|
|
|
|
|
+ // endregion
|
|
|
|
|
+
|
|
|
|
|
+ // region 新UI节点
|
|
|
|
|
+ Shape.HTML.register({
|
|
|
|
|
+ shape: "custom-image",
|
|
|
|
|
+ width: 130,
|
|
|
|
|
+ height: 60,
|
|
|
|
|
+ html(cell) {
|
|
|
|
|
+ let div = document.createElement("div");
|
|
|
|
|
+ let left = document.createElement("div");
|
|
|
|
|
+ let right = document.createElement("div");
|
|
|
|
|
+ div.className = "custom-html";
|
|
|
|
|
+ left.className = "custom-html-left";
|
|
|
|
|
+ right.className = "custom-html-right";
|
|
|
|
|
+ let img=document.createElement("img")
|
|
|
|
|
+ img.src=cell.getData().image
|
|
|
|
|
+ img.width=32
|
|
|
|
|
+ img.height=32
|
|
|
|
|
+ let title = document.createElement("div");
|
|
|
|
|
+ let text = document.createElement("div");
|
|
|
|
|
+ title.className = "custom-html-right-title";
|
|
|
|
|
+ text.className = "custom-html-right-text";
|
|
|
|
|
+ title.innerHTML=cell.getData().nodeName
|
|
|
|
|
+ text.innerHTML=cell.getData().nodeKindName
|
|
|
|
|
+ left.appendChild(img)
|
|
|
|
|
+ right.appendChild(title)
|
|
|
|
|
+ right.appendChild(text)
|
|
|
|
|
+ div.appendChild(left)
|
|
|
|
|
+ div.appendChild(right)
|
|
|
|
|
+
|
|
|
|
|
+ if(cell.getData().isValid===false){
|
|
|
|
|
+ left.style.borderColor='#ed4014'
|
|
|
|
|
+ right.style.borderColor='#ed4014'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return div;
|
|
|
|
|
+ },
|
|
|
|
|
+ ports: { ...ports },
|
|
|
|
|
+ });
|
|
|
|
|
+ // endregion 新UI节点
|
|
|
|
|
|
|
|
// region 节点组
|
|
// region 节点组
|
|
|
const g1 = this.graph.createNode({
|
|
const g1 = this.graph.createNode({
|
|
@@ -950,42 +906,44 @@ export default class Process {
|
|
|
{
|
|
{
|
|
|
label: '计件',
|
|
label: '计件',
|
|
|
image:getImg('登记.png'),
|
|
image:getImg('登记.png'),
|
|
|
- nodeKind:'工艺节点-计件',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.register,
|
|
|
|
|
+ nodeKindName:config.nodeKind.registerName
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '登窑',
|
|
label: '登窑',
|
|
|
image:getImg('装卸.png'),
|
|
image:getImg('装卸.png'),
|
|
|
- nodeKind:'工艺节点-登窑',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.climbKiln,
|
|
|
|
|
+ nodeKindName:config.nodeKind.climbKilnName
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '入窑',
|
|
label: '入窑',
|
|
|
image:getImg('火炉.png'),
|
|
image:getImg('火炉.png'),
|
|
|
- nodeKind:'工艺节点-入窑',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.inKiln,
|
|
|
|
|
+ nodeKindName:config.nodeKind.inKilnName
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '出窑',
|
|
label: '出窑',
|
|
|
image:getImg('火炉.png'),
|
|
image:getImg('火炉.png'),
|
|
|
- nodeKind:'工艺节点-出窑',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.outKiln,
|
|
|
|
|
+ nodeKindName:config.nodeKind.outKilnName
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '卸窑',
|
|
label: '卸窑',
|
|
|
image:getImg('装卸.png'),
|
|
image:getImg('装卸.png'),
|
|
|
- nodeKind:'工艺节点-卸窑',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.uninstallKiln,
|
|
|
|
|
+ nodeKindName:config.nodeKind.uninstallKilnName
|
|
|
},
|
|
},
|
|
|
]
|
|
]
|
|
|
const countNodes = countImages.map((item) =>
|
|
const countNodes = countImages.map((item) =>
|
|
|
this.graph.createNode({
|
|
this.graph.createNode({
|
|
|
shape: 'custom-image',
|
|
shape: 'custom-image',
|
|
|
- label: item.label,
|
|
|
|
|
- attrs: { image: { 'xlink:href': item.image, }, },
|
|
|
|
|
|
|
+ // label: item.label,
|
|
|
data:{
|
|
data:{
|
|
|
nodeName:item.label,
|
|
nodeName:item.label,
|
|
|
nodeKind:item.nodeKind,
|
|
nodeKind:item.nodeKind,
|
|
|
- }
|
|
|
|
|
- // shape: 'image', //可选值:Rect Circle Ellipse Polygon Polyline Path Image HTML TextBlock BorderedImage EmbeddedImage InscribedImage Cylinder
|
|
|
|
|
- // imageUrl: item.image,
|
|
|
|
|
- // width: 52,
|
|
|
|
|
- // height: 52,
|
|
|
|
|
|
|
+ image:item.image,
|
|
|
|
|
+ nodeKindName:item.nodeKindName,
|
|
|
|
|
+ },
|
|
|
}),
|
|
}),
|
|
|
)
|
|
)
|
|
|
//endregion
|
|
//endregion
|
|
@@ -995,27 +953,26 @@ export default class Process {
|
|
|
{
|
|
{
|
|
|
label: '半检',
|
|
label: '半检',
|
|
|
image:getImg('检查.png'),
|
|
image:getImg('检查.png'),
|
|
|
- nodeKind:'工艺节点-半检',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.halfCheck,
|
|
|
|
|
+ nodeKindName:config.nodeKind.halfCheckName
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '成检',
|
|
label: '成检',
|
|
|
image:getImg('检查.png'),
|
|
image:getImg('检查.png'),
|
|
|
- nodeKind:'工艺节点-成检',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.finishCheck,
|
|
|
|
|
+ nodeKindName:config.nodeKind.finishCheckName
|
|
|
},
|
|
},
|
|
|
]
|
|
]
|
|
|
const testNodes = testImages.map((item) =>
|
|
const testNodes = testImages.map((item) =>
|
|
|
this.graph.createNode({
|
|
this.graph.createNode({
|
|
|
shape: 'custom-image',
|
|
shape: 'custom-image',
|
|
|
- label: item.label,
|
|
|
|
|
- attrs: { image: { 'xlink:href': item.image, }, },
|
|
|
|
|
|
|
+ // label: item.label,
|
|
|
data:{
|
|
data:{
|
|
|
nodeName:item.label,
|
|
nodeName:item.label,
|
|
|
nodeKind:item.nodeKind,
|
|
nodeKind:item.nodeKind,
|
|
|
- }
|
|
|
|
|
- // shape: 'image', //可选值:Rect Circle Ellipse Polygon Polyline Path Image HTML TextBlock BorderedImage EmbeddedImage InscribedImage Cylinder
|
|
|
|
|
- // imageUrl: item.image,
|
|
|
|
|
- // width: 52,
|
|
|
|
|
- // height: 52,
|
|
|
|
|
|
|
+ image:item.image,
|
|
|
|
|
+ nodeKindName:item.nodeKindName,
|
|
|
|
|
+ },
|
|
|
}),
|
|
}),
|
|
|
)
|
|
)
|
|
|
//endregion
|
|
//endregion
|
|
@@ -1025,31 +982,31 @@ export default class Process {
|
|
|
{
|
|
{
|
|
|
label: '回收',
|
|
label: '回收',
|
|
|
image:getImg('回收.png'),
|
|
image:getImg('回收.png'),
|
|
|
- nodeKind:'工艺节点-回收',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.recover,
|
|
|
|
|
+ nodeKindName:config.nodeKind.recoverName
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '成型',
|
|
label: '成型',
|
|
|
image:getImg('马桶.png'),
|
|
image:getImg('马桶.png'),
|
|
|
- nodeKind:'工艺节点-成型',
|
|
|
|
|
|
|
+ nodeKind:config.nodeKind.shaping,
|
|
|
|
|
+ nodeKindName:config.nodeKind.shapingName
|
|
|
},
|
|
},
|
|
|
]
|
|
]
|
|
|
const specialNodes = specialImages.map((item) =>
|
|
const specialNodes = specialImages.map((item) =>
|
|
|
this.graph.createNode({
|
|
this.graph.createNode({
|
|
|
shape: 'custom-image',
|
|
shape: 'custom-image',
|
|
|
- label: item.label,
|
|
|
|
|
- attrs: { image: { 'xlink:href': item.image, }, },
|
|
|
|
|
|
|
+ // label: item.label,
|
|
|
data:{
|
|
data:{
|
|
|
nodeName:item.label,
|
|
nodeName:item.label,
|
|
|
nodeKind:item.nodeKind,
|
|
nodeKind:item.nodeKind,
|
|
|
- }
|
|
|
|
|
- // shape: 'image', //可选值:Rect Circle Ellipse Polygon Polyline Path Image HTML TextBlock BorderedImage EmbeddedImage InscribedImage Cylinder
|
|
|
|
|
- // imageUrl: item.image,
|
|
|
|
|
- // width: 52,
|
|
|
|
|
- // height: 52,
|
|
|
|
|
|
|
+ image:item.image,
|
|
|
|
|
+ nodeKindName:item.nodeKindName,
|
|
|
|
|
+ },
|
|
|
}),
|
|
}),
|
|
|
)
|
|
)
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
+
|
|
|
//region 加载元素节点
|
|
//region 加载元素节点
|
|
|
stencil.load(countNodes, 'count')
|
|
stencil.load(countNodes, 'count')
|
|
|
stencil.load(testNodes, 'test')
|
|
stencil.load(testNodes, 'test')
|