cnhis-design-vue 2.1.29 → 2.1.30

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 (134) hide show
  1. package/CHANGELOG.md +19 -1
  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 +164 -164
  12. package/es/breadcrumb/index.js +8 -8
  13. package/es/button/index.js +31 -31
  14. package/es/calendar/index.js +8 -8
  15. package/es/captcha/index.js +3 -3
  16. package/es/card/index.js +8 -8
  17. package/es/carousel/index.js +8 -8
  18. package/es/cascader/index.js +8 -8
  19. package/es/checkbox/index.js +9 -9
  20. package/es/col/index.js +8 -8
  21. package/es/collapse/index.js +8 -8
  22. package/es/color-picker/index.js +1 -1
  23. package/es/comment/index.js +8 -8
  24. package/es/config-provider/index.js +8 -8
  25. package/es/date-picker/index.js +8 -8
  26. package/es/descriptions/index.js +8 -8
  27. package/es/divider/index.js +8 -8
  28. package/es/drag-layout/index.js +3 -3
  29. package/es/drawer/index.js +8 -8
  30. package/es/dropdown/index.js +8 -8
  31. package/es/editor/index.js +1 -1
  32. package/es/empty/index.js +8 -8
  33. package/es/fabric-chart/index.js +21 -30
  34. package/es/form/index.js +8 -8
  35. package/es/form-model/index.js +8 -8
  36. package/es/form-table/index.js +62 -62
  37. package/es/index/index.js +1283 -1085
  38. package/es/index/style.css +1 -1
  39. package/es/input/index.js +9 -9
  40. package/es/input-number/index.js +8 -8
  41. package/es/layout/index.js +8 -8
  42. package/es/list/index.js +8 -8
  43. package/es/locale-provider/index.js +8 -8
  44. package/es/map/index.js +9 -9
  45. package/es/mentions/index.js +8 -8
  46. package/es/menu/index.js +8 -8
  47. package/es/message/index.js +8 -8
  48. package/es/multi-chat/index.js +759 -562
  49. package/es/multi-chat/style.css +1 -1
  50. package/es/multi-chat-client/index.js +352 -220
  51. package/es/multi-chat-client/style.css +1 -1
  52. package/es/multi-chat-history/index.js +278 -38
  53. package/es/multi-chat-history/style.css +1 -1
  54. package/es/multi-chat-record/index.js +54 -18
  55. package/es/multi-chat-setting/index.js +75 -33
  56. package/es/multi-chat-sip/index.js +1 -1
  57. package/es/notification/index.js +8 -8
  58. package/es/page-header/index.js +8 -8
  59. package/es/pagination/index.js +8 -8
  60. package/es/popconfirm/index.js +8 -8
  61. package/es/popover/index.js +8 -8
  62. package/es/progress/index.js +8 -8
  63. package/es/radio/index.js +9 -9
  64. package/es/rate/index.js +8 -8
  65. package/es/result/index.js +8 -8
  66. package/es/row/index.js +8 -8
  67. package/es/scale-view/index.js +33 -33
  68. package/es/select/index.js +11 -11
  69. package/es/select-label/index.js +11 -11
  70. package/es/select-person/index.js +36 -28
  71. package/es/select-person/style.css +1 -1
  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 +74 -74
  81. package/es/tabs/index.js +8 -8
  82. package/es/tag/index.js +9 -9
  83. package/es/time-picker/index.js +8 -8
  84. package/es/timeline/index.js +8 -8
  85. package/es/tooltip/index.js +8 -8
  86. package/es/transfer/index.js +8 -8
  87. package/es/tree/index.js +8 -8
  88. package/es/tree-select/index.js +8 -8
  89. package/es/upload/index.js +8 -8
  90. package/es/utils/UniRTCv2.js +77 -11
  91. package/es/utils/trtc.js +19025 -0
  92. package/es/verification-code/index.js +2 -2
  93. package/lib/cui.common.js +26349 -6267
  94. package/lib/cui.umd.js +26349 -6267
  95. package/lib/cui.umd.min.js +149 -147
  96. package/package.json +1 -1
  97. package/packages/big-table/src/BigTable.vue +3044 -3044
  98. package/packages/big-table/src/utils/batchEditing.js +610 -610
  99. package/packages/big-table/src/utils/bigTableProps.js +95 -95
  100. package/packages/button/src/ButtonPrint/components/IdentityVerification.vue +181 -181
  101. package/packages/button/src/ButtonPrint/index.vue +739 -739
  102. package/packages/fabric-chart/src/components/TimeScaleValue.vue +113 -113
  103. package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
  104. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +3 -11
  105. package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +135 -135
  106. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +558 -558
  107. package/packages/fabric-chart/src/fabric-chart2/FabricTop.vue +172 -172
  108. package/packages/multi-chat/chat/audio.vue +18 -5
  109. package/packages/multi-chat/chat/chatFooter.vue +1594 -1594
  110. package/packages/multi-chat/chat/chatHeader.vue +4 -1
  111. package/packages/multi-chat/chat/chatHistory.vue +10 -2
  112. package/packages/multi-chat/chat/chatMain.vue +5 -0
  113. package/packages/multi-chat/chat/index.vue +29 -0
  114. package/packages/multi-chat/chat/mixins/uniRTCAPI.js +10 -7
  115. package/packages/multi-chat/chat/multiVideo.vue +16 -4
  116. package/packages/multi-chat/chat/quickReply.vue +439 -439
  117. package/packages/multi-chat/chat/scrollList.vue +9 -3
  118. package/packages/multi-chat/components/avatar.vue +64 -26
  119. package/packages/multi-chat/setting/baseInfo/index.vue +1316 -1316
  120. package/packages/multi-chat/store/actions.js +8 -4
  121. package/packages/multi-chat/store/state.js +112 -112
  122. package/packages/multi-chat/utils/index.js +25 -0
  123. package/packages/multi-chat/utils/rtc-client.js +23 -3
  124. package/packages/scale-view/formitem/r-choice.vue +714 -714
  125. package/packages/scale-view/scaleView.vue +2010 -2010
  126. package/packages/select-person/select-person.vue +9 -4
  127. package/packages/table-filter/src/components/c-tree-select/tree-select.vue +336 -336
  128. package/packages/table-filter/src/components/multi-select/multi-select.vue +219 -219
  129. package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +340 -340
  130. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +1825 -1825
  131. package/packages/table-filter/src/const/dataOptions.js +43 -43
  132. package/src/directive/preventReClick.js +12 -12
  133. package/src/utils/UniRTCv2.js +46 -13
  134. package/src/utils/trtc.js +1 -0
