• <menu id="w2i4a"></menu>
  • logo GoJS教程2020

    文檔首頁>>GoJS教程2020>>流程圖控件GoJS教程:用戶權(quán)限

    流程圖控件GoJS教程:用戶權(quán)限


    GoJS是一款功能強(qiáng)大,快速且輕量級的流程圖控件,可幫助你在JavaScript 和HTML5 Canvas程序中創(chuàng)建流程圖,且極大地簡化您的JavaScript / Canvas 程序。

    點(diǎn)擊下載GoJS最新試用版

    用戶權(quán)限

    以編程方式,您可以做什么沒有任何限制。但是,您可能希望限制用戶可以執(zhí)行的操作。

    最簡單的限制是將Diagram.isEnabled設(shè)置為false。用戶將無能為力。在此示例中,即使啟用了分組,撤消和重做命令,由于禁用了圖,因此這些命令無法執(zhí)行。

      diagram.commandHandler.archetypeGroupData =
        { key: "Group", isGroup: true, color: "blue" };
    
      var nodeDataArray = [
        { key: "Alpha" },
        { key: "Beta" },
        { key: "Delta", group: "Epsilon" },
        { key: "Gamma", group: "Epsilon" },
        { key: "Epsilon", isGroup: true }
      ];
      var linkDataArray = [
        { from: "Alpha", to: "Beta" },
        { from: "Beta", to: "Beta" },
        { from: "Gamma", to: "Delta" },
        { from: "Delta", to: "Alpha" }
      ];
      diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
      diagram.undoManager.isEnabled = true;
    
      diagram.add($(go.Part,  // this is just a visual comment
                    { location: new go.Point(200, 50) },
                    $(go.TextBlock, "Diagram.isEnabled == false",
                      { font: "16pt bold", stroke: "red" })
                  ));
    
      diagram.isEnabled = false;  // Disable the diagram!

    流程圖控件GoJS教程:用戶權(quán)限

    更常見的是將Diagram.isReadOnly設(shè)置為true。這使用戶可以滾動和縮放以及選擇零件,但不能插入或刪除或拖動或修改零件。(如果要允許滾動和縮放而不是選擇,則可以禁用選擇,如下所述。)

      diagram.commandHandler.archetypeGroupData =
        { key: "Group", isGroup: true, color: "blue" };
    
      var nodeDataArray = [
        { key: "Alpha" },
        { key: "Beta" },
        { key: "Delta", group: "Epsilon" },
        { key: "Gamma", group: "Epsilon" },
        { key: "Epsilon", isGroup: true }
      ];
      var linkDataArray = [
        { from: "Alpha", to: "Beta" },
        { from: "Beta", to: "Beta" },
        { from: "Gamma", to: "Delta" },
        { from: "Delta", to: "Alpha" }
      ];
      diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
      diagram.undoManager.isEnabled = true;
    
      diagram.add($(go.Part,  // this is just a visual comment
                    { location: new go.Point(200, 50) },
                    $(go.TextBlock, "Diagram.isReadOnly == true",
                      { font: "16pt bold", stroke: "red" })
                  ));
    
      // Disable diagram modifications, but allow navigation and selection
      diagram.isReadOnly = true;


    另一種可能性是將Model.isReadOnly設(shè)置為true。這使用戶可以滾動,縮放,選擇和移動零件,但不能插入或刪除零件,包括不添加或刪除鏈接或添加或刪除組成員。

    該Diagram.isModelReadOnly屬性只是獲取和設(shè)置Model.isReadOnly財(cái)產(chǎn)。如果要加載新模型,則需要在設(shè)置Diagram.model之后設(shè)置這個Diagram屬性。

      diagram.commandHandler.archetypeGroupData =
        { key: "Group", isGroup: true, color: "blue" };
    
      var nodeDataArray = [
        { key: "Alpha" },
        { key: "Beta" },
        { key: "Delta", group: "Epsilon" },
        { key: "Gamma", group: "Epsilon" },
        { key: "Epsilon", isGroup: true }
      ];
      var linkDataArray = [
        { from: "Alpha", to: "Beta" },
        { from: "Beta", to: "Beta" },
        { from: "Gamma", to: "Delta" },
        { from: "Delta", to: "Alpha" }
      ];
      diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
      diagram.undoManager.isEnabled = true;
    
      diagram.add($(go.Part,  // this is just a visual comment
                    { location: new go.Point(200, 50) },
                    $(go.TextBlock, "Diagram.model.isReadOnly == true",
                      { font: "16pt bold", stroke: "red" })
                  ));
    
      diagram.model.isReadOnly = true;  // Disable adding or removing parts

    ====================================================

    想要購買GoJS正版授權(quán)的朋友可以咨詢慧都官方客服

    有關(guān)產(chǎn)品的最新消息和最新資訊,歡迎掃描關(guān)注下方微信公眾號


    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();