bl-common-vue3 0.0.53 → 0.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -84343,6 +84343,9 @@ var es_string_match = __webpack_require__("466d");
84343
84343
 
84344
84344
 
84345
84345
 
84346
+
84347
+
84348
+
84346
84349
  var utils = {
84347
84350
  numberReg: /^\d+(\.\d+)?$/,
84348
84351
  // 数字验证正则
@@ -84353,6 +84356,8 @@ var utils = {
84353
84356
  // 表单验证为必填项
84354
84357
  blCommonKey: "BL_COMMON_LOCAL",
84355
84358
  // 公共localstorge存储
84359
+ BTN_PERMISSION: null,
84360
+ // 按钮权限集合
84356
84361
 
84357
84362
  /**
84358
84363
  * 表单验证为数字
@@ -84454,8 +84459,15 @@ var utils = {
84454
84459
  },
84455
84460
 
84456
84461
  /**
84457
- * 获取公共存储参数
84462
+ * 存取公共存储参数
84458
84463
  */
84464
+ setCommonLocal: function setCommonLocal(key, value) {
84465
+ var localData = localStorage.getItem(utils.blCommonKey);
84466
+
84467
+ if (localData) {
84468
+ localData[key] = JSON.String(value);
84469
+ }
84470
+ },
84459
84471
  getCommonLocal: function getCommonLocal(key) {
84460
84472
  var localData = localStorage.getItem(utils.blCommonKey);
84461
84473
 
@@ -84463,7 +84475,7 @@ var utils = {
84463
84475
  localData = JSON.parse(localData);
84464
84476
  }
84465
84477
 
84466
- return key && localData ? localData[key] : localData;
84478
+ return key && localData ? localData[key] : null;
84467
84479
  },
84468
84480
 
84469
84481
  /**
@@ -84472,6 +84484,37 @@ var utils = {
84472
84484
  dictName: function dictName(name) {
84473
84485
  var dictionary = utils.getCommonLocal("dictionary");
84474
84486
  return dictionary[name] || name;
84487
+ },
84488
+
84489
+ /**
84490
+ * 设置按钮权限
84491
+ */
84492
+ setSystemBtnPermission: function setSystemBtnPermission(permission) {
84493
+ utils.setCommonLocal("BTN_PERMISSION", permission);
84494
+ },
84495
+
84496
+ /**
84497
+ * 获取按钮权限
84498
+ * alias 权限路由alias
84499
+ * actionKey 所属权限key
84500
+ * action 权限字段
84501
+ */
84502
+ getBtnPermission: function getBtnPermission(_ref) {
84503
+ var alias = _ref.alias,
84504
+ actionKey = _ref.actionKey,
84505
+ action = _ref.action;
84506
+
84507
+ if (!utils.BTN_PERMISSION || !Object.keys(utils.BTN_PERMISSION).length) {
84508
+ utils.BTN_PERMISSION = utils.getCommonLocal("BTN_PERMISSION");
84509
+ }
84510
+
84511
+ var permisson = utils.BTN_PERMISSION;
84512
+
84513
+ if (permisson && permisson[alias] && permisson[alias][actionKey] && permisson[alias][actionKey].includes(action)) {
84514
+ return true;
84515
+ }
84516
+
84517
+ return false;
84475
84518
  }
84476
84519
  };
84477
84520
  /* harmony default export */ var utils_util = (utils);
@@ -84352,6 +84352,9 @@ var es_string_match = __webpack_require__("466d");
84352
84352
 
84353
84353
 
84354
84354
 
84355
+
84356
+
84357
+
84355
84358
  var utils = {
84356
84359
  numberReg: /^\d+(\.\d+)?$/,
84357
84360
  // 数字验证正则
@@ -84362,6 +84365,8 @@ var utils = {
84362
84365
  // 表单验证为必填项
84363
84366
  blCommonKey: "BL_COMMON_LOCAL",
84364
84367
  // 公共localstorge存储
84368
+ BTN_PERMISSION: null,
84369
+ // 按钮权限集合
84365
84370
 
84366
84371
  /**
84367
84372
  * 表单验证为数字
@@ -84463,8 +84468,15 @@ var utils = {
84463
84468
  },
84464
84469
 
84465
84470
  /**
84466
- * 获取公共存储参数
84471
+ * 存取公共存储参数
84467
84472
  */
84473
+ setCommonLocal: function setCommonLocal(key, value) {
84474
+ var localData = localStorage.getItem(utils.blCommonKey);
84475
+
84476
+ if (localData) {
84477
+ localData[key] = JSON.String(value);
84478
+ }
84479
+ },
84468
84480
  getCommonLocal: function getCommonLocal(key) {
84469
84481
  var localData = localStorage.getItem(utils.blCommonKey);
84470
84482
 
@@ -84472,7 +84484,7 @@ var utils = {
84472
84484
  localData = JSON.parse(localData);
84473
84485
  }
84474
84486
 
84475
- return key && localData ? localData[key] : localData;
84487
+ return key && localData ? localData[key] : null;
84476
84488
  },
84477
84489
 
84478
84490
  /**
@@ -84481,6 +84493,37 @@ var utils = {
84481
84493
  dictName: function dictName(name) {
84482
84494
  var dictionary = utils.getCommonLocal("dictionary");
84483
84495
  return dictionary[name] || name;
84496
+ },
84497
+
84498
+ /**
84499
+ * 设置按钮权限
84500
+ */
84501
+ setSystemBtnPermission: function setSystemBtnPermission(permission) {
84502
+ utils.setCommonLocal("BTN_PERMISSION", permission);
84503
+ },
84504
+
84505
+ /**
84506
+ * 获取按钮权限
84507
+ * alias 权限路由alias
84508
+ * actionKey 所属权限key
84509
+ * action 权限字段
84510
+ */
84511
+ getBtnPermission: function getBtnPermission(_ref) {
84512
+ var alias = _ref.alias,
84513
+ actionKey = _ref.actionKey,
84514
+ action = _ref.action;
84515
+
84516
+ if (!utils.BTN_PERMISSION || !Object.keys(utils.BTN_PERMISSION).length) {
84517
+ utils.BTN_PERMISSION = utils.getCommonLocal("BTN_PERMISSION");
84518
+ }
84519
+
84520
+ var permisson = utils.BTN_PERMISSION;
84521
+
84522
+ if (permisson && permisson[alias] && permisson[alias][actionKey] && permisson[alias][actionKey].includes(action)) {
84523
+ return true;
84524
+ }
84525
+
84526
+ return false;
84484
84527
  }
84485
84528
  };
84486
84529
  /* harmony default export */ var utils_util = (utils);