cnhis-design-vue 2.1.63 → 2.1.65
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 +88 -59
- package/es/affix/index.js +8 -8
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/anchor/index.js +8 -8
- package/es/auto-complete/index.js +8 -8
- package/es/avatar/index.js +8 -8
- package/es/back-top/index.js +8 -8
- package/es/badge/index.js +8 -8
- package/es/base/index.js +8 -8
- package/es/big-table/index.js +114 -94
- package/es/big-table/style.css +1 -1
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +22 -22
- package/es/calendar/index.js +8 -8
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/carousel/index.js +8 -8
- package/es/cascader/index.js +8 -8
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/collapse/index.js +8 -8
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/config-provider/index.js +8 -8
- package/es/date-picker/index.js +8 -8
- package/es/descriptions/index.js +8 -8
- package/es/divider/index.js +8 -8
- package/es/drag-layout/index.js +3 -3
- package/es/drawer/index.js +8 -8
- package/es/dropdown/index.js +8 -8
- package/es/editor/index.js +1 -1
- package/es/ellipsis/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +490 -275
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +66 -66
- package/es/index/index.js +1008 -740
- package/es/index/style.css +1 -1
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/layout/index.js +8 -8
- package/es/list/index.js +8 -8
- package/es/locale-provider/index.js +8 -8
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/menu/index.js +8 -8
- package/es/message/index.js +8 -8
- package/es/multi-chat/index.js +76 -76
- package/es/multi-chat-client/index.js +70 -70
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +14 -14
- package/es/multi-chat-setting/index.js +22 -22
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/page-header/index.js +8 -8
- package/es/pagination/index.js +8 -8
- package/es/popconfirm/index.js +8 -8
- package/es/popover/index.js +8 -8
- package/es/progress/index.js +8 -8
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/result/index.js +8 -8
- package/es/row/index.js +8 -8
- package/es/scale-container/index.js +1 -1
- package/es/scale-view/index.js +61 -49
- package/es/scale-view/style.css +1 -1
- package/es/select/index.js +12 -12
- package/es/select-label/index.js +11 -11
- package/es/select-person/index.js +2 -2
- package/es/shortcut-setter/index.js +10 -10
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/space/index.js +8 -8
- package/es/spin/index.js +8 -8
- package/es/statistic/index.js +8 -8
- package/es/steps/index.js +8 -8
- package/es/switch/index.js +8 -8
- package/es/table-filter/index.js +102 -81
- package/es/table-filter/style.css +1 -1
- package/es/tabs/index.js +8 -8
- package/es/tag/index.js +9 -9
- package/es/time-picker/index.js +8 -8
- package/es/timeline/index.js +8 -8
- package/es/tooltip/index.js +8 -8
- package/es/transfer/index.js +8 -8
- package/es/tree/index.js +8 -8
- package/es/tree-select/index.js +8 -8
- package/es/upload/index.js +8 -8
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +1004 -736
- package/lib/cui.umd.js +1004 -736
- package/lib/cui.umd.min.js +22 -22
- package/package.json +1 -1
- package/packages/big-table/src/BigTable.vue +16 -5
- package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +3 -3
- package/packages/fabric-chart/src/fabric-chart/FabricLines.vue +20 -20
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +54 -20
- package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +25 -24
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +66 -11
- package/packages/scale-view/scaleView.vue +7 -0
- package/packages/table-filter/src/mixins/wordBookutils.js +36 -25
- package/packages/table-filter/src/quick-search/QuickSearch.vue +5 -0
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
</div>
|
|
45
45
|
<c-grid
|
|
46
46
|
border
|
|
47
|
-
show-overflow
|
|
47
|
+
:show-overflow="isShowOverflow"
|
|
48
48
|
show-header-overflow
|
|
49
49
|
highlight-hover-row
|
|
50
50
|
highlight-current-row
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
}"
|
|
89
89
|
:row-style="getRowStyle"
|
|
90
90
|
:edit-config="{ trigger: 'manual', mode: 'row', autoClear: false, showIcon: false }"
|
|
91
|
-
:scroll-x="
|
|
92
|
-
:scroll-y="
|
|
91
|
+
:scroll-x="scrollXConfig"
|
|
92
|
+
:scroll-y="scrollYConfig"
|
|
93
93
|
:expand-config="{
|
|
94
94
|
lazy: true,
|
|
95
95
|
accordion: columnConfig && columnConfig.accordion,
|
|
@@ -265,7 +265,10 @@ export default create({
|
|
|
265
265
|
del: 'close'
|
|
266
266
|
},
|
|
267
267
|
tableHeight: '100%',
|
|
268
|
-
allCheckedRows: []
|
|
268
|
+
allCheckedRows: [],
|
|
269
|
+
scrollXConfig: { enabled: true, gt: 25 },
|
|
270
|
+
scrollYConfig: { enabled: true, gt: 50, mode: 'wheel' },
|
|
271
|
+
isShowOverflow: true
|
|
269
272
|
};
|
|
270
273
|
},
|
|
271
274
|
computed: {
|
|
@@ -1238,11 +1241,17 @@ export default create({
|
|
|
1238
1241
|
// 配置列表
|
|
1239
1242
|
let { selectType } = this.getOtherConfigInit() || {};
|
|
1240
1243
|
let { tableNoSetting } = this;
|
|
1241
|
-
let { isBatchSelect, fieldList, showButtonTop, isScanMultiTable } = map;
|
|
1244
|
+
let { isBatchSelect, fieldList, showButtonTop, isScanMultiTable, autoCellHeight } = map;
|
|
1242
1245
|
if (selectType) {
|
|
1243
1246
|
// 有设置 selectType 强制可选。
|
|
1244
1247
|
isBatchSelect = 1;
|
|
1245
1248
|
}
|
|
1249
|
+
// 如果表格单行需要内容撑开, 则把虚拟滚动关掉
|
|
1250
|
+
if (autoCellHeight) {
|
|
1251
|
+
this.scrollXConfig.enabled = false;
|
|
1252
|
+
this.scrollYConfig.enabled = false;
|
|
1253
|
+
this.isShowOverflow = false;
|
|
1254
|
+
}
|
|
1246
1255
|
selectType = selectType || 'checkbox';
|
|
1247
1256
|
// 扫码弹框 设置为radio
|
|
1248
1257
|
let { listType } = this.tableOptions;
|
|
@@ -1400,6 +1409,8 @@ export default create({
|
|
|
1400
1409
|
},
|
|
1401
1410
|
// 2022/12/1 沈培均/方晶晶要求新增 如果有自定义提示就不显示表格自带的提示
|
|
1402
1411
|
handleShowOverflow(item) {
|
|
1412
|
+
// 2023/03/17 新增单行高度由内容撑开, 不需要缺省
|
|
1413
|
+
if (!this.isShowOverflow) return false
|
|
1403
1414
|
if (item.columnName == "operatorColumn") return false;
|
|
1404
1415
|
// 选人组件 自己的tooltip
|
|
1405
1416
|
if (item.attrType === "CANDIDATE_COMPONENTS") return false;
|
|
@@ -144,9 +144,9 @@ export default {
|
|
|
144
144
|
},
|
|
145
145
|
endY() {
|
|
146
146
|
// 画布高度 - 底部列表高度 ,网格右下角y轴坐标值
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return this.canvasHeight -
|
|
147
|
+
const { show = true, height } = this.templateData.bottom || {};
|
|
148
|
+
if (!show || !height) return this.templateData.canvasHeight;
|
|
149
|
+
return this.canvasHeight - height;
|
|
150
150
|
},
|
|
151
151
|
xCellWidth() {
|
|
152
152
|
// 水平方向网格宽度
|
|
@@ -181,7 +181,7 @@ export default {
|
|
|
181
181
|
// 左边手柄竖线
|
|
182
182
|
let leftLine;
|
|
183
183
|
if (x1 && x1 >= originX && x1 <= endX) {
|
|
184
|
-
leftLine = await this.drawGroup(x1, x2, y1 + spaceHeight, y2 - spaceHeight, i, j, { position: 'left', customIcon: !endMinute && !isContinue
|
|
184
|
+
leftLine = await this.drawGroup(x1, x2, y1 + spaceHeight, y2 - spaceHeight, i, j, { position: 'left', customIcon: !endMinute && !isContinue });
|
|
185
185
|
lineItemList.push(leftLine);
|
|
186
186
|
} else if (x1 < originX) {
|
|
187
187
|
x1 = originX;
|
|
@@ -233,7 +233,7 @@ export default {
|
|
|
233
233
|
// 右边手柄竖线
|
|
234
234
|
let rightLine;
|
|
235
235
|
if (item[1] && endMinute <= maxMinute && endMinute >= minMinute) {
|
|
236
|
-
rightLine = await this.drawGroup(x1, x2, y1 + spaceHeight, y2 - spaceHeight, i, j, { position: 'right' });
|
|
236
|
+
rightLine = await this.drawGroup(x1, x2, y1 + spaceHeight, y2 - spaceHeight, i, j, { position: 'right', isContinue });
|
|
237
237
|
lineItemList.push(rightLine);
|
|
238
238
|
}
|
|
239
239
|
|
|
@@ -355,7 +355,6 @@ export default {
|
|
|
355
355
|
left = x2 - this.propItems.xCellWidth / 2;
|
|
356
356
|
}
|
|
357
357
|
let line;
|
|
358
|
-
let arrow;
|
|
359
358
|
const common = {
|
|
360
359
|
selectable: false,
|
|
361
360
|
evented: false
|
|
@@ -380,23 +379,23 @@ export default {
|
|
|
380
379
|
...common
|
|
381
380
|
});
|
|
382
381
|
} else {
|
|
383
|
-
line =
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
height: 5,
|
|
394
|
-
arrowwidth: 6,
|
|
395
|
-
arrowheight: 5,
|
|
382
|
+
line = isContinue
|
|
383
|
+
? await this.createArrow({
|
|
384
|
+
left: x2,
|
|
385
|
+
top: y1 + (y2 - y1) / 2 - 3.5,
|
|
386
|
+
originY: 'bottom',
|
|
387
|
+
originX: 'right',
|
|
388
|
+
fill: 'transparent',
|
|
389
|
+
width: 7,
|
|
390
|
+
height: 7,
|
|
391
|
+
angle: 270,
|
|
396
392
|
...dataLineStyle,
|
|
397
393
|
...common
|
|
398
394
|
})
|
|
399
|
-
:
|
|
395
|
+
: this.drawLine(point, {
|
|
396
|
+
...dataLineStyle,
|
|
397
|
+
...common
|
|
398
|
+
});
|
|
400
399
|
}
|
|
401
400
|
const rect = new this.fabric.Rect({
|
|
402
401
|
width: this.propItems.xCellWidth,
|
|
@@ -408,7 +407,7 @@ export default {
|
|
|
408
407
|
evented: false
|
|
409
408
|
});
|
|
410
409
|
|
|
411
|
-
return new this.fabric.Group([line, rect
|
|
410
|
+
return new this.fabric.Group([line, rect], {
|
|
412
411
|
selectable: true,
|
|
413
412
|
evented: true,
|
|
414
413
|
originX: 'center',
|
|
@@ -418,6 +417,7 @@ export default {
|
|
|
418
417
|
colIndex: j,
|
|
419
418
|
...this.eventStyle,
|
|
420
419
|
...others,
|
|
420
|
+
isContinue,
|
|
421
421
|
lockMovementY: true // 锁定Y轴,即只能x轴方向移动
|
|
422
422
|
});
|
|
423
423
|
},
|
|
@@ -497,13 +497,13 @@ export default {
|
|
|
497
497
|
// 移动手柄竖线后,需要更新this.lines,便于后面重新渲染时重新计算其左右限制坐标点
|
|
498
498
|
updateData(line, isHover) {
|
|
499
499
|
if (!line) return;
|
|
500
|
-
const { rowIndex, colIndex, position, left } = line;
|
|
500
|
+
const { rowIndex, colIndex, position, left, isContinue } = line;
|
|
501
501
|
const linesRow = this.lines[rowIndex];
|
|
502
502
|
// isHover,只是鼠标移上去显示提示信息而不需要重新计算x值
|
|
503
503
|
if (isHover) {
|
|
504
504
|
return { lineObj: { title: linesRow.title, obj: linesRow.lineList[colIndex], rowIndex, index: colIndex } };
|
|
505
505
|
}
|
|
506
|
-
const x = this.getXValue(left);
|
|
506
|
+
const x = this.getXValue(isContinue ? left + 0.5 : left);
|
|
507
507
|
if (position === 'left') {
|
|
508
508
|
linesRow.lineList[colIndex][0] = x;
|
|
509
509
|
} else {
|
|
@@ -85,7 +85,9 @@ export default {
|
|
|
85
85
|
selectArea: null, // 选区矩形对象
|
|
86
86
|
currentDelPoint: null, // 缓存当前可批量删除的项目线段上的点
|
|
87
87
|
polylinePointList: [], // 缓存折线项目节点
|
|
88
|
-
isMovingToOtherTarget: false
|
|
88
|
+
isMovingToOtherTarget: false,
|
|
89
|
+
interval: null,
|
|
90
|
+
flickerablePoints: [] // 记录需要闪烁的节点
|
|
89
91
|
};
|
|
90
92
|
},
|
|
91
93
|
computed: {
|
|
@@ -114,11 +116,12 @@ export default {
|
|
|
114
116
|
init() {
|
|
115
117
|
this.drawPolylineTitle();
|
|
116
118
|
this.polylinePointList = [];
|
|
119
|
+
this.flickerablePoints = [];
|
|
117
120
|
this.polyline.forEach((polylineType, polylineTypeId) => {
|
|
118
121
|
this.createPolyline(polylineType, polylineTypeId);
|
|
119
122
|
});
|
|
120
|
-
|
|
121
123
|
this.eventStyle.evented && this.createEvent();
|
|
124
|
+
this.setFlicker();
|
|
122
125
|
},
|
|
123
126
|
createEvent() {
|
|
124
127
|
this.canvas.on('mouse:up', event => {
|
|
@@ -424,15 +427,27 @@ export default {
|
|
|
424
427
|
const getTime = new Date(time).getTime();
|
|
425
428
|
return getTime >= minMinute && getTime <= maxMinute;
|
|
426
429
|
},
|
|
430
|
+
// 设置节点闪烁
|
|
431
|
+
setFlicker() {
|
|
432
|
+
setTimeout(() => {
|
|
433
|
+
if (this.interval) clearInterval(this.interval);
|
|
434
|
+
if (this.flickerablePoints?.length) {
|
|
435
|
+
this.interval = setInterval(() => {
|
|
436
|
+
this.flickerablePoints.forEach(o => o?.set('opacity', o.opacity === 1 ? 0.5 : 1));
|
|
437
|
+
this.canvas.renderAll();
|
|
438
|
+
}, 800);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
},
|
|
427
442
|
// 创建危急值和差异值
|
|
428
|
-
createAttrVaule(attr, polyline, polylineIndex, polylineType, polylineTypeId) {
|
|
443
|
+
createAttrVaule({ attr, polyline, polylineIndex, polylineType, polylineTypeId }) {
|
|
429
444
|
const { list } = polyline;
|
|
430
|
-
const
|
|
431
|
-
if (!
|
|
445
|
+
const { max, min } = polyline[attr] || {};
|
|
446
|
+
if (!max && !min) return;
|
|
432
447
|
|
|
433
448
|
const { originX, endX } = this.propItems;
|
|
434
|
-
const isMax =
|
|
435
|
-
const isMin =
|
|
449
|
+
const isMax = max?.show && max?.value && list.some(v => +v.value >= +max.value && this.isLimit(v.time));
|
|
450
|
+
const isMin = min?.show && min?.value && list.some(v => +v.value <= +min.value && this.isLimit(v.time));
|
|
436
451
|
const lines = [];
|
|
437
452
|
|
|
438
453
|
const drawLine = ({ value, lineStyle }) => {
|
|
@@ -449,21 +464,21 @@ export default {
|
|
|
449
464
|
top: top - 5
|
|
450
465
|
});
|
|
451
466
|
};
|
|
467
|
+
const isDraw = (isMaxOrMin, maxOrMin) => isMaxOrMin && (!maxOrMin?.flickerable || attr !== 'critical');
|
|
452
468
|
|
|
453
|
-
if (isMax) {
|
|
454
|
-
const line = drawLine(
|
|
455
|
-
const text = drawText(
|
|
469
|
+
if (isDraw(isMax, max)) {
|
|
470
|
+
const line = drawLine(max);
|
|
471
|
+
const text = drawText(max, line.top);
|
|
456
472
|
line.text = text;
|
|
457
473
|
lines.push(line, text);
|
|
458
474
|
}
|
|
459
|
-
if (isMin) {
|
|
460
|
-
const line = drawLine(
|
|
461
|
-
const text = drawText(
|
|
475
|
+
if (isDraw(isMin, min)) {
|
|
476
|
+
const line = drawLine(min);
|
|
477
|
+
const text = drawText(min, line.top);
|
|
462
478
|
line.text = text;
|
|
463
479
|
lines.push(line, text);
|
|
464
480
|
}
|
|
465
481
|
this.canvas.add(...lines);
|
|
466
|
-
// this.canvas.renderAll();
|
|
467
482
|
},
|
|
468
483
|
/**
|
|
469
484
|
* 绘制一条折线
|
|
@@ -475,10 +490,9 @@ export default {
|
|
|
475
490
|
*/
|
|
476
491
|
drawPolyline(polyline, polylineIndex, polylineType, polylineTypeId) {
|
|
477
492
|
const { originY, endY } = this.propItems;
|
|
478
|
-
const { pointAttr, lineAttr } = polyline;
|
|
493
|
+
const { pointAttr, lineAttr, list = [], critical = {} } = polyline;
|
|
479
494
|
this._iconClassName = polyline.type === 'img' && pointAttr.iconClassName ? pointAttr.iconClassName : '';
|
|
480
495
|
|
|
481
|
-
const list = polyline.list;
|
|
482
496
|
const pointList = [];
|
|
483
497
|
let lineList = [];
|
|
484
498
|
const _this = this;
|
|
@@ -493,6 +507,7 @@ export default {
|
|
|
493
507
|
}
|
|
494
508
|
return { isInit, points };
|
|
495
509
|
}
|
|
510
|
+
this.flickerablePoints = this.flickerablePoints.filter(point => point.polylineTypeId !== polylineTypeId && point.polylineIndex !== polylineIndex);
|
|
496
511
|
list.forEach((linePoints, index) => {
|
|
497
512
|
// 当前点
|
|
498
513
|
let { points, isInit } = getPointer(linePoints);
|
|
@@ -511,7 +526,8 @@ export default {
|
|
|
511
526
|
Object.assign(pointOthers, {
|
|
512
527
|
originLeft: points[0],
|
|
513
528
|
originTop: points[1],
|
|
514
|
-
time: linePoints.time
|
|
529
|
+
time: linePoints.time,
|
|
530
|
+
__value: linePoints.value
|
|
515
531
|
});
|
|
516
532
|
point = previousLine ? this.drawPoint(...points, previousLine, line, polyline.type, pointOthers, isInit) : this.drawPoint(...points, null, line, polyline.type, pointOthers, isInit);
|
|
517
533
|
}
|
|
@@ -548,11 +564,24 @@ export default {
|
|
|
548
564
|
return v;
|
|
549
565
|
});
|
|
550
566
|
this.canvas.add(...lineList, ...res);
|
|
551
|
-
|
|
567
|
+
|
|
568
|
+
// 缓存需要闪烁的节点
|
|
569
|
+
const { max, min } = critical;
|
|
570
|
+
if (max?.flickerable || min?.flickerable) {
|
|
571
|
+
const maxVal = max?.value;
|
|
572
|
+
const minVal = min?.value;
|
|
573
|
+
if (maxVal && max?.flickerable) {
|
|
574
|
+
this.flickerablePoints.push(...res.filter(point => +point.__value >= +maxVal));
|
|
575
|
+
}
|
|
576
|
+
if (minVal && min?.flickerable) {
|
|
577
|
+
this.flickerablePoints.push(...res.filter(point => +point.__value <= +minVal));
|
|
578
|
+
}
|
|
579
|
+
}
|
|
552
580
|
});
|
|
553
581
|
|
|
554
|
-
|
|
555
|
-
this.createAttrVaule(
|
|
582
|
+
const params = { polyline, polylineIndex, polylineType, polylineTypeId };
|
|
583
|
+
this.createAttrVaule({ ...params, attr: 'critical' });
|
|
584
|
+
this.createAttrVaule({ ...params, attr: 'diffValue' });
|
|
556
585
|
},
|
|
557
586
|
// 计算y轴坐标
|
|
558
587
|
cumputedY(polylineType, linePointY) {
|
|
@@ -1134,6 +1163,7 @@ export default {
|
|
|
1134
1163
|
this.removePolyline();
|
|
1135
1164
|
}
|
|
1136
1165
|
this.polylinePointList = [];
|
|
1166
|
+
this.flickerablePoints = [];
|
|
1137
1167
|
this.polyline.forEach((polylineType, polylineTypeId) => {
|
|
1138
1168
|
this.createPolyline(polylineType, polylineTypeId);
|
|
1139
1169
|
});
|
|
@@ -1145,6 +1175,10 @@ export default {
|
|
|
1145
1175
|
this.drawPolyline(this.polyline[polylineTypeId].dataList[parseInt(dadaIndex)], parseInt(dadaIndex), this.polyline[polylineTypeId], polylineTypeId);
|
|
1146
1176
|
}
|
|
1147
1177
|
}
|
|
1178
|
+
},
|
|
1179
|
+
beforeDestroy() {
|
|
1180
|
+
clearInterval(this.interval);
|
|
1181
|
+
this.interval = null;
|
|
1148
1182
|
}
|
|
1149
1183
|
};
|
|
1150
1184
|
</script>
|
|
@@ -45,11 +45,8 @@ export default {
|
|
|
45
45
|
// x轴时间刻度绘制
|
|
46
46
|
topScaleValue(obj) {
|
|
47
47
|
const { originX, originY, xCellWidth, originYTime, spaceHeight } = this.propItems;
|
|
48
|
-
const spaceGridNumber = obj.xScalevalue
|
|
49
|
-
const defaultSpaceMinute = obj.xScalevalue.defaultSpaceTime || 15;
|
|
48
|
+
const { spaceGridNumber = 3, defaultSpaceTime: defaultSpaceMinute = 15, style = {}, customStyle = {} } = obj.xScalevalue || {};
|
|
50
49
|
const defaultSpaceTime = defaultSpaceMinute * 60 * 1000;
|
|
51
|
-
const style = obj.xScalevalue.style || {};
|
|
52
|
-
const customStyle = obj.xScalevalue.customStyle || {};
|
|
53
50
|
const top = originYTime + Math.floor(spaceHeight / 2);
|
|
54
51
|
let textList = [];
|
|
55
52
|
const list = obj.xScalevalue.list || [];
|
|
@@ -73,18 +70,19 @@ export default {
|
|
|
73
70
|
},
|
|
74
71
|
rightScaleValue(obj) {
|
|
75
72
|
if (!obj) return;
|
|
76
|
-
const spaceGridNumber = obj.rightYScalevalue
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const style = obj.rightYScalevalue.style ? obj.rightYScalevalue.style : {};
|
|
73
|
+
const { spaceGridNumber = 2, marginLeft = 3, style = {}, list = [], unit } = obj.rightYScalevalue || {};
|
|
74
|
+
const { endX, endY, yCellHeight } = this.propItems;
|
|
75
|
+
const _originX = endX + marginLeft;
|
|
80
76
|
let textList = [];
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
list.forEach((item, index) => {
|
|
78
|
+
const numObj = this.createText(item, _originX, endY - index * yCellHeight * spaceGridNumber, 'left', style);
|
|
79
|
+
index === 0 && this.setOverFlowPoint(numObj);
|
|
80
|
+
textList.push(numObj);
|
|
83
81
|
});
|
|
84
82
|
// 添加单位
|
|
85
|
-
if (
|
|
86
|
-
const top =
|
|
87
|
-
textList.push(this.createText(
|
|
83
|
+
if (unit) {
|
|
84
|
+
const top = endY - list.length * yCellHeight * spaceGridNumber + yCellHeight;
|
|
85
|
+
textList.push(this.createText(unit, _originX, top, 'left', style));
|
|
88
86
|
}
|
|
89
87
|
const group = new this.fabric.Group([...textList], {
|
|
90
88
|
evented: false,
|
|
@@ -94,23 +92,22 @@ export default {
|
|
|
94
92
|
this.canvas.sendBackwards(group);
|
|
95
93
|
},
|
|
96
94
|
leftScaleValue(obj) {
|
|
97
|
-
const {
|
|
98
|
-
const
|
|
99
|
-
const [titleMarginRight, titleMarginButton] =
|
|
100
|
-
const listMarginRight = obj.leftYScalevalue.listMarginRight || 3;
|
|
101
|
-
const style = obj.leftYScalevalue.style || {};
|
|
102
|
-
const originX = this.propItems.originX;
|
|
95
|
+
const { spaceGridNumber = 2, titleMargin = [5, 30], listMarginRight = 3, style = {}, list = [], name, unit } = obj.leftYScalevalue || {};
|
|
96
|
+
const { originX, endY, yCellHeight } = this.propItems;
|
|
97
|
+
const [titleMarginRight, titleMarginButton] = titleMargin;
|
|
103
98
|
let textList = [];
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
list.forEach((item, index) => {
|
|
100
|
+
const numObj = this.createText(item, originX - listMarginRight, endY - index * yCellHeight * spaceGridNumber, 'right', style);
|
|
101
|
+
index === 0 && this.setOverFlowPoint(numObj);
|
|
102
|
+
textList.push(numObj);
|
|
106
103
|
});
|
|
107
104
|
|
|
108
105
|
// 添加标题和单位
|
|
109
106
|
let txt = '';
|
|
110
|
-
txt =
|
|
111
|
-
if (
|
|
107
|
+
txt = name || '';
|
|
108
|
+
if (unit) txt += '\n' + unit;
|
|
112
109
|
if (txt) {
|
|
113
|
-
const top = endY - (
|
|
110
|
+
const top = endY - (list.length - 1) * yCellHeight * spaceGridNumber - titleMarginButton;
|
|
114
111
|
textList.push(this.createText(txt, originX - titleMarginRight, top, 'right', { ...style, textAlign: 'right', originY: 'bottom' }));
|
|
115
112
|
}
|
|
116
113
|
const group = new this.fabric.Group([...textList], {
|
|
@@ -120,6 +117,10 @@ export default {
|
|
|
120
117
|
this.canvas.add(group);
|
|
121
118
|
this.canvas.sendBackwards(group);
|
|
122
119
|
},
|
|
120
|
+
setOverFlowPoint(point) {
|
|
121
|
+
const { endY, canvasHeight } = this.propItems;
|
|
122
|
+
endY === canvasHeight && point.set('top', point.top - point.height / 2);
|
|
123
|
+
},
|
|
123
124
|
createText(text, left, top, originX, style) {
|
|
124
125
|
return new this.fabric.Text(String(text), {
|
|
125
126
|
...this.defaultTextStyle,
|
|
@@ -264,18 +264,23 @@ export default {
|
|
|
264
264
|
if (list[index - 1]) {
|
|
265
265
|
top += item.lineHeight || 15;
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
const originOptions = { originX: 'right', left, top };
|
|
268
268
|
const title = new this.fabric.Text(String(item.title), {
|
|
269
269
|
...defaultVaule.style,
|
|
270
270
|
...defaultVaule.textStyle,
|
|
271
271
|
...item.style,
|
|
272
272
|
...(item.titleStyle || {}),
|
|
273
|
-
originX: 'right',
|
|
274
273
|
originY: 'center',
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
id: `${index}_other_${Date.now()}`,
|
|
275
|
+
dataIndex: index,
|
|
276
|
+
type: 'list',
|
|
277
|
+
hasControls: false,
|
|
278
|
+
hasBorders: false,
|
|
279
|
+
...originOptions,
|
|
280
|
+
...this.eventStyle,
|
|
281
|
+
dataList: []
|
|
278
282
|
});
|
|
283
|
+
this.setMovingEvent(title, originOptions);
|
|
279
284
|
textList.push(title);
|
|
280
285
|
const { icon: _icon = { type: 'circle' }, dataList } = item || {};
|
|
281
286
|
for (let i = 0, len = dataList.length; i < len; i++) {
|
|
@@ -288,9 +293,11 @@ export default {
|
|
|
288
293
|
index: i,
|
|
289
294
|
type: 'list'
|
|
290
295
|
};
|
|
296
|
+
const left = this.cumputedX(v.time);
|
|
297
|
+
title.dataList.push(left);
|
|
291
298
|
const icon = await this.createPoint(_icon.type, {
|
|
292
299
|
originX: 'center',
|
|
293
|
-
left
|
|
300
|
+
left,
|
|
294
301
|
...item.style,
|
|
295
302
|
...(item.style ? { stroke: item.style.fill } : {}),
|
|
296
303
|
...(_icon.style || {}),
|
|
@@ -300,7 +307,7 @@ export default {
|
|
|
300
307
|
...defaultVaule.style,
|
|
301
308
|
...defaultVaule.textStyle,
|
|
302
309
|
...item.style,
|
|
303
|
-
left:
|
|
310
|
+
left: left + icon.width / 2,
|
|
304
311
|
name: v.value,
|
|
305
312
|
...commonOptions
|
|
306
313
|
});
|
|
@@ -309,7 +316,8 @@ export default {
|
|
|
309
316
|
lockMovementX: true,
|
|
310
317
|
lockMovementY: true,
|
|
311
318
|
...commonOptions,
|
|
312
|
-
...this.eventStyle
|
|
319
|
+
...this.eventStyle,
|
|
320
|
+
realLeft: left
|
|
313
321
|
});
|
|
314
322
|
groupObj.hasControls = groupObj.hasBorders = false;
|
|
315
323
|
this.setPopup(groupObj);
|
|
@@ -319,6 +327,52 @@ export default {
|
|
|
319
327
|
}
|
|
320
328
|
this.canvas.add(...textList);
|
|
321
329
|
},
|
|
330
|
+
setMovingEvent(point) {
|
|
331
|
+
const { originX, originY, endX, endY } = this.propItems;
|
|
332
|
+
const isLimit = () => point.left >= originX && point.left <= endX && point.top >= originY && point.top <= endY;
|
|
333
|
+
let cloneObj;
|
|
334
|
+
point.on('moving', () => {
|
|
335
|
+
point.set('originX', 'center');
|
|
336
|
+
!point.isClone &&
|
|
337
|
+
point.clone(obj => {
|
|
338
|
+
obj.set('originX', 'right');
|
|
339
|
+
this.canvas.add(obj);
|
|
340
|
+
cloneObj = obj;
|
|
341
|
+
point.isClone = true;
|
|
342
|
+
});
|
|
343
|
+
if (isLimit()) {
|
|
344
|
+
Bus.$emit('mouseoverTarget', true);
|
|
345
|
+
this.showDrapPopup(point, true);
|
|
346
|
+
} else {
|
|
347
|
+
!this.isRightVisible && Bus.$emit('mouseoverTarget', false);
|
|
348
|
+
this.isDropVisible = false;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
point.on('moved', () => {
|
|
352
|
+
this.canvas.remove(cloneObj);
|
|
353
|
+
point.isClone = false;
|
|
354
|
+
this.removeOther();
|
|
355
|
+
this.drawTextDataGroup(this.templateData.other);
|
|
356
|
+
!this.isRightVisible && Bus.$emit('mouseoverTarget', false);
|
|
357
|
+
this.isDropVisible = false;
|
|
358
|
+
if (isLimit()) {
|
|
359
|
+
const { type, dataIndex, left, dataList } = point;
|
|
360
|
+
const time = this.getXValue(left);
|
|
361
|
+
const index = dataList.findIndex(_left => _left > left);
|
|
362
|
+
// 使用定时器,是因为:防止上方移除重绘过慢新增完后再次触发移除重绘导致页面多次重绘节点
|
|
363
|
+
setTimeout(() => {
|
|
364
|
+
this.$emit('addOhter', {
|
|
365
|
+
type,
|
|
366
|
+
dataIndex,
|
|
367
|
+
index: !~index ? (dataList.length ? dataList.length - 1 : 0) : index,
|
|
368
|
+
data: {
|
|
369
|
+
time
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
},
|
|
322
376
|
setPopup(point) {
|
|
323
377
|
point.on('mouseover', () => {
|
|
324
378
|
Bus.$emit('mouseoverTarget', true);
|
|
@@ -346,10 +400,11 @@ export default {
|
|
|
346
400
|
},
|
|
347
401
|
// 底部标记
|
|
348
402
|
drawBottomTextDataGroup(obj) {
|
|
349
|
-
|
|
403
|
+
const { endX, originX, endY, canvasHeight, topTotal } = this.propItems;
|
|
404
|
+
if (!obj.list || endY === canvasHeight) {
|
|
350
405
|
return;
|
|
351
406
|
}
|
|
352
|
-
|
|
407
|
+
|
|
353
408
|
topTotal.width && this.canvas.add(this.drawLine([endX, endY - 1, endX, canvasHeight], { ...this.defaultRectStyle }));
|
|
354
409
|
// const textList = [];
|
|
355
410
|
const marginLeft = this.templateData.left.leftYScalevalue.spaceGridNumber || defaultVaule.spaceGridNumber;
|
|
@@ -546,7 +601,7 @@ export default {
|
|
|
546
601
|
top: point.top,
|
|
547
602
|
margin: { top: this.propItems.yCellHeight }
|
|
548
603
|
};
|
|
549
|
-
const x = arguments.length > 1 && point.other?.viewTime ? point.other.viewTime : this.getXValue(point.left);
|
|
604
|
+
const x = arguments.length > 1 && point.other?.viewTime ? point.other.viewTime : this.getXValue(point.realLeft || point.left);
|
|
550
605
|
this.dropVal = {
|
|
551
606
|
title: point.name || '',
|
|
552
607
|
list: [{ id: '1', name: '时间', value: x }]
|
|
@@ -406,6 +406,7 @@ export default create({
|
|
|
406
406
|
return function (item) {
|
|
407
407
|
let { type } = item || {};
|
|
408
408
|
let tempTile = this.config?.autoQuestionNumber === false ? item.showTitle : `${item.softcode}、${item.showTitle}`;
|
|
409
|
+
tempTile = this.html2Escape(tempTile);
|
|
409
410
|
if (!this.isEvaluation(type)) return tempTile;
|
|
410
411
|
|
|
411
412
|
let score = this.handleEvaluationScore(item);
|
|
@@ -1848,6 +1849,12 @@ export default create({
|
|
|
1848
1849
|
handleEvaluationScore(ele) {
|
|
1849
1850
|
let { minScore = 0, maxScore = 0, scoreType } = ele.scoreConfigs || {};
|
|
1850
1851
|
return `(${maxScore}分)`;
|
|
1852
|
+
},
|
|
1853
|
+
html2Escape(sHtml) {
|
|
1854
|
+
if(!sHtml || typeof sHtml != 'string') return sHtml;
|
|
1855
|
+
return sHtml.replace(/[<>&"]/g,function(c){
|
|
1856
|
+
return {'<':'<','>':'>','&':'&','"':'"'}[c];
|
|
1857
|
+
});
|
|
1851
1858
|
}
|
|
1852
1859
|
}
|
|
1853
1860
|
});
|