|
@@ -304,7 +304,7 @@
|
|
|
|
|
|
// Remove all tools when the mouse leaving
|
|
// Remove all tools when the mouse leaving
|
|
this.graph.on('node:mouseleave', ({ node }) => {
|
|
this.graph.on('node:mouseleave', ({ node }) => {
|
|
- node.removeTools()
|
|
|
|
|
|
+ node.removeTool('button')
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
@@ -372,6 +372,17 @@
|
|
node.setData({ taskName: name })
|
|
node.setData({ taskName: name })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ setNodeForbiddenStatus (id, flag) {
|
|
|
|
+ id += ''
|
|
|
|
+ const node = this.graph.getCellById(id)
|
|
|
|
+ if (node) {
|
|
|
|
+ if (flag) {
|
|
|
|
+ node.attr('rect/fill', '#c4c4c4')
|
|
|
|
+ } else {
|
|
|
|
+ node.attr('rect/fill', '#ffffff')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* Convert the graph to JSON
|
|
* Convert the graph to JSON
|
|
* @return {{cells:Cell[]}}
|
|
* @return {{cells:Cell[]}}
|
|
@@ -529,20 +540,22 @@
|
|
console.warn(`taskType:${taskType} is invalid!`)
|
|
console.warn(`taskType:${taskType} is invalid!`)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- const node = this.genNodeJSON(id, taskType, '', coordinate)
|
|
|
|
|
|
+ const node = this.genNodeJSON(id, taskType, '', false, coordinate)
|
|
this.graph.addNode(node)
|
|
this.graph.addNode(node)
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* generate node json
|
|
* generate node json
|
|
* @param {number|string} id
|
|
* @param {number|string} id
|
|
* @param {string} taskType
|
|
* @param {string} taskType
|
|
|
|
+ * @param {boolean} forbidden flag
|
|
* @param {{x:number;y:number}} coordinate Default is { x: 100, y: 100 }
|
|
* @param {{x:number;y:number}} coordinate Default is { x: 100, y: 100 }
|
|
*/
|
|
*/
|
|
- genNodeJSON (id, taskType, taskName, coordinate = { x: 100, y: 100 }) {
|
|
|
|
|
|
+ genNodeJSON (id, taskType, taskName, flag, coordinate = { x: 100, y: 100 }) {
|
|
id += ''
|
|
id += ''
|
|
const url = require(`../images/task-icos/${taskType.toLocaleLowerCase()}.png`)
|
|
const url = require(`../images/task-icos/${taskType.toLocaleLowerCase()}.png`)
|
|
const truncation = taskName ? this.truncateText(taskName, 18) : id
|
|
const truncation = taskName ? this.truncateText(taskName, 18) : id
|
|
- return {
|
|
|
|
|
|
+
|
|
|
|
+ const nodeJson = {
|
|
id: id,
|
|
id: id,
|
|
shape: X6_NODE_NAME,
|
|
shape: X6_NODE_NAME,
|
|
x: coordinate.x,
|
|
x: coordinate.x,
|
|
@@ -561,6 +574,12 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (flag) {
|
|
|
|
+ nodeJson.attrs.rect = { fill: '#c4c4c4' }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return nodeJson
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* generate edge json
|
|
* generate edge json
|