cnhis-design-vue 2.1.34 → 2.1.36

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +43 -9
  2. package/es/affix/index.js +8 -8
  3. package/es/age/index.js +10 -10
  4. package/es/alert/index.js +8 -8
  5. package/es/anchor/index.js +8 -8
  6. package/es/auto-complete/index.js +8 -8
  7. package/es/avatar/index.js +8 -8
  8. package/es/back-top/index.js +8 -8
  9. package/es/badge/index.js +8 -8
  10. package/es/base/index.js +8 -8
  11. package/es/big-table/index.js +133 -117
  12. package/es/big-table/style.css +1 -1
  13. package/es/breadcrumb/index.js +8 -8
  14. package/es/button/index.js +22 -22
  15. package/es/calendar/index.js +8 -8
  16. package/es/captcha/index.js +3 -3
  17. package/es/card/index.js +8 -8
  18. package/es/carousel/index.js +8 -8
  19. package/es/cascader/index.js +8 -8
  20. package/es/checkbox/index.js +9 -9
  21. package/es/col/index.js +8 -8
  22. package/es/collapse/index.js +8 -8
  23. package/es/color-picker/index.js +1 -1
  24. package/es/comment/index.js +8 -8
  25. package/es/config-provider/index.js +8 -8
  26. package/es/date-picker/index.js +8 -8
  27. package/es/descriptions/index.js +8 -8
  28. package/es/divider/index.js +8 -8
  29. package/es/drag-layout/index.js +3 -3
  30. package/es/drawer/index.js +8 -8
  31. package/es/dropdown/index.js +8 -8
  32. package/es/editor/index.js +1 -1
  33. package/es/empty/index.js +8 -8
  34. package/es/fabric-chart/index.js +646 -2463
  35. package/es/fabric-chart/style.css +1 -1
  36. package/es/form/index.js +8 -8
  37. package/es/form-model/index.js +8 -8
  38. package/es/form-table/index.js +62 -62
  39. package/es/index/index.js +1801 -3244
  40. package/es/index/style.css +1 -1
  41. package/es/input/index.js +9 -9
  42. package/es/input-number/index.js +8 -8
  43. package/es/layout/index.js +8 -8
  44. package/es/list/index.js +8 -8
  45. package/es/locale-provider/index.js +8 -8
  46. package/es/map/index.js +9 -9
  47. package/es/mentions/index.js +8 -8
  48. package/es/menu/index.js +8 -8
  49. package/es/message/index.js +8 -8
  50. package/es/multi-chat/index.js +726 -379
  51. package/es/multi-chat/style.css +1 -1
  52. package/es/multi-chat-client/index.js +653 -325
  53. package/es/multi-chat-client/style.css +1 -1
  54. package/es/multi-chat-history/index.js +4 -4
  55. package/es/multi-chat-record/index.js +120 -40
  56. package/es/multi-chat-setting/index.js +154 -49
  57. package/es/multi-chat-sip/index.js +1 -1
  58. package/es/notification/index.js +8 -8
  59. package/es/page-header/index.js +8 -8
  60. package/es/pagination/index.js +8 -8
  61. package/es/popconfirm/index.js +8 -8
  62. package/es/popover/index.js +8 -8
  63. package/es/progress/index.js +8 -8
  64. package/es/radio/index.js +9 -9
  65. package/es/rate/index.js +8 -8
  66. package/es/result/index.js +8 -8
  67. package/es/row/index.js +8 -8
  68. package/es/scale-view/index.js +33 -33
  69. package/es/select/index.js +11 -11
  70. package/es/select-label/index.js +11 -11
  71. package/es/select-person/index.js +2 -2
  72. package/es/shortcut-setter/index.js +10 -10
  73. package/es/skeleton/index.js +8 -8
  74. package/es/slider/index.js +8 -8
  75. package/es/space/index.js +8 -8
  76. package/es/spin/index.js +8 -8
  77. package/es/statistic/index.js +8 -8
  78. package/es/steps/index.js +8 -8
  79. package/es/switch/index.js +8 -8
  80. package/es/table-filter/index.js +84 -73
  81. package/es/table-filter/style.css +1 -1
  82. package/es/tabs/index.js +8 -8
  83. package/es/tag/index.js +9 -9
  84. package/es/time-picker/index.js +8 -8
  85. package/es/timeline/index.js +8 -8
  86. package/es/tooltip/index.js +8 -8
  87. package/es/transfer/index.js +8 -8
  88. package/es/tree/index.js +8 -8
  89. package/es/tree-select/index.js +8 -8
  90. package/es/upload/index.js +8 -8
  91. package/es/utils/UniRTCv2.js +50 -15
  92. package/es/verification-code/index.js +2 -2
  93. package/lib/cui.common.js +1940 -3417
  94. package/lib/cui.umd.js +1940 -3417
  95. package/lib/cui.umd.min.js +48 -48
  96. package/package.json +2 -1
  97. package/packages/big-table/src/BigTable.vue +10 -8
  98. package/packages/big-table/src/components/AutoLayoutButton.vue +3 -3
  99. package/packages/fabric-chart/src/FabricChart.vue +8 -36
  100. package/packages/fabric-chart/src/FabricGrid.vue +3 -10
  101. package/packages/fabric-chart/src/components/TimeScaleValue.vue +10 -8
  102. package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
  103. package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +3 -3
  104. package/packages/fabric-chart/src/fabric-chart/FabricLines.vue +3 -23
  105. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +49 -41
  106. package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +5 -6
  107. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +50 -42
  108. package/packages/fabric-chart/src/mixins/draw.js +25 -5
  109. package/packages/fabric-chart/src/mixins/fabricCommon.js +14 -4
  110. package/packages/multi-chat/chat/audio.vue +82 -14
  111. package/packages/multi-chat/chat/chatFooter.vue +3 -1
  112. package/packages/multi-chat/chat/chatMain.vue +17 -2
  113. package/packages/multi-chat/chat/index.vue +23 -3
  114. package/packages/multi-chat/chat/multiVideo.vue +4 -3
  115. package/packages/multi-chat/chat/video.vue +2 -1
  116. package/packages/multi-chat/store/getters.js +12 -0
  117. package/packages/multi-chat/store/mutation.js +12 -0
  118. package/packages/multi-chat/store/state.js +5 -1
  119. package/packages/multi-chat/utils/index.js +53 -0
  120. package/packages/multi-chat/utils/rtc-client.js +50 -3
  121. package/packages/scale-view/scaleView.vue +2010 -2010
  122. package/packages/table-filter/src/base-search-com/BaseSearch.vue +9 -0
  123. package/src/utils/UniRTCv2.js +40 -12
  124. package/packages/fabric-chart/src/fabric-chart2/FabricBottom.vue +0 -108
  125. package/packages/fabric-chart/src/fabric-chart2/FabricCanvas.vue +0 -181
  126. package/packages/fabric-chart/src/fabric-chart2/FabricCenter.vue +0 -612
  127. package/packages/fabric-chart/src/fabric-chart2/FabricLeft.vue +0 -104
  128. package/packages/fabric-chart/src/fabric-chart2/FabricRight.vue +0 -112
  129. package/packages/fabric-chart/src/fabric-chart2/FabricTop.vue +0 -172
