|
|
@@ -8,7 +8,16 @@ import { Clipboard } from '@antv/x6-plugin-clipboard'
|
|
|
import { History } from '@antv/x6-plugin-history'
|
|
|
import { Export } from '@antv/x6-plugin-export'
|
|
|
import { MiniMap } from '@antv/x6-plugin-minimap'
|
|
|
-import { getImg } from '../../../../libs/base/x6-utils'
|
|
|
+import climbKiln from '@/assets/icons/climbKiln.png'
|
|
|
+import finishCheck from '@/assets/icons/finishCheck.png'
|
|
|
+import halfCheck from '@/assets/icons/halfCheck.png'
|
|
|
+import inKiln from '@/assets/icons/inKiln.png'
|
|
|
+import outKiln from '@/assets/icons/outKiln.png'
|
|
|
+import recover from '@/assets/icons/recover.png'
|
|
|
+import register from '@/assets/icons/register.png'
|
|
|
+import shaping from '@/assets/icons/shaping.png'
|
|
|
+import uninstallKiln from '@/assets/icons/uninstallKiln.png'
|
|
|
+import dklogo from '@/assets/images/dklogo.png'
|
|
|
import router from '@/router'
|
|
|
import config from '@/config'
|
|
|
import { mapState, mapMutations } from 'vuex'
|
|
|
@@ -52,7 +61,7 @@ export default class Process {
|
|
|
autoResize: showGraph,//自动设置宽高
|
|
|
panning: {//开启拖拽画布
|
|
|
enabled: true,
|
|
|
- eventTypes: 'rightMouseDown',//触发画布平移的交互方式为“右键按下”
|
|
|
+ eventTypes: ['rightMouseDown'],//触发画布平移的交互方式为“右键按下”
|
|
|
},
|
|
|
grid: {//设置网格
|
|
|
size: 10,
|
|
|
@@ -82,10 +91,10 @@ export default class Process {
|
|
|
line: {
|
|
|
stroke: '#A2B1C3',
|
|
|
strokeWidth: 3,
|
|
|
- strokeDasharray: 5,
|
|
|
- style: {
|
|
|
- animation: 'ant-line 30s infinite linear',
|
|
|
- },
|
|
|
+ strokeDasharray: 6,
|
|
|
+ // style: {
|
|
|
+ // animation: 'ant-line 30s infinite linear',
|
|
|
+ // },
|
|
|
},
|
|
|
router: {
|
|
|
name: 'metro',
|
|
|
@@ -112,9 +121,9 @@ export default class Process {
|
|
|
stroke: '#A2B1C3',
|
|
|
strokeWidth: 3,
|
|
|
strokeDasharray: 6,
|
|
|
- style: {
|
|
|
- animation: 'ant-line 30s infinite linear',
|
|
|
- },
|
|
|
+ // style: {
|
|
|
+ // animation: 'ant-line 30s infinite linear',
|
|
|
+ // },
|
|
|
},
|
|
|
},
|
|
|
zIndex: 0,
|
|
|
@@ -220,8 +229,9 @@ export default class Process {
|
|
|
.use(new Selection({//多选
|
|
|
enabled: true,
|
|
|
multiple: true,//是否启用点击多选,启用后按住 ctrl 或 command 键点击工序实现多选
|
|
|
- rubberband: true,//是否启用多选工序功能
|
|
|
- showNodeSelectionBox: true,//是否显示工序的选择框
|
|
|
+ rubberband: true,//是否启用框选工序功能
|
|
|
+ showNodeSelectionBox: true,//是否显示选择框
|
|
|
+ pointerEvents:'none',//事件向上冒泡
|
|
|
filter: (e) => {
|
|
|
return e.visible
|
|
|
}
|
|
|
@@ -445,23 +455,42 @@ export default class Process {
|
|
|
// endregion
|
|
|
|
|
|
// region 鼠标移入移出 连接桩显示/隐藏
|
|
|
- this.graph.on('node:mouseenter', ({ view} ) => {
|
|
|
+ this.graph.on('node:mouseenter', ({ node} ) => {
|
|
|
+ //取消动画
|
|
|
+ let allEdges=this.graph.getEdges()
|
|
|
+ allEdges?.forEach((edge) => {
|
|
|
+ edge.attr('line/style/animation', '')
|
|
|
+ })
|
|
|
+ //设置动画
|
|
|
+ let edges = this.graph.getOutgoingEdges(node)
|
|
|
+ edges?.forEach((edge) => {
|
|
|
+ edge.attr('line/style/animation', 'ant-line 30s infinite linear')
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
|
|
|
this.graph.on('node:mouseleave', ({ view} ) => {
|
|
|
+ console.log('node:mouseleave')
|
|
|
+ //取消动画
|
|
|
+ let allEdges=this.graph.getEdges()
|
|
|
+ allEdges?.forEach((edge) => {
|
|
|
+ edge.attr('line/style/animation', '')
|
|
|
+ })
|
|
|
})
|
|
|
+
|
|
|
this.graph.on('node:click', ({ node} ) => {
|
|
|
- console.log('click')
|
|
|
+ console.log('node:click')
|
|
|
// this.graph.clearTransformWidgets()
|
|
|
})
|
|
|
+
|
|
|
// 监听节点选中
|
|
|
this.graph.on('node:selected', ({ node} ) => {
|
|
|
- console.log('selected')
|
|
|
+ console.log('node:selected')
|
|
|
this.showPorts(this.graph.findViewByCell(node.id),true)
|
|
|
})
|
|
|
this.graph.on('node:unselected', ({ node} ) => {
|
|
|
this.showPorts(this.graph.findViewByCell(node.id),false)
|
|
|
+
|
|
|
})
|
|
|
// endregion
|
|
|
|
|
|
@@ -475,17 +504,11 @@ export default class Process {
|
|
|
})
|
|
|
// endregion
|
|
|
|
|
|
+
|
|
|
// region 双击工序进入编辑模式
|
|
|
this.graph.on('node:dblclick', ({ node, e }) => {
|
|
|
- //如果是工序组 进入编辑模式
|
|
|
- if (node.data?.parent) {
|
|
|
- node.addTools({
|
|
|
- name: 'node-editor',
|
|
|
- args: {
|
|
|
- event: e,
|
|
|
- },
|
|
|
- })
|
|
|
- } else {
|
|
|
+ //如果双击的不是工序组,显示弹窗
|
|
|
+ if (!node.data?.parent) {
|
|
|
//设置值
|
|
|
store.commit('setCurrentNodeId', node.id)
|
|
|
//显示弹窗
|
|
|
@@ -879,7 +902,7 @@ export default class Process {
|
|
|
left.className = 'custom-html-left'
|
|
|
right.className = 'custom-html-right'
|
|
|
let img = document.createElement('img')
|
|
|
- img.src = cell.getData().image
|
|
|
+ img.src = self.getCellImg(cell)
|
|
|
img.width = 32
|
|
|
img.height = 32
|
|
|
let title = document.createElement('div')
|
|
|
@@ -887,7 +910,7 @@ export default class Process {
|
|
|
title.className = 'custom-html-right-title'
|
|
|
text.className = 'custom-html-right-text'
|
|
|
title.innerHTML = cell.getData().nodeName
|
|
|
- text.innerHTML = cell.getData().nodeKindName
|
|
|
+ text.innerHTML = nodeKindList.find(it => it.kindCode == cell.getData().nodeKind)?.kindName
|
|
|
left.appendChild(img)
|
|
|
right.appendChild(title)
|
|
|
right.appendChild(text)
|
|
|
@@ -929,7 +952,6 @@ export default class Process {
|
|
|
const countImages = [
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.register)?.gradeKindDesc,
|
|
|
- image: getImg('登记.png'),
|
|
|
nodeKind: config.nodeKind.register,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.register)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -942,7 +964,6 @@ export default class Process {
|
|
|
},
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.climbKiln)?.gradeKindDesc,
|
|
|
- image: getImg('装卸.png'),
|
|
|
nodeKind: config.nodeKind.climbKiln,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.climbKiln)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -955,7 +976,6 @@ export default class Process {
|
|
|
},
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.inKiln)?.gradeKindDesc,
|
|
|
- image: getImg('火炉.png'),
|
|
|
nodeKind: config.nodeKind.inKiln,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.inKiln)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -968,7 +988,6 @@ export default class Process {
|
|
|
},
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.outKiln)?.gradeKindDesc,
|
|
|
- image: getImg('火炉1.png'),
|
|
|
nodeKind: config.nodeKind.outKiln,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.outKiln)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -981,7 +1000,6 @@ export default class Process {
|
|
|
},
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.uninstallKiln)?.gradeKindDesc,
|
|
|
- image: getImg('装卸1.png'),
|
|
|
nodeKind: config.nodeKind.uninstallKiln,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.uninstallKiln)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -1000,7 +1018,6 @@ export default class Process {
|
|
|
data: {
|
|
|
nodeName: item.label,
|
|
|
nodeKind: item.nodeKind,
|
|
|
- image: item.image,
|
|
|
nodeKindName: item.nodeKindName,
|
|
|
flgJobDefect: item.flgJobDefect,
|
|
|
flowKind: item.flowKind,
|
|
|
@@ -1018,7 +1035,6 @@ export default class Process {
|
|
|
const testImages = [
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.halfCheck)?.gradeKindDesc,
|
|
|
- image: getImg('检查.png'),
|
|
|
nodeKind: config.nodeKind.halfCheck,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.halfCheck)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -1031,7 +1047,6 @@ export default class Process {
|
|
|
},
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.finishCheck)?.gradeKindDesc,
|
|
|
- image: getImg('检查.png'),
|
|
|
nodeKind: config.nodeKind.finishCheck,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.finishCheck)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -1050,7 +1065,6 @@ export default class Process {
|
|
|
data: {
|
|
|
nodeName: item.label,
|
|
|
nodeKind: item.nodeKind,
|
|
|
- image: item.image,
|
|
|
nodeKindName: item.nodeKindName,
|
|
|
flgJobDefect: item.flgJobDefect,
|
|
|
flowKind: item.flowKind,
|
|
|
@@ -1068,7 +1082,6 @@ export default class Process {
|
|
|
const specialImages = [
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.recover)?.gradeKindDesc,
|
|
|
- image: getImg('回收.png'),
|
|
|
nodeKind: config.nodeKind.recover,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.recover)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -1082,7 +1095,6 @@ export default class Process {
|
|
|
},
|
|
|
{
|
|
|
label: nodeKindList.find(it => it.kindCode == config.nodeKind.shaping)?.gradeKindDesc,
|
|
|
- image: getImg('马桶.png'),
|
|
|
nodeKind: config.nodeKind.shaping,
|
|
|
nodeKindName: nodeKindList.find(it => it.kindCode == config.nodeKind.shaping)?.kindName,
|
|
|
flgJobDefect: true,
|
|
|
@@ -1101,7 +1113,6 @@ export default class Process {
|
|
|
data: {
|
|
|
nodeName: item.label,
|
|
|
nodeKind: item.nodeKind,
|
|
|
- image: item.image,
|
|
|
nodeKindName: item.nodeKindName,
|
|
|
flgJobDefect: item.flgJobDefect,
|
|
|
flowKind: item.flowKind,
|
|
|
@@ -1129,11 +1140,11 @@ export default class Process {
|
|
|
this.graph.on('view:mounted', ({ view }) => {
|
|
|
if(view.cell.shape==='custom-image'){
|
|
|
view.container.addEventListener("mouseenter",function () {
|
|
|
- console.log('mouseenter')
|
|
|
+ // console.log('mouseenter')
|
|
|
self.showPorts(view, true)
|
|
|
},false)
|
|
|
view.container.addEventListener("mouseleave",function () {
|
|
|
- console.log('mouseleave')
|
|
|
+ // console.log('mouseleave')
|
|
|
if(!self.graph.isSelected(view.cell)){
|
|
|
self.showPorts(view, false)
|
|
|
}
|
|
|
@@ -1169,4 +1180,22 @@ export default class Process {
|
|
|
}
|
|
|
|
|
|
// endregion
|
|
|
+ static imgList={
|
|
|
+ 'climbKiln':climbKiln,
|
|
|
+ 'finishCheck':finishCheck,
|
|
|
+ 'halfCheck':halfCheck,
|
|
|
+ 'inKiln':inKiln,
|
|
|
+ 'outKiln':outKiln,
|
|
|
+ 'recover':recover,
|
|
|
+ 'register':register,
|
|
|
+ 'shaping':shaping,
|
|
|
+ 'uninstallKiln':uninstallKiln,
|
|
|
+ }
|
|
|
+
|
|
|
+ static getCellImg(cell) {
|
|
|
+ let nodeKindValue=cell.getData().nodeKind
|
|
|
+ let nodeKindKey=Object.keys(config.nodeKind).find(key => config.nodeKind[key] === nodeKindValue);
|
|
|
+ // console.log('1',self.imgList[nodeKindKey])
|
|
|
+ return this.imgList[nodeKindKey]
|
|
|
+ }
|
|
|
}
|