YangYuGang
2025-03-11 bfdfeb40c7ba97511584a30477acf5ad801398ba
src/views/tigerprojects/mes/eng/route/index.vue
@@ -9,6 +9,7 @@
          @select-node="handleSelect"
          @click-blank="clickBlank"
          @anchor-drop="AnchorDrop"
          @anchor-dragend="AnchorDragend"
          @init="init"
        />
      </LayoutContent>
@@ -231,7 +232,7 @@
        AUTH_WH: '',
        WORK_ORDER: currRoute.value.WORK_ORDER,
        PROD_CODE: currRoute.value.PROD_CODE,
        CUST_CODE: currRoute.value.CUST_CODE,
        CUST_CODE: '',
      },
      nodes: [],
      edges: [],
@@ -358,6 +359,8 @@
            if (unref(lf).getNodeIncomingNode(n.id).length == 0) {
              node.IS_FIRST_NODE = 'Y';
              nd.IS_FIRST_NODE = 'Y';
              node.IS_INPUT = 'Y';
              nd.IS_INPUT = 'Y';
            }
            currRotData.nodes.push(node);
          }
@@ -424,20 +427,34 @@
      });
    } else {
      var hasError = false;
      let msg = '';
      unref(lf)
        .getGraphData()
        .nodes.forEach((n) => {
          /* 判断是否有Node未连接 */
          if (
            unref(lf).getNodeIncomingEdge(n.id).length == 0 &&
            unref(lf).getNodeOutgoingEdge(n.id).length == 0
          ) {
            hasError = true;
            msg = '有节点未连线,请重新设计工艺路线再保存数据!';
          }
          if (
            unref(lf)
              .getNodeOutgoingNode(n.id)
              .some((q) => q.properties.operType == 'End') &&
            unref(lf)
              .getNodeOutgoingNode(n.id)
              .some((q) => q.properties.operType != 'End' && q.properties.operType != 'Action')
          ) {
            hasError = true;
            msg = '完工节点不是唯一的最后节点,请重新设计工艺路线再保存数据!';
          }
        });
      if (hasError) {
        createErrorModal({
          title: t('警告'),
          content: t('有节点未连线,请重新设计工艺路线再保存数据!'),
          content: t(msg),
          getContainer: () => document.body,
        });
      } else {
@@ -472,7 +489,7 @@
  function handleSelect(data, lf) {
    lf.graphModel.clearSelectElements();
    lf.graphModel.getNodeModelById(data.data.id).setSelected(true);
    let nnn = lf.graphModel.getNodeIncomingNode(data.data.id)
    let nnn = lf.graphModel.getNodeIncomingNode(data.data.id);
    selectnode.value = data.data;
    if (
      unref(lf)
@@ -544,7 +561,7 @@
          node: {} as node,
          WORK_ORDER: currRoute.value.WORK_ORDER,
          PROD_CODE: currRoute.value.PROD_CODE,
          CUST_CODE: currRoute.value.CUST_CODE,
          CUST_CODE: '',
        };
        routeConfig.routeData.nodes.push(_node);
        _num++;
@@ -596,7 +613,7 @@
            node: {} as node,
            WORK_ORDER: currRoute.value.WORK_ORDER,
            PROD_CODE: currRoute.value.PROD_CODE,
            CUST_CODE: currRoute.value.CUST_CODE,
            CUST_CODE: '',
          };
          routeConfig.routeData.acts.push(_act);
          _numEdge++;
@@ -637,7 +654,7 @@
          node: {} as node,
          WORK_ORDER: currRoute.value.WORK_ORDER,
          PROD_CODE: currRoute.value.PROD_CODE,
          CUST_CODE: currRoute.value.CUST_CODE,
          CUST_CODE: '',
        };
        const actModel = lf.getNodeModelById(selectnode.value.id);
        actModel.updateText(routeConfig.currentAct?.ACT_NAME);
@@ -672,7 +689,7 @@
          REMARK: _node.REMARK,
          WORK_ORDER: currRoute.value.WORK_ORDER,
          PROD_CODE: currRoute.value.PROD_CODE,
          CUST_CODE: currRoute.value.CUST_CODE,
          CUST_CODE: '',
          node: {} as node,
        };
        const nodeModel = lf.getNodeModelById(selectnode.value.id);
@@ -705,25 +722,43 @@
   * @return {*}
   */
  function AnchorDrop(data, lf) {
    if (data.nodeModel.properties['operType'] == 'Action') {
      lf.graphModel.deleteEdgeById(data.edgeModel.id);
      createErrorModal({
        title: t('警告'),
        content: t('行为节点不能连接完工节点!'),
        getContainer: () => document.body,
      });
    } else {
      if (unref(lf).getNodeIncomingNode(data.nodeModel.id).length == 0) {
    let targetNode = lf.graphModel.getNodeModelById(data.edgeModel.targetNodeId);
    if (targetNode.properties['operType'] == 'End') {
      if (data.nodeModel.properties['operType'] == 'Action') {
        lf.graphModel.deleteEdgeById(data.edgeModel.id);
        createErrorModal({
          title: t('警告'),
          content: t('开始节点不能直接连接完工节点!'),
          content: t('行为节点不能连接完工节点!'),
          getContainer: () => document.body,
        });
      } else {
        if (
          unref(lf).getNodeIncomingNode(data.nodeModel.id).length == 0 &&
          unref(lf)
            .getNodeOutgoingNode(data.nodeModel.id)
            .some((q) => q.properties.operType == 'Node')
        ) {
          lf.graphModel.deleteEdgeById(data.edgeModel.id);
          createErrorModal({
            title: t('警告'),
            content: t('开始节点不能直接连接完工节点!'),
            getContainer: () => document.body,
          });
        }
      }
    }
  }
  /**
   * @description: 锚点连线结束,不管是否创建连线都会触发。
   * @param {*} data
   * @param {*} e
   * @param {*} nodeModel
   * @param {*} lf
   * @return {*}
   */
  function AnchorDragend(data, e, nodeModel, lf) {}
  /*
   *点击画布事件
   */