atr-components 0.2.300 → 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.
@@ -611,6 +611,24 @@ class ToolsUtil {
611
611
  static allEmpty(...arr) {
612
612
  return arr.every(item => !item);
613
613
  }
614
+ static isEmpty(obj) {
615
+ if (obj === undefined) {
616
+ return true;
617
+ }
618
+ if (obj === null) {
619
+ return true;
620
+ }
621
+ if (typeof obj == 'boolean') {
622
+ return false;
623
+ }
624
+ if (obj === 0) {
625
+ return false;
626
+ }
627
+ if (obj.trim() === '') {
628
+ return true;
629
+ }
630
+ return false;
631
+ }
614
632
  static encodeValue(params) {
615
633
  Object.keys(params).forEach(key => params[key] = encodeURIComponent(params[key]));
616
634
  return params;
@@ -624,6 +642,44 @@ class ToolsUtil {
624
642
  static modaleStyle() {
625
643
  return { 'maxHeight': ToolsUtil.windowHeight() - 200 + 'px', 'overflow-y': 'auto' };
626
644
  }
645
+ static getRotateNum(pointB, pointC, pointA) {
646
+ //ABC中心点,起始点,终点
647
+ let AB = {};
648
+ let AC = {};
649
+ AB.x1 = pointB.x1 - pointA.x1;
650
+ AB.y1 = pointB.y1 - pointA.y1;
651
+ AC.x1 = pointC.x1 - pointA.x1;
652
+ AC.y1 = pointC.y1 - pointA.y1;
653
+ var direct = AB.x1 * AC.y1 - AB.y1 * AC.y1;
654
+ var lengthAB = Math.sqrt(Math.pow(pointA.x1 - pointB.x1, 2) +
655
+ Math.pow(pointA.y1 - pointB.y1, 2));
656
+ var lengthAC = Math.sqrt(Math.pow(pointA.x1 - pointC.x1, 2) +
657
+ Math.pow(pointA.y1 - pointC.y1, 2));
658
+ var lengthBC = Math.sqrt(Math.pow(pointB.x1 - pointC.x1, 2) +
659
+ Math.pow(pointB.y1 - pointC.y1, 2));
660
+ var cosA = (Math.pow(lengthAB, 2) + Math.pow(lengthAC, 2) -
661
+ Math.pow(lengthBC, 2)) / (2 * lengthAB * lengthAC);
662
+ var angleA = Math.round(Math.acos(cosA) * 180 / Math.PI);
663
+ if (direct < 0) {
664
+ return -angleA;
665
+ }
666
+ else {
667
+ return angleA;
668
+ }
669
+ }
670
+ //绕center点旋转rotate角度
671
+ static getRotatePoint(p, center, rotate) {
672
+ let startX = p.x1;
673
+ let startY = p.y1;
674
+ let a = center.x1;
675
+ let b = center.y1;
676
+ let x1 = a - Math.cos(rotate * Math.PI / 180) * (a - startX) + Math.sin(rotate * Math.PI / 180) * (b - startY);
677
+ let y1 = b - Math.cos(rotate * Math.PI / 180) * (b - startY) - Math.sin(rotate * Math.PI / 180) * (a - startX);
678
+ return {
679
+ x1: x1,
680
+ y1: y1
681
+ };
682
+ }
627
683
  }
628
684
  ToolsUtil.getOrgCode = function () {
629
685
  // var orgCode = '';
@@ -2576,15 +2632,11 @@ class TableTdComponent {
2576
2632
  let isShow = false;
2577
2633
  if (op.length > 1) {
2578
2634
  let value = data[op[0]];
2579
- if (!value) {
2580
- isShow = false;
2581
- }
2582
- else {
2583
- isShow = this.compare(value, op[1], op[2]);
2584
- }
2635
+ isShow = this.compare(value, op[1], op[2]);
2585
2636
  }
2586
- else
2637
+ else {
2587
2638
  isShow = false;
2639
+ }
2588
2640
  return isShow;
2589
2641
  }
2590
2642
  compare(value, operator, target) {
@@ -2606,16 +2658,10 @@ class TableTdComponent {
2606
2658
  }
2607
2659
  break;
2608
2660
  case 'notEmpty':
2609
- isRight = false;
2610
- if (value) {
2611
- isRight = true;
2612
- }
2661
+ isRight = !ToolsUtil.isEmpty(value);
2613
2662
  break;
2614
2663
  case 'empty':
2615
- isRight = true;
2616
- if (!!value) {
2617
- isRight = false;
2618
- }
2664
+ isRight = ToolsUtil.isEmpty(value);
2619
2665
  break;
2620
2666
  default:
2621
2667
  isRight = false;
@@ -3585,7 +3631,16 @@ class UploadComponent {
3585
3631
  delImg(numer) {
3586
3632
  console.log(numer);
3587
3633
  this.opts.imageList = this.opts.imageList.filter((v, i) => i != numer);
3588
- // this.opts.imageList = numer
3634
+ let fileUrls = [];
3635
+ for (let file of this.opts.imageList) {
3636
+ if (file["key"] != undefined) {
3637
+ fileUrls.push(file["key"]);
3638
+ continue;
3639
+ }
3640
+ if (file.originFileObj && file.originFileObj["key"] != undefined)
3641
+ fileUrls.push(file.originFileObj["key"]);
3642
+ }
3643
+ this.afterChange.emit({ key: this.opts.key, values: fileUrls.join(",") });
3589
3644
  }
3590
3645
  priviewImg(img) {
3591
3646
  let url = ToolsUtil.getOssUrl(this.getImgUrl(img));