atr-components 0.2.301 → 0.2.302

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.
@@ -610,6 +610,24 @@ class ToolsUtil {
610
610
  static allEmpty(...arr) {
611
611
  return arr.every(item => !item);
612
612
  }
613
+ static isEmpty(obj) {
614
+ if (obj === undefined) {
615
+ return true;
616
+ }
617
+ if (obj === null) {
618
+ return true;
619
+ }
620
+ if (typeof obj == 'boolean') {
621
+ return false;
622
+ }
623
+ if (obj === 0) {
624
+ return false;
625
+ }
626
+ if (obj.trim() === '') {
627
+ return true;
628
+ }
629
+ return false;
630
+ }
613
631
  static encodeValue(params) {
614
632
  Object.keys(params).forEach(key => params[key] = encodeURIComponent(params[key]));
615
633
  return params;
@@ -623,6 +641,44 @@ class ToolsUtil {
623
641
  static modaleStyle() {
624
642
  return { 'maxHeight': ToolsUtil.windowHeight() - 200 + 'px', 'overflow-y': 'auto' };
625
643
  }
644
+ static getRotateNum(pointB, pointC, pointA) {
645
+ //ABC中心点,起始点,终点
646
+ let AB = {};
647
+ let AC = {};
648
+ AB.x1 = pointB.x1 - pointA.x1;
649
+ AB.y1 = pointB.y1 - pointA.y1;
650
+ AC.x1 = pointC.x1 - pointA.x1;
651
+ AC.y1 = pointC.y1 - pointA.y1;
652
+ var direct = AB.x1 * AC.y1 - AB.y1 * AC.y1;
653
+ var lengthAB = Math.sqrt(Math.pow(pointA.x1 - pointB.x1, 2) +
654
+ Math.pow(pointA.y1 - pointB.y1, 2));
655
+ var lengthAC = Math.sqrt(Math.pow(pointA.x1 - pointC.x1, 2) +
656
+ Math.pow(pointA.y1 - pointC.y1, 2));
657
+ var lengthBC = Math.sqrt(Math.pow(pointB.x1 - pointC.x1, 2) +
658
+ Math.pow(pointB.y1 - pointC.y1, 2));
659
+ var cosA = (Math.pow(lengthAB, 2) + Math.pow(lengthAC, 2) -
660
+ Math.pow(lengthBC, 2)) / (2 * lengthAB * lengthAC);
661
+ var angleA = Math.round(Math.acos(cosA) * 180 / Math.PI);
662
+ if (direct < 0) {
663
+ return -angleA;
664
+ }
665
+ else {
666
+ return angleA;
667
+ }
668
+ }
669
+ //绕center点旋转rotate角度
670
+ static getRotatePoint(p, center, rotate) {
671
+ let startX = p.x1;
672
+ let startY = p.y1;
673
+ let a = center.x1;
674
+ let b = center.y1;
675
+ let x1 = a - Math.cos(rotate * Math.PI / 180) * (a - startX) + Math.sin(rotate * Math.PI / 180) * (b - startY);
676
+ let y1 = b - Math.cos(rotate * Math.PI / 180) * (b - startY) - Math.sin(rotate * Math.PI / 180) * (a - startX);
677
+ return {
678
+ x1: x1,
679
+ y1: y1
680
+ };
681
+ }
626
682
  }
627
683
  ToolsUtil.getOrgCode = function () {
628
684
  // var orgCode = '';
@@ -2570,15 +2626,11 @@ class TableTdComponent {
2570
2626
  let isShow = false;
2571
2627
  if (op.length > 1) {
2572
2628
  let value = data[op[0]];
2573
- if (!value) {
2574
- isShow = false;
2575
- }
2576
- else {
2577
- isShow = this.compare(value, op[1], op[2]);
2578
- }
2629
+ isShow = this.compare(value, op[1], op[2]);
2579
2630
  }
2580
- else
2631
+ else {
2581
2632
  isShow = false;
2633
+ }
2582
2634
  return isShow;
2583
2635
  }
2584
2636
  compare(value, operator, target) {
@@ -2600,16 +2652,10 @@ class TableTdComponent {
2600
2652
  }
2601
2653
  break;
2602
2654
  case 'notEmpty':
2603
- isRight = false;
2604
- if (value) {
2605
- isRight = true;
2606
- }
2655
+ isRight = !ToolsUtil.isEmpty(value);
2607
2656
  break;
2608
2657
  case 'empty':
2609
- isRight = true;
2610
- if (!!value) {
2611
- isRight = false;
2612
- }
2658
+ isRight = ToolsUtil.isEmpty(value);
2613
2659
  break;
2614
2660
  default:
2615
2661
  isRight = false;