sh4wmoo il y a 3 ans
Parent
commit
a68c858d37

+ 2 - 0
src/api/pages/mst/process.js

@@ -8,6 +8,8 @@ export default {
     prefix: 'mdm-server/mst/process_flow/',
     //流程设置
     processSetting: 'process_setting',
+    //根据节点id查询,当前节点是否被成型绑定
+    getBindMolding: 'get_bind_molding',
   }
 }
 

+ 8 - 3
src/components/business/process/node-modal/node-modal.vue

@@ -144,7 +144,7 @@
           <InputPop ref="remarks" v-model="nodeData.remarks"/>
         </DkFormItem>
       </DkForm>
-            {{ nodeData }}<br/>
+<!--            {{ nodeData }}<br/>-->
       <!--      {{ allNodes }}<br/>-->
       <Divider></Divider>
       <!--   表格     -->
@@ -472,10 +472,13 @@ export default {
      * @date   : 2023/1/5 10:38
      */
     modalOk() {
+      //校验
       if (!this.validData()) return
+      //设置业务数据
       this.setParams()
-      //关闭modal,清空当前选中节点id
+      //关闭modal
       this.setProcessNodeModalDisplay(false)
+      //清空当前选中节点id
       this.setCurrentNodeId(undefined)
     },
     /**
@@ -636,6 +639,8 @@ export default {
           return;
         }
       }
+      // 销毁提示弹窗
+      this.$Message.destroy()
       return true
     },
     /**
@@ -719,7 +724,7 @@ export default {
         if (this.$refs.formInline && this.$refs.formInline.$el) {
           formHeight = this.$refs.formInline.$el.offsetHeight + this.$refs.formInline.$el.offsetTop
         }
-        this.tableHeight = mainHeight - formHeight - 43 - 57 - 20;
+        this.tableHeight = mainHeight - formHeight - 43 - 57 - 40;
       })
     }
   },

+ 30 - 1
src/view/process/process-flow/process-setting.vue

@@ -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 : 张潇木