cnhis-design-vue 0.2.42-beta → 0.2.45-beta
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/es/affix/index.js +8 -8
- package/es/affix/style.css +0 -0
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/alert/style.css +0 -0
- package/es/anchor/index.js +8 -8
- package/es/anchor/style.css +0 -0
- package/es/auto-complete/index.js +8 -8
- package/es/auto-complete/style.css +0 -0
- package/es/avatar/index.js +8 -8
- package/es/avatar/style.css +0 -0
- package/es/back-top/index.js +8 -8
- package/es/back-top/style.css +0 -0
- package/es/badge/index.js +8 -8
- package/es/badge/style.css +0 -0
- package/es/base/index.js +8 -8
- package/es/base/style.css +0 -0
- package/es/big-table/index.js +169 -136
- package/es/big-table/style.css +1 -1
- package/es/breadcrumb/index.js +8 -8
- package/es/breadcrumb/style.css +0 -0
- package/es/button/index.js +64 -61
- package/es/calendar/index.js +8 -8
- package/es/calendar/style.css +0 -0
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/card/style.css +0 -0
- package/es/carousel/index.js +8 -8
- package/es/carousel/style.css +0 -0
- package/es/cascader/index.js +8 -8
- package/es/cascader/style.css +0 -0
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/col/style.css +0 -0
- package/es/collapse/index.js +8 -8
- package/es/collapse/style.css +0 -0
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/comment/style.css +0 -0
- package/es/config-provider/index.js +8 -8
- package/es/config-provider/style.css +0 -0
- package/es/date-picker/index.js +8 -8
- package/es/date-picker/style.css +0 -0
- package/es/descriptions/index.js +8 -8
- package/es/descriptions/style.css +0 -0
- package/es/divider/index.js +8 -8
- package/es/divider/style.css +0 -0
- package/es/drag-layout/index.js +39 -36
- package/es/drawer/index.js +8 -8
- package/es/drawer/style.css +0 -0
- package/es/dropdown/index.js +8 -8
- package/es/dropdown/style.css +0 -0
- package/es/editor/index.js +31 -11
- package/es/empty/index.js +8 -8
- package/es/empty/style.css +0 -0
- package/es/fabric-chart/index.js +588 -340
- package/es/fabric-chart/style.css +1 -1
- package/es/form/index.js +8 -8
- package/es/form/style.css +0 -0
- package/es/form-model/index.js +8 -8
- package/es/form-model/style.css +0 -0
- package/es/form-table/index.js +177 -154
- package/es/form-table/style.css +1 -1
- package/es/grid/index.js +24 -0
- package/es/grid/style.css +0 -0
- package/es/icon/style.css +0 -0
- package/es/index/index.js +1647 -1155
- package/es/index/style.css +1 -1
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/input-number/style.css +0 -0
- package/es/layout/index.js +8 -8
- package/es/layout/style.css +0 -0
- package/es/list/index.js +8 -8
- package/es/list/style.css +0 -0
- package/es/locale-provider/index.js +8 -8
- package/es/locale-provider/style.css +0 -0
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/mentions/style.css +0 -0
- package/es/menu/index.js +8 -8
- package/es/menu/style.css +0 -0
- package/es/message/index.js +8 -8
- package/es/message/style.css +0 -0
- package/es/modal/style.css +0 -0
- package/es/multi-chat/index.js +176 -146
- package/es/multi-chat/style.css +1 -1
- package/es/multi-chat-client/index.js +169 -139
- package/es/multi-chat-client/style.css +1 -1
- package/es/multi-chat-history/index.js +40 -37
- package/es/multi-chat-record/index.js +50 -47
- package/es/multi-chat-setting/index.js +97 -84
- package/es/multi-chat-setting/style.css +1 -1
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/notification/style.css +0 -0
- package/es/page-header/index.js +8 -8
- package/es/page-header/style.css +0 -0
- package/es/pagination/index.js +8 -8
- package/es/pagination/style.css +0 -0
- package/es/popconfirm/index.js +8 -8
- package/es/popconfirm/style.css +0 -0
- package/es/popover/index.js +8 -8
- package/es/popover/style.css +0 -0
- package/es/progress/index.js +8 -8
- package/es/progress/style.css +0 -0
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/rate/style.css +0 -0
- package/es/result/index.js +8 -8
- package/es/result/style.css +0 -0
- package/es/row/index.js +8 -8
- package/es/row/style.css +0 -0
- package/es/scale-view/index.js +92 -69
- package/es/select/index.js +487 -280
- package/es/select/style.css +1 -1
- package/es/select-label/index.js +78 -55
- package/es/select-person/index.js +63 -63
- package/es/select-person/style.css +1 -1
- package/es/skeleton/index.js +8 -8
- package/es/skeleton/style.css +0 -0
- package/es/slider/index.js +8 -8
- package/es/slider/style.css +0 -0
- package/es/space/index.js +8 -8
- package/es/space/style.css +0 -0
- package/es/spin/index.js +8 -8
- package/es/spin/style.css +0 -0
- package/es/statistic/index.js +8 -8
- package/es/statistic/style.css +0 -0
- package/es/steps/index.js +8 -8
- package/es/steps/style.css +0 -0
- package/es/switch/index.js +8 -8
- package/es/switch/style.css +0 -0
- package/es/table-filter/index.js +205 -171
- package/es/table-filter/style.css +1 -1
- package/es/tabs/index.js +8 -8
- package/es/tabs/style.css +0 -0
- package/es/tag/index.js +45 -42
- package/es/time-picker/index.js +8 -8
- package/es/time-picker/style.css +0 -0
- package/es/timeline/index.js +8 -8
- package/es/timeline/style.css +0 -0
- package/es/tooltip/index.js +8 -8
- package/es/tooltip/style.css +0 -0
- package/es/transfer/index.js +8 -8
- package/es/transfer/style.css +0 -0
- package/es/tree/index.js +8 -8
- package/es/tree/style.css +0 -0
- package/es/tree-select/index.js +8 -8
- package/es/tree-select/style.css +0 -0
- package/es/upload/index.js +8 -8
- package/es/upload/style.css +0 -0
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +2807 -1378
- package/lib/cui.umd.js +2807 -1378
- package/lib/cui.umd.min.js +77 -77
- package/package.json +4 -2
- package/packages/big-table/src/BigTable.vue +2 -3
- package/packages/big-table/src/utils/bigTableProps.js +9 -1
- package/packages/fabric-chart/src/FabricChart.vue +3 -0
- package/packages/fabric-chart/src/components/DropPopup.vue +0 -2
- package/packages/fabric-chart/src/components/MouseRightClick.vue +1 -1
- package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +5 -1
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +181 -92
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +3 -2
- package/packages/form-table/src/FormTable.vue +1 -1
- package/packages/grid/src/grid.js +3 -0
- package/packages/multi-chat/chat/chatMain.vue +1 -1
- package/packages/multi-chat/setting/index.vue +6 -1
- package/packages/multi-chat/store/actions.js +4 -1
- package/packages/select/src/CustomSelect/index.vue +40 -13
- package/packages/select/src/TableSelect/index.vue +177 -113
- package/packages/select-person/select-person.vue +1 -9
- package/packages/table-filter/src/base-search-com/BaseSearch.vue +8 -1
- package/packages/table-filter/src/components/multi-select/multi-select.vue +0 -1
- package/packages/table-filter/src/components/search-condition/SearchCondition.vue +3 -0
- package/src/component/select-pages/index.vue +2 -2
- package/packages/select/src/CustomSelect/components/select-pages.vue +0 -53
- package/packages/table-filter/src/components/multi-select/select-pages.vue +0 -72
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.45-beta",
|
|
4
4
|
"description": "基于 Ant Desgin Vue 的UI库",
|
|
5
5
|
"keyword": "cnhis-design-vue vue cnhis",
|
|
6
6
|
"homepage": "http://dv.cnhis.com/",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"build:utils": "cross-env BABEL_ENV=utils babel src/utils --config-file ./build/babel.component.js --out-dir es/utils",
|
|
24
24
|
"build:docs": "vue-cli-service build --mode docs",
|
|
25
25
|
"build:es": "vue-cli-service build --mode component && npm run build:utils",
|
|
26
|
+
"postbuild:es": "node ./build/build.component.js",
|
|
26
27
|
"build:umd": "vue-cli-service build --mode library --target lib --name cui --dest lib packages/index.js",
|
|
27
28
|
"build:lib": "npm run build:es && npm run build:umd",
|
|
28
29
|
"lint": "vue-cli-service lint"
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"vue-resize-directive": "^1.2.0",
|
|
50
51
|
"vue-simple-uploader": "^0.7.6",
|
|
51
52
|
"vuedraggable": "^2.24.3",
|
|
53
|
+
"vxe-table-plugin-antd": "^1.11.3",
|
|
52
54
|
"vxe-table": "^3.4.1",
|
|
53
55
|
"wangeditor": "^4.7.5",
|
|
54
56
|
"xe-utils": "^3.4.0"
|
|
@@ -93,4 +95,4 @@
|
|
|
93
95
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
|
-
}
|
|
98
|
+
}
|
|
@@ -1759,7 +1759,7 @@ export default create({
|
|
|
1759
1759
|
/>
|
|
1760
1760
|
{field.visible ? (
|
|
1761
1761
|
<div
|
|
1762
|
-
v-dom-portal
|
|
1762
|
+
v-dom-portal={this.filterDomPortal}
|
|
1763
1763
|
class="big-table-filter-wrap"
|
|
1764
1764
|
style={{
|
|
1765
1765
|
left: field.left,
|
|
@@ -1995,7 +1995,6 @@ export default create({
|
|
|
1995
1995
|
field.left = 'initial';
|
|
1996
1996
|
field.right = 'initial';
|
|
1997
1997
|
field.top = 'initial';
|
|
1998
|
-
|
|
1999
1998
|
let transformWrapWidth = transformWrap.clientWidth;
|
|
2000
1999
|
if (btnRectLeft + FILTER_BOX_WIDTH > transformWrapWidth) {
|
|
2001
2000
|
let transformWrapRight = transformWrap?.getBoundingClientRect().right || 0;
|
|
@@ -2004,7 +2003,7 @@ export default create({
|
|
|
2004
2003
|
field.left = btnRectLeft + 'px';
|
|
2005
2004
|
}
|
|
2006
2005
|
|
|
2007
|
-
field.top = btnRectTop + FILTER_BOX_TOP_OFFSET + 'px';
|
|
2006
|
+
field.top = (btnRectTop + FILTER_BOX_TOP_OFFSET) + (this.filterTopOffset || 0)+ 'px';
|
|
2008
2007
|
|
|
2009
2008
|
field.visible = !field.visible;
|
|
2010
2009
|
|
|
@@ -80,7 +80,15 @@ const bigTableProps = {
|
|
|
80
80
|
asyncCount: Boolean,
|
|
81
81
|
showSettings: { type: Object, default: () => ({}) },
|
|
82
82
|
inlineFormData: { type: Object, default: () => ({}) },
|
|
83
|
-
inlineOriginalTableRow: { type: Object, default: () => ({}) }
|
|
83
|
+
inlineOriginalTableRow: { type: Object, default: () => ({}) },
|
|
84
|
+
filterDomPortal:{ // 表头筛选挂载的地方
|
|
85
|
+
type: String,
|
|
86
|
+
default: "body"
|
|
87
|
+
},
|
|
88
|
+
filterTopOffset:{ // 表头 top 调节
|
|
89
|
+
type: Number,
|
|
90
|
+
default: 0
|
|
91
|
+
}
|
|
84
92
|
};
|
|
85
93
|
|
|
86
94
|
export default bigTableProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="c-mouse-right-menu-popup c-animation-in" :style="dialogStyle">
|
|
3
3
|
<div class="c-mouse-right-menu">
|
|
4
|
-
<div v-for="item in nodeList" :key="
|
|
4
|
+
<div v-for="(item, index) in nodeList" :key="index" class="c-mouse-menu-item" @click="handleNodeClick(item)">
|
|
5
5
|
<span>{{ item.name }}</span>
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
@@ -68,7 +68,8 @@ export default {
|
|
|
68
68
|
yScaleCellLeft: this.yScaleCellLeft,
|
|
69
69
|
yScaleCellRight: this.yScaleCellRight,
|
|
70
70
|
eventStyle: this.eventStyle,
|
|
71
|
-
topTotal: this.topTotal
|
|
71
|
+
topTotal: this.topTotal,
|
|
72
|
+
operable: this.operable
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
};
|
|
@@ -200,6 +201,9 @@ export default {
|
|
|
200
201
|
},
|
|
201
202
|
eventStyle() {
|
|
202
203
|
return this.templateData.table?.eventStyle || { selectable: true, evented: true };
|
|
204
|
+
},
|
|
205
|
+
operable() {
|
|
206
|
+
return this.templateData.table?.operable || { set: false, connect: false };
|
|
203
207
|
}
|
|
204
208
|
},
|
|
205
209
|
mounted() {
|
|
@@ -14,10 +14,18 @@ import MouseRightClick from '../components/MouseRightClick';
|
|
|
14
14
|
import DropPopup from '../components/DropPopup';
|
|
15
15
|
import defaultVaule from '../const/defaultVaule';
|
|
16
16
|
|
|
17
|
+
const isEffectiveNode = node => {
|
|
18
|
+
return node?.time && (node?.value || node?.value === 0);
|
|
19
|
+
};
|
|
17
20
|
const rightClickNode = [
|
|
18
21
|
{ name: '新增节点', type: 'add' },
|
|
22
|
+
{ name: '检测项设置', type: 'set' },
|
|
19
23
|
{ name: '删除节点', type: 'delete' }
|
|
20
24
|
];
|
|
25
|
+
const rightClickNodeConnect = [
|
|
26
|
+
{ name: '新增节点连接右侧节点', type: 'add', },
|
|
27
|
+
{ name: '新增节点连接左侧节点', type: 'add' }
|
|
28
|
+
];
|
|
21
29
|
export default {
|
|
22
30
|
name: 'fabric-polylines',
|
|
23
31
|
mixins: [FabricCommon, draw, eventCommon],
|
|
@@ -43,13 +51,6 @@ export default {
|
|
|
43
51
|
dropPos: { clientX: 0, clientY: 0 },
|
|
44
52
|
isRightVisible: false,
|
|
45
53
|
rightPos: { clientX: 0, clientY: 0 },
|
|
46
|
-
|
|
47
|
-
willUpdatePolylineIndex: 0,
|
|
48
|
-
// willUpdatePointIndex: 0,
|
|
49
|
-
// willUpdateLine: null,
|
|
50
|
-
polylineList: [],
|
|
51
|
-
|
|
52
|
-
// polineGroup: null,
|
|
53
54
|
rightClickNode: [],
|
|
54
55
|
activeEvent: null, // 当前可右键活动的对象
|
|
55
56
|
addPointList: [], // 快速新增的节点list
|
|
@@ -64,24 +65,12 @@ export default {
|
|
|
64
65
|
},
|
|
65
66
|
|
|
66
67
|
watch: {
|
|
67
|
-
// polyline() {
|
|
68
|
-
// this.repaintPolyline();
|
|
69
|
-
// },
|
|
70
|
-
// polylineList(value) {
|
|
71
|
-
// if (value) {
|
|
72
|
-
// // console.log(this.canvas.toObject());
|
|
73
|
-
// this.polylineList.forEach((polylineType, polylineTypeId) => {
|
|
74
|
-
// this.createPolyline(polylineType, polylineTypeId);
|
|
75
|
-
// });
|
|
76
|
-
// }
|
|
77
|
-
// }
|
|
78
68
|
},
|
|
79
69
|
|
|
80
70
|
mounted() {
|
|
81
71
|
this.$nextTick(() => {
|
|
82
|
-
this.polylineList = [...this.polyline];
|
|
83
72
|
this.drawPolylineTitle();
|
|
84
|
-
this.
|
|
73
|
+
this.polyline.forEach((polylineType, polylineTypeId) => {
|
|
85
74
|
this.createPolyline(polylineType, polylineTypeId);
|
|
86
75
|
});
|
|
87
76
|
|
|
@@ -160,7 +149,7 @@ export default {
|
|
|
160
149
|
// 绘制左侧折线标题
|
|
161
150
|
drawPolylineTitle() {
|
|
162
151
|
const { canvasHeight, treeTableminCellWidth, originX, xScaleList, xScaleCellList, endX } = this.propItems;
|
|
163
|
-
const leftYScalevalue = this.
|
|
152
|
+
const leftYScalevalue = this.polyline.find(v => v.position === 'left');
|
|
164
153
|
const lableMargin = leftYScalevalue.lableMargin || [5, 30];
|
|
165
154
|
const lableLineHeight = leftYScalevalue.lableLineHeight || 20;
|
|
166
155
|
const style = leftYScalevalue.style || { fontSize: 12, fill: '#000' };
|
|
@@ -169,19 +158,19 @@ export default {
|
|
|
169
158
|
|
|
170
159
|
const minTime = Math.min(...xScaleList);
|
|
171
160
|
const maxTime = Math.max(...xScaleList);
|
|
172
|
-
this.
|
|
161
|
+
this.polyline.forEach((item, index) => {
|
|
173
162
|
item.dataList.forEach((v, i) => {
|
|
174
|
-
|
|
163
|
+
// 配置是否可拖动标题图标批量增加-
|
|
175
164
|
const isAdd = v.list.length
|
|
176
165
|
? !v.list.some(k => {
|
|
177
|
-
return k
|
|
166
|
+
return isEffectiveNode(k) && new Date(k.time).getTime() >= minTime && new Date(k.time).getTime() < xScaleCellList[1].time;
|
|
178
167
|
})
|
|
179
168
|
: true;
|
|
180
169
|
let rightLimit = endX;
|
|
181
|
-
const point = v.list.find(k => k
|
|
170
|
+
const point = v.list.find(k => isEffectiveNode(k) && new Date(k.time).getTime() >= xScaleCellList[1].time && new Date(k.time).getTime() <= maxTime);
|
|
182
171
|
const limitObj =
|
|
183
172
|
point &&
|
|
184
|
-
JSON.parse(JSON.stringify(
|
|
173
|
+
JSON.parse(JSON.stringify(xScaleCellList))
|
|
185
174
|
.reverse()
|
|
186
175
|
.find(k => new Date(point.time).getTime() > k.time);
|
|
187
176
|
limitObj && (rightLimit = limitObj.x);
|
|
@@ -275,9 +264,19 @@ export default {
|
|
|
275
264
|
let originTop = top;
|
|
276
265
|
let cloneIconId;
|
|
277
266
|
icon.on('moving', () => {
|
|
267
|
+
|
|
268
|
+
// 优化左侧图标太小不容易选中的问题
|
|
269
|
+
if (!icon.url && icon.scaleX == 1.8 && icon.scaleY == 1.8) {
|
|
270
|
+
icon.set({
|
|
271
|
+
'scaleX': 1,
|
|
272
|
+
'scaleY': 1
|
|
273
|
+
});
|
|
274
|
+
this.canvas.renderAll();
|
|
275
|
+
}
|
|
276
|
+
|
|
278
277
|
if (!cloneIconId) {
|
|
278
|
+
cloneIconId = '_polylinePoint_temp_' + new Date().getTime();
|
|
279
279
|
icon.clone(clonedObj => {
|
|
280
|
-
cloneIconId = '_polylinePoint_temp_' + new Date().getTime();
|
|
281
280
|
clonedObj.set({
|
|
282
281
|
id: cloneIconId // 此id必须,用于remove节点的时候
|
|
283
282
|
});
|
|
@@ -321,6 +320,17 @@ export default {
|
|
|
321
320
|
this.drawPolylineTitle();
|
|
322
321
|
});
|
|
323
322
|
|
|
323
|
+
// 优化左侧图标太小不容易选中的问题
|
|
324
|
+
if (icon.evented && !icon.url) {
|
|
325
|
+
const maxVal = Math.max(icon.width * icon.scale, icon.height * icon.scale);
|
|
326
|
+
if (maxVal < 7) {
|
|
327
|
+
icon.set({
|
|
328
|
+
scaleX: 1.8,
|
|
329
|
+
scaleY: 1.8
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
324
334
|
this.canvas.add(text, icon);
|
|
325
335
|
this.canvas.requestRenderAll();
|
|
326
336
|
});
|
|
@@ -367,7 +377,7 @@ export default {
|
|
|
367
377
|
const lines = [];
|
|
368
378
|
|
|
369
379
|
const drawLine = ({ value, lineStyle }) => {
|
|
370
|
-
const top = this.cumputedY(polylineType, +value
|
|
380
|
+
const top = this.cumputedY(polylineType, +value);
|
|
371
381
|
return this.drawLine([originX, top, endX, top], { polylineIndex, lineIndex: 0, polylineTypeId, ...(lineStyle || defaultVaule.criticalStyle) });
|
|
372
382
|
};
|
|
373
383
|
const drawText = ({ name, nameStyle }, top) => {
|
|
@@ -417,9 +427,9 @@ export default {
|
|
|
417
427
|
// 当前点
|
|
418
428
|
let points = null;
|
|
419
429
|
let isInit = false;
|
|
420
|
-
if (
|
|
430
|
+
if (isEffectiveNode(linePoints)) {
|
|
421
431
|
const x = this.cumputedX(linePoints.time);
|
|
422
|
-
const y = this.cumputedY(polylineType, linePoints.value
|
|
432
|
+
const y = this.cumputedY(polylineType, linePoints.value);
|
|
423
433
|
isInit = y < originY || y > endY;
|
|
424
434
|
if (this.isLimit(linePoints.time)) points = [x, y < originY ? originY : y > endY ? endY : y];
|
|
425
435
|
}
|
|
@@ -427,9 +437,9 @@ export default {
|
|
|
427
437
|
// 下一个点
|
|
428
438
|
const nextPoints = list[index + 1];
|
|
429
439
|
let nextPoint = null;
|
|
430
|
-
if (
|
|
440
|
+
if (isEffectiveNode(nextPoints)) {
|
|
431
441
|
const nextX = this.cumputedX(nextPoints.time);
|
|
432
|
-
const nextY = this.cumputedY(polylineType, nextPoints.value
|
|
442
|
+
const nextY = this.cumputedY(polylineType, nextPoints.value);
|
|
433
443
|
if (this.isLimit(nextPoints.time)) nextPoint = [nextX, nextY < originY ? originY : nextY > endY ? endY : nextY];
|
|
434
444
|
}
|
|
435
445
|
let line;
|
|
@@ -440,6 +450,7 @@ export default {
|
|
|
440
450
|
previousLine = lineList[index - 1];
|
|
441
451
|
const pointOthers = { polylineTypeId, polylineIndex, pointIndex: index, ...pointAttr, lineAttr };
|
|
442
452
|
if (points) {
|
|
453
|
+
pointOthers.time = linePoints.time;
|
|
443
454
|
point = previousLine ? this.drawPoint(...points, previousLine, line, polyline.type, pointOthers, isInit) : this.drawPoint(...points, null, line, polyline.type, pointOthers, isInit);
|
|
444
455
|
}
|
|
445
456
|
lineList.push(line);
|
|
@@ -463,9 +474,11 @@ export default {
|
|
|
463
474
|
this.createCritical(polyline, polylineIndex, polylineType, polylineTypeId);
|
|
464
475
|
},
|
|
465
476
|
// 计算y轴坐标
|
|
466
|
-
cumputedY(polylineType, linePointY
|
|
467
|
-
const
|
|
468
|
-
const
|
|
477
|
+
cumputedY(polylineType, linePointY) {
|
|
478
|
+
const { position = 'left', list = [] } = polylineType;
|
|
479
|
+
const key = position === 'left' ? 'Left' : 'Right';
|
|
480
|
+
const yScaleCell = this.propItems[`yScaleCell${key}`];
|
|
481
|
+
const yCellUnit = linePointY - Math.min(...list);
|
|
469
482
|
return this.propItems.endY - yScaleCell * yCellUnit;
|
|
470
483
|
},
|
|
471
484
|
/**
|
|
@@ -510,7 +523,7 @@ export default {
|
|
|
510
523
|
this.canvas.renderAll();
|
|
511
524
|
this.showDrapPopup(point);
|
|
512
525
|
});
|
|
513
|
-
// 折线点停止拖拽后 更新
|
|
526
|
+
// 折线点停止拖拽后 更新polyline中对应的坐标
|
|
514
527
|
point.on('moved', () => {
|
|
515
528
|
if (point && point.id.includes('_polylinePoint_')) {
|
|
516
529
|
this.isDropVisible = false;
|
|
@@ -541,11 +554,18 @@ export default {
|
|
|
541
554
|
...last,
|
|
542
555
|
value: {
|
|
543
556
|
time: this.getXValue(point.nextPoint.left),
|
|
544
|
-
value: this.getYValue(point.polylineTypeId
|
|
557
|
+
value: this.getYValue(this.polyline[point.polylineTypeId].position, point.nextPoint.top)
|
|
545
558
|
}
|
|
546
559
|
};
|
|
547
|
-
last.left === point.left
|
|
548
|
-
|
|
560
|
+
if (last.left === point.left) {
|
|
561
|
+
this.addPointList.splice(-1, 1, value);
|
|
562
|
+
} else {
|
|
563
|
+
this.addPointList.push(value);
|
|
564
|
+
const [lastPoint, prePoint, ...list] = JSON.parse(JSON.stringify(this.addPointList)).reverse();
|
|
565
|
+
if (prePoint.value.time == lastPoint.value.time) {
|
|
566
|
+
this.addPointList.splice(-2, 1);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
549
569
|
}
|
|
550
570
|
!point.id.includes('isTitle') && this.removePolyline(point.id);
|
|
551
571
|
this.$emit('pointOperation', 'increasePointBatch', this.addPointList);
|
|
@@ -567,7 +587,7 @@ export default {
|
|
|
567
587
|
* @param {*} originTop 拖动的源节点的top值
|
|
568
588
|
* @return {*}
|
|
569
589
|
*/
|
|
570
|
-
addPoint(point, originLeft, originTop) {
|
|
590
|
+
async addPoint(point, originLeft, originTop) {
|
|
571
591
|
const { xCellWidth, table, originX } = this.propItems;
|
|
572
592
|
// const addPointSpaceGridNumbers = table.addPointSpaceGridNumbers || [];
|
|
573
593
|
let addPointSpaceGridNumber = table.addPointSpaceGridNumber || 1;
|
|
@@ -576,7 +596,7 @@ export default {
|
|
|
576
596
|
const currentLeft = left;
|
|
577
597
|
|
|
578
598
|
const startLength = this.addPointList.length;
|
|
579
|
-
const n =
|
|
599
|
+
const n = 6; // 拖动范围,在需要增加节点的刻度左右吸入的范围值
|
|
580
600
|
const spaceWidth = xCellWidth * addPointSpaceGridNumber;
|
|
581
601
|
const residue = (left - originLeft) % spaceWidth;
|
|
582
602
|
|
|
@@ -588,21 +608,46 @@ export default {
|
|
|
588
608
|
point.set({
|
|
589
609
|
left
|
|
590
610
|
});
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
611
|
+
|
|
612
|
+
const checkPoints = () => {
|
|
613
|
+
const PointLens = Math.floor((left - originLeft) / spaceWidth);
|
|
614
|
+
if (PointLens > 1 && this.addPointList?.length < PointLens) {
|
|
615
|
+
for (let k = 0; k < PointLens; k++) {
|
|
616
|
+
if (k > 0) {
|
|
617
|
+
const curLeft = originLeft + spaceWidth * k;
|
|
618
|
+
// 判断this.addPointList中的left是否包含curLeft,不包含就说明是漏了
|
|
619
|
+
const isNoLack = this.addPointList.some(v => v.left === curLeft);
|
|
620
|
+
if (!isNoLack) {
|
|
621
|
+
let index;
|
|
622
|
+
const pointObj = this.addPointList.find((v, i) => {
|
|
623
|
+
if (v.left > curLeft) {
|
|
624
|
+
index = i;
|
|
625
|
+
}
|
|
626
|
+
return v.left > curLeft;
|
|
627
|
+
});
|
|
628
|
+
if (pointObj) {
|
|
629
|
+
let cloneObj = JSON.parse(JSON.stringify(pointObj));
|
|
630
|
+
cloneObj.value.time = this.getXValue(curLeft);
|
|
631
|
+
cloneObj.left = curLeft;
|
|
632
|
+
this.addPointList.splice(index, 0 , cloneObj);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
// const i = Math.floor((left - originLeft) / spaceWidth);
|
|
597
641
|
// 复制点和线
|
|
598
642
|
if (left > originLeft) {
|
|
599
643
|
point.line1 && this.removePolyline(point.line1.id);
|
|
600
|
-
if (i === 1) {
|
|
601
|
-
this.clonePoint(point, [point.line1 ? point.line1.x1 : originLeft, point.line1 ? point.line1.y1 : originTop, originLeft, originTop]);
|
|
602
|
-
}
|
|
603
|
-
if (
|
|
604
|
-
const points1 = i === 1 ? [originLeft, originTop] : point.prePoints;
|
|
605
|
-
points1
|
|
644
|
+
// if (i === 1) {
|
|
645
|
+
this.addPointList.length == 0 && await this.clonePoint(point, [point.line1 ? point.line1.x1 : originLeft, point.line1 ? point.line1.y1 : originTop, originLeft, originTop]);
|
|
646
|
+
// }
|
|
647
|
+
if (this.addPointList.every(v => v.left !== left)) {
|
|
648
|
+
// const points1 = i === 1 ? [originLeft, originTop] : point.prePoints;
|
|
649
|
+
const points1 = this.addPointList.length == 0 ? [originLeft, originTop] : point.prePoints;
|
|
650
|
+
points1 && await this.clonePoint(point, [...points1, left, top]);
|
|
606
651
|
// this.setAddPointList(point);
|
|
607
652
|
// 调用上面方法就会导致线段绘制失败,目前还不知道为啥子
|
|
608
653
|
const { data, x, y } = this.getValue(point);
|
|
@@ -611,15 +656,17 @@ export default {
|
|
|
611
656
|
data.top = top;
|
|
612
657
|
this.addPointList.push(data);
|
|
613
658
|
}
|
|
659
|
+
checkPoints();
|
|
614
660
|
}
|
|
615
661
|
}
|
|
662
|
+
|
|
616
663
|
// 断点相连
|
|
617
664
|
if (point.nextPoint && left >= point.nextPoint.left - n && top <= point.nextPoint.top + n && top >= point.nextPoint.top - n) {
|
|
618
665
|
point.set({
|
|
619
666
|
left: point.nextPoint.get('left'),
|
|
620
667
|
top: point.nextPoint.get('top'),
|
|
621
|
-
scaleX: point.scale === 1 ?
|
|
622
|
-
scaleY: point.scale === 1 ?
|
|
668
|
+
scaleX: point.scale === 1 ? 2.5 : 0.1,
|
|
669
|
+
scaleY: point.scale === 1 ? 2.5 : 0.1
|
|
623
670
|
});
|
|
624
671
|
} else if (point.nextPoint) {
|
|
625
672
|
point.set({
|
|
@@ -648,25 +695,29 @@ export default {
|
|
|
648
695
|
polylineIndex = point.polylineIndex;
|
|
649
696
|
polylineTypeId = point.polylineTypeId;
|
|
650
697
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
698
|
+
return new Promise((resolve, reject) => {
|
|
699
|
+
point.clone(clonedObj => {
|
|
700
|
+
clonedObj.set({
|
|
701
|
+
left: points[2],
|
|
702
|
+
top: points[3],
|
|
703
|
+
idClone: 'increasePointBatch',
|
|
704
|
+
id: '_polylinePoint_' + new Date().getTime(), // 此id必须,用于remove节点的时候
|
|
705
|
+
polylineTypeId,
|
|
706
|
+
polylineIndex: point.polylineIndex
|
|
707
|
+
});
|
|
708
|
+
clonedObj.hasControls = clonedObj.hasBorders = false;
|
|
709
|
+
point.set({
|
|
710
|
+
prePoints: [point.left, point.top]
|
|
711
|
+
});
|
|
712
|
+
const line = this.drawLine([...points], { evented, selectable, ...lineAttr, polylineIndex, polylineTypeId, lineIndex });
|
|
713
|
+
clonedObj.line1 = line;
|
|
714
|
+
this.canvas.sendBackwards(line);
|
|
715
|
+
clonedObj.bringForward();
|
|
716
|
+
this.canvas.add(clonedObj);
|
|
717
|
+
this.canvas.renderAll();
|
|
718
|
+
resolve(clonedObj);
|
|
663
719
|
});
|
|
664
|
-
|
|
665
|
-
clonedObj.line1 = line;
|
|
666
|
-
this.canvas.sendBackwards(line);
|
|
667
|
-
clonedObj.bringForward();
|
|
668
|
-
this.canvas.add(clonedObj);
|
|
669
|
-
});
|
|
720
|
+
})
|
|
670
721
|
},
|
|
671
722
|
getValue(point) {
|
|
672
723
|
const x = this.getXValue(point.left);
|
|
@@ -713,11 +764,22 @@ export default {
|
|
|
713
764
|
top: point.top
|
|
714
765
|
};
|
|
715
766
|
let { x, y, data } = this.getValue(point);
|
|
767
|
+
const getY = y => {
|
|
768
|
+
if (data?.position == 'right') {
|
|
769
|
+
if (y.toString().includes('.')) {
|
|
770
|
+
const [m, n] = y.toString().split('.');
|
|
771
|
+
return parseFloat(`${m}.${n.slice(0, 1)}`) * 10 / 10;
|
|
772
|
+
}
|
|
773
|
+
return y;
|
|
774
|
+
} else {
|
|
775
|
+
return Math.round(y);
|
|
776
|
+
}
|
|
777
|
+
};
|
|
716
778
|
this.dropVal = {
|
|
717
779
|
title: data.title,
|
|
718
780
|
list: [
|
|
719
781
|
{ id: '11', name: '时间', value: x },
|
|
720
|
-
{ id: '22', name: '值', value:
|
|
782
|
+
{ id: '22', name: '值', value: getY(y) }
|
|
721
783
|
]
|
|
722
784
|
};
|
|
723
785
|
},
|
|
@@ -743,29 +805,56 @@ export default {
|
|
|
743
805
|
const id = target ? target.id : '';
|
|
744
806
|
this.$nextTick(() => {
|
|
745
807
|
if (id && id.includes('_polylinePoint_')) {
|
|
746
|
-
this.
|
|
747
|
-
|
|
808
|
+
this._currentPoint = target;
|
|
809
|
+
let nodeConnect = [];
|
|
810
|
+
if (this.propItems.operable.connect) {
|
|
811
|
+
if (!target.line2 && target.nextPoint) {
|
|
812
|
+
nodeConnect = rightClickNodeConnect.slice(0, 1);
|
|
813
|
+
}
|
|
814
|
+
if (!target.line1 && target.prevPoint) {
|
|
815
|
+
nodeConnect = rightClickNodeConnect.slice(1);
|
|
816
|
+
}
|
|
817
|
+
if (!target.line1 && !target.line2 && target.prevPoint && target.nextPoint) {
|
|
818
|
+
nodeConnect = rightClickNodeConnect.slice();
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
this.rightClickNode = Object.freeze(rightClickNode.slice(0, 1).concat(nodeConnect).concat(rightClickNode.slice(-1)));
|
|
748
822
|
this.isRightVisible = true;
|
|
749
823
|
} else if (!id) {
|
|
750
|
-
|
|
751
|
-
this.
|
|
824
|
+
const { operable } = this.propItems;
|
|
825
|
+
this._currentPoint = null;
|
|
826
|
+
this.rightClickNode = Object.freeze(operable.set ? rightClickNode.slice(0, 2) : rightClickNode.slice(0, 1));
|
|
752
827
|
this.isRightVisible = true;
|
|
753
828
|
}
|
|
754
829
|
});
|
|
755
830
|
},
|
|
756
831
|
// 关闭右键菜单,打开添加节点弹窗表单
|
|
757
|
-
handleRightClick({ type }) {
|
|
832
|
+
handleRightClick({ type, name }) {
|
|
758
833
|
this.isRightVisible = false;
|
|
759
|
-
const id = this.
|
|
760
|
-
this._currentPointId = '';
|
|
834
|
+
const id = this._currentPoint?.id;
|
|
761
835
|
const { left, top } = this._active;
|
|
762
836
|
let data = id ? this.getDataById(id) : this.getValue({ left, top });
|
|
837
|
+
if (type == 'add') {
|
|
838
|
+
if (name.includes('左')) {
|
|
839
|
+
data.range = {
|
|
840
|
+
time: [this._currentPoint.prevPoint.time, this._currentPoint.time],
|
|
841
|
+
direction: 'left'
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
if (name.includes('右')) {
|
|
845
|
+
data.range = {
|
|
846
|
+
time: [this._currentPoint.time, this._currentPoint.nextPoint.time],
|
|
847
|
+
direction: 'right'
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
}
|
|
763
851
|
this.$emit('pointOperation', type, data);
|
|
852
|
+
this._currentPoint = null;
|
|
764
853
|
},
|
|
765
854
|
getDataById(id) {
|
|
766
855
|
const arr = id.replace(/_?[a-zA-Z]+.+$/, '').split('_');
|
|
767
856
|
const [typeIndex, lineIndex, pointIndex] = arr;
|
|
768
|
-
const data = this.
|
|
857
|
+
const data = this.polyline[typeIndex];
|
|
769
858
|
const value = data?.dataList?.[lineIndex]?.list?.[pointIndex]?.data || '';
|
|
770
859
|
return {
|
|
771
860
|
title: data?.dataList?.[lineIndex].title || '',
|
|
@@ -775,7 +864,7 @@ export default {
|
|
|
775
864
|
data: value
|
|
776
865
|
};
|
|
777
866
|
},
|
|
778
|
-
removePolyline(id, left,
|
|
867
|
+
removePolyline(id, left, position, polylineIndex) {
|
|
779
868
|
// 根据id或者idClone删除
|
|
780
869
|
if (id) {
|
|
781
870
|
const pointId = left ? 'idClone' : 'id';
|
|
@@ -794,14 +883,15 @@ export default {
|
|
|
794
883
|
return;
|
|
795
884
|
}
|
|
796
885
|
// 删除一条线
|
|
797
|
-
if (
|
|
886
|
+
if (position && (polylineIndex === 0 || polylineIndex)) {
|
|
887
|
+
const polylineTypeId = this.polyline.findIndex(v => v.position === position);
|
|
798
888
|
this.canvas.forEachObject(obj => {
|
|
799
889
|
const isPolyLine = obj.polylineTypeId === polylineTypeId && obj.polylineIndex === polylineIndex;
|
|
800
890
|
if (obj.id && /_polyline(Point|Line)_/.test(obj.id) && !obj.id.includes('isTitle') && isPolyLine) {
|
|
801
|
-
this.canvas.remove(obj);
|
|
802
891
|
obj.text && this.canvas.remove(obj.text);
|
|
803
892
|
obj.line1 && this.canvas.remove(obj.line1);
|
|
804
893
|
obj.line2 && this.canvas.remove(obj.line2);
|
|
894
|
+
this.canvas.remove(obj);
|
|
805
895
|
}
|
|
806
896
|
});
|
|
807
897
|
return;
|
|
@@ -809,6 +899,7 @@ export default {
|
|
|
809
899
|
// 删除折线图上的所有点和线
|
|
810
900
|
this.canvas.forEachObject(obj => {
|
|
811
901
|
if (obj.id && /_polyline(Point|Line)_/.test(obj.id) && !obj.id.includes('isTitle')) {
|
|
902
|
+
obj.text && this.canvas.remove(obj.text);
|
|
812
903
|
this.canvas.remove(obj);
|
|
813
904
|
}
|
|
814
905
|
});
|
|
@@ -821,20 +912,18 @@ export default {
|
|
|
821
912
|
},
|
|
822
913
|
repaintPolyline(position, dadaIndex) {
|
|
823
914
|
if (arguments.length < 2) {
|
|
824
|
-
if (this.
|
|
915
|
+
if (this.polyline.length) {
|
|
825
916
|
this.removePolyline();
|
|
826
917
|
}
|
|
827
|
-
this.
|
|
828
|
-
this.polylineList.forEach((polylineType, polylineTypeId) => {
|
|
918
|
+
this.polyline.forEach((polylineType, polylineTypeId) => {
|
|
829
919
|
this.createPolyline(polylineType, polylineTypeId);
|
|
830
920
|
});
|
|
831
921
|
this.removeTitle();
|
|
832
922
|
this.drawPolylineTitle();
|
|
833
923
|
} else {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
this.
|
|
837
|
-
this.drawPolyline(this.polylineList[polylineTypeId].dataList[parseInt(dadaIndex)], parseInt(dadaIndex), this.polylineList[polylineTypeId], polylineTypeId);
|
|
924
|
+
const polylineTypeId = this.polyline.findIndex(v => v.position === position);
|
|
925
|
+
this.removePolyline(null, null, position, parseInt(dadaIndex));
|
|
926
|
+
this.drawPolyline(this.polyline[polylineTypeId].dataList[parseInt(dadaIndex)], parseInt(dadaIndex), this.polyline[polylineTypeId], polylineTypeId);
|
|
838
927
|
}
|
|
839
928
|
}
|
|
840
929
|
}
|
|
@@ -253,8 +253,8 @@ export default {
|
|
|
253
253
|
const { originX, originY } = this.propItems;
|
|
254
254
|
let top = originY + 10;
|
|
255
255
|
list.forEach((item, index) => {
|
|
256
|
-
const marginLeft =
|
|
257
|
-
const left = originX - marginLeft
|
|
256
|
+
const marginLeft = item.titleStyle?.marginLeft || 8;
|
|
257
|
+
const left = originX - marginLeft; // 防止最左边的数据与名称显示重合了
|
|
258
258
|
|
|
259
259
|
if (list[index - 1]) {
|
|
260
260
|
top += item.lineHeight || 15;
|
|
@@ -264,6 +264,7 @@ export default {
|
|
|
264
264
|
...defaultVaule.style,
|
|
265
265
|
...defaultVaule.textStyle,
|
|
266
266
|
...item.style,
|
|
267
|
+
...(item.titleStyle || {}),
|
|
267
268
|
originX: 'right',
|
|
268
269
|
originY: 'center',
|
|
269
270
|
left,
|
|
@@ -512,7 +512,7 @@ export default create({
|
|
|
512
512
|
$event.preventDefault();
|
|
513
513
|
$event.stopPropagation();
|
|
514
514
|
// 触发checkbox 不执行下面逻辑
|
|
515
|
-
if (className
|
|
515
|
+
if (className?.includes("vxe-checkbox--icon")) return;
|
|
516
516
|
|
|
517
517
|
let table = this.$refs[this.formTableGridRef];
|
|
518
518
|
let isChecked = table.isCheckedByCheckboxRow(row);
|