@@ -94,8 +94,10 @@ export default {
94
94
 
95
95
  watch: {},
96
96
 
97
- mounted() {
98
- this.$nextTick(() => {
97
+ mounted() {},
98
+
99
+ methods: {
100
+ init() {
99
101
  this.drawPolylineTitle();
100
102
  this.polylinePointList = [];
101
103
  this.polyline.forEach((polylineType, polylineTypeId) => {
@@ -103,10 +105,7 @@ export default {
103
105
  });
104
106
 
105
107
  this.eventStyle.evented && this.createEvent();
106
- });
107
- },
108
-
109
- methods: {
108
+ },
110
109
  createEvent() {
111
110
  this.canvas.on('mouse:up', event => {
112
111
  if (event.button === 3) {
@@ -176,7 +175,7 @@ export default {
176
175
  ponits: [selectAreaOrigin.left, selectAreaOrigin.top, event.pointer.x, event.pointer.y]
177
176
  });
178
177
  this.canvas.add(this.selectArea);
179
- this.canvas.renderAll();
178
+ // this.canvas.renderAll();
180
179
  },
181
180
  // 每一个折线类别
182
181
  createPolyline(polylineType, polylineTypeId) {
@@ -246,7 +245,7 @@ export default {
246
245
  }
247
246
 
248
247
  const eventStyle = { selectable: false, evented: false };
249
- const types = ['arrow', '+', 'shjs', 'shks', 'cg', 'jxtq'];
248
+ const types = ['arrow', '+', 'shjs', 'shks', 'cg', 'jxtq', 'qgcg', 'zrhz'];
250
249
  leftTitleList.forEach(async (v, i) => {
251
250
  const baseTop = canvasHeight - lableMargin[1];
252
251
  const top = baseTop - i * lableLineHeight;
@@ -296,7 +295,6 @@ export default {
296
295
  scaleX: 1,
297
296
  scaleY: 1
298
297
  });
299
- this.canvas.renderAll();
300
298
  }
301
299
 
302
300
  if (!cloneIconId) {
@@ -307,7 +305,6 @@ export default {
307
305
  });
308
306
  clonedObj.bringForward();
309
307
  this.canvas.add(clonedObj);
310
- this.canvas.renderAll();
311
308
  });
312
309
  }
313
310
 
@@ -319,14 +316,14 @@ export default {
319
316
  } else {
320
317
  this.isDropVisible = false;
321
318
  }
322
- this.canvas.renderAll();
319
+ // this.canvas.renderAll();
323
320
  });
324
321
  // 标题折线点停止拖拽后 更新
325
322
  icon.on('moved', () => {
326
323
  icon.set({
327
324
  id: icon.id.replace('_isTitle', '')
328
325
  });
329
- this.canvas.renderAll();
326
+ // this.canvas.renderAll();
330
327
  this.removeTitle();
331
328
  this.removePolyline(cloneIconId);
332
329
 
@@ -356,7 +353,7 @@ export default {
356
353
  }
357
354
 
358
355
  this.canvas.add(text, icon);
359
- this.canvas.requestRenderAll();
356
+ // this.canvas.requestRenderAll();
360
357
  });
361
358
  },
362
359
  // 点移动限制
@@ -429,7 +426,7 @@ export default {
429
426
  lines.push(line, text);
430
427
  }
431
428
  this.canvas.add(...lines);
432
- this.canvas.renderAll();
429
+ // this.canvas.renderAll();
433
430
  },
