|
|
@@ -77,7 +77,7 @@ export default {
|
|
|
mounted() {
|
|
|
//创建流程图对象
|
|
|
this.graph = Process.init(this.$refs.container)
|
|
|
-
|
|
|
+ this.bindDeleteNodes()
|
|
|
// this.graph.zoomToFit({ maxScale: 1 });// 将画布中元素缩小或者放大一定级别,让画布正好容纳所有元素,可以通过 maxScale 配置最大缩放级别
|
|
|
// this.graph.centerContent(); // 将画布中元素居中展示
|
|
|
},
|
|
|
@@ -174,6 +174,35 @@ export default {
|
|
|
if (invalidNodes.length > 0) return false
|
|
|
return true
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 删除节点特殊控制,如果是成型模型,且被成型线绑定了,则不能删除
|
|
|
+ * @author : 张潇木
|
|
|
+ * @date : 2023/3/29 13:26
|
|
|
+ */
|
|
|
+ bindDeleteNodes(){
|
|
|
+ this.graph.bindKey(['backspace','del'], () => {
|
|
|
+ const cells = this.graph.getSelectedCells()
|
|
|
+ if (cells.length) {
|
|
|
+ //取成型节点id
|
|
|
+ let shapingNodes=cells.filter(it=>it.getData()?.nodeKind === this.$config.nodeKind.shaping).map(it=> {return it.getData()?.nodeId})
|
|
|
+ console.log('shapingNodes',shapingNodes)
|
|
|
+ if(shapingNodes.length){
|
|
|
+ //查询是否存在绑定的成型线
|
|
|
+ this.excute(this.$service.processService, this.$service.processService.getBindMolding, shapingNodes).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE&&res.data.length) {
|
|
|
+ this.$Message.error('无法删除已被成型线绑定的节点')
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.graph.removeCells(cells)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.graph.removeCells(cells)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 查询明细
|
|
|
* @author : 张潇木
|