cnhis-design-vue 2.1.18 → 2.1.21
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 +51 -0
- package/es/age/index.js +2 -2
- package/es/big-table/index.js +112 -134
- package/es/big-table/style.css +1 -1
- package/es/button/index.js +35 -38
- package/es/captcha/index.js +3 -3
- package/es/checkbox/index.js +1 -1
- package/es/color-picker/index.js +1 -1
- package/es/drag-layout/index.js +36 -39
- package/es/editor/index.js +11 -31
- package/es/fabric-chart/index.js +491 -393
- package/es/fabric-chart/style.css +1 -1
- package/es/form-table/index.js +62 -85
- package/es/index/index.js +971 -807
- 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 +210 -196
- package/es/multi-chat/style.css +1 -1
- package/es/multi-chat-client/index.js +203 -189
- package/es/multi-chat-client/style.css +1 -1
- package/es/multi-chat-history/index.js +37 -40
- package/es/multi-chat-record/index.js +37 -40
- package/es/multi-chat-setting/index.js +54 -57
- package/es/multi-chat-sip/index.js +1 -1
- package/es/radio/index.js +1 -1
- package/es/scale-view/index.js +70 -93
- package/es/select/index.js +36 -39
- package/es/select-label/index.js +47 -70
- package/es/select-person/index.js +35 -38
- package/es/table-filter/index.js +191 -186
- package/es/table-filter/style.css +1 -1
- package/es/tag/index.js +34 -37
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +1107 -939
- package/lib/cui.umd.js +1107 -939
- package/lib/cui.umd.min.js +79 -79
- package/package.json +2 -2
- package/packages/big-table/src/BigTable.vue +20 -19
- package/packages/fabric-chart/src/components/TimeScaleValue.vue +1 -5
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +185 -90
- package/packages/fabric-chart/src/mixins/draw.js +70 -62
- package/packages/fabric-chart/src/mixins/eventCommon.js +9 -10
- package/packages/multi-chat/chat/chatFooter.vue +1 -5
- package/packages/multi-chat/chat/chatMain.vue +29 -5
- package/packages/table-filter/src/components/search-condition/SearchCondition.vue +1825 -1824
- package/packages/table-filter/src/const/dataOptions.js +10 -10
- package/packages/table-filter/src/quick-search/QuickSearch.vue +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.21",
|
|
4
4
|
"description": "前端业务UI库",
|
|
5
5
|
"keyword": "cnhis-design-vue vue cnhis",
|
|
6
6
|
"homepage": "http://dv.cnhis.com/",
|
|
@@ -104,4 +104,4 @@
|
|
|
104
104
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
}
|
|
107
|
+
}
|
|
@@ -1965,25 +1965,26 @@ export default create({
|
|
|
1965
1965
|
* 删除选中scan数据
|
|
1966
1966
|
*/
|
|
1967
1967
|
confirmScanMulti(params) {
|
|
1968
|
-
let { row,
|
|
1968
|
+
let { row, rowIndex } = params || {};
|
|
1969
1969
|
if (!row) return;
|
|
1970
|
-
this.$emit('scanMultiRemove',
|
|
1970
|
+
this.$emit('scanMultiRemove', rowIndex, params);
|
|
1971
1971
|
let vxeTable = this.$refs.xGrid;
|
|
1972
1972
|
vxeTable.remove(row);
|
|
1973
1973
|
},
|
|
1974
1974
|
// 表格渲染逻辑
|
|
1975
1975
|
formatter(params, col) {
|
|
1976
|
-
|
|
1976
|
+
// 用rowIndex替换$rowIndex, 如果开启了虚拟滚动$rowIndex 下标会有问题
|
|
1977
|
+
let { row, column, rowIndex } = params;
|
|
1977
1978
|
let own = column?._own || column?.own || col;
|
|
1978
1979
|
let attrType = own?.attrType || '';
|
|
1979
1980
|
let fieldType = own?.fieldType || '';
|
|
1980
1981
|
// 批量行编辑
|
|
1981
|
-
let formUnionItem = this.showEditForm(row, column,
|
|
1982
|
+
let formUnionItem = this.showEditForm(row, column, rowIndex);
|
|
1982
1983
|
if (formUnionItem) {
|
|
1983
|
-
let dynamicProps = this.initBatchDynamicProps(formUnionItem, row, column,
|
|
1984
|
+
let dynamicProps = this.initBatchDynamicProps(formUnionItem, row, column, rowIndex);
|
|
1984
1985
|
if (dynamicProps) {
|
|
1985
1986
|
return [
|
|
1986
|
-
<EditForm class={`js-inlineEditForm`} key={row[this.primaryKey] +
|
|
1987
|
+
<EditForm class={`js-inlineEditForm`} key={row[this.primaryKey] + rowIndex + column.property} data-key={row[this.primaryKey] + rowIndex + column.property} {...dynamicProps}></EditForm>
|
|
1987
1988
|
];
|
|
1988
1989
|
}
|
|
1989
1990
|
}
|
|
@@ -2058,12 +2059,12 @@ export default create({
|
|
|
2058
2059
|
if (this.rowBtnAutoLayout && !this.isRowEditing) {
|
|
2059
2060
|
// 行内列表按钮改为自适应。
|
|
2060
2061
|
let filterList = Array.isArray(row.btnList) ? row.btnList.filter(btn => btn.isShow == '1' && btn.type != 'LINK') : [];
|
|
2061
|
-
return [<AutoLayoutButton btnList={filterList} row={row} index={
|
|
2062
|
+
return [<AutoLayoutButton btnList={filterList} row={row} index={rowIndex} on-clickBtn={(...arg) => this.clickBtn(...arg)} />];
|
|
2062
2063
|
}
|
|
2063
2064
|
// 行编辑
|
|
2064
|
-
const inlineBtnList = this.generateInlineBtnList(row,
|
|
2065
|
-
const tileBtnList = this.getTileBtnList(row,
|
|
2066
|
-
const foldBtnList = this.getFoldBtnList(row,
|
|
2065
|
+
const inlineBtnList = this.generateInlineBtnList(row, rowIndex);
|
|
2066
|
+
const tileBtnList = this.getTileBtnList(row, rowIndex);
|
|
2067
|
+
const foldBtnList = this.getFoldBtnList(row, rowIndex);
|
|
2067
2068
|
return [
|
|
2068
2069
|
<span>
|
|
2069
2070
|
{this.rowBtnAutoLayout ? null : tileBtnList}
|
|
@@ -2082,12 +2083,12 @@ export default create({
|
|
|
2082
2083
|
disabled = true;
|
|
2083
2084
|
}
|
|
2084
2085
|
}
|
|
2085
|
-
return this.getBtnLinkSwitch(row, own, disabled || this.isTableEdit,
|
|
2086
|
+
return this.getBtnLinkSwitch(row, own, disabled || this.isTableEdit, rowIndex);
|
|
2086
2087
|
} else {
|
|
2087
|
-
return this.getField(row, own,
|
|
2088
|
+
return this.getField(row, own, rowIndex, true);
|
|
2088
2089
|
}
|
|
2089
2090
|
} else {
|
|
2090
|
-
return this.getField(row, own,
|
|
2091
|
+
return this.getField(row, own, rowIndex, false);
|
|
2091
2092
|
}
|
|
2092
2093
|
},
|
|
2093
2094
|
handleImgArr(imgs, type) {
|
|
@@ -2248,7 +2249,7 @@ export default create({
|
|
|
2248
2249
|
// 嵌套表与主表click切换时需要清除上次的选中
|
|
2249
2250
|
this.isAboutNestTable && this.$emit('resetNestLastClickTable', table);
|
|
2250
2251
|
|
|
2251
|
-
let { row, $event = {},
|
|
2252
|
+
let { row, $event = {}, rowIndex } = data;
|
|
2252
2253
|
// 点击主表格展开行按钮 不需要触发选中行
|
|
2253
2254
|
let { className } = $event.target || {};
|
|
2254
2255
|
if (className && vexutils.isString(className) && className.includes('vxe-table--expand-btn')) return;
|
|
@@ -2272,7 +2273,7 @@ export default create({
|
|
|
2272
2273
|
const value = this.getRowClassName({ row }) == 'single--checked' ? [] : [row];
|
|
2273
2274
|
this.$set(this, 'checkedRows', value);
|
|
2274
2275
|
this.pubCheckChange(value);
|
|
2275
|
-
this.$emit('handlerClickRow', row,
|
|
2276
|
+
this.$emit('handlerClickRow', row, rowIndex);
|
|
2276
2277
|
return;
|
|
2277
2278
|
}
|
|
2278
2279
|
this.visibleCheckAllWrap = false;
|
|
@@ -2337,7 +2338,7 @@ export default create({
|
|
|
2337
2338
|
if (rowLen > 1) {
|
|
2338
2339
|
this.selectType != 'radio' && table.setCheckboxRow([row], true);
|
|
2339
2340
|
this.isTree != 0 && this.selectType != 'radio' && this.pubCheckChange(newRow);
|
|
2340
|
-
this.selectType != 'radio' && this.$emit('handlerClickRow', row,
|
|
2341
|
+
this.selectType != 'radio' && this.$emit('handlerClickRow', row, rowIndex);
|
|
2341
2342
|
} else {
|
|
2342
2343
|
setChecked = !setChecked;
|
|
2343
2344
|
if (!setChecked) {
|
|
@@ -2351,7 +2352,7 @@ export default create({
|
|
|
2351
2352
|
this.selectType != 'radio' && table.setCheckboxRow([row], setChecked);
|
|
2352
2353
|
}
|
|
2353
2354
|
if (this.isTree != 0) {
|
|
2354
|
-
setChecked && this.$emit('handlerClickRow', row,
|
|
2355
|
+
setChecked && this.$emit('handlerClickRow', row, rowIndex);
|
|
2355
2356
|
return;
|
|
2356
2357
|
}
|
|
2357
2358
|
|
|
@@ -2364,7 +2365,7 @@ export default create({
|
|
|
2364
2365
|
}
|
|
2365
2366
|
this.setCurrentCheckedLength();
|
|
2366
2367
|
this.lastPageIndex = this.pageVO.pageIndex;
|
|
2367
|
-
setChecked && this.$emit('handlerClickRow', row,
|
|
2368
|
+
setChecked && this.$emit('handlerClickRow', row, rowIndex);
|
|
2368
2369
|
},
|
|
2369
2370
|
/**
|
|
2370
2371
|
* 单选行数据 树结构 扁平化处理
|
|
@@ -2834,7 +2835,7 @@ export default create({
|
|
|
2834
2835
|
},
|
|
2835
2836
|
// 单选
|
|
2836
2837
|
radioOnChange(rowData = {}) {
|
|
2837
|
-
let { data, row,
|
|
2838
|
+
let { data, row, rowIndex } = rowData;
|
|
2838
2839
|
this.$emit('selectionChange', [{ ...row }]);
|
|
2839
2840
|
this.isradioChange = true;
|
|
2840
2841
|
},
|
|
@@ -83,11 +83,7 @@ export default {
|
|
|
83
83
|
const newOriginY = originY - spaceHeight;
|
|
84
84
|
const { xScalevalue } = this.$attrs.templateData.top || {};
|
|
85
85
|
const popupTop = xScalevalue?.popupTop || 0;
|
|
86
|
-
|
|
87
|
-
this.isShow = true;
|
|
88
|
-
} else {
|
|
89
|
-
this.isShow = false;
|
|
90
|
-
}
|
|
86
|
+
this.isShow = top + newOriginY < popupTop ? true : false;
|
|
91
87
|
}
|
|
92
88
|
}
|
|
93
89
|
},
|
|
@@ -55,7 +55,9 @@ export default {
|
|
|
55
55
|
activeEvent: null, // 当前可右键活动的对象
|
|
56
56
|
addPointList: [], // 快速新增的节点list
|
|
57
57
|
isSelectArea: false, // 是否正在选区
|
|
58
|
-
selectArea: null // 选区矩形对象
|
|
58
|
+
selectArea: null, // 选区矩形对象
|
|
59
|
+
currentDelPoint: null, // 缓存当前可批量删除的项目线段上的点
|
|
60
|
+
polylinePointList: [] // 缓存折线项目节点
|
|
59
61
|
};
|
|
60
62
|
},
|
|
61
63
|
computed: {
|
|
@@ -69,6 +71,7 @@ export default {
|
|
|
69
71
|
mounted() {
|
|
70
72
|
this.$nextTick(() => {
|
|
71
73
|
this.drawPolylineTitle();
|
|
74
|
+
this.polylinePointList = [];
|
|
72
75
|
this.polyline.forEach((polylineType, polylineTypeId) => {
|
|
73
76
|
this.createPolyline(polylineType, polylineTypeId);
|
|
74
77
|
});
|
|
@@ -95,7 +98,10 @@ export default {
|
|
|
95
98
|
const points = this.selectArea.ponits;
|
|
96
99
|
const delList = this.getAreaPonits(points);
|
|
97
100
|
delList.length === 0 && this.removeSelectArea();
|
|
98
|
-
delList.length > 0 && this.selectArea
|
|
101
|
+
if (delList.length > 0 && this.selectArea) {
|
|
102
|
+
this.$emit('pointOperation', 'delete', delList);
|
|
103
|
+
this.currentDelPoint = null;
|
|
104
|
+
}
|
|
99
105
|
}
|
|
100
106
|
});
|
|
101
107
|
let selectAreaOrigin = { left: 0, top: 0 };
|
|
@@ -118,7 +124,14 @@ export default {
|
|
|
118
124
|
const { id, left, top } = obj;
|
|
119
125
|
const isArea = left >= x1 && left <= x2 && top >= y1 && top <= y2;
|
|
120
126
|
if (id && /_polyline(Point)_/.test(id) && !id.includes('isTitle') && isArea) {
|
|
121
|
-
|
|
127
|
+
if (this.currentDelPoint) {
|
|
128
|
+
const { polylineIndex } = this.currentDelPoint;
|
|
129
|
+
if (polylineIndex == obj.polylineIndex) {
|
|
130
|
+
delList.push(this.getDataById(id));
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
delList.push(this.getDataById(id));
|
|
134
|
+
}
|
|
122
135
|
}
|
|
123
136
|
});
|
|
124
137
|
return delList;
|
|
@@ -189,32 +202,20 @@ export default {
|
|
|
189
202
|
|
|
190
203
|
// 配置左侧title图标(但不是折线项目)
|
|
191
204
|
if (this.other?.list && Array.isArray(this.other.list)) {
|
|
205
|
+
const otherList = this.other.list.map(v => {
|
|
206
|
+
return {
|
|
207
|
+
title: v.name,
|
|
208
|
+
type: v.type,
|
|
209
|
+
pointAttr: v,
|
|
210
|
+
isAdd: false,
|
|
211
|
+
polylineTypeId: -1,
|
|
212
|
+
polylineIndex: -1
|
|
213
|
+
};
|
|
214
|
+
});
|
|
192
215
|
if (this.other.position && this.other.position === 'top') {
|
|
193
|
-
leftTitleList.push(
|
|
194
|
-
...this.other.list.map(v => {
|
|
195
|
-
return {
|
|
196
|
-
title: v.name,
|
|
197
|
-
type: v.type,
|
|
198
|
-
pointAttr: v,
|
|
199
|
-
isAdd: false,
|
|
200
|
-
polylineTypeId: -1,
|
|
201
|
-
polylineIndex: -1
|
|
202
|
-
};
|
|
203
|
-
})
|
|
204
|
-
);
|
|
216
|
+
leftTitleList.push(...otherList);
|
|
205
217
|
} else {
|
|
206
|
-
leftTitleList.unshift(
|
|
207
|
-
...this.other.list.map(v => {
|
|
208
|
-
return {
|
|
209
|
-
title: v.name,
|
|
210
|
-
type: v.type,
|
|
211
|
-
pointAttr: v,
|
|
212
|
-
isAdd: false,
|
|
213
|
-
polylineTypeId: -1,
|
|
214
|
-
polylineIndex: -1
|
|
215
|
-
};
|
|
216
|
-
})
|
|
217
|
-
);
|
|
218
|
+
leftTitleList.unshift(...otherList);
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
|
|
@@ -421,30 +422,29 @@ export default {
|
|
|
421
422
|
const list = polyline.list;
|
|
422
423
|
const pointList = [];
|
|
423
424
|
let lineList = [];
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
// 当前点
|
|
427
|
-
let points = null;
|
|
425
|
+
const _this = this;
|
|
426
|
+
function getPointer(point) {
|
|
428
427
|
let isInit = false;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
const
|
|
428
|
+
let points = null;
|
|
429
|
+
if (isEffectiveNode(point) && _this.isLimit(point.time)) {
|
|
430
|
+
const x = _this.cumputedX(point.time);
|
|
431
|
+
const y = _this.cumputedY(polylineType, point.value);
|
|
432
432
|
isInit = y < originY || y > endY;
|
|
433
|
-
|
|
433
|
+
points = [x, y < originY ? originY : y > endY ? endY : y];
|
|
434
434
|
}
|
|
435
|
+
return { isInit, points };
|
|
436
|
+
}
|
|
437
|
+
list.forEach((linePoints, index) => {
|
|
438
|
+
// 当前点
|
|
439
|
+
let { points, isInit } = getPointer(linePoints);
|
|
435
440
|
|
|
436
441
|
// 下一个点
|
|
437
442
|
const nextPoints = list[index + 1];
|
|
438
|
-
let nextPoint =
|
|
439
|
-
|
|
440
|
-
const nextX = this.cumputedX(nextPoints.time);
|
|
441
|
-
const nextY = this.cumputedY(polylineType, nextPoints.value);
|
|
442
|
-
if (this.isLimit(nextPoints.time)) nextPoint = [nextX, nextY < originY ? originY : nextY > endY ? endY : nextY];
|
|
443
|
-
}
|
|
443
|
+
let { points: nextPoint } = getPointer(nextPoints);
|
|
444
|
+
|
|
444
445
|
let line;
|
|
445
446
|
let point;
|
|
446
447
|
let previousLine;
|
|
447
|
-
|
|
448
448
|
line = points && nextPoint ? this.drawLine([...points, ...nextPoint], { polylineIndex, polylineTypeId, lineIndex: index, ...lineAttr }) : null;
|
|
449
449
|
previousLine = lineList[index - 1];
|
|
450
450
|
const pointOthers = { polylineTypeId, polylineIndex, pointIndex: index, ...pointAttr, lineAttr };
|
|
@@ -455,7 +455,31 @@ export default {
|
|
|
455
455
|
lineList.push(line);
|
|
456
456
|
point && pointList.push(point);
|
|
457
457
|
});
|
|
458
|
+
|
|
458
459
|
Promise.all(pointList).then(res => {
|
|
460
|
+
const polylineObj = this.polylinePointList.find(v => v.polylineTypeId == polylineTypeId && v.polylineIndex == polylineIndex);
|
|
461
|
+
const pointerList = res.map(v => v.left);
|
|
462
|
+
if (polylineObj) {
|
|
463
|
+
Object.assign(polylineObj, {
|
|
464
|
+
pointerList,
|
|
465
|
+
pointList: res
|
|
466
|
+
});
|
|
467
|
+
polylineObj.pointerList = pointerList;
|
|
468
|
+
} else {
|
|
469
|
+
this.polylinePointList.push({
|
|
470
|
+
polylineTypeId,
|
|
471
|
+
polylineIndex,
|
|
472
|
+
pointerList,
|
|
473
|
+
pointStyle: {
|
|
474
|
+
fill: res[0].fill,
|
|
475
|
+
stroke: res[0].stroke
|
|
476
|
+
},
|
|
477
|
+
lineStyle: {
|
|
478
|
+
stroke: lineAttr.stroke
|
|
479
|
+
},
|
|
480
|
+
pointList: res
|
|
481
|
+
});
|
|
482
|
+
}
|
|
459
483
|
lineList = lineList.filter(v => v);
|
|
460
484
|
let prevPoint = null;
|
|
461
485
|
res = res.filter(v => {
|
|
@@ -510,19 +534,7 @@ export default {
|
|
|
510
534
|
line2 && (point.line2 = line2);
|
|
511
535
|
point.on('mouseover', () => {
|
|
512
536
|
this.showDrapPopup(point);
|
|
513
|
-
|
|
514
|
-
// 线段不能先置顶,会挡住其他线段上的点
|
|
515
|
-
// this.canvas.forEachObject(obj => {
|
|
516
|
-
// if (this.isOnePolyLine(obj, point.polylineTypeId, point.polylineIndex)) {
|
|
517
|
-
// obj.line1 && this.canvas.bringToFront(obj.line1);
|
|
518
|
-
// obj.line2 && this.canvas.bringToFront(obj.line2);
|
|
519
|
-
// }
|
|
520
|
-
// });
|
|
521
|
-
this.canvas.forEachObject(obj => {
|
|
522
|
-
if (this.isOnePolyLine(obj, point.polylineTypeId, point.polylineIndex)) {
|
|
523
|
-
this.canvas.bringToFront(obj);
|
|
524
|
-
}
|
|
525
|
-
});
|
|
537
|
+
this.pointToFront(point);
|
|
526
538
|
});
|
|
527
539
|
point.on('mouseout', () => {
|
|
528
540
|
this.isDropVisible = false;
|
|
@@ -530,7 +542,7 @@ export default {
|
|
|
530
542
|
// 折线点移动中 实时更新相关联的线的坐标
|
|
531
543
|
if (this.eventStyle.evented) {
|
|
532
544
|
point.on('moving', () => {
|
|
533
|
-
this.pointMoveLimit(point);
|
|
545
|
+
this.pointMoveLimit(point, false);
|
|
534
546
|
this.pointMoveUpdateLine(point);
|
|
535
547
|
this.addPoint(point, left, top);
|
|
536
548
|
this.canvas.renderAll();
|
|
@@ -543,6 +555,13 @@ export default {
|
|
|
543
555
|
this.setEmitFunction(point);
|
|
544
556
|
}
|
|
545
557
|
});
|
|
558
|
+
point.on('mouseup', event => {
|
|
559
|
+
const { button, isClick } = event;
|
|
560
|
+
if (button == 1 && isClick) {
|
|
561
|
+
// 可配置批量删除当前项目上的点了
|
|
562
|
+
this.currentDelPoint = point;
|
|
563
|
+
}
|
|
564
|
+
});
|
|
546
565
|
}
|
|
547
566
|
|
|
548
567
|
// 超出表格最高或最低值则需要触发pointChange事件并且不能更新视图,否则连接节点判断不会成功
|
|
@@ -560,29 +579,32 @@ export default {
|
|
|
560
579
|
if (this.addPointList.length === 0) {
|
|
561
580
|
this.$emit('pointChange', data);
|
|
562
581
|
} else {
|
|
563
|
-
const
|
|
582
|
+
const lastPoint = this.addPointList.at(-1);
|
|
583
|
+
const position = this.polyline[point.polylineTypeId].position;
|
|
564
584
|
// 如果是重合/连线节点
|
|
565
585
|
if (point.get('scaleX') !== point.scale) {
|
|
566
|
-
|
|
567
|
-
...
|
|
586
|
+
this.addPointList.splice(-1, 1, {
|
|
587
|
+
...lastPoint,
|
|
568
588
|
value: {
|
|
569
|
-
time: this.getXValue(
|
|
570
|
-
value: this.getYValue(
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
if (last.left === point.left) {
|
|
574
|
-
this.addPointList.splice(-1, 1, value);
|
|
575
|
-
} else {
|
|
576
|
-
this.addPointList.push(value);
|
|
577
|
-
const [lastPoint, prePoint, ...list] = JSON.parse(JSON.stringify(this.addPointList)).reverse();
|
|
578
|
-
if (prePoint.value.time == lastPoint.value.time) {
|
|
579
|
-
this.addPointList.splice(-2, 1);
|
|
589
|
+
time: this.getXValue(this._concatPoint?.left),
|
|
590
|
+
value: this.getYValue(position, this._concatPoint?.top)
|
|
580
591
|
}
|
|
581
|
-
}
|
|
592
|
+
});
|
|
593
|
+
this.addPointList.forEach(v => Object.assign(v, { isConcat: true, concatIndex: this._concatIndex }));
|
|
594
|
+
} else if (point.line2 || (point.nextPoint && lastPoint.left >= point.nextPoint.left)) {
|
|
595
|
+
// 1、存在右连线 2、无右侧连线,并且存在下一个节点的情况
|
|
596
|
+
this.addPointList = [];
|
|
597
|
+
this.repaintPolyline(position, point.polylineIndex);
|
|
598
|
+
return;
|
|
582
599
|
}
|
|
600
|
+
!point.line2 && this.addPointList.splice(0, 1);
|
|
583
601
|
!point.id.includes('isTitle') && this.removePolyline(point.id);
|
|
584
|
-
|
|
585
|
-
|
|
602
|
+
if (this.addPointList.length > 0) {
|
|
603
|
+
this.$emit('pointOperation', 'increasePointBatch', this.addPointList);
|
|
604
|
+
this.addPointList = [];
|
|
605
|
+
} else {
|
|
606
|
+
this.repaintPolyline(position, point.polylineIndex);
|
|
607
|
+
}
|
|
586
608
|
}
|
|
587
609
|
},
|
|
588
610
|
// 设置批量新增数据
|
|
@@ -594,7 +616,7 @@ export default {
|
|
|
594
616
|
this.addPointList.push(data);
|
|
595
617
|
},
|
|
596
618
|
/**
|
|
597
|
-
* @description:
|
|
619
|
+
* @description: 拖动批量新增节点
|
|
598
620
|
* @param {*} point 拖动的最后一个节点
|
|
599
621
|
* @param {*} originLeft 拖动的源节点的left值
|
|
600
622
|
* @param {*} originTop 拖动的源节点的top值
|
|
@@ -614,8 +636,11 @@ export default {
|
|
|
614
636
|
const residue = (left - originLeft) % spaceWidth;
|
|
615
637
|
|
|
616
638
|
const condition = residue > spaceWidth - n || residue < n;
|
|
639
|
+
const conditionNoLine2 = !point.line2 && left > originLeft;
|
|
640
|
+
const conditionHasLine2 = point.line2 && left > originLeft + spaceWidth;
|
|
617
641
|
|
|
618
|
-
if (!point.line2 && left > originLeft && condition) {
|
|
642
|
+
// if (!point.line2 && left > originLeft && condition) {
|
|
643
|
+
if (condition && (conditionNoLine2 || conditionHasLine2)) {
|
|
619
644
|
if (residue > spaceWidth - n) left = left - residue + spaceWidth;
|
|
620
645
|
if (residue < n) left = left - residue;
|
|
621
646
|
point.set({
|
|
@@ -652,8 +677,15 @@ export default {
|
|
|
652
677
|
|
|
653
678
|
// const i = Math.floor((left - originLeft) / spaceWidth);
|
|
654
679
|
// 复制点和线
|
|
655
|
-
if (
|
|
656
|
-
point.line1 && this.removePolyline(point.line1.id);
|
|
680
|
+
if (conditionNoLine2 || conditionHasLine2) {
|
|
681
|
+
// point.line1 && this.removePolyline(point.line1.id);
|
|
682
|
+
point.line1?.set({
|
|
683
|
+
stroke: 'transparent'
|
|
684
|
+
});
|
|
685
|
+
conditionHasLine2 &&
|
|
686
|
+
point.line2?.set({
|
|
687
|
+
stroke: 'transparent'
|
|
688
|
+
});
|
|
657
689
|
// if (i === 1) {
|
|
658
690
|
this.addPointList.length == 0 && (await this.clonePoint(point, [point.line1 ? point.line1.x1 : originLeft, point.line1 ? point.line1.y1 : originTop, originLeft, originTop]));
|
|
659
691
|
// }
|
|
@@ -674,25 +706,76 @@ export default {
|
|
|
674
706
|
}
|
|
675
707
|
|
|
676
708
|
// 断点相连
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
709
|
+
function concatPoint(target) {
|
|
710
|
+
const { left: targetLeft, top: targetTop } = target;
|
|
711
|
+
point.setCoords();
|
|
712
|
+
if (left >= targetLeft - n && left <= targetLeft + n && top <= targetTop + n && top >= targetTop - n) {
|
|
713
|
+
point.set({
|
|
714
|
+
left: targetLeft,
|
|
715
|
+
top: targetTop,
|
|
716
|
+
scaleX: point.scale === 1 ? 2.5 : 0.1,
|
|
717
|
+
scaleY: point.scale === 1 ? 2.5 : 0.1
|
|
718
|
+
});
|
|
719
|
+
} else {
|
|
720
|
+
point.set({
|
|
721
|
+
scaleX: point.scale,
|
|
722
|
+
scaleY: point.scale
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// 检查是否显示重合连线放大节点的标识
|
|
728
|
+
// if (conditionHasLine2) {
|
|
729
|
+
if (point.nextPoint) {
|
|
730
|
+
const { polylineTypeId, polylineIndex } = point;
|
|
731
|
+
const polylineObj = this.polylinePointList.find(v => v.polylineTypeId == polylineTypeId && v.polylineIndex == polylineIndex);
|
|
732
|
+
this._concatIndex = polylineObj?.pointerList.findIndex(v => v + n > left && v > originLeft);
|
|
733
|
+
if (!~this._concatIndex) {
|
|
734
|
+
point.set({
|
|
735
|
+
scaleX: point.scale,
|
|
736
|
+
scaleY: point.scale
|
|
737
|
+
});
|
|
738
|
+
} else {
|
|
739
|
+
concatPoint(polylineObj?.pointList[this._concatIndex]);
|
|
740
|
+
}
|
|
741
|
+
this._concatPoint = polylineObj?.pointList?.[this._concatIndex] || null;
|
|
742
|
+
polylineObj?.pointerList.forEach((v, i) => {
|
|
743
|
+
const obj = polylineObj?.pointList[i];
|
|
744
|
+
if (v > originLeft && v < left) {
|
|
745
|
+
const { fill, stroke } = polylineObj.pointStyle;
|
|
746
|
+
const setColor = color => {
|
|
747
|
+
return color && (color !== '#fff' || color !== 'transparent') ? '#999' : color;
|
|
748
|
+
};
|
|
749
|
+
// 此处需要递归遍历group节点的所有子节点,然后更改其颜色
|
|
750
|
+
// 待完善
|
|
751
|
+
obj.set({ fill: setColor(fill), stroke: setColor(stroke) });
|
|
752
|
+
// obj.line2?.set({ fill: setColor(fill), stroke: setColor(stroke) });
|
|
753
|
+
} else {
|
|
754
|
+
obj.set(polylineObj.pointStyle);
|
|
755
|
+
// obj.line2?.set(polylineObj.lineStyle);
|
|
756
|
+
}
|
|
688
757
|
});
|
|
689
758
|
}
|
|
759
|
+
|
|
760
|
+
// } else {
|
|
761
|
+
// point.nextPoint && concatPoint(point.nextPoint);
|
|
762
|
+
// }
|
|
763
|
+
|
|
690
764
|
// 如果往回拖动则删除经过的已存在的节点
|
|
691
765
|
if (startLength > 0 && currentLeft <= this.addPointList[startLength - 1].left) {
|
|
692
766
|
this.removePolyline('increasePointBatch', left);
|
|
693
767
|
this.addPointList = this.addPointList.filter(v => v.left < left);
|
|
694
768
|
const endLength = this.addPointList.length;
|
|
695
|
-
if (endLength === 0)
|
|
769
|
+
if (endLength === 0) {
|
|
770
|
+
point.line1?.set({
|
|
771
|
+
stroke: point.stroke
|
|
772
|
+
});
|
|
773
|
+
conditionHasLine2 &&
|
|
774
|
+
point.line2?.set({
|
|
775
|
+
stroke: point.stroke
|
|
776
|
+
});
|
|
777
|
+
this.removePolyline('increasePointBatch', originLeft);
|
|
778
|
+
}
|
|
696
779
|
if (endLength > 0) {
|
|
697
780
|
point.set({
|
|
698
781
|
prePoints: [this.addPointList[endLength - 1].left, this.addPointList[endLength - 1].top]
|
|
@@ -716,7 +799,9 @@ export default {
|
|
|
716
799
|
idClone: 'increasePointBatch',
|
|
717
800
|
id: '_polylinePoint_' + new Date().getTime(), // 此id必须,用于remove节点的时候
|
|
718
801
|
polylineTypeId,
|
|
719
|
-
polylineIndex: point.polylineIndex
|
|
802
|
+
polylineIndex: point.polylineIndex,
|
|
803
|
+
scaleX: point.scale,
|
|
804
|
+
scaleY: point.scale
|
|
720
805
|
});
|
|
721
806
|
clonedObj.hasControls = clonedObj.hasBorders = false;
|
|
722
807
|
point.set({
|
|
@@ -894,6 +979,15 @@ export default {
|
|
|
894
979
|
if (obj.id && /_polyline(Point|Line)_/.test(obj.id) && !obj.id.includes('isTitle') && isPolyLine) return true;
|
|
895
980
|
return;
|
|
896
981
|
},
|
|
982
|
+
// 将当条线段以及点层级置顶
|
|
983
|
+
// 线段不能先置顶,会挡住其他线段上的点
|
|
984
|
+
pointToFront(point) {
|
|
985
|
+
this.canvas.forEachObject(obj => {
|
|
986
|
+
if (this.isOnePolyLine(obj, point.polylineTypeId, point.polylineIndex)) {
|
|
987
|
+
this.canvas.bringToFront(obj);
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
},
|
|
897
991
|
removePolyline(id, left, position, polylineIndex) {
|
|
898
992
|
// 根据id或者idClone删除
|
|
899
993
|
if (id) {
|
|
@@ -944,6 +1038,7 @@ export default {
|
|
|
944
1038
|
if (this.polyline.length) {
|
|
945
1039
|
this.removePolyline();
|
|
946
1040
|
}
|
|
1041
|
+
this.polylinePointList = [];
|
|
947
1042
|
this.polyline.forEach((polylineType, polylineTypeId) => {
|
|
948
1043
|
this.createPolyline(polylineType, polylineTypeId);
|
|
949
1044
|
});
|