434
431
  /**
435
432
  * 绘制一条折线
@@ -476,9 +473,9 @@ export default {
476
473
  if (points) {
477
474
  Object.assign(pointOthers, {
478
475
  originLeft: points[0],
479
- originTop: points[1]
476
+ originTop: points[1],
477
+ time: linePoints.time
480
478
  });
481
- pointOthers.time = linePoints.time;
482
479
  point = previousLine ? this.drawPoint(...points, previousLine, line, polyline.type, pointOthers, isInit) : this.drawPoint(...points, null, line, polyline.type, pointOthers, isInit);
483
480
  }
484
481
  lineList.push(line);
@@ -514,7 +511,7 @@ export default {
514
511
  return v;
515
512
  });
516
513
  this.canvas.add(...lineList, ...res);
517
- this.canvas.requestRenderAll();
514
+ // this.canvas.requestRenderAll();
518
515
  });
519
516
 
520
517
  this.createAttrVaule('critical', polyline, polylineIndex, polylineType, polylineTypeId);
@@ -568,7 +565,7 @@ export default {
568
565
  this.pointMoveLimit(point, false);
569
566
  this.pointMoveUpdateLine(point);
570
567
  this.addPoint(point);
571
- this.canvas.renderAll();
568
+ // this.canvas.renderAll();
572
569
  this.showDrapPopup(point);
573
570
  });
574
571
  // 折线点停止拖拽后 更新polyline中对应的坐标
@@ -594,9 +591,10 @@ export default {
594
591
  },
595
592
  // 拖动停止后 设置回调触发方法
596
593
  setEmitFunction(point, isInit = false) {
594
+ const { operable } = this.propItems;
597
595
  const { data, x, y } = this.getValue(point);
598
596
  Object.assign(data, {
599
- value: { time: x, value: y },
597
+ value: { time: operable.lockMovementX ? point.time : x, value: y },
600
598
  isInit
601
599
  });
602
600
  if (this.addPointList.length === 0) {
@@ -614,8 +612,13 @@ export default {
614
612
  }
615
613
  this.$emit('pointChange', data);
616
614
  } else {
615
+ this.$nextTick(() => {
616
+ // 拖动新增节点时默认所有节点可删除
617
+ this.currentDelPoint = null;
618
+ });
617
619
  const lastPoint = this.addPointList.at(-1);
618
620
  const position = this.polyline[point.polylineTypeId].position;
621
+ const [firstPoint] = this.addPointList;
619
622
  // 如果是重合/连线节点
620
623
  if (point.get('scaleX') !== point.scale) {
621
624
  const addOjb = {
@@ -637,7 +640,7 @@ export default {
637
640
  this.repaintPolyline(position, point.polylineIndex);
638
641
  return;
639
642
  }
640
- !point.line2 && this.addPointList.splice(0, 1);
643
+ !point.line2 && firstPoint.left <= point.originLeft && this.addPointList.splice(0, 1);
641
644
  !point.id.includes('isTitle') && this.removePolyline(point.id);
642
645
  if (this.addPointList.length > 0) {
643
646
  this.$emit('pointOperation', 'increasePointBatch', this.addPointList);
@@ -660,7 +663,7 @@ export default {
660
663
  * @param {*} point 拖动的最后一个节点
661
664
  * @return {*}
662
665
  */