@@ -1,558 +1,558 @@
1
- <template>
2
- <div class="text-group">
3
- <MouseRightClick v-if="isRightVisible" :getContainer="getContainer" :nodeList="rightClickNode" :rightPos="rightPos" @nodeClick="handleRightClick" @closeRight="isRightVisible = false" />
4
- <DropPopup v-if="isDropVisible" :val="dropVal" :dropPos="dropPos" />
5
- </div>
6
- </template>
7
-
8
- <script>
9
- import fabricCommon from '../mixins/fabricCommon';
10
- import draw from '../mixins/draw';
11
- import defaultVaule from '../const/defaultVaule';
12
- import DropPopup from '../components/DropPopup';
13
- import MouseRightClick from '../components/MouseRightClick';
14
- import eventCommon from '../mixins/eventCommon';
15
-
16
- const rightClickNode = [
17
- { name: '修改', type: 'edit' },
18
- { name: '删除', type: 'delete' }
19
- ];
20
-
21
- let topTotalList = [];
22
- const getTopTotalList = (tree, topTotalList) => {
23
- tree.forEach(item => {
24
- if (item?.children?.length) {
25
- getTopTotalList(item.children, topTotalList);
26
- } else {
27
- const obj = JSON.parse(JSON.stringify(item));
28
- topTotalList.push(obj?.total || '');
29
- }
30
- });
31
- };
32
-
33
- export default {
34
- name: 'fabric-text-group',
35
- components: {
36
- DropPopup,
37
- MouseRightClick
38
- },
39
- mixins: [fabricCommon, draw, eventCommon],
40
- props: {
41
- templateData: {
42
- type: Object,
43
- required: true
44
- }
45
- },
46
- watch: {
47
- 'templateData.other': {
48
- handler(value) {
49
- if (value) {
50
- this.removeOther();
51
- this.drawTextDataGroup(value);
52
- this.canvas.renderAll();
53
- }
54
- },
55
- deep: true
56
- }
57
- },
58
- data() {
59
- return {
60
- leftStartX: 0,
61
- isDropVisible: false,
62
- dropVal: {},
63
- dropPos: { clientX: 0, clientY: 0 },
64
- isRightVisible: false,
65
- rightPos: { clientX: 0, clientY: 0 },
66
- rightClickNode: [],
67
- activeEvent: null // 当前可右键活动的对象
68
- };
69
- },
70
- mounted() {
71
- this.$nextTick(() => {
72
- this.init();
73
- });
74
- },
75
- computed: {
76
- girdLineStyle() {
77
- return Object.assign({}, defaultVaule.borderStyle, this.templateData.borderStyle || {});
78
- },
79
- eventStyle() {
80
- return this.propItems.eventStyle;
81
- }
82
- },
83
- methods: {
84
- init() {
85
- if (this.propItems.treeList?.length) {
86
- this.topTreeTextGroup(this.propItems.treeList);
87
- if (this.propItems.topTotal?.width) {
88
- topTotalList = [];
89
- getTopTotalList(this.templateData.top.list, topTotalList);
90
- this.drawTopTotal(topTotalList);
91
- }
92
- }
93
- this.templateData.left && this.drawLeftScaleGroup(this.templateData.left);
94
- this.templateData.other && this.drawTextDataGroup(this.templateData.other);
95
- this.eventStyle.evented && this.createEvent();
96
- this.drawBorder();
97
- this.canvas.renderAll();
98
- this.templateData.bottom && this.drawBottomTextDataGroup(this.templateData.bottom);
99
- },
100
- drawBorder() {
101
- const { endX, canvasWidth, canvasHeight, topTotal } = this.propItems;
102
- const curEndX = topTotal.width ? canvasWidth : endX;
103
- // 右 下两条线宽度和高度顶格不显示未发现具体原因 暂时减一处理
104
- // 上边线
105
- this.canvas.add(this.drawLine([0, 0, curEndX, 0], { ...this.girdLineStyle }));
106
- // 右边线
107
- this.canvas.add(this.drawLine([topTotal.width ? curEndX - 1 : curEndX, 0, topTotal.width ? curEndX - 1 : curEndX, canvasHeight], { ...this.girdLineStyle }));
108
- // 下边线
109
- this.canvas.add(this.drawLine([0, canvasHeight - 1, curEndX, canvasHeight - 1], { ...this.girdLineStyle }));
110
- // 左侧边框线
111
- this.canvas.add(this.drawLine([0, 0, 0, canvasHeight], { ...this.girdLineStyle }));
112
- },
113
- createEvent() {
114
- this.canvas.on('mouse:up', event => {
115
- if (event.button === 3) {
116
- const { x, y } = event.pointer;
117
- const { originX, originY, endX, endY } = this.$propItems();
118
- if (!(x < originX || x > endX || y < originY || y > endY)) {
119
- this.activeEvent = event;
120
- document.querySelector('.upper-canvas').addEventListener('contextmenu', this.addEventListenerContextmenu, true);
121
- }
122
- }
123
- });
124
- },
125
- // 打开右键菜单
126
- openRightModal(event) {
127
- this.rightPos = {
128
- clientX: event.e.clientX || event.e.pageX,
129
- clientY: event.e.clientY || event.e.pageY
130
- };
131
- this.isRightVisible = false;
132
- const target = event.target;
133
- const id = target ? target.id : '';
134
- this.$nextTick(() => {
135
- if (id && id.includes('_other')) {
136
- this._currentPoint = target || '';
137
- this.rightClickNode = Object.freeze(rightClickNode.slice());
138
- this.isRightVisible = true;
139
- }
140
- });
141
- },
142
- // 关闭右键菜单,打开添加节点弹窗表单
143
- handleRightClick({ type }) {
144
- this.isRightVisible = false;
145
- const text = this._currentPoint;
146
- this._currentPoint = '';
147
- const obj = {
148
- type: text.type,
149
- index: text.index,
150
- dataIndex: text.dataIndex
151
- };
152
- this.$emit(`${type}Other`, obj);
153
- },
154
- removeOther() {
155
- this.canvas.forEachObject(obj => {
156
- if (obj.id && obj.id.includes('_other')) {
157
- this.canvas.remove(obj);
158
- }
159
- });
160
- },
161
- drawTopTotal(topTotalList) {
162
- const { endX, canvasWidth, yCellHeightTop, topTotal, endYTop, spaceHeight } = this.propItems;
163
- const textList = [];
164
- const left = endX + (canvasWidth - endX) / 2;
165
- topTotalList.forEach((v, i) => {
166
- const top = i * yCellHeightTop + yCellHeightTop / 2;
167
- const text = v
168
- ? new this.fabric.Text(String(v), {
169
- ...defaultVaule.style,
170
- ...(topTotal.style || defaultVaule.textStyle),
171
- left,
172
- top,
173
- originX: 'center',
174
- originY: 'center'
175
- })
176
- : null;
177
- text && textList.push(text);
178
- });
179
- const title = this.drawTextGroup(
180
- { width: canvasWidth - endX, height: spaceHeight, strokeWidth: 1 },
181
- { text: String(topTotal.title), ...(topTotal.style || defaultVaule.textStyle) },
182
- { left: endX, top: endYTop }
183
- );
184
- this.canvas.add(...textList, title);
185
- },
186
- topTreeTextGroup(list) {
187
- list.forEach(item => {
188
- if (item?.children?.length) {
189
- this.canvas.add(
190
- this.drawTextGroup(
191
- { width: item.width, height: item.height, strokeWidth: 1 },
192
- { text: String(item.title), ...(this.templateData.top.treeTableTextStyle || {}) },
193
- { left: item.left, top: item.top }
194
- )
195
- );
196
- this.topTreeTextGroup(item.children);
197
- } else {
198
- // 此处的文本text的中心源的定位由于draw.js中封装反向的,所以此时文本需要向左排列originX值应为right
199
- this.canvas.add(
200
- this.drawTextGroup(
201
- { width: item.width, height: item.height, strokeWidth: 1 },
202
- { text: String(item.title), ...(this.templateData.top.treeTableTextStyle || {}), originX: 'right', left: -Math.floor(item.width / 2) + 5 },
203
- { left: item.left, top: item.top }
204
- )
205
- );
206
- }
207
- });
208
- },
209
-
210
- // 绘制x轴下方的数据
211
- drawTextDataGroup(obj) {
212
- if (obj.list) {
213
- this.drawTextDataGroupList(obj.list);
214
- }
215
- if (obj.colList) {
216
- this.drawTextDataGroupColList(obj.colList);
217
- }
218
- },
219
- drawTextDataGroupColList(colList) {
220
- const { originY } = this.propItems;
221
- let textList = [];
222
- colList.forEach((item, index) => {
223
- const baseTop = originY + (item.marginTop || 10);
224
- if (this.isLimit(item.scalevalue)) {
225
- item.dataList.forEach((v, i) => {
226
- const top = baseTop + i * (item.lineHeight || 15);
227
- const text = new this.fabric.Text(String(v.value), {
228
- ...defaultVaule.style,
229
- ...defaultVaule.textStyle,
230
- ...item.style,
231
- originX: 'left',
232
- originY: 'center',
233
- left: this.cumputedX(item.scalevalue),
234
- top,
235
- lockMovementX: true,
236
- lockMovementY: true,
237
- dataIndex: index,
238
- index: i,
239
- type: 'colList',
240
- id: `${index}_${i}_other_${Date.now()}`,
241
- ...this.eventStyle
242
- });
243
- text.hasControls = text.hasBorders = false;
244
- textList.push(text);
245
- });
246
- }
247
- });
248
- this.canvas.add(...textList);
249
- },
250
- drawTextDataGroupList(list) {
251
- let textList = [];
252
- const { originX, originY } = this.propItems;
253
- let top = originY + 10;
254
- list.forEach((item, index) => {
255
- const marginLeft = item.titleStyle?.marginLeft || 8;
256
- const left = originX - marginLeft; // 防止最左边的数据与名称显示重合了
257
-
258
- if (list[index - 1]) {
259
- top += item.lineHeight || 15;
260
- }
261
-
262
- const title = new this.fabric.Text(String(item.title), {
263
- ...defaultVaule.style,
264
- ...defaultVaule.textStyle,
265
- ...item.style,
266
- ...(item.titleStyle || {}),
267
- originX: 'right',
268
- originY: 'center',
269
- left,
270
- top,
271
- id: `${index}_other_${Date.now()}`
272
- });
273
- textList.push(title);
274
- item.dataList.forEach((v, i) => {
275
- if (this.isLimit(v.time)) {
276
- const text = new this.fabric.Text(String(v.value), {
277
- ...defaultVaule.style,
278
- ...defaultVaule.textStyle,
279
- ...item.style,
280
- originX: 'center',
281
- originY: 'center',
282
- left: this.cumputedX(v.time),
283
- top,
284
- lockMovementX: true,
285
- lockMovementY: true,
286
- dataIndex: index,
287
- index: i,
288
- type: 'list',
289
- id: `${index}_${i}_other_${Date.now()}`,
290
- ...this.eventStyle
291
- });
292
- text.hasControls = text.hasBorders = false;
293
- textList.push(text);
294
- }
295
- });
296
- });
297
- this.canvas.add(...textList);
298
- },
299
- // 判断当前时间是否超出网格区域
300
- isLimit(value) {
301
- const { xScaleList } = this.propItems;
302
- const minTime = Math.min(...xScaleList);
303
- const maxTime = Math.max(...xScaleList);
304
- const time = new Date(value).getTime();
305
- return time >= minTime && time <= maxTime;
306
- },
307
- removeMark() {
308
- this.canvas.forEachObject(obj => {
309
- if (obj.type && obj.type === 'mark') {
310
- this.canvas.remove(obj);
311
- }
312
- });
313
- },
314
- // 底部标记
315
- drawBottomTextDataGroup(obj) {
316
- if (!obj.list) {
317
- return;
318
- }
319
- const { endX, originX, endY, canvasHeight, topTotal } = this.propItems;
320
- topTotal.width && this.canvas.add(this.drawLine([endX, endY - 1, endX, canvasHeight], { ...this.defaultRectStyle }));
321
- // const textList = [];
322
- const marginLeft = this.templateData.left.leftYScalevalue.spaceGridNumber || defaultVaule.spaceGridNumber;
323
- const left = originX - marginLeft * 4; // 默认减去4倍的左边距,防止最左边的数据与名称显示重合了
324
- const title = new this.fabric.Text(String(obj.title), {
325
- ...defaultVaule.style,
326
- ...defaultVaule.textStyle,
327
- ...obj.style,
328
- originX: 'right',
329
- originY: 'center',
330
- left,
331
- top: endY + (canvasHeight - endY) / 2,
332
- type: 'mark'
333
- });
334
- this.canvas.add(title);
335
- // textList.push(title);
336
- const baseY = endY + 2; // 目前固定10像素的下边距
337
- const baseYLimit = endY - 2; // 目前固定10像素的上边距
338
- const lineHeightText = (obj.style?.fontSize || 12) + 2;
339
- const lineHeightImg = (obj.iconStyle?.height || 12) + 2;
340
- const lineHeightSeq = (obj.seqStyle?.circle?.radius || 9) * 2 + 2;
341
- obj.list.forEach((item, index) => {
342
- let limitIndex = -1; // 标志点是否往上排列的标志,大于-1则表示需要往上排列
343
- let y = baseY;
344
- const x = this.cumputedX(item[0]);
345
- if (this.isLimit(item[0])) {
346
- item[1].forEach(async (v, i) => {
347
- const common = {
348
- left: x,
349
- originX: 'center',
350
- originY: 'center',
351
- data: v.data || {},
352
- other: v.other || {},
353
- time: item[0],
354
- name: v.name,
355
- type: 'mark'
356
- };
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
- }
372
- const eventStyle = !this.eventStyle.evented
373
- ? {
374
- lockMovementX: true,
375
- lockMovementY: true
376
- }
377
- : {};
378
-
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
- if (this.isObject(v) && !v.value) {
386
- setTop(lineHeightImg);
387
- const option = Object.assign({}, obj.iconStyle || {}, v || {}, {
388
- ...common,
389
- ...eventStyle
390
- });
391
- let ele;
392
- if (v?.iconClassName) {
393
- ele = await this.createImage(v.iconClassName, v);
394
- }
395
- const img = await this.createPoint(v?.url || v?.iconClassName ? 'img' : v.type, {
396
- ele: ele || '',
397
- ...option
398
- });
399
- addCanvas(img);
400
- } else if (v.value) {
401
- if (v.seq) {
402
- setTop(lineHeightSeq);
403
- // 标记增加序号
404
- const circle = await this.createPoint('circle', {
405
- ...common,
406
- radius: 5,
407
- strokeWidth: 1,
408
- stroke: '#000',
409
- fill: 'transparent',
410
- ...(obj.seqStyle?.circle || {})
411
- });
412
- const text = new this.fabric.Text(String(v.value), {
413
- ...defaultVaule.textStyle,
414
- ...common,
415
- ...(obj.seqStyle?.text || {})
416
- });
417
- const group = new this.fabric.Group([circle, text], {
418
- ...common,
419
- // hoverCursor: 'default',
420
- ...eventStyle
421
- });
422
- addCanvas(group);
423
- } else {
424
- setTop(lineHeightText);
425
- const text = new this.fabric.Text(String(v.value), {
426
- ...defaultVaule.textStyle,
427
- ...obj.style,
428
- ...common,
429
- ...eventStyle
430
- });
431
- addCanvas(text);
432
- }
433
- }
434
- });
435
- }
436
- });
437
- // this.canvas.add(...textList);
438
- },
439
- pointEvent(point) {
440
- point.on('mouseover', () => {
441
- this.showDrapPopup(point, true);
442
- });
443
- point.on('mouseout', () => {
444
- this.isDropVisible = false;
445
- });
446
- // 移动中 实时更新相关联的线的坐标
447
- if (this.eventStyle.evented) {
448
- point.on('moving', () => {
449
- this.moveLimit(point);
450
- this.canvas.renderAll();
451
- this.showDrapPopup(point);
452
- });
453
- point.on('moved', () => {
454
- this.isDropVisible = false;
455
- const value = {
456
- data: point.data,
457
- oldVal: point.time,
458
- newVal: this.getXValue(point.left)
459
- };
460
- this.$emit('markChange', value);
461
- });
462
- }
463
- },
464
- moveLimit(point) {
465
- point.setCoords();
466
- const { originX, endX, originY, canvasHeight } = this.propItems;
467
- const bottom = this.templateData.bottom;
468
- // 如果是起始标记,如入手术室时间
469
- if (point.other?.isStart) {
470
- const newList = JSON.parse(JSON.stringify(bottom.list)).sort((a, b) => {
471
- return new Date(a[0]).getTime() - new Date(b[0]).getTime();
472
- });
473
- const obj = newList.find(v => {
474
- const isStart = v[1].some(k => k.other?.isStart);
475
- return !isStart && new Date(v[0]).getTime() >= new Date(point.time).getTime();
476
- });
477
- const limitRight = obj ? this.cumputedX(obj[0]) : endX;
478
- if (point.left > limitRight) {
479
- point.set('left', limitRight);
480
- }
481
- if (point.left < originX) {
482
- point.set('left', originX);
483
- }
484
- } else {
485
- const startList = bottom.list.find(v => v[1].some(k => k.other?.isStart));
486
- const leftId = point.other?.limitLeft;
487
- const limitLeftTime = leftId ? bottom.list.find(v => v[1].some(k => k.data?.id && k.data?.id === leftId))[0] : null;
488
- const rightId = point.other?.limitRight;
489
- const limitRightTime = rightId ? bottom.list.find(v => v[1].some(k => k.data?.id && k.data?.id === rightId))[0] : null;
490
- const limitLeft =
491
- (limitLeftTime && !startList) || (limitLeftTime && startList && new Date(limitLeftTime).getTime() >= new Date(startList[0]).getTime())
492
- ? this.cumputedX(limitLeftTime)
493
- : (!limitLeftTime && startList) || (limitLeftTime && startList && new Date(limitLeftTime).getTime() < new Date(startList[0]).getTime())
494
- ? this.cumputedX(startList[0])
495
- : originX;
496
- const limitRight = limitRightTime ? this.cumputedX(limitRightTime) : endX;
497
- if (point.left > limitRight) {
498
- point.set('left', limitRight);
499
- }
500
- if (point.left < limitLeft) {
501
- point.set('left', limitLeft);
502
- }
503
- }
504
- if (point.top > canvasHeight - 14) {
505
- point.set('top', canvasHeight - 14);
506
- }
507
- if (point.top < originY) {
508
- point.set('top', originY);
509
- }
510
- },
511
- showDrapPopup(point) {
512
- // 第二个参数表示需要展示提供的viewTime时间
513
- this.isDropVisible = true;
514
- this.dropPos = {
515
- left: point.left,
516
- top: point.top,
517
- margin: { top: this.propItems.yCellHeight }
518
- };
519
- const x = arguments.length > 1 && point.other?.viewTime ? point.other.viewTime : this.getXValue(point.left);
520
- this.dropVal = {
521
- title: point.name || '',
522
- list: [{ id: '1', name: '时间', value: x }]
523
- };
524
- },
525
-
526
- drawLeftScaleGroup(dataLeft) {
527
- this.drawLeftTitle(dataLeft);
528
- const { canvasHeight, originX, originY, treeTableminCellWidth } = this.propItems;
529
- let rect = new this.fabric.Rect({
530
- left: treeTableminCellWidth,
531
- top: originY,
532
- width: originX - treeTableminCellWidth,
533
- height: canvasHeight - originY,
534
- ...defaultVaule.rectStyle,
535
- ...defaultVaule.style,
536
- originX: 'left',
537
- originY: 'top'
538
- });
539
- rect.sendToBack(); // 向下跳底层
540
- this.canvas.add(rect);
541
- },
542
- drawLeftTitle(dataLeft) {
543
- if (dataLeft.title) {
544
- this.canvas.add(
545
- this.drawTextGroup(
546
- { width: this.propItems.treeTableminCellWidth, height: this.propItems.canvasHeight - this.propItems.originY },
547
- { text: String(dataLeft.title.split('').join('\n')), ...defaultVaule.textStyle, ...dataLeft.titleStyle },
548
- { left: 0, top: this.propItems.originY }
549
- )
550
- );
551
- }
552
- }
553
- }
554
- // render(h) {
555
- // return this.$slots.default ? h('div', this.$slots.default) : undefined;
556
- // }
557
- };
558
- </script>
1
+ <template>
2
+ <div class="text-group">
3
+ <MouseRightClick v-if="isRightVisible" :getContainer="getContainer" :nodeList="rightClickNode" :rightPos="rightPos" @nodeClick="handleRightClick" @closeRight="isRightVisible = false" />
4
+ <DropPopup v-if="isDropVisible" :val="dropVal" :dropPos="dropPos" />
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import fabricCommon from '../mixins/fabricCommon';
10
+ import draw from '../mixins/draw';
11
+ import defaultVaule from '../const/defaultVaule';
12
+ import DropPopup from '../components/DropPopup';
13
+ import MouseRightClick from '../components/MouseRightClick';
14
+ import eventCommon from '../mixins/eventCommon';
15
+
16
+ const rightClickNode = [
17
+ { name: '修改', type: 'edit' },
18
+ { name: '删除', type: 'delete' }
19
+ ];
20
+
21
+ let topTotalList = [];
22
+ const getTopTotalList = (tree, topTotalList) => {
23
+ tree.forEach(item => {
24
+ if (item?.children?.length) {
25
+ getTopTotalList(item.children, topTotalList);
26
+ } else {
27
+ const obj = JSON.parse(JSON.stringify(item));
28
+ topTotalList.push(obj?.total || '');
29
+ }
30
+ });
31
+ };
32
+
33
+ export default {
34
+ name: 'fabric-text-group',
35
+ components: {
36
+ DropPopup,
37
+ MouseRightClick
38
+ },
39
+ mixins: [fabricCommon, draw, eventCommon],
40
+ props: {
41
+ templateData: {
42
+ type: Object,
43
+ required: true
44
+ }
45
+ },
46
+ watch: {
47
+ 'templateData.other': {
48
+ handler(value) {
49
+ if (value) {
50
+ this.removeOther();
51
+ this.drawTextDataGroup(value);
52
+ this.canvas.renderAll();
53
+ }
54
+ },
55
+ deep: true
56
+ }
57
+ },
58
+ data() {
59
+ return {
60
+ leftStartX: 0,
61
+ isDropVisible: false,
62
+ dropVal: {},
63
+ dropPos: { clientX: 0, clientY: 0 },
64
+ isRightVisible: false,
65
+ rightPos: { clientX: 0, clientY: 0 },
66
+ rightClickNode: [],
67
+ activeEvent: null // 当前可右键活动的对象
68
+ };
69
+ },
70
+ mounted() {
71
+ this.$nextTick(() => {
72
+ this.init();
73
+ });
74
+ },
75
+ computed: {
76
+ girdLineStyle() {
77
+ return Object.assign({}, defaultVaule.borderStyle, this.templateData.borderStyle || {});
78
+ },
79
+ eventStyle() {
80
+ return this.propItems.eventStyle;
81
+ }
82
+ },
83
+ methods: {
84
+ init() {
85
+ if (this.propItems.treeList?.length) {
86
+ this.topTreeTextGroup(this.propItems.treeList);
87
+ if (this.propItems.topTotal?.width) {
88
+ topTotalList = [];
89
+ getTopTotalList(this.templateData.top.list, topTotalList);
90
+ this.drawTopTotal(topTotalList);
91
+ }
92
+ }
93
+ this.templateData.left && this.drawLeftScaleGroup(this.templateData.left);
94
+ this.templateData.other && this.drawTextDataGroup(this.templateData.other);
95
+ this.eventStyle.evented && this.createEvent();
96
+ this.drawBorder();
97
+ this.canvas.renderAll();
98
+ this.templateData.bottom && this.drawBottomTextDataGroup(this.templateData.bottom);
99
+ },
100
+ drawBorder() {
101
+ const { endX, canvasWidth, canvasHeight, topTotal } = this.propItems;
102
+ const curEndX = topTotal.width ? canvasWidth : endX;
103
+ // 右 下两条线宽度和高度顶格不显示未发现具体原因 暂时减一处理
104
+ // 上边线
105
+ this.canvas.add(this.drawLine([0, 0, curEndX, 0], { ...this.girdLineStyle }));
106
+ // 右边线
107
+ this.canvas.add(this.drawLine([topTotal.width ? curEndX - 1 : curEndX, 0, topTotal.width ? curEndX - 1 : curEndX, canvasHeight], { ...this.girdLineStyle }));
108
+ // 下边线
109
+ this.canvas.add(this.drawLine([0, canvasHeight - 1, curEndX, canvasHeight - 1], { ...this.girdLineStyle }));
110
+ // 左侧边框线
111
+ this.canvas.add(this.drawLine([0, 0, 0, canvasHeight], { ...this.girdLineStyle }));
112
+ },
113
+ createEvent() {
114
+ this.canvas.on('mouse:up', event => {
115
+ if (event.button === 3) {
116
+ const { x, y } = event.pointer;
117
+ const { originX, originY, endX, endY } = this.$propItems();
118
+ if (!(x < originX || x > endX || y < originY || y > endY)) {
119
+ this.activeEvent = event;
120
+ document.querySelector('.upper-canvas').addEventListener('contextmenu', this.addEventListenerContextmenu, true);
121
+ }
122
+ }
123
+ });
124
+ },
125
+ // 打开右键菜单
126
+ openRightModal(event) {
127
+ this.rightPos = {
128
+ clientX: event.e.clientX || event.e.pageX,
129
+ clientY: event.e.clientY || event.e.pageY
130
+ };
131
+ this.isRightVisible = false;
132
+ const target = event.target;
133
+ const id = target ? target.id : '';
134
+ this.$nextTick(() => {
135
+ if (id && id.includes('_other')) {
136
+ this._currentPoint = target || '';
137
+ this.rightClickNode = Object.freeze(rightClickNode.slice());
138
+ this.isRightVisible = true;
139
+ }
140
+ });
141
+ },
142
+ // 关闭右键菜单,打开添加节点弹窗表单
143
+ handleRightClick({ type }) {
144
+ this.isRightVisible = false;
145
+ const text = this._currentPoint;
146
+ this._currentPoint = '';
147
+ const obj = {
148
+ type: text.type,
149
+ index: text.index,
150
+ dataIndex: text.dataIndex
151
+ };
152
+ this.$emit(`${type}Other`, obj);
153
+ },
154
+ removeOther() {
155
+ this.canvas.forEachObject(obj => {
156
+ if (obj.id && obj.id.includes('_other')) {
157
+ this.canvas.remove(obj);
158
+ }
159
+ });
160
+ },
161
+ drawTopTotal(topTotalList) {
162
+ const { endX, canvasWidth, yCellHeightTop, topTotal, endYTop, spaceHeight } = this.propItems;
163
+ const textList = [];
164
+ const left = endX + (canvasWidth - endX) / 2;
165
+ topTotalList.forEach((v, i) => {
166
+ const top = i * yCellHeightTop + yCellHeightTop / 2;
167
+ const text = v
168
+ ? new this.fabric.Text(String(v), {
169
+ ...defaultVaule.style,
170
+ ...(topTotal.style || defaultVaule.textStyle),
171
+ left,
172
+ top,
173
+ originX: 'center',
174
+ originY: 'center'
175
+ })
176
+ : null;
177
+ text && textList.push(text);
178
+ });
179
+ const title = this.drawTextGroup(
180
+ { width: canvasWidth - endX, height: spaceHeight, strokeWidth: 1 },
181
+ { text: String(topTotal.title), ...(topTotal.style || defaultVaule.textStyle) },
182
+ { left: endX, top: endYTop }
183
+ );
184
+ this.canvas.add(...textList, title);
185
+ },
186
+ topTreeTextGroup(list) {
187
+ list.forEach(item => {
188
+ if (item?.children?.length) {
189
+ this.canvas.add(
190
+ this.drawTextGroup(
191
+ { width: item.width, height: item.height, strokeWidth: 1 },
192
+ { text: String(item.title), ...(this.templateData.top.treeTableTextStyle || {}) },
193
+ { left: item.left, top: item.top }
194
+ )
195
+ );
196
+ this.topTreeTextGroup(item.children);
197
+ } else {
198
+ // 此处的文本text的中心源的定位由于draw.js中封装反向的,所以此时文本需要向左排列originX值应为right
199
+ this.canvas.add(
200
+ this.drawTextGroup(
201
+ { width: item.width, height: item.height, strokeWidth: 1 },
202
+ { text: String(item.title), ...(this.templateData.top.treeTableTextStyle || {}), originX: 'right', left: -Math.floor(item.width / 2) + 5 },
203
+ { left: item.left, top: item.top }
204
+ )
205
+ );
206
+ }
207
+ });
208
+ },
209
+
210
+ // 绘制x轴下方的数据
211
+ drawTextDataGroup(obj) {
212
+ if (obj.list) {
213
+ this.drawTextDataGroupList(obj.list);
214
+ }
215
+ if (obj.colList) {
216
+ this.drawTextDataGroupColList(obj.colList);
217
+ }
218
+ },
219
+ drawTextDataGroupColList(colList) {
220
+ const { originY } = this.propItems;
221
+ let textList = [];
222
+ colList.forEach((item, index) => {
223
+ const baseTop = originY + (item.marginTop || 10);
224
+ if (this.isLimit(item.scalevalue)) {
225
+ item.dataList.forEach((v, i) => {
226
+ const top = baseTop + i * (item.lineHeight || 15);
227
+ const text = new this.fabric.Text(String(v.value), {
228
+ ...defaultVaule.style,
229
+ ...defaultVaule.textStyle,
230
+ ...item.style,
231
+ originX: 'left',
232
+ originY: 'center',
233
+ left: this.cumputedX(item.scalevalue),
234
+ top,
235
+ lockMovementX: true,
236
+ lockMovementY: true,
237
+ dataIndex: index,
238
+ index: i,
239
+ type: 'colList',
240
+ id: `${index}_${i}_other_${Date.now()}`,
241
+ ...this.eventStyle
242
+ });
243
+ text.hasControls = text.hasBorders = false;
244
+ textList.push(text);
245
+ });
246
+ }
247
+ });
248
+ this.canvas.add(...textList);
249
+ },
250
+ drawTextDataGroupList(list) {
251
+ let textList = [];
252
+ const { originX, originY } = this.propItems;
253
+ let top = originY + 10;
254
+ list.forEach((item, index) => {
255
+ const marginLeft = item.titleStyle?.marginLeft || 8;
256
+ const left = originX - marginLeft; // 防止最左边的数据与名称显示重合了
257
+
258
+ if (list[index - 1]) {
259
+ top += item.lineHeight || 15;
260
+ }
261
+
262
+ const title = new this.fabric.Text(String(item.title), {
263
+ ...defaultVaule.style,
264
+ ...defaultVaule.textStyle,
265
+ ...item.style,
266
+ ...(item.titleStyle || {}),
267
+ originX: 'right',
268
+ originY: 'center',
269
+ left,
270
+ top,
271
+ id: `${index}_other_${Date.now()}`
272
+ });
273
+ textList.push(title);
274
+ item.dataList.forEach((v, i) => {
275
+ if (this.isLimit(v.time)) {
276
+ const text = new this.fabric.Text(String(v.value), {
277
+ ...defaultVaule.style,
278
+ ...defaultVaule.textStyle,
279
+ ...item.style,
280
+ originX: 'center',
281
+ originY: 'center',
282
+ left: this.cumputedX(v.time),
283
+ top,
284
+ lockMovementX: true,
285
+ lockMovementY: true,
286
+ dataIndex: index,
287
+ index: i,
288
+ type: 'list',
289
+ id: `${index}_${i}_other_${Date.now()}`,
290
+ ...this.eventStyle
291
+ });
292
+ text.hasControls = text.hasBorders = false;
293
+ textList.push(text);
294
+ }
295
+ });
296
+ });
297
+ this.canvas.add(...textList);
298
+ },
299
+ // 判断当前时间是否超出网格区域
300
+ isLimit(value) {
301
+ const { xScaleList } = this.propItems;
302
+ const minTime = Math.min(...xScaleList);
303
+ const maxTime = Math.max(...xScaleList);
304
+ const time = new Date(value).getTime();
305
+ return time >= minTime && time <= maxTime;
306
+ },
307
+ removeMark() {
308
+ this.canvas.forEachObject(obj => {
309
+ if (obj.type && obj.type === 'mark') {
310
+ this.canvas.remove(obj);
311
+ }
312
+ });
313
+ },
314
+ // 底部标记
315
+ drawBottomTextDataGroup(obj) {
316
+ if (!obj.list) {
317
+ return;
318
+ }
319
+ const { endX, originX, endY, canvasHeight, topTotal } = this.propItems;
320
+ topTotal.width && this.canvas.add(this.drawLine([endX, endY - 1, endX, canvasHeight], { ...this.defaultRectStyle }));
321
+ // const textList = [];
322
+ const marginLeft = this.templateData.left.leftYScalevalue.spaceGridNumber || defaultVaule.spaceGridNumber;
323
+ const left = originX - marginLeft * 4; // 默认减去4倍的左边距,防止最左边的数据与名称显示重合了
324
+ const title = new this.fabric.Text(String(obj.title), {
325
+ ...defaultVaule.style,
326
+ ...defaultVaule.textStyle,
327
+ ...obj.style,
328
+ originX: 'right',
329
+ originY: 'center',
330
+ left,
331
+ top: endY + (canvasHeight - endY) / 2,
332
+ type: 'mark'
333
+ });
334
+ this.canvas.add(title);
335
+ // textList.push(title);
336
+ const baseY = endY + 2; // 目前固定10像素的下边距
337
+ const baseYLimit = endY - 2; // 目前固定10像素的上边距
338
+ const lineHeightText = (obj.style?.fontSize || 12) + 2;
339
+ const lineHeightImg = (obj.iconStyle?.height || 12) + 2;
340
+ const lineHeightSeq = (obj.seqStyle?.circle?.radius || 9) * 2 + 2;
341
+ obj.list.forEach((item, index) => {
342
+ let limitIndex = -1; // 标志点是否往上排列的标志,大于-1则表示需要往上排列
343
+ let y = baseY;
344
+ const x = this.cumputedX(item[0]);
345
+ if (this.isLimit(item[0])) {
346
+ item[1].forEach(async (v, i) => {
347
+ const common = {
348
+ left: x,
349
+ originX: 'center',
350
+ originY: 'center',
351
+ data: v.data || {},
352
+ other: v.other || {},
353
+ time: item[0],
354
+ name: v.name,
355
+ type: 'mark'
356
+ };
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
+ }
372
+ const eventStyle = !this.eventStyle.evented
373
+ ? {
374
+ lockMovementX: true,
375
+ lockMovementY: true
376
+ }
377
+ : {};
378
+
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
+ if (this.isObject(v) && !v.value) {
386
+ setTop(lineHeightImg);
387
+ const option = Object.assign({}, obj.iconStyle || {}, v || {}, {
388
+ ...common,
389
+ ...eventStyle
390
+ });
391
+ let ele;
392
+ if (v?.iconClassName) {
393
+ ele = await this.createImage(v.iconClassName, v);
394
+ }
395
+ const img = await this.createPoint(v?.url || v?.iconClassName ? 'img' : v.type, {
396
+ ele: ele || '',
397
+ ...option
398
+ });
399
+ addCanvas(img);
400
+ } else if (v.value) {
401
+ if (v.seq) {
402
+ setTop(lineHeightSeq);
403
+ // 标记增加序号
404
+ const circle = await this.createPoint('circle', {
405
+ ...common,
406
+ radius: 5,
407
+ strokeWidth: 1,
408
+ stroke: '#000',
409
+ fill: 'transparent',
410
+ ...(obj.seqStyle?.circle || {})
411
+ });
412
+ const text = new this.fabric.Text(String(v.value), {
413
+ ...defaultVaule.textStyle,
414
+ ...common,
415
+ ...(obj.seqStyle?.text || {})
416
+ });
417
+ const group = new this.fabric.Group([circle, text], {
418
+ ...common,
419
+ // hoverCursor: 'default',
420
+ ...eventStyle
421
+ });
422
+ addCanvas(group);
423
+ } else {
424
+ setTop(lineHeightText);
425
+ const text = new this.fabric.Text(String(v.value), {
426
+ ...defaultVaule.textStyle,
427
+ ...obj.style,
428
+ ...common,
429
+ ...eventStyle
430
+ });
431
+ addCanvas(text);
432
+ }
433
+ }
434
+ });
435
+ }
436
+ });
437
+ // this.canvas.add(...textList);
438
+ },
439
+ pointEvent(point) {
440
+ point.on('mouseover', () => {
441
+ this.showDrapPopup(point, true);
442
+ });
443
+ point.on('mouseout', () => {
444
+ this.isDropVisible = false;
445
+ });
446
+ // 移动中 实时更新相关联的线的坐标
447
+ if (this.eventStyle.evented) {
448
+ point.on('moving', () => {
449
+ this.moveLimit(point);
450
+ this.canvas.renderAll();
451
+ this.showDrapPopup(point);
452
+ });
453
+ point.on('moved', () => {
454
+ this.isDropVisible = false;
455
+ const value = {
456
+ data: point.data,
457
+ oldVal: point.time,
458
+ newVal: this.getXValue(point.left)
459
+ };
460
+ this.$emit('markChange', value);
461
+ });
462
+ }
463
+ },
464
+ moveLimit(point) {
465
+ point.setCoords();
466
+ const { originX, endX, originY, canvasHeight } = this.propItems;
467
+ const bottom = this.templateData.bottom;
468
+ // 如果是起始标记,如入手术室时间
469
+ if (point.other?.isStart) {
470
+ const newList = JSON.parse(JSON.stringify(bottom.list)).sort((a, b) => {
471
+ return new Date(a[0]).getTime() - new Date(b[0]).getTime();
472
+ });
473
+ const obj = newList.find(v => {
474
+ const isStart = v[1].some(k => k.other?.isStart);
475
+ return !isStart && new Date(v[0]).getTime() >= new Date(point.time).getTime();
476
+ });
477
+ const limitRight = obj ? this.cumputedX(obj[0]) : endX;
478
+ if (point.left > limitRight) {
479
+ point.set('left', limitRight);
480
+ }
481
+ if (point.left < originX) {
482
+ point.set('left', originX);
483
+ }
484
+ } else {
485
+ const startList = bottom.list.find(v => v[1].some(k => k.other?.isStart));
486
+ const leftId = point.other?.limitLeft;
487
+ const limitLeftTime = leftId ? bottom.list.find(v => v[1].some(k => k.data?.id && k.data?.id === leftId))[0] : null;
488
+ const rightId = point.other?.limitRight;
489
+ const limitRightTime = rightId ? bottom.list.find(v => v[1].some(k => k.data?.id && k.data?.id === rightId))[0] : null;
490
+ const limitLeft =
491
+ (limitLeftTime && !startList) || (limitLeftTime && startList && new Date(limitLeftTime).getTime() >= new Date(startList[0]).getTime())
492
+ ? this.cumputedX(limitLeftTime)
493
+ : (!limitLeftTime && startList) || (limitLeftTime && startList && new Date(limitLeftTime).getTime() < new Date(startList[0]).getTime())
494
+ ? this.cumputedX(startList[0])
495
+ : originX;
496
+ const limitRight = limitRightTime ? this.cumputedX(limitRightTime) : endX;
497
+ if (point.left > limitRight) {
498
+ point.set('left', limitRight);
499
+ }
500
+ if (point.left < limitLeft) {
501
+ point.set('left', limitLeft);
502
+ }
503
+ }
504
+ if (point.top > canvasHeight - 14) {
505
+ point.set('top', canvasHeight - 14);
506
+ }
507
+ if (point.top < originY) {
508
+ point.set('top', originY);
509
+ }
510
+ },
511
+ showDrapPopup(point) {
512
+ // 第二个参数表示需要展示提供的viewTime时间
513
+ this.isDropVisible = true;
514
+ this.dropPos = {
515
+ left: point.left,
516
+ top: point.top,
517
+ margin: { top: this.propItems.yCellHeight }
518
+ };
519
+ const x = arguments.length > 1 && point.other?.viewTime ? point.other.viewTime : this.getXValue(point.left);
520
+ this.dropVal = {
521
+ title: point.name || '',
522
+ list: [{ id: '1', name: '时间', value: x }]
523
+ };
524
+ },
525
+
526
+ drawLeftScaleGroup(dataLeft) {
527
+ this.drawLeftTitle(dataLeft);
528
+ const { canvasHeight, originX, originY, treeTableminCellWidth } = this.propItems;
529
+ let rect = new this.fabric.Rect({
530
+ left: treeTableminCellWidth,
531
+ top: originY,
532
+ width: originX - treeTableminCellWidth,
533
+ height: canvasHeight - originY,
534
+ ...defaultVaule.rectStyle,
535
+ ...defaultVaule.style,
536
+ originX: 'left',
537
+ originY: 'top'
538
+ });
539
+ rect.sendToBack(); // 向下跳底层
540
+ this.canvas.add(rect);
541
+ },
542
+ drawLeftTitle(dataLeft) {
543
+ if (dataLeft.title) {
544
+ this.canvas.add(
545
+ this.drawTextGroup(
546
+ { width: this.propItems.treeTableminCellWidth, height: this.propItems.canvasHeight - this.propItems.originY },
547
+ { text: String(dataLeft.title.split('').join('\n')), ...defaultVaule.textStyle, ...dataLeft.titleStyle },
548
+ { left: 0, top: this.propItems.originY }
549
+ )
550
+ );
551
+ }
552
+ }
553
+ }
554
+ // render(h) {
555
+ // return this.$slots.default ? h('div', this.$slots.default) : undefined;
556
+ // }
557
+ };
558
+ </script>