cnhis-design-vue 2.1.100 → 2.1.101
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.
- package/CHANGELOG.md +18 -0
- package/es/age/index.js +2 -2
- package/es/big-table/index.js +141 -101
- package/es/big-table/style.css +1 -1
- package/es/button/index.js +2 -2
- package/es/captcha/index.js +3 -3
- package/es/card-reader-sdk/index.js +1 -1
- package/es/checkbox/index.js +1 -1
- package/es/color-picker/index.js +1 -1
- package/es/drag-layout/index.js +3 -3
- package/es/editor/index.js +1 -1
- package/es/ellipsis/index.js +1 -1
- package/es/fabric-chart/index.js +414 -270
- package/es/fabric-chart/style.css +1 -1
- package/es/form-table/index.js +20 -20
- package/es/index/index.js +699 -515
- package/es/index/style.css +1 -1
- package/es/input/index.js +1 -1
- package/es/map/index.js +1 -1
- package/es/multi-chat/index.js +25 -25
- package/es/multi-chat-client/index.js +19 -19
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +4 -4
- package/es/multi-chat-setting/index.js +20 -20
- package/es/multi-chat-sip/index.js +1 -1
- package/es/radio/index.js +1 -1
- package/es/scale-container/index.js +1 -1
- package/es/scale-view/index.js +27 -27
- package/es/select/index.js +4 -4
- package/es/select-label/index.js +3 -3
- package/es/select-person/index.js +2 -2
- package/es/select-tag/index.js +4 -4
- package/es/shortcut-setter/index.js +2 -2
- package/es/table-filter/index.js +29 -29
- package/es/tag/index.js +1 -1
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +752 -568
- package/lib/cui.umd.js +752 -568
- package/lib/cui.umd.min.js +12 -12
- package/package.json +1 -1
- package/packages/big-table/src/BigTable.vue +33 -5
- package/packages/big-table/src/assets/style/table-global.less +3 -5
- package/packages/fabric-chart/src/FabricChart.vue +1 -1
- package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +10 -8
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +83 -47
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +85 -43
- package/packages/fabric-chart/src/mixins/draw.js +1 -1
package/package.json
CHANGED
|
@@ -170,6 +170,18 @@ import eventBroadcast from './utils/eventBroadcast';
|
|
|
170
170
|
import bigTableProps from './utils/bigTableProps';
|
|
171
171
|
import SvgIcon from '@/component/svg/index.vue';
|
|
172
172
|
import cloneDeep from 'lodash/cloneDeep';
|
|
173
|
+
const filterTopOffsetMap = {
|
|
174
|
+
large: 28,
|
|
175
|
+
medium: 24,
|
|
176
|
+
small: 22,
|
|
177
|
+
extrasmall: 20
|
|
178
|
+
}
|
|
179
|
+
const fontSizeMap = {
|
|
180
|
+
large: 1.25,
|
|
181
|
+
medium: 1.1,
|
|
182
|
+
small: 1,
|
|
183
|
+
extrasmall: 0.9
|
|
184
|
+
}
|
|
173
185
|
let addInlineEditPrimaryKey = '';
|
|
174
186
|
export default create({
|
|
175
187
|
name: 'big-table',
|
|
@@ -681,7 +693,7 @@ export default create({
|
|
|
681
693
|
i[`_${item}__redner_before_`] = {
|
|
682
694
|
isLink: col ? this.isLink(col, i) : undefined,
|
|
683
695
|
isCopy:col ? this.isCopy(col, i) : undefined,
|
|
684
|
-
tips:col ? this.handleValueTips(
|
|
696
|
+
tips:col ? this.handleValueTips(i, col) : undefined,
|
|
685
697
|
isHtml:this.checkHtml(i[item])
|
|
686
698
|
}
|
|
687
699
|
|
|
@@ -2130,7 +2142,9 @@ export default create({
|
|
|
2130
2142
|
if (this.isInlineOperating) return false;
|
|
2131
2143
|
let target = event.target;
|
|
2132
2144
|
const FILTER_BOX_WIDTH = 400;
|
|
2133
|
-
|
|
2145
|
+
let fontSize = this.styleSetting?.fontSize || 'small'
|
|
2146
|
+
const scaleNum = fontSizeMap[fontSize]
|
|
2147
|
+
const FILTER_BOX_TOP_OFFSET = filterTopOffsetMap[fontSize]
|
|
2134
2148
|
|
|
2135
2149
|
let transformWrap = document.body;
|
|
2136
2150
|
let { left: btnRectLeft, right: btnRectRight, top: btnRectTop, width: btnWidth } = target.getBoundingClientRect();
|
|
@@ -2141,12 +2155,16 @@ export default create({
|
|
|
2141
2155
|
let transformWrapWidth = transformWrap.clientWidth;
|
|
2142
2156
|
if (btnRectLeft + FILTER_BOX_WIDTH > transformWrapWidth) {
|
|
2143
2157
|
let transformWrapRight = transformWrap?.getBoundingClientRect().right || 0;
|
|
2144
|
-
|
|
2158
|
+
const right = transformWrapRight - btnRectRight - btnWidth / 2
|
|
2159
|
+
field.right = right / scaleNum + 'px';
|
|
2145
2160
|
} else {
|
|
2146
|
-
|
|
2161
|
+
const left = btnRectLeft + (this.filterLeftOffset || 0)
|
|
2162
|
+
field.left = left / scaleNum + 'px';
|
|
2147
2163
|
}
|
|
2148
2164
|
|
|
2149
|
-
|
|
2165
|
+
|
|
2166
|
+
const top = btnRectTop + FILTER_BOX_TOP_OFFSET + (this.filterTopOffset || 0)
|
|
2167
|
+
field.top = top / scaleNum + 'px';
|
|
2150
2168
|
|
|
2151
2169
|
field.visible = !field.visible;
|
|
2152
2170
|
|
|
@@ -2602,6 +2620,16 @@ export default create({
|
|
|
2602
2620
|
let table = this.$refs.xGrid;
|
|
2603
2621
|
if (!table) return;
|
|
2604
2622
|
let curRow = table?.getRowById(id);
|
|
2623
|
+
const {fullData} = table.getTableData()
|
|
2624
|
+
if(!curRow) {
|
|
2625
|
+
if(fullData?.length) {
|
|
2626
|
+
curRow = fullData.find(item => item[this.handleRowId] === id)
|
|
2627
|
+
if(!curRow) {
|
|
2628
|
+
let oId = row.__originItem__?.[this.handleRowId]
|
|
2629
|
+
oId && (curRow = fullData.find(item => item[this.handleRowId] === oId));
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2605
2633
|
if (!curRow) return;
|
|
2606
2634
|
this.handlerClickRow({ row: curRow });
|
|
2607
2635
|
},
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
position: fixed;
|
|
4
4
|
z-index: 99998;
|
|
5
5
|
transform: translateX(-2%);
|
|
6
|
-
margin-top: -6px;
|
|
7
6
|
|
|
8
7
|
// max-width: 400px;
|
|
9
8
|
min-width: 280px;
|
|
@@ -18,9 +17,7 @@
|
|
|
18
17
|
flex-direction: column;
|
|
19
18
|
overflow: hidden;
|
|
20
19
|
transition: width 2s;
|
|
21
|
-
|
|
22
|
-
margin-top: 6px;
|
|
23
|
-
}
|
|
20
|
+
padding-top: 8px;
|
|
24
21
|
.sort-item {
|
|
25
22
|
line-height: 32px;
|
|
26
23
|
padding: 0 13px;
|
|
@@ -76,6 +73,7 @@
|
|
|
76
73
|
|
|
77
74
|
.checkbox-box {
|
|
78
75
|
padding-right: 3px;
|
|
76
|
+
margin-top: 4px;
|
|
79
77
|
width: 100%;
|
|
80
78
|
}
|
|
81
79
|
.checkbox-wrap {
|
|
@@ -134,7 +132,7 @@
|
|
|
134
132
|
.checkbox-btn-wrap {
|
|
135
133
|
display: flex;
|
|
136
134
|
// justify-content: space-between;
|
|
137
|
-
padding:
|
|
135
|
+
padding: 8px 10px 8px 14px;
|
|
138
136
|
|
|
139
137
|
.checkbox-btn {
|
|
140
138
|
width: 56px;
|
|
@@ -63,7 +63,7 @@ export default create({
|
|
|
63
63
|
return list;
|
|
64
64
|
},
|
|
65
65
|
hasTopTable() {
|
|
66
|
-
return this.templateData.top?.
|
|
66
|
+
return typeof this.templateData.top?.show === 'undefined' || this.templateData.top?.show;
|
|
67
67
|
},
|
|
68
68
|
hasTable() {
|
|
69
69
|
const hasLeft = this.templateData.left?.leftYScalevalue?.list?.length > 0;
|
|
@@ -93,6 +93,7 @@ export default {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
this.throttleEvent = vexutils.throttle((event, componentInstance) => {
|
|
96
|
+
if (!componentInstance) return;
|
|
96
97
|
const { eventStyle = null, handleMoving = null } = componentInstance;
|
|
97
98
|
eventStyle.evented && handleMoving?.(event);
|
|
98
99
|
}, 50);
|
|
@@ -237,7 +238,7 @@ export default {
|
|
|
237
238
|
return this.templateData.table?.operable || { set: false, connect: false, lockMovementX: false };
|
|
238
239
|
},
|
|
239
240
|
fabricLinesInstances() {
|
|
240
|
-
return this.$slots.default.find(VNode => /lines/.test(VNode.tag))?.componentInstance;
|
|
241
|
+
return this.$slots.default.find(VNode => /fabric-lines/.test(VNode.tag))?.componentInstance;
|
|
241
242
|
},
|
|
242
243
|
fabricPolylinesInstances() {
|
|
243
244
|
// return this.$slots.default.filter(VNode => /(polylines)|(lines)/.test(VNode.tag));
|
|
@@ -249,15 +250,16 @@ export default {
|
|
|
249
250
|
},
|
|
250
251
|
methods: {
|
|
251
252
|
init() {
|
|
253
|
+
const { canvasWidth, canvasHeight, top } = this.templateData;
|
|
252
254
|
this.canvas = new this.fabric.Canvas(this.id, {
|
|
253
|
-
width:
|
|
254
|
-
height:
|
|
255
|
+
width: canvasWidth,
|
|
256
|
+
height: canvasHeight,
|
|
255
257
|
...this.canvasAttr
|
|
256
258
|
});
|
|
257
259
|
|
|
258
|
-
if (
|
|
259
|
-
this.getGridYnumberTop(
|
|
260
|
-
this.treeList = this.setTreeStyle(vexutils.clone(
|
|
260
|
+
if ((typeof top?.show === 'undefined' || top?.show) && top?.list?.length) {
|
|
261
|
+
this.getGridYnumberTop(top.list);
|
|
262
|
+
this.treeList = this.setTreeStyle(vexutils.clone(top.list, true));
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
this.canvas.on('mouse:move', event => {
|
|
@@ -269,10 +271,10 @@ export default {
|
|
|
269
271
|
this.fabricPolylinesInstances.isDropVisible = false;
|
|
270
272
|
} else if (x > originX && x < endX && y > originY && y < endY && !target) {
|
|
271
273
|
this.throttleEvent?.(event, this.fabricPolylinesInstances);
|
|
272
|
-
this.fabricLinesInstances.isDropVisible = false;
|
|
274
|
+
if (this.fabricLinesInstances) this.fabricLinesInstances.isDropVisible = false;
|
|
273
275
|
} else if (x <= originX || x >= endX || !((y > originY && y < endY) || (y > originYTop && y < endYTop))) {
|
|
274
276
|
this.fabricPolylinesInstances.isDropVisible = false;
|
|
275
|
-
this.fabricLinesInstances.isDropVisible = false;
|
|
277
|
+
if (this.fabricLinesInstances) this.fabricLinesInstances.isDropVisible = false;
|
|
276
278
|
}
|
|
277
279
|
});
|
|
278
280
|
},
|
|
@@ -37,7 +37,8 @@ function resetPointColor(pointArr, color) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
const setPointLineColor = (point, color, conditionHasLine2) => {
|
|
40
|
-
point.
|
|
40
|
+
const line1Color = color === 'transparent' ? color : point.prevPoint?.__attrs?.lineAttr?.stroke || color;
|
|
41
|
+
point.line1?.set({ stroke: line1Color });
|
|
41
42
|
conditionHasLine2 && point.line2?.set({ stroke: color });
|
|
42
43
|
};
|
|
43
44
|
|
|
@@ -153,8 +154,7 @@ export default {
|
|
|
153
154
|
// 左键松开鼠标-批量删除
|
|
154
155
|
this.isSelectArea = false;
|
|
155
156
|
if (event.button === 1 && this.selectArea) {
|
|
156
|
-
const
|
|
157
|
-
const { polylineList, otherList } = this.getAreaPonits(points);
|
|
157
|
+
const { polylineList, otherList } = this.getAreaPoints();
|
|
158
158
|
!polylineList.length && !otherList.length && this.removeSelectArea();
|
|
159
159
|
if (polylineList.length > 0 && this.selectArea) {
|
|
160
160
|
this.$emit('pointOperation', 'delete', polylineList);
|
|
@@ -166,7 +166,7 @@ export default {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
|
-
|
|
169
|
+
let startPos;
|
|
170
170
|
this.canvas.on('mouse:down', event => {
|
|
171
171
|
if (event.button !== 1) return;
|
|
172
172
|
|
|
@@ -209,12 +209,11 @@ export default {
|
|
|
209
209
|
|
|
210
210
|
if (!event.target) {
|
|
211
211
|
this.isSelectArea = true;
|
|
212
|
-
|
|
213
|
-
selectAreaOrigin.top = event.pointer.y;
|
|
212
|
+
startPos = event.pointer;
|
|
214
213
|
}
|
|
215
214
|
});
|
|
216
215
|
this.canvas.on('mouse:move', event => {
|
|
217
|
-
this.isSelectArea && this.createSelectArea(event,
|
|
216
|
+
this.isSelectArea && this.createSelectArea(event, startPos);
|
|
218
217
|
this.setTimeRange(event.pointer);
|
|
219
218
|
});
|
|
220
219
|
},
|
|
@@ -237,16 +236,19 @@ export default {
|
|
|
237
236
|
this.movingShowPopup(movingPopupContentList);
|
|
238
237
|
},
|
|
239
238
|
// 获取选区内包含的节点
|
|
240
|
-
|
|
239
|
+
getAreaPoints() {
|
|
241
240
|
const polylineList = [];
|
|
242
241
|
let otherList = [];
|
|
243
|
-
|
|
242
|
+
if (!this.selectArea?.areaPos) return { polylineList, otherList };
|
|
243
|
+
const { startPos, endPos } = this.selectArea.areaPos;
|
|
244
|
+
const [x1, x2] = [startPos.x, endPos.x].sort((a, b) => a - b);
|
|
245
|
+
const [y1, y2] = [startPos.y, endPos.y].sort((a, b) => a - b);
|
|
244
246
|
this.canvas.forEachObject(obj => {
|
|
245
247
|
const { id, left, top, currentDelPoint } = obj;
|
|
246
248
|
const isArea = left >= x1 && left <= x2 && top >= y1 && top <= y2;
|
|
247
249
|
if (isArea && this.isGridLimit(left, top) && id) {
|
|
248
250
|
if (/_polyline(Point)_/.test(id)) {
|
|
249
|
-
const data = this.
|
|
251
|
+
const data = this.getDataByPoint(obj);
|
|
250
252
|
if (currentDelPoint) {
|
|
251
253
|
if (currentDelPoint.polylineIndex == obj.polylineIndex) {
|
|
252
254
|
polylineList.push(data);
|
|
@@ -271,10 +273,10 @@ export default {
|
|
|
271
273
|
return { polylineList, otherList };
|
|
272
274
|
},
|
|
273
275
|
// 创建选区
|
|
274
|
-
createSelectArea(event,
|
|
276
|
+
createSelectArea(event, startPos) {
|
|
275
277
|
this.selectArea && this.canvas.remove(this.selectArea);
|
|
276
|
-
const
|
|
277
|
-
const
|
|
278
|
+
const { x: x1, y: y1 } = startPos;
|
|
279
|
+
const { x: x2, y: y2 } = event.pointer;
|
|
278
280
|
this.selectArea = new this.fabric.Rect({
|
|
279
281
|
...defaultVaule.style,
|
|
280
282
|
fill: '#CAF982',
|
|
@@ -282,9 +284,9 @@ export default {
|
|
|
282
284
|
left: x1,
|
|
283
285
|
top: y1,
|
|
284
286
|
width: x2 - x1,
|
|
285
|
-
height: y2 - y1
|
|
286
|
-
ponits: x1 < x2 ? [x1, y1, x2, y2] : [x2, y2, x1, y1]
|
|
287
|
+
height: y2 - y1
|
|
287
288
|
});
|
|
289
|
+
this.selectArea.areaPos = { startPos, endPos: event.pointer };
|
|
288
290
|
this.canvas.add(this.selectArea);
|
|
289
291
|
},
|
|
290
292
|
createTimeRangeLine(line, pointer) {
|
|
@@ -332,7 +334,16 @@ export default {
|
|
|
332
334
|
|
|
333
335
|
this.polyline.forEach((item, index) => {
|
|
334
336
|
item.dataList.forEach((v, i) => {
|
|
335
|
-
|
|
337
|
+
let targetList = v.list;
|
|
338
|
+
let linkKey = '';
|
|
339
|
+
if (v.linkKey) {
|
|
340
|
+
const target = item.dataList.find(_data => _data.key === v.linkKey);
|
|
341
|
+
if (target) {
|
|
342
|
+
targetList = target.list;
|
|
343
|
+
linkKey = v.linkKey;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const point = targetList.find(k => isEffectiveNode(k) && new Date(k.time).getTime() >= minTime && new Date(k.time).getTime() <= maxTime);
|
|
336
347
|
const firstPointLeft = point ? this.cumputedX(point.time) : 0;
|
|
337
348
|
const rightLimit = point ? firstPointLeft - this.spaceWidth : '';
|
|
338
349
|
// 配置是否可拖动标题图标批量增加-
|
|
@@ -345,7 +356,14 @@ export default {
|
|
|
345
356
|
polylineTypeId: index,
|
|
346
357
|
polylineIndex: i,
|
|
347
358
|
isAdd,
|
|
348
|
-
rightLimit
|
|
359
|
+
rightLimit,
|
|
360
|
+
__attrs: {
|
|
361
|
+
title: v.title,
|
|
362
|
+
pointAttr: v.pointAttr,
|
|
363
|
+
lineAttr: v.pointAttr,
|
|
364
|
+
key: v.key,
|
|
365
|
+
linkKey
|
|
366
|
+
}
|
|
349
367
|
});
|
|
350
368
|
});
|
|
351
369
|
});
|
|
@@ -398,7 +416,8 @@ export default {
|
|
|
398
416
|
polylineTypeId: v.polylineTypeId,
|
|
399
417
|
polylineIndex: v.polylineIndex,
|
|
400
418
|
...(v.isAdd && this.eventStyle.evented ? {} : eventStyle),
|
|
401
|
-
rightLimit: v.rightLimit || ''
|
|
419
|
+
rightLimit: v.rightLimit || '',
|
|
420
|
+
__attrs: v.__attrs
|
|
402
421
|
};
|
|
403
422
|
let ele;
|
|
404
423
|
if (v.type === 'img' && v.pointAttr?.iconClassName) {
|
|
@@ -590,8 +609,7 @@ export default {
|
|
|
590
609
|
*/
|
|
591
610
|
drawPolyline(polyline, polylineIndex, polylineType, polylineTypeId) {
|
|
592
611
|
const { originY, endY } = this.propItems;
|
|
593
|
-
const {
|
|
594
|
-
this._iconClassName = polyline.type === 'img' && pointAttr.iconClassName ? pointAttr.iconClassName : '';
|
|
612
|
+
const { list = [], critical = {}, diffValue = {} } = polyline;
|
|
595
613
|
|
|
596
614
|
const pointList = [];
|
|
597
615
|
let lineList = [];
|
|
@@ -609,6 +627,16 @@ export default {
|
|
|
609
627
|
}
|
|
610
628
|
this.flickerablePoints = this.flickerablePoints.filter(point => point.polylineTypeId !== polylineTypeId && point.polylineIndex !== polylineIndex);
|
|
611
629
|
list.forEach((linePoints, index) => {
|
|
630
|
+
let { pointAttr, lineAttr = {}, type, title } = polyline;
|
|
631
|
+
const target = polylineType.dataList.find(_data => linePoints.key && _data.key === linePoints.key);
|
|
632
|
+
if (target) {
|
|
633
|
+
type = target.type;
|
|
634
|
+
pointAttr = target.pointAttr;
|
|
635
|
+
lineAttr = target.lineAttr;
|
|
636
|
+
title = target.title;
|
|
637
|
+
}
|
|
638
|
+
this._iconClassName = polyline.type === 'img' && pointAttr.iconClassName ? pointAttr.iconClassName : '';
|
|
639
|
+
|
|
612
640
|
// 当前点
|
|
613
641
|
let { points, isInit } = getPointer(linePoints);
|
|
614
642
|
|
|
@@ -627,9 +655,16 @@ export default {
|
|
|
627
655
|
originLeft: points[0],
|
|
628
656
|
originTop: points[1],
|
|
629
657
|
time: linePoints.time,
|
|
630
|
-
__value: linePoints.value
|
|
658
|
+
__value: linePoints.value,
|
|
659
|
+
__attrs: {
|
|
660
|
+
type,
|
|
661
|
+
pointAttr,
|
|
662
|
+
lineAttr,
|
|
663
|
+
title,
|
|
664
|
+
key: linePoints.key
|
|
665
|
+
}
|
|
631
666
|
});
|
|
632
|
-
point = previousLine ? this.drawPoint(...points, previousLine, line,
|
|
667
|
+
point = previousLine ? this.drawPoint(...points, previousLine, line, type, pointOthers, isInit) : this.drawPoint(...points, null, line, type, pointOthers, isInit);
|
|
633
668
|
}
|
|
634
669
|
lineList.push(line);
|
|
635
670
|
point && pointList.push(point);
|
|
@@ -649,7 +684,6 @@ export default {
|
|
|
649
684
|
polylineTypeId,
|
|
650
685
|
polylineIndex,
|
|
651
686
|
pointerList,
|
|
652
|
-
color: lineAttr.stroke,
|
|
653
687
|
pointList: res
|
|
654
688
|
});
|
|
655
689
|
}
|
|
@@ -769,7 +803,7 @@ export default {
|
|
|
769
803
|
const { operable } = this.propItems;
|
|
770
804
|
const { data, x, y } = this.getValue(point);
|
|
771
805
|
Object.assign(data, {
|
|
772
|
-
value: { time: operable.lockMovementX ? point.time : x, value: y },
|
|
806
|
+
value: { time: operable.lockMovementX ? point.time : x, value: y, ...(point.__attrs?.key ? { key: point.__attrs.key } : {}) },
|
|
773
807
|
isInit
|
|
774
808
|
});
|
|
775
809
|
if (this.addPointList.length === 0) {
|
|
@@ -800,7 +834,8 @@ export default {
|
|
|
800
834
|
...lastPoint,
|
|
801
835
|
value: {
|
|
802
836
|
time: this.getXValue(this._concatPoint?.left),
|
|
803
|
-
value: this.getYValue(position, this._concatPoint?.top)
|
|
837
|
+
value: this.getYValue(position, this._concatPoint?.top),
|
|
838
|
+
...(point.__attrs?.key ? { key: point.__attrs.key } : {})
|
|
804
839
|
}
|
|
805
840
|
};
|
|
806
841
|
if (lastPoint.value.time == addOjb.value.time) {
|
|
@@ -828,9 +863,10 @@ export default {
|
|
|
828
863
|
// 设置批量新增数据
|
|
829
864
|
setAddPointList(point) {
|
|
830
865
|
const { data, x, y } = this.getValue(point);
|
|
831
|
-
data.value = { time: x, value: y };
|
|
866
|
+
data.value = { time: x, value: y, ...(point.__attrs.linkKey ? { key: point.__attrs.key } : {}) };
|
|
832
867
|
data.left = point.left;
|
|
833
868
|
data.top = top;
|
|
869
|
+
if (point.__attrs.linkKey) data.linkKey = point.__attrs.linkKey;
|
|
834
870
|
this.addPointList.push(data);
|
|
835
871
|
},
|
|
836
872
|
// 纠正线段坐标
|
|
@@ -881,6 +917,7 @@ export default {
|
|
|
881
917
|
cloneObj.top = prePoint.top + spaceHeight;
|
|
882
918
|
cloneObj.value.time = this.getXValue(curLeft);
|
|
883
919
|
cloneObj.value.value = this.getYValue(position, cloneObj.top);
|
|
920
|
+
if (point.__attrs.key) cloneObj.value.key = point.__attrs.key;
|
|
884
921
|
cloneObj.left = curLeft;
|
|
885
922
|
this.addPointList.splice(index, 0, cloneObj);
|
|
886
923
|
this.clonePoint(point, [prePoint.left, prePoint.top, cloneObj.left, cloneObj.top]);
|
|
@@ -931,6 +968,7 @@ export default {
|
|
|
931
968
|
// 调用上面方法就会导致线段绘制失败,目前还不知道为啥子
|
|
932
969
|
const { data, x, y } = this.getValue(point);
|
|
933
970
|
data.value = { time: x, value: y };
|
|
971
|
+
if (point.__attrs.key) data.value.key = point.__attrs.key;
|
|
934
972
|
data.left = left;
|
|
935
973
|
data.top = top;
|
|
936
974
|
// 避免重复添加
|
|
@@ -965,6 +1003,7 @@ export default {
|
|
|
965
1003
|
|
|
966
1004
|
// 检查是否显示重合连线放大节点的标识
|
|
967
1005
|
const { polylineTypeId, polylineIndex } = point;
|
|
1006
|
+
const color = point.__attrs.lineAttr.stroke;
|
|
968
1007
|
const polylineObj = this.polylinePointList.find(v => v.polylineTypeId == polylineTypeId && v.polylineIndex == polylineIndex);
|
|
969
1008
|
polylineObj?.pointList.forEach(v => v.bringToFront());
|
|
970
1009
|
if (point.nextPoint) {
|
|
@@ -987,12 +1026,13 @@ export default {
|
|
|
987
1026
|
resetPointColor([obj], '#999');
|
|
988
1027
|
obj.line2?.set({ stroke: '#999' });
|
|
989
1028
|
} else {
|
|
990
|
-
|
|
991
|
-
obj
|
|
1029
|
+
const color = obj.__attrs.lineAttr.stroke;
|
|
1030
|
+
resetPointColor([obj], color);
|
|
1031
|
+
obj.line2?.set({ stroke: color });
|
|
992
1032
|
}
|
|
993
1033
|
});
|
|
994
1034
|
if ((point.line1 || point.line2) && left < originLeft + this.spaceWidth) {
|
|
995
|
-
setPointLineColor(point,
|
|
1035
|
+
setPointLineColor(point, color, true);
|
|
996
1036
|
} else {
|
|
997
1037
|
setPointLineColor(point, 'transparent', true);
|
|
998
1038
|
}
|
|
@@ -1004,7 +1044,7 @@ export default {
|
|
|
1004
1044
|
this.addPointList = this.addPointList.filter(v => v.left < left);
|
|
1005
1045
|
const endLength = this.addPointList.length;
|
|
1006
1046
|
if (endLength === 0) {
|
|
1007
|
-
setPointLineColor(point,
|
|
1047
|
+
setPointLineColor(point, color, conditionHasLine2);
|
|
1008
1048
|
this.removePolyline('increasePointBatch', originLeft);
|
|
1009
1049
|
}
|
|
1010
1050
|
if (endLength > 0) {
|
|
@@ -1015,26 +1055,23 @@ export default {
|
|
|
1015
1055
|
}
|
|
1016
1056
|
},
|
|
1017
1057
|
clonePoint(point, points) {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
lineIndex = point.pointIndex;
|
|
1022
|
-
polylineIndex = point.polylineIndex;
|
|
1023
|
-
polylineTypeId = point.polylineTypeId;
|
|
1058
|
+
const { lineIndex, polylineIndex, lineAttr, polylineTypeId, originLeft } = point;
|
|
1059
|
+
const currentLineAttr = originLeft === points[2] && point.prevPoint ? point.prevPoint.__attrs.lineAttr : lineAttr;
|
|
1060
|
+
|
|
1024
1061
|
point.clone(clonedObj => {
|
|
1025
1062
|
clonedObj.set({
|
|
1026
1063
|
left: points[2],
|
|
1027
1064
|
top: points[3],
|
|
1028
1065
|
idClone: 'increasePointBatch',
|
|
1029
|
-
id: '_polylinePoint_'
|
|
1066
|
+
id: '_polylinePoint_',
|
|
1030
1067
|
polylineTypeId,
|
|
1031
|
-
polylineIndex
|
|
1068
|
+
polylineIndex,
|
|
1032
1069
|
scaleX: point.scale || 1,
|
|
1033
1070
|
scaleY: point.scale || 1
|
|
1034
1071
|
});
|
|
1035
1072
|
clonedObj.hasControls = clonedObj.hasBorders = false;
|
|
1036
1073
|
point.prePoints = [point.left, point.top];
|
|
1037
|
-
const line = this.drawLine([...points], { evented, selectable, ...
|
|
1074
|
+
const line = this.drawLine([...points], { evented: false, selectable: false, ...currentLineAttr, polylineIndex, polylineTypeId, lineIndex });
|
|
1038
1075
|
clonedObj.line1 = line;
|
|
1039
1076
|
this.canvas.add(clonedObj);
|
|
1040
1077
|
this.canvas.sendBackwards(line);
|
|
@@ -1045,7 +1082,7 @@ export default {
|
|
|
1045
1082
|
getValue(point) {
|
|
1046
1083
|
const x = this.getXValue(point.left);
|
|
1047
1084
|
if (point.id) {
|
|
1048
|
-
const data = this.
|
|
1085
|
+
const data = this.getDataByPoint(point);
|
|
1049
1086
|
const position = data.position;
|
|
1050
1087
|
const y = this.getYValue(position, point.top);
|
|
1051
1088
|
return { data, x, y };
|
|
@@ -1160,9 +1197,8 @@ export default {
|
|
|
1160
1197
|
// 关闭右键菜单,打开添加节点弹窗表单
|
|
1161
1198
|
handleRightClick({ type, name }) {
|
|
1162
1199
|
this.isRightVisible = false;
|
|
1163
|
-
const id = this._currentPoint?.id;
|
|
1164
1200
|
const { left, top } = this._active;
|
|
1165
|
-
let data = id ? this.
|
|
1201
|
+
let data = this._currentPoint?.id ? this.getDataByPoint(this._currentPoint) : this.getValue({ left, top });
|
|
1166
1202
|
if (type == 'add') {
|
|
1167
1203
|
if (name.includes('左')) {
|
|
1168
1204
|
data.range = {
|
|
@@ -1180,16 +1216,16 @@ export default {
|
|
|
1180
1216
|
this.$emit('pointOperation', type, data);
|
|
1181
1217
|
this._currentPoint = null;
|
|
1182
1218
|
},
|
|
1183
|
-
|
|
1184
|
-
const arr = id.replace(/_?[a-zA-Z]+.+$/, '').split('_');
|
|
1219
|
+
getDataByPoint(point) {
|
|
1220
|
+
const arr = point.id.replace(/_?[a-zA-Z]+.+$/, '').split('_');
|
|
1185
1221
|
const [typeIndex, lineIndex, pointIndex] = arr;
|
|
1186
1222
|
const data = this.polyline[typeIndex];
|
|
1187
1223
|
const value = data?.dataList?.[lineIndex]?.list?.[pointIndex]?.data || '';
|
|
1188
1224
|
return {
|
|
1189
|
-
title:
|
|
1225
|
+
title: point.__attrs.title,
|
|
1190
1226
|
position: data.position,
|
|
1191
|
-
dataIndex: lineIndex,
|
|
1192
|
-
pointIndex: pointIndex,
|
|
1227
|
+
dataIndex: +lineIndex,
|
|
1228
|
+
pointIndex: +pointIndex,
|
|
1193
1229
|
data: value
|
|
1194
1230
|
};
|
|
1195
1231
|
},
|