663
- async addPoint(point) {
666
+ addPoint(point) {
664
667
  const { xCellWidth, table, originX } = this.propItems;
665
668
  // const addPointSpaceGridNumbers = table.addPointSpaceGridNumbers || [];
666
669
  let addPointSpaceGridNumber = table.addPointSpaceGridNumber || 1;
@@ -673,7 +676,7 @@ export default {
673
676
  const spaceWidth = xCellWidth * addPointSpaceGridNumber;
674
677
  const residue = (left - originLeft) % spaceWidth;
675
678
 
676
- const condition = residue > spaceWidth - n || residue < n;
679
+ const condition = residue > 0 && (residue > spaceWidth - n || residue < n);
677
680
  const conditionNoLine2 = !point.line2 && left > originLeft;
678
681
  const conditionHasLine2 = point.line2 && left > originLeft + spaceWidth;
679
682
 
@@ -687,13 +690,14 @@ export default {
687
690
 
688
691
  const checkPoints = () => {
689
692
  const PointLens = Math.floor((left - originLeft) / spaceWidth);
690
- if (PointLens > 1 && this.addPointList?.length < PointLens) {
691
- for (let k = 0; k < PointLens; k++) {
693
+ if (PointLens > 1 && this.addPointList?.length <= PointLens) {
694
+ for (let k = 0; k <= PointLens; k++) {
692
695
  if (k > 0) {
693
696
  const curLeft = originLeft + spaceWidth * k;
694
697
  // 判断this.addPointList中的left是否包含curLeft,不包含就说明是漏了
695
- const isNoLack = this.addPointList.some(v => v.left === curLeft);
696
- if (!isNoLack) {
698
+ const hasPoint = this.addPointList.some(p => Math.abs(p.left - curLeft) <= 0.001);
699
+ // const hasPoint = this.addPointList.some(v => v.left == curLeft);
700
+ if (!hasPoint) {
697
701
  let index;
698
702
  const pointObj = this.addPointList.find((v, i) => {
699
703
  if (v.left > curLeft) {
@@ -703,11 +707,16 @@ export default {
703
707
  });
704
708
  if (pointObj) {
705
709
  let cloneObj = JSON.parse(JSON.stringify(pointObj));
710
+ const len = ~~((pointObj.left - (curLeft - spaceWidth)) / spaceWidth);
711
+ const prePoint = this.addPointList[index - 1] || pointObj;
712
+ const spaceHeight = (pointObj.top - prePoint.top) / len;
713
+ const position = this.polyline[point.polylineTypeId].position;
714
+ cloneObj.top = prePoint.top + spaceHeight;
706
715
  cloneObj.value.time = this.getXValue(curLeft);
716
+ cloneObj.value.value = this.getYValue(position, cloneObj.top);
707
717
  cloneObj.left = curLeft;
708
- // 补充的节点会和滑动的线条对应不上
709
- // await this.clonePoint(point, [curLeft, cloneObj.top, cloneObj.left, cloneObj.top])
710
718
  this.addPointList.splice(index, 0, cloneObj);
719
+ this.clonePoint(point, [prePoint.left, prePoint.top, cloneObj.left, cloneObj.top]);
711
720
  }
712
721
  }
713
722
  }
@@ -720,18 +729,20 @@ export default {
720
729
  if (conditionNoLine2 || conditionHasLine2) {
721
730
  // point.line1 && this.removePolyline(point.line1.id);
722
731
  setPointLineColor(point, 'transparent', conditionHasLine2);
723
- this.addPointList.length == 0 && (await this.clonePoint(point, [point.line1 ? point.line1.x1 : originLeft, point.line1 ? point.line1.y1 : originTop, originLeft, originTop]));
732
+ this.addPointList.length == 0 && this.clonePoint(point, [point.line1 ? point.line1.x1 : originLeft, point.line1 ? point.line1.y1 : originTop, originLeft, originTop]);
724
733
  if (this.addPointList.every(v => v.left !== left)) {
725
734
  // const points1 = i === 1 ? [originLeft, originTop] : point.prePoints;
726
735
  const points1 = this.addPointList.length == 0 ? [originLeft, originTop] : point.prePoints;
727
- points1 && (await this.clonePoint(point, [...points1, left, top]));
728
- // this.setAddPointList(point);
729
- // 调用上面方法就会导致线段绘制失败,目前还不知道为啥子
730
- const { data, x, y } = this.getValue(point);
731
- data.value = { time: x, value: y };
732
- data.left = point.left;
733
- data.top = top;
734
- this.addPointList.push(data);
736
+ if (points1) {
737
+ // this.setAddPointList(point);
738
+ // 调用上面方法就会导致线段绘制失败,目前还不知道为啥子
739
+ const { data, x, y } = this.getValue(point);
740
+ data.value = { time: x, value: y };
741
+ data.left = left;
742
+ data.top = top;
743
+ this.addPointList.push(data);
744
+ this.clonePoint(point, [...points1, left, top]);
745
+ }
735
746
  }
736
747
  checkPoints();
737
748
  }
@@ -828,15 +839,12 @@ export default {
828
839
  scaleY: point.scale
829
840
  });
830
841
  clonedObj.hasControls = clonedObj.hasBorders = false;
831
- point.set({
832
- prePoints: [point.left, point.top]
833
- });
842
+ point.prePoints = [point.left, point.top];
834
843
  const line = this.drawLine([...points], { evented, selectable, ...lineAttr, polylineIndex, polylineTypeId, lineIndex });
835
844
  clonedObj.line1 = line;
836
845
  this.canvas.sendBackwards(line);
837
846
  clonedObj.bringForward();
838
847
  this.canvas.add(clonedObj);
839
- this.canvas.renderAll();
840
848
  resolve(clonedObj);
841
849
  });
842
850
  });
@@ -34,15 +34,14 @@ export default {
34
34
  };
35
35
  }
36
36
  },
37
- mounted() {
38
- this.$nextTick(() => {
37
+ mounted() {},
38
+ methods: {
39
+ init() {
39
40
  this.topScaleValue(this.templateData.top);
40
41
  this.rightScaleValue(this.templateData.right);
41
42
  this.leftScaleValue(this.templateData.left);
42
- this.canvas.renderAll();
43
- });
44
- },
45
- methods: {
43
+ // this.canvas.renderAll();
44
+ },
46
45
  // x轴时间刻度绘制
47
46
  topScaleValue(obj) {
48
47
  const { originX, originY, xCellWidth, spaceHeight } = this.propItems;
@@ -47,9 +47,11 @@ export default {
47
47
  'templateData.other': {
48
48
  handler(value) {
49
49
  if (value) {
50
- this.removeOther();
51
- this.drawTextDataGroup(value);
52
- this.canvas.renderAll();
50
+ this.$nextTick(() => {
51
+ this.removeOther();
52
+ this.drawTextDataGroup(value);
53
+ // this.canvas.renderAll();
54
+ });
53
55
  }
54
56
  },
55
57
  deep: true
@@ -67,11 +69,7 @@ export default {
67
69
  activeEvent: null // 当前可右键活动的对象
68
70
  };
69
71
  },
70
- mounted() {
71
- this.$nextTick(() => {
72
- this.init();
73
- });
74
- },
72
+ mounted() {},
75
73
  computed: {
76
74
  girdLineStyle() {
77
75
  return Object.assign({}, defaultVaule.borderStyle, this.templateData.borderStyle || {});
@@ -94,7 +92,7 @@ export default {
94
92
  this.templateData.other && this.drawTextDataGroup(this.templateData.other);
95
93
  this.eventStyle.evented && this.createEvent();
96
94
  this.drawBorder();
97
- this.canvas.renderAll();
95
+ // this.canvas.renderAll();
98
96
  this.templateData.bottom && this.drawBottomTextDataGroup(this.templateData.bottom);
99
97
  },
100
98
  drawBorder() {
@@ -238,9 +236,11 @@ export default {
238
236
  index: i,
239
237
  type: 'colList',
240
238
  id: `${index}_${i}_other_${Date.now()}`,
239
+ name: v.value,
241
240
  ...this.eventStyle
242
241
  });
243
242
  text.hasControls = text.hasBorders = false;
243
+ this.setPopup(text);
244
244
  textList.push(text);
245
245
  });
246
246
  }
@@ -287,15 +287,25 @@ export default {
287
287
  index: i,
288
288
  type: 'list',
289
289
  id: `${index}_${i}_other_${Date.now()}`,
290
+ name: v.value,
290
291
  ...this.eventStyle
291
292
  });
292
293
  text.hasControls = text.hasBorders = false;
294
+ this.setPopup(text);
293
295
  textList.push(text);
294
296
  }
295
297
  });
296
298
  });
297
299
  this.canvas.add(...textList);
298
300
  },
301
+ setPopup(point) {
302
+ point.on('mouseover', () => {
303
+ this.showDrapPopup(point, true);
304
+ });
305
+ point.on('mouseout', () => {
306
+ this.isDropVisible = false;
307
+ });
308
+ },
299
309
  // 判断当前时间是否超出网格区域
300
310
  isLimit(value) {
301
311
  const { xScaleList } = this.propItems;
@@ -338,9 +348,32 @@ export default {
338
348
  const lineHeightText = (obj.style?.fontSize || 12) + 2;
339
349
  const lineHeightImg = (obj.iconStyle?.height || 12) + 2;
340
350
  const lineHeightSeq = (obj.seqStyle?.circle?.radius || 9) * 2 + 2;
351
+ const addCanvas = point => {
352
+ point.hasControls = point.hasBorders = false;
353
+ this.pointEvent(point);
354
+ this.canvas.add(point);
355
+ // this.canvas.requestRenderAll();
356
+ };
357
+ const setTop = (lineHeight, i, condition) => {
358
+ if (!~condition.limitIndex) {
359
+ condition.y += i === 0 ? lineHeight / 2 : lineHeight;
360
+ if (condition.y >= canvasHeight - lineHeight / 2) {
361
+ condition.limitIndex++;
362
+ if (condition.limitIndex === 0) {
363
+ condition.y = baseYLimit;
364
+ condition.y -= lineHeight / 2;
365
+ }
366
+ }
367
+ } else {
368
+ condition.y -= lineHeight;
369
+ }
370
+ return condition.y;
371
+ };
341
372
  obj.list.forEach((item, index) => {
342
- let limitIndex = -1; // 标志点是否往上排列的标志,大于-1则表示需要往上排列
343
- let y = baseY;
373
+ const condition = {
374
+ limitIndex: -1, // 标志点是否往上排列的标志,大于-1则表示需要往上排列
375
+ y: baseY
376
+ };
344
377
  const x = this.cumputedX(item[0]);
345
378
  if (this.isLimit(item[0])) {
346
379
  item[1].forEach(async (v, i) => {
@@ -354,21 +387,7 @@ export default {
354
387
  name: v.name,
355
388
  type: 'mark'
356
389
  };
357
- function setTop(lineHeight) {
358
- if (!~limitIndex) {
359
- y += i === 0 ? lineHeight / 2 : lineHeight;
360
- if (y >= canvasHeight - lineHeight / 2) {
361
- limitIndex++;
362
- if (limitIndex === 0) {
363
- y = baseYLimit;
364
- y -= lineHeight / 2;
365
- }
366
- }
367
- } else {
368
- y -= lineHeight;
369
- }
370
- common.top = y;
371
- }
390
+
372
391
  const eventStyle = !this.eventStyle.evented
373
392
  ? {
374
393
  lockMovementX: true,
@@ -376,14 +395,8 @@ export default {
376
395
  }
377
396
  : {};
378
397
 
379
- const addCanvas = async point => {
380
- point.hasControls = point.hasBorders = false;
381
- this.pointEvent(point);
382
- this.canvas.add(point);
383
- this.canvas.requestRenderAll();
384
- };
385
398
  if (this.isObject(v) && !v.value) {
386
- setTop(lineHeightImg);
399
+ common.top = setTop(lineHeightImg, i, condition);
387
400
  const option = Object.assign({}, obj.iconStyle || {}, v || {}, {
388
401
  ...common,
389
402
  ...eventStyle
@@ -399,7 +412,7 @@ export default {
399
412
  addCanvas(img);
400
413
  } else if (v.value) {
401
414
  if (v.seq) {
402
- setTop(lineHeightSeq);
415
+ common.top = setTop(lineHeightSeq, i, condition);
403
416
  // 标记增加序号
404
417
  const circle = await this.createPoint('circle', {
405
418
  ...common,
@@ -421,7 +434,7 @@ export default {
421
434
  });
422
435
  addCanvas(group);
423
436
  } else {
424
- setTop(lineHeightText);
437
+ common.top = setTop(lineHeightText, i, condition);
425
438
  const text = new this.fabric.Text(String(v.value), {
426
439
  ...defaultVaule.textStyle,
427
440
  ...obj.style,
@@ -437,17 +450,12 @@ export default {
437
450
  // this.canvas.add(...textList);
438
451
  },
439
452
  pointEvent(point) {
440
- point.on('mouseover', () => {
441
- this.showDrapPopup(point, true);
442
- });
443
- point.on('mouseout', () => {
444
- this.isDropVisible = false;
445
- });
453
+ this.setPopup(point);
446
454
  // 移动中 实时更新相关联的线的坐标
447
455
  if (this.eventStyle.evented) {
448
456
  point.on('moving', () => {
449
457
  this.moveLimit(point);
450
- this.canvas.renderAll();
458
+ // this.canvas.renderAll();
451
459
  this.showDrapPopup(point);
452
460
  });
453
461
  point.on('moved', () => {
@@ -50,10 +50,6 @@ export default {
50
50
  ...lineStyle
51
51
  });
52
52
  },
53
- // 绘制点
54
- // drawPoint(points, style) {
55
- // console.log(points, style);
56
- // },
57
53
  // 绘制文本区
58
54
  drawTextGroup(rectStyle, fontStyle, groupStyle) {
59
55
  const rect_style = this.isObject(rectStyle)
@@ -115,7 +111,8 @@ export default {
115
111
  // });
116
112
  // fabric.loadSVGFromURL的工作方式相同,只不过您传递的是包含URL而不是SVG内容的字符串
117
113
  return new Promise((resolve, reject) => {
118
- const svg = document.querySelector(iconClassName).querySelector('svg');
114
+ const svg = document?.querySelector(iconClassName)?.querySelector('svg');
115
+ if (!svg) reject('图片转换svg失败!');
119
116
  svg.setAttribute('version', 1.1);
120
117
  svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
121
118
  svg.style.color = others.color || '#000';
@@ -291,6 +288,29 @@ export default {
291
288
  scale: 1,
292
289
  ...data
293
290
  });
291
+ case 'qgcg': {
292
+ const { width, height } = data;
293
+ obj1 = new this.fabric.Line([0, height / 2, width, height / 2], {
294
+ strokeWidth: 1,
295
+ ...data
296
+ });
297
+ obj2 = this.createCircleBorder({ ...data, width: width / 2 });
298
+ return new this.fabric.Group([obj2, obj1], {
299
+ ...data
300
+ });
301
+ }
302
+ case 'zrhz': {
303
+ const { width, height } = data;
304
+ obj1 = new this.fabric.Line([0, height / 2, width, height / 2], {
305
+ strokeWidth: 1,
306
+ ...data
307
+ });
308
+ obj2 = this.createCircleBorder({ ...data, width: width / 2 });
309
+ const obj3 = this.createCircleBorder({ ...data, width: width / 3 });
310
+ return new this.fabric.Group([obj2, obj3, obj1], {
311
+ ...data
312
+ });
313
+ }
294
314
  case 'cg':
295
315
  obj1 = this.ceateLineArrow(data);
296
316
  obj2 = this.createCircleBorder(data);
@@ -1,5 +1,3 @@
1
- import { v } from 'vxe-table';
2
-
3
1
  export default {
4
2
  name: 'fabric-common',
5
3
  inject: ['$canvas', '$group', '$propItems', '$fabric'],
@@ -20,6 +18,18 @@ export default {
20
18
  return this.$propItems();
21
19
  }
22
20
  },
21
+ watch: {
22
+ canvas: {
23
+ handler(value) {
24
+ if (value) {
25
+ this.$nextTick(() => {
26
+ this.init?.();
27
+ });
28
+ }
29
+ },
30
+ immediate: true
31
+ }
32
+ },
23
33
  methods: {
24
34
  // 根据x轴坐标获取对应的时间点
25
35
  // getXValue(left) {
@@ -70,7 +80,7 @@ export default {
70
80
  !~index && (index = xScaleCellList.length);
71
81
  const obj = xScaleCellList[index - 1];
72
82
  return obj.x + (time - obj.time) / obj.xScaleTime;
73
- },
83
+ }
74
84
  // // 根据时间戳计算x轴坐标
75
85
  // cumputedX(value) {
76
86
  // if (!value) {
@@ -82,4 +92,4 @@ export default {
82
92
  // return originX + (time - minScale) * xScaleCell;
83
93
  // },
84
94
  }
85
- };
95
+ };