Selaa lähdekoodia

添加uuid工具类; 非同一级item 不可同时选择

haojianlong 5 vuotta sitten
vanhempi
commit
62cf3fd25b

+ 34 - 0
saga-web-base/src/utils/SUuid.ts

@@ -0,0 +1,34 @@
+/**
+ * 生成uuid工具
+ *
+ */
+export class SUuid {
+    /**
+     * 默认生成32位uuid
+     *
+     * @param   len     要生成的uuid的长度
+     * @param   radix   生成uuid的基数
+     * */
+    static uuid(len: number, radix: number): string {
+        const chars = "0123456789abcdef".split("");
+        let uuid = [],
+            i;
+        radix = radix || chars.length;
+        if (len) {
+            for (i = 0; i < len; i++) {
+                uuid[i] = chars[0 | (Math.random() * radix)];
+            }
+        } else {
+            let r;
+            uuid[8] = uuid[13] = uuid[18] = uuid[23] = "";
+            uuid[14] = "4";
+            for (i = 0; i < 32; i++) {
+                if (!uuid[i]) {
+                    r = 0 | (Math.random() * 16);
+                    uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
+                }
+            }
+        }
+        return uuid.join("");
+    } // Function uuid()
+} // Class SUuid()

+ 2 - 2
saga-web-big/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/big",
-    "version": "1.0.38",
+    "version": "1.0.39",
     "description": "上格云建筑信息化库",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -42,6 +42,6 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@saga-web/graph": "2.1.80"
+        "@saga-web/graph": "2.1.81"
     }
 }

+ 1 - 1
saga-web-graph/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/graph",
-    "version": "2.1.80",
+    "version": "2.1.81",
     "description": "上格云二维图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",

+ 7 - 0
saga-web-graph/src/SGraphSelectContainer.ts

@@ -75,6 +75,13 @@ export class SGraphSelectContainer extends SObject {
             if (this.itemList[i] == item) {
                 this.itemList[i].selected = false;
                 this.itemList.splice(i, 1);
+                this.$emit("listChange", this.itemList);
+                return;
+            }
+        }
+        // 多选时,父级item需要一致
+        if (this.itemList.length) {
+            if (item.parent != this.itemList[0].parent) {
                 return;
             }
         }