cnhis-design-vue 2.1.34 → 2.1.35

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 (112) hide show
  1. package/CHANGELOG.md +28 -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 +86 -86
  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 +545 -2355
  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 +1117 -2909
  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 +75 -75
  51. package/es/multi-chat-client/index.js +69 -69
  52. package/es/multi-chat-history/index.js +4 -4
  53. package/es/multi-chat-record/index.js +14 -14
  54. package/es/multi-chat-setting/index.js +22 -22
  55. package/es/multi-chat-sip/index.js +1 -1
  56. package/es/notification/index.js +8 -8
  57. package/es/page-header/index.js +8 -8
  58. package/es/pagination/index.js +8 -8
  59. package/es/popconfirm/index.js +8 -8
  60. package/es/popover/index.js +8 -8
  61. package/es/progress/index.js +8 -8
  62. package/es/radio/index.js +9 -9
  63. package/es/rate/index.js +8 -8
  64. package/es/result/index.js +8 -8
  65. package/es/row/index.js +8 -8
  66. package/es/scale-view/index.js +33 -33
  67. package/es/select/index.js +11 -11
  68. package/es/select-label/index.js +11 -11
  69. package/es/select-person/index.js +2 -2
  70. package/es/shortcut-setter/index.js +10 -10
  71. package/es/skeleton/index.js +8 -8
  72. package/es/slider/index.js +8 -8
  73. package/es/space/index.js +8 -8
  74. package/es/spin/index.js +8 -8
  75. package/es/statistic/index.js +8 -8
  76. package/es/steps/index.js +8 -8
  77. package/es/switch/index.js +8 -8
  78. package/es/table-filter/index.js +84 -73
  79. package/es/table-filter/style.css +1 -1
  80. package/es/tabs/index.js +8 -8
  81. package/es/tag/index.js +9 -9
  82. package/es/time-picker/index.js +8 -8
  83. package/es/timeline/index.js +8 -8
  84. package/es/tooltip/index.js +8 -8
  85. package/es/transfer/index.js +8 -8
  86. package/es/tree/index.js +8 -8
  87. package/es/tree-select/index.js +8 -8
  88. package/es/upload/index.js +8 -8
  89. package/es/verification-code/index.js +2 -2
  90. package/lib/cui.common.js +911 -2767
  91. package/lib/cui.umd.js +911 -2767
  92. package/lib/cui.umd.min.js +29 -29
  93. package/package.json +2 -1
  94. package/packages/big-table/src/components/AutoLayoutButton.vue +3 -3
  95. package/packages/fabric-chart/src/FabricChart.vue +0 -17
  96. package/packages/fabric-chart/src/FabricGrid.vue +3 -10
  97. package/packages/fabric-chart/src/components/TimeScaleValue.vue +10 -8
  98. package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
  99. package/packages/fabric-chart/src/fabric-chart/FabricLines.vue +2 -22
  100. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +41 -34
  101. package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +5 -6
  102. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +21 -16
  103. package/packages/fabric-chart/src/mixins/draw.js +2 -1
  104. package/packages/fabric-chart/src/mixins/fabricCommon.js +14 -4
  105. package/packages/scale-view/scaleView.vue +2010 -2010
  106. package/packages/table-filter/src/base-search-com/BaseSearch.vue +9 -0
  107. package/packages/fabric-chart/src/fabric-chart2/FabricBottom.vue +0 -108
  108. package/packages/fabric-chart/src/fabric-chart2/FabricCanvas.vue +0 -181
  109. package/packages/fabric-chart/src/fabric-chart2/FabricCenter.vue +0 -612
  110. package/packages/fabric-chart/src/fabric-chart2/FabricLeft.vue +0 -104
  111. package/packages/fabric-chart/src/fabric-chart2/FabricRight.vue +0 -112
  112. package/packages/fabric-chart/src/fabric-chart2/FabricTop.vue +0 -172
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "2.1.34",
3
+ "version": "2.1.35",
4
4
  "description": "前端业务UI库",
5
5
  "keyword": "cnhis-design-vue vue cnhis",
6
6
  "homepage": "http://dv.cnhis.com/",
@@ -76,6 +76,7 @@
76
76
  "eslint": "^6.8.0",
77
77
  "eslint-plugin-vue": "^6.2.2",
78
78
  "filemanager-webpack-plugin": "^2.0.5",
79
+ "git-flow": "^0.2.0",
79
80
  "highlight.js": "^10.7.2",
80
81
  "husky": "^4.3.7",
81
82
  "less": "^3.9.0",
@@ -177,12 +177,12 @@ export default {
177
177
  <a-icon type="more" style="cursor: pointer;" />
178
178
  <a-menu slot="overlay">
179
179
  {this.hideList.map((b, j) => {
180
- return (
180
+ return b ? (
181
181
  <a-menu-item key={b.sid} class="c_dropdown-btn" on-click={e => this.clickBtn(row, b, index, e.domEvent, j)}>
182
182
  {this.getBtnIcon(b)}
183
183
  {b.showStyle === 'only_icon' ? '' : this.handleName(b)}
184
184
  </a-menu-item>
185
- );
185
+ ): null;
186
186
  })}
187
187
  </a-menu>
188
188
  </a-dropdown>
@@ -238,7 +238,7 @@ export default {
238
238
  // 展示的按钮宽度和加上“更多按钮”的宽度大于容器的宽度,showList 最后一个按钮移动到 hideList
239
239
  if(this.hideList.length > 0 && (showBtnListWidth + 15 > wrapWidth)){
240
240
  let t = this.showList.pop();
241
- this.hideList.unshift(t);
241
+ t && this.hideList.unshift(t);
242
242
  }
243
243
  },
244
244
 
@@ -3,11 +3,6 @@
3
3
  <component ref="canvasEle" :is="`FabricCanvas${templateData.type || ''}`" :id="id" :templateData="templateData" v-if="rendercanvas">
4
4
  <template v-if="templateData.type">
5
5
  <fabric-grid></fabric-grid>
6
- <fabric-top2 :templateData="templateData"></fabric-top2>
7
- <fabric-left2 :templateData="templateData"></fabric-left2>
8
- <fabric-right2 :templateData="templateData"></fabric-right2>
9
- <fabric-bottom2 :templateData="templateData"></fabric-bottom2>
10
- <fabric-center2 :other="templateData.other" :polyline="templateData.left.leftYScalevalue" v-on="$listeners" @pointOperation="pointOperation"></fabric-center2>
11
6
  </template>
12
7
 
13
8
  <template v-else>
@@ -29,17 +24,11 @@
29
24
  */
30
25
  import create from '@/core/create';
31
26
  import FabricCanvas from './fabric-chart/FabricCanvas';
32
- import FabricCanvas2 from './fabric-chart2/FabricCanvas';
33
27
  import FabricPolylines from './fabric-chart/FabricPolylines';
34
28
  import FabricGrid from './FabricGrid';
35
29
  import FabricTextGroup from './fabric-chart/FabricTextGroup';
36
30
  import FabricScaleValue from './fabric-chart/FabricScaleValue';
37
31
  import FabricLines from './fabric-chart/FabricLines';
38
- import FabricTop2 from './fabric-chart2/FabricTop';
39
- import FabricLeft2 from './fabric-chart2/FabricLeft';
40
- import FabricRight2 from './fabric-chart2/FabricRight';
41
- import FabricBottom2 from './fabric-chart2/FabricBottom';
42
- import FabricCenter2 from './fabric-chart2/FabricCenter';
43
32
  import { isObject } from './mixins/type';
44
33
 
45
34
  export default create({
@@ -57,17 +46,11 @@ export default create({
57
46
  },
58
47
  components: {
59
48
  FabricCanvas,
60
- FabricCanvas2,
61
49
  FabricGrid,
62
50
  FabricTextGroup,
63
51
  FabricPolylines,
64
52
  FabricScaleValue,
65
53
  FabricLines,
66
- FabricTop2,
67
- FabricLeft2,
68
- FabricRight2,
69
- FabricBottom2,
70
- FabricCenter2
71
54
  },
72
55
  computed: {
73
56
  polylines() {
@@ -5,16 +5,10 @@ export default {
5
5
  name: 'fabric-grid',
6
6
  mixins: [fabricCommon, draw],
7
7
  data() {
8
- return {
9
- };
10
- },
11
- mounted() {
12
- this.$nextTick(() => {
13
- this.initGrid();
14
- });
8
+ return {};
15
9
  },
16
10
  methods: {
17
- initGrid() {
11
+ init() {
18
12
  // 主表格
19
13
  this.createGrid(this.propItems.originY, this.propItems.endY, this.propItems.gridYNumber, this.propItems.yCellHeight);
20
14
 
@@ -22,7 +16,6 @@ export default {
22
16
  if (!this.propItems.type) {
23
17
  this.createGrid(0, this.propItems.endYTop, this.propItems.gridYnumberTop, this.propItems.yCellHeightTop);
24
18
  }
25
-
26
19
  },
27
20
  createGrid(originY, endY, gridYNumber, yCellHeight) {
28
21
  const yList = [];
@@ -63,7 +56,7 @@ export default {
63
56
  });
64
57
  this.canvas.add(group);
65
58
  this.canvas.sendToBack(group);
66
- this.canvas.renderAll();
59
+ // this.canvas.renderAll();
67
60
  }
68
61
  },
69
62
  render(h) {
@@ -49,22 +49,23 @@ export default {
49
49
  };
50
50
  },
51
51
  mounted() {
52
- this.$nextTick(() => {
53
- setTimeout(() => {
54
- this.init();
55
- }, 0);
56
- });
52
+ this._timer = setInterval(() => {
53
+ if (document.readyState === 'complete') {
54
+ this.initDoc();
55
+ clearInterval(this._timer);
56
+ }
57
+ }, 500);
57
58
  },
58
59
  methods: {
59
- init() {
60
+ initDoc() {
60
61
  // this.to = this.templateData.top?.xScalevalue?.to || 'body';
61
62
  const { xScalevalue } = this.$attrs.templateData.top || {};
62
63
  const { canvasWidth, spaceHeight, xCellWidth } = this.propItems;
63
64
  this.cFabricChart = document.querySelector('.c-fabric-chart');
64
65
  // this.bodyHeight = document.body.getBoundingClientRect().height;
65
- this.top = this.cFabricChart.getBoundingClientRect().top;
66
+ this.top = this.cFabricChart?.getBoundingClientRect()?.top || 0;
66
67
  this.popupStyle = {
67
- left: `${this.cFabricChart.getBoundingClientRect().left}px`,
68
+ left: `${this.cFabricChart?.getBoundingClientRect()?.left || 0}px`,
68
69
  top: `${xScalevalue?.popupTop || 0}px`,
69
70
  width: `${canvasWidth}px`,
70
71
  height: `${spaceHeight}px`,
@@ -88,6 +89,7 @@ export default {
88
89
  }
89
90
  },
90
91
  beforeDestroy() {
92
+ this._timer && clearInterval(this._timer);
91
93
  window.removeEventListener('scroll', this.scroll, true);
92
94
  }
93
95
  };
@@ -1,59 +1,59 @@
1
- const data = {
2
- style: {
3
- evented: false,
4
- selectable: false
5
- },
6
- rectStyle: {
7
- fill: 'transparent',
8
- stroke: '#999',
9
- strokeWidth: 1
10
- },
11
- textStyle: {
12
- fontFamily: '微软雅黑',
13
- fontSize: 12,
14
- fill: '#000',
15
- lineHeight: 1
16
- },
17
- borderStyle: {
18
- stroke: '#999',
19
- strokeWidth: 1,
20
- selectable: false,
21
- evented: false
22
- },
23
- // 折线图中的点
24
- pointStyle: {
25
- fill: '#ffffff', // 填充色
26
- stroke: '#000000', // 描边色
27
- originX: 'center',
28
- originY: 'center'
29
- },
30
- // 折线图中的线
31
- lineStyle: {
32
- stroke: '#000', // 描边色
33
- strokeWidth: 1, // 描边宽度
34
- originX: 'center',
35
- originY: 'center'
36
- },
37
- topSpaceHeight: 10, // templateData.top.spaceHeight
38
- topSpaceGridNumber: 3, // templateData.top.xScalevalue.spaceGridNumber
39
- leftSpaceGridNumber: 2, // templateData.left.leftYScalevalue.spaceGridNumber
40
- rightSpaceGridNumber: 2, // templateData.right.rightYScalevalue.spaceGridNumber
41
- topTotal: {
42
- title: '总量',
43
- width: 0,
44
- style: {
45
- fontFamily: '微软雅黑',
46
- fontSize: 12,
47
- fill: '#000',
48
- lineHeight: 1
49
- }
50
- },
51
- criticalStyle: { // 危急值样式
52
- stroke: 'purple', // 颜色 默认 #999
53
- strokeWidth: 1, // 线宽 默认 1
54
- strokeDashArray: [0, 0] // 实线设置 默认[0, 0]
55
- },
56
- bottomNumberLeftSpace: 10 // 底部标记的序号与标记之间的距离
57
- };
58
-
59
- export default data;
1
+ const data = {
2
+ style: {
3
+ evented: false,
4
+ selectable: false
5
+ },
6
+ rectStyle: {
7
+ fill: 'transparent',
8
+ stroke: '#999',
9
+ strokeWidth: 1
10
+ },
11
+ textStyle: {
12
+ fontFamily: '微软雅黑',
13
+ fontSize: 12,
14
+ fill: '#000',
15
+ lineHeight: 1
16
+ },
17
+ borderStyle: {
18
+ stroke: '#999',
19
+ strokeWidth: 1,
20
+ selectable: false,
21
+ evented: false
22
+ },
23
+ // 折线图中的点
24
+ pointStyle: {
25
+ fill: '#ffffff', // 填充色
26
+ stroke: '#000000', // 描边色
27
+ originX: 'center',
28
+ originY: 'center'
29
+ },
30
+ // 折线图中的线
31
+ lineStyle: {
32
+ stroke: '#000', // 描边色
33
+ strokeWidth: 1, // 描边宽度
34
+ originX: 'center',
35
+ originY: 'center'
36
+ },
37
+ topSpaceHeight: 10, // templateData.top.spaceHeight
38
+ topSpaceGridNumber: 3, // templateData.top.xScalevalue.spaceGridNumber
39
+ leftSpaceGridNumber: 2, // templateData.left.leftYScalevalue.spaceGridNumber
40
+ rightSpaceGridNumber: 2, // templateData.right.rightYScalevalue.spaceGridNumber
41
+ topTotal: {
42
+ title: '总量',
43
+ width: 0,
44
+ style: {
45
+ fontFamily: '微软雅黑',
46
+ fontSize: 12,
47
+ fill: '#000',
48
+ lineHeight: 1
49
+ }
50
+ },
51
+ criticalStyle: { // 危急值样式
52
+ stroke: 'purple', // 颜色 默认 #999
53
+ strokeWidth: 1, // 线宽 默认 1
54
+ strokeDashArray: [0, 0] // 实线设置 默认[0, 0]
55
+ },
56
+ bottomNumberLeftSpace: 10 // 底部标记的序号与标记之间的距离
57
+ };
58
+
59
+ export default data;
@@ -47,27 +47,7 @@ export default {
47
47
  return this.linesObj?.eventStyle || { selectable: true, evented: true };
48
48
  }
49
49
  },
50
-
51
- watch: {
52
- // linesObj: {
53
- // handler(value) {
54
- // if (value) {
55
- // if (this.lines.length) {
56
- // this.removeLines();
57
- // }
58
- // this.getLineList(this.linesObj.list);
59
- // this.createLine();
60
- // }
61
- // },
62
- // deep: true
63
- // },
64
- },
65
-
66
- mounted() {
67
- this.$nextTick(() => {
68
- this.init();
69
- });
70
- },
50
+ mounted() {},
71
51
 
72
52
  methods: {
73
53
  init() {
@@ -394,7 +374,7 @@ export default {
394
374
  this.lineMoveLimit(line);
395
375
  this.lineMoveUpdateLine(line);
396
376
  this.textUpdatePositionX(line);
397
- this.canvas.renderAll();
377
+ // this.canvas.renderAll();
398
378
  this.showDrapPopup(line);
399
379
  });
400
380
  line.on('moved', () => {
@@ -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) {
@@ -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
 
@@ -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
  * 绘制一条折线
@@ -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中对应的坐标
@@ -614,8 +611,13 @@ export default {
614
611
  }
615
612
  this.$emit('pointChange', data);
616
613
  } else {
614
+ this.$nextTick(() => {
615
+ // 拖动新增节点时默认所有节点可删除
616
+ this.currentDelPoint = null;
617
+ });
617
618
  const lastPoint = this.addPointList.at(-1);
618
619
  const position = this.polyline[point.polylineTypeId].position;
620
+ const [firstPoint] = this.addPointList;
619
621
  // 如果是重合/连线节点
620
622
  if (point.get('scaleX') !== point.scale) {
621
623
  const addOjb = {
@@ -637,7 +639,7 @@ export default {
637
639
  this.repaintPolyline(position, point.polylineIndex);
638
640
  return;
639
641
  }
640
- !point.line2 && this.addPointList.splice(0, 1);
642
+ !point.line2 && firstPoint.left <= point.originLeft && this.addPointList.splice(0, 1);
641
643
  !point.id.includes('isTitle') && this.removePolyline(point.id);
642
644
  if (this.addPointList.length > 0) {
643
645
  this.$emit('pointOperation', 'increasePointBatch', this.addPointList);
@@ -660,7 +662,7 @@ export default {
660
662
  * @param {*} point 拖动的最后一个节点
661
663
  * @return {*}
662
664
  */
663
- async addPoint(point) {
665
+ addPoint(point) {
664
666
  const { xCellWidth, table, originX } = this.propItems;
665
667
  // const addPointSpaceGridNumbers = table.addPointSpaceGridNumbers || [];
666
668
  let addPointSpaceGridNumber = table.addPointSpaceGridNumber || 1;
@@ -673,7 +675,7 @@ export default {
673
675
  const spaceWidth = xCellWidth * addPointSpaceGridNumber;
674
676
  const residue = (left - originLeft) % spaceWidth;
675
677
 
676
- const condition = residue > spaceWidth - n || residue < n;
678
+ const condition = residue > 0 && (residue > spaceWidth - n || residue < n);
677
679
  const conditionNoLine2 = !point.line2 && left > originLeft;
678
680
  const conditionHasLine2 = point.line2 && left > originLeft + spaceWidth;
679
681
 
@@ -687,13 +689,14 @@ export default {
687
689
 
688
690
  const checkPoints = () => {
689
691
  const PointLens = Math.floor((left - originLeft) / spaceWidth);
690
- if (PointLens > 1 && this.addPointList?.length < PointLens) {
692
+ if (PointLens > 1 && this.addPointList?.length <= PointLens) {
691
693
  for (let k = 0; k < PointLens; k++) {
692
694
  if (k > 0) {
693
695
  const curLeft = originLeft + spaceWidth * k;
694
696
  // 判断this.addPointList中的left是否包含curLeft,不包含就说明是漏了
695
- const isNoLack = this.addPointList.some(v => v.left === curLeft);
696
- if (!isNoLack) {
697
+ // const hasPoint = this.addPointList.some(v => Math.abs(v.left - curLeft) <= 0.0001);
698
+ const hasPoint = this.addPointList.some(v => v.left == curLeft);
699
+ if (!hasPoint) {
697
700
  let index;
698
701
  const pointObj = this.addPointList.find((v, i) => {
699
702
  if (v.left > curLeft) {
@@ -703,11 +706,16 @@ export default {
703
706
  });
704
707
  if (pointObj) {
705
708
  let cloneObj = JSON.parse(JSON.stringify(pointObj));
709
+ const len = ~~((pointObj.left - (curLeft - spaceWidth)) / spaceWidth);
710
+ const prePoint = this.addPointList[index - 1] || pointObj;
711
+ const spaceHeight = (pointObj.top - prePoint.top) / len;
712
+ const position = this.polyline[point.polylineTypeId].position;
713
+ cloneObj.top = prePoint.top + spaceHeight;
706
714
  cloneObj.value.time = this.getXValue(curLeft);
715
+ cloneObj.value.value = this.getYValue(position, cloneObj.top);
707
716
  cloneObj.left = curLeft;
708
- // 补充的节点会和滑动的线条对应不上
709
- // await this.clonePoint(point, [curLeft, cloneObj.top, cloneObj.left, cloneObj.top])
710
717
  this.addPointList.splice(index, 0, cloneObj);
718
+ this.clonePoint(point, [prePoint.left, prePoint.top, cloneObj.left, cloneObj.top]);
711
719
  }
712
720
  }
713
721
  }
@@ -720,18 +728,20 @@ export default {
720
728
  if (conditionNoLine2 || conditionHasLine2) {
721
729
  // point.line1 && this.removePolyline(point.line1.id);
722
730
  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]));
731
+ this.addPointList.length == 0 && this.clonePoint(point, [point.line1 ? point.line1.x1 : originLeft, point.line1 ? point.line1.y1 : originTop, originLeft, originTop]);
724
732
  if (this.addPointList.every(v => v.left !== left)) {
725
733
  // const points1 = i === 1 ? [originLeft, originTop] : point.prePoints;
726
734
  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);
735
+ if (points1) {
736
+ // this.setAddPointList(point);
737
+ // 调用上面方法就会导致线段绘制失败,目前还不知道为啥子
738
+ const { data, x, y } = this.getValue(point);
739
+ data.value = { time: x, value: y };
740
+ data.left = left;
741
+ data.top = top;
742
+ this.addPointList.push(data);
743
+ this.clonePoint(point, [...points1, left, top]);
744
+ }
735
745
  }
736
746
  checkPoints();
737
747
  }
@@ -828,15 +838,12 @@ export default {
828
838
  scaleY: point.scale
829
839
  });
830
840
  clonedObj.hasControls = clonedObj.hasBorders = false;
831
- point.set({
832
- prePoints: [point.left, point.top]
833
- });
841
+ point.prePoints = [point.left, point.top];
834
842
  const line = this.drawLine([...points], { evented, selectable, ...lineAttr, polylineIndex, polylineTypeId, lineIndex });
835
843
  clonedObj.line1 = line;
836
844
  this.canvas.sendBackwards(line);
837
845
  clonedObj.bringForward();
838
846
  this.canvas.add(clonedObj);
839
- this.canvas.renderAll();
840
847
  resolve(clonedObj);
841
848
  });
842
849
  });
@@ -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;
@@ -437,17 +447,12 @@ export default {
437
447
  // this.canvas.add(...textList);
438
448
  },
439
449
  pointEvent(point) {
440
- point.on('mouseover', () => {
441
- this.showDrapPopup(point, true);
442
- });
443
- point.on('mouseout', () => {
444
- this.isDropVisible = false;
445
- });
450
+ this.setPopup(point);
446
451
  // 移动中 实时更新相关联的线的坐标
447
452
  if (this.eventStyle.evented) {
448
453
  point.on('moving', () => {
449
454
  this.moveLimit(point);
450
- this.canvas.renderAll();
455
+ // this.canvas.renderAll();
451
456
  this.showDrapPopup(point);
452
457
  });
453
458
  point.on('moved', () => {
@@ -115,7 +115,8 @@ export default {
115
115
  // });
116
116
  // fabric.loadSVGFromURL的工作方式相同,只不过您传递的是包含URL而不是SVG内容的字符串
117
117
  return new Promise((resolve, reject) => {
118
- const svg = document.querySelector(iconClassName).querySelector('svg');
118
+ const svg = document?.querySelector(iconClassName)?.querySelector('svg');
119
+ if (!svg) reject('图片转换svg失败!')
119
120
  svg.setAttribute('version', 1.1);
120
121
  svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
121
122
  svg.style.color = others.color || '#000';