dcim-topology2d 2.1.0 → 2.2.2
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/chart-diagram/index.d.ts +1 -1
- package/chart-diagram/index.js +1 -1
- package/chart-diagram/src/echarts/index.js +112 -109
- package/chart-diagram/src/utils/changeOptions.d.ts +8 -8
- package/chart-diagram/src/utils/changeOptions.js +8 -2
- package/chart-diagram/src/utils/conversion.d.ts +19 -19
- package/chart-diagram/src/utils/conversion.js +601 -559
- package/chart-diagram/src/utils/drawGraphic.d.ts +3 -3
- package/chart-diagram/src/utils/drawGraphic.js +97 -97
- package/chart-diagram/src/utils/index.d.ts +5 -5
- package/chart-diagram/src/utils/index.js +5 -5
- package/chart-diagram/src/utils/render.js +4 -0
- package/core/index.js +1 -19
- package/core/src/activeLayer.js +23 -23
- package/core/src/calling.js +32 -33
- package/core/src/common.d.ts +1 -0
- package/core/src/common.js +115 -83
- package/core/src/core.js +15 -1
- package/core/src/element/common.js +12 -4
- package/core/src/element/datePicker.js +13 -16
- package/core/src/element/select.d.ts +1 -1
- package/core/src/element/select.js +1 -3
- package/core/src/element/tab.js +3 -8
- package/core/src/healps/changeData.js +64 -41
- package/core/src/middles/default.js +49 -43
- package/core/src/middles/index.d.ts +1 -2
- package/core/src/middles/index.js +3 -2
- package/core/src/middles/nodes/formDatePicker.js +54 -12
- package/core/src/middles/nodes/formoverflow.js +17 -16
- package/core/src/middles/nodes/formselect.js +14 -5
- package/core/src/middles/nodes/index.d.ts +3 -1
- package/core/src/middles/nodes/index.js +2 -0
- package/core/src/middles/nodes/progress.d.ts +2 -0
- package/core/src/middles/nodes/progress.js +63 -0
- package/core/src/middles/nodes/progress.js.map +1 -0
- package/core/src/middles/nodes/rectangle.js +54 -15
- package/core/src/middles/nodes/switchs.d.ts +2 -0
- package/core/src/middles/nodes/switchs.js +46 -0
- package/core/src/models/line.js +7 -7
- package/core/src/models/node.js +90 -81
- package/core/src/models/pen.js +21 -12
- package/core/src/offscreen.js +19 -19
- package/core/src/preview.js +75 -40
- package/core/src/store/data.d.ts +11 -0
- package/core/src/store/data.js +11 -0
- package/core/src/utils/assignment.d.ts +1 -1
- package/core/src/utils/assignment.js +50 -6
- package/core/src/utils/construction.d.ts +24 -0
- package/core/src/utils/construction.js +22 -1
- package/core/src/utils/conversion.d.ts +2 -0
- package/core/src/utils/conversion.js +109 -0
- package/core/src/utils/math.d.ts +0 -1
- package/core/src/utils/math.js +0 -3
- package/core/src/utils/onmousevent.js +1 -1
- package/core/src/utils/params.d.ts +1 -0
- package/core/src/utils/params.js +75 -4
- package/package.json +1 -1
- package/static/echartsDefaultData.js +178 -178
- package/store/actions.js +2 -1
- package/store/clear.js +4 -0
- package/store/default.js +22 -0
- package/store/index.js +2 -1
- /package/myShape-diagram/{index.ts → index.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
//let DETAILDATA = null;
|
|
2
|
-
import {commonStore} from '../store';
|
|
2
|
+
import { commonStore } from '../store';
|
|
3
3
|
import { getEchartsRealData } from '../utils/conversion';
|
|
4
4
|
export function setConfItemNode(pen, syn_synata) {
|
|
5
5
|
const entranceGuard = pen.events.find((ev) => {
|
|
6
6
|
return ev.value === 'entranceGuard';
|
|
7
7
|
});
|
|
8
|
-
if(entranceGuard) {
|
|
8
|
+
if (entranceGuard) {
|
|
9
9
|
// 绑定门禁的元件实时数据
|
|
10
10
|
const nullUndefinedRegex = /^(?:null|undefined|\s*)$/;
|
|
11
11
|
const doorData = syn_synata.doorData && syn_synata.doorData[entranceGuard.params];
|
|
@@ -13,59 +13,64 @@ export function setConfItemNode(pen, syn_synata) {
|
|
|
13
13
|
pen.text = doorState === 1 ? '开门' : '关门'; // 1-开门,其他值为关门
|
|
14
14
|
}
|
|
15
15
|
if (!pen.data) return;
|
|
16
|
-
if(commonStore[pen.TID]) commonStore[pen.TID].data.dataResize = 1;
|
|
16
|
+
if (commonStore[pen.TID]) commonStore[pen.TID].data.dataResize = 1;
|
|
17
17
|
let isAlarm = false; // 判断元件绑定的数据中是否有告警发生,用于九所项目服务器自身监控功能
|
|
18
|
-
if(pen.data instanceof Array) {
|
|
18
|
+
if (pen.data instanceof Array) {
|
|
19
19
|
let _syn = null;
|
|
20
20
|
let isResetVal = false;
|
|
21
|
-
const {areaData, assetData, kpiData, tagData, asset} = syn_synata
|
|
21
|
+
const { areaData, assetData, componentData, kpiData, tagData, asset } = syn_synata;
|
|
22
|
+
const comData = componentData && componentData[pen.id];
|
|
22
23
|
pen.data.map((d) => {
|
|
23
24
|
const key = d.key;
|
|
24
25
|
let value = d.value;
|
|
25
|
-
|
|
26
|
-
const areaItem = areaData[value];
|
|
27
|
-
const kpiItem = kpiData[value];
|
|
28
|
-
if(key === 'tagId') value = d.tagId ? d.tagId : d.value;
|
|
29
|
-
const tagItem = tagData[value];
|
|
26
|
+
if (key === 'tagId') value = d.tagId ? d.tagId : d.value;
|
|
30
27
|
//console.log('key===========', d)
|
|
31
28
|
if (key === 'assetKey' && d.value === 'assetName' && asset) {
|
|
29
|
+
|
|
32
30
|
pen.text = asset.assetName;
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
|
|
32
|
+
} else if (key === 'assetId') {
|
|
33
|
+
|
|
34
|
+
_syn = comData || assetData[value];
|
|
35
|
+
|
|
35
36
|
// if(value === '264'){console.log('_syn',_syn,pen.name,parseInt(_syn.state))}
|
|
36
|
-
}else if (key === 'areaId'
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
} else if (key === 'areaId') {
|
|
38
|
+
|
|
39
|
+
_syn = comData || areaData[value];
|
|
40
|
+
|
|
41
|
+
} else if (key === 'tagId' && (comData || tagData[value])) {
|
|
42
|
+
|
|
43
|
+
_syn = comData || tagData[value];
|
|
44
|
+
|
|
45
|
+
if (_syn.kpiName !== '通讯状态' || pen.name !== 'circle') {
|
|
41
46
|
isResetVal = true;
|
|
42
47
|
}
|
|
43
|
-
const isControl = parseInt(
|
|
48
|
+
const isControl = parseInt(_syn.isControlDis); // 是否可控,0可控,1不可控
|
|
44
49
|
//d.isControlDis = isControlDis
|
|
45
|
-
if(!isControl) {
|
|
50
|
+
if (!isControl) {
|
|
46
51
|
d.tagVal = value
|
|
47
|
-
d.controlParams =
|
|
52
|
+
d.controlParams = _syn
|
|
48
53
|
//Object.assign(d, tagItem)
|
|
49
54
|
}
|
|
50
|
-
}else if (key === 'kpiAddr' &&
|
|
51
|
-
_syn =
|
|
55
|
+
} else if (key === 'kpiAddr' && (comData || kpiData[value])) {
|
|
56
|
+
_syn = comData || kpiData[value];
|
|
52
57
|
isResetVal = true
|
|
53
|
-
const isControl = parseInt(
|
|
58
|
+
const isControl = parseInt(_syn.isControlDis); // 是否可控,0可控,1不可控
|
|
54
59
|
//d.isControlDis = isControlDis
|
|
55
|
-
if(!isControl) {
|
|
60
|
+
if (!isControl) {
|
|
56
61
|
d.tagVal = value
|
|
57
|
-
d.controlParams =
|
|
62
|
+
d.controlParams = _syn
|
|
58
63
|
// delete kpiItem[value]
|
|
59
64
|
// Object.assign(d, kpiItem)
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
})
|
|
63
|
-
if(!_syn) return;
|
|
68
|
+
if (!_syn) return;
|
|
64
69
|
// const type = parseInt(_syn.type) // 是否是开关量
|
|
65
70
|
// 显示的值
|
|
66
71
|
if (isResetVal) pen.text = `${_syn.value}${_syn.unit}`;
|
|
67
72
|
const state = parseInt(_syn.state)
|
|
68
|
-
if(!state && state !== 0) return
|
|
73
|
+
if (!state && state !== 0) return
|
|
69
74
|
const name = pen.name
|
|
70
75
|
// 显示的颜色
|
|
71
76
|
let color = ''
|
|
@@ -83,9 +88,9 @@ export function setConfItemNode(pen, syn_synata) {
|
|
|
83
88
|
let defaulColor = ''
|
|
84
89
|
if (name === 'text') {
|
|
85
90
|
defaulColor = 'defaultFontColor'
|
|
86
|
-
}else if(name === 'line') {
|
|
91
|
+
} else if (name === 'line') {
|
|
87
92
|
defaulColor = 'defaultStrokeStyle'
|
|
88
|
-
}else {
|
|
93
|
+
} else {
|
|
89
94
|
defaulColor = 'defaultFillStyle'
|
|
90
95
|
}
|
|
91
96
|
color = pen[defaulColor]
|
|
@@ -97,17 +102,27 @@ export function setConfItemNode(pen, syn_synata) {
|
|
|
97
102
|
// 显示的属性
|
|
98
103
|
if (name === 'text') {
|
|
99
104
|
pen.font.color = color
|
|
100
|
-
}else if(name === 'line') {
|
|
105
|
+
} else if (name === 'line') {
|
|
101
106
|
pen.strokeStyle = color
|
|
102
107
|
pen.text = ''
|
|
103
|
-
}else {
|
|
108
|
+
} else if (name === 'switchs') {
|
|
109
|
+
//获取值说明中的开值 默认为第一个值为开
|
|
110
|
+
let openValue = getOpenValue(_syn.valExplain)
|
|
111
|
+
pen.isOpen = _syn.v == openValue;
|
|
112
|
+
pen.fillStyle = pen.isOpen ? pen.visitStrokeStyle : pen.strokeStyle;
|
|
113
|
+
pen.text = '';
|
|
114
|
+
} else if (name === 'progress') {
|
|
115
|
+
pen.value = _syn.v;
|
|
116
|
+
pen.text = '';
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
104
119
|
pen.fillStyle = color
|
|
105
120
|
}
|
|
106
121
|
if (name === 'electricFan') setFanData(pen, _syn)
|
|
107
|
-
}else {
|
|
122
|
+
} else {
|
|
108
123
|
if (pen.elementRendered) pen.elementRendered = false;
|
|
109
124
|
if (pen.data.echarts) {
|
|
110
|
-
const {echartDataValue} = syn_synata;
|
|
125
|
+
const { echartDataValue } = syn_synata;
|
|
111
126
|
const seriesData = echartDataValue;
|
|
112
127
|
const realData = pen.data.params && seriesData && Object.keys(seriesData).length && seriesData[pen.data.params.id];
|
|
113
128
|
if (Array.isArray(realData) && pen.data.params && pen.data.params.displayMode !== 7) {
|
|
@@ -137,24 +152,24 @@ export function setFanData(pen, syncData) {
|
|
|
137
152
|
let runState = false
|
|
138
153
|
let percentage = 1
|
|
139
154
|
const value = parseInt(syncData.v)
|
|
140
|
-
if(pen.fanValType == '1'){
|
|
141
|
-
if(value > pen.fanMinVal
|
|
155
|
+
if (pen.fanValType == '1') {
|
|
156
|
+
if (value > pen.fanMinVal && value <= pen.fanMaxVal) {
|
|
142
157
|
runState = true
|
|
143
|
-
percentage = value/(pen.fanMaxVal-pen.fanMinVal)
|
|
158
|
+
percentage = value / (pen.fanMaxVal - pen.fanMinVal)
|
|
144
159
|
}
|
|
145
|
-
}else if(pen.fanValType == '2'){
|
|
146
|
-
if(pen.fanNorVal === value) runState = true
|
|
160
|
+
} else if (pen.fanValType == '2') {
|
|
161
|
+
if (pen.fanNorVal === value) runState = true
|
|
147
162
|
}
|
|
148
|
-
if(runState){
|
|
163
|
+
if (runState) {
|
|
149
164
|
addAnimateByRevolve(pen, percentage)
|
|
150
165
|
pen.animatePlay = true
|
|
151
|
-
}else{
|
|
166
|
+
} else {
|
|
152
167
|
pen.animatePlay = false
|
|
153
168
|
}
|
|
154
169
|
}
|
|
155
170
|
|
|
156
171
|
export function addAnimateByRevolve(pen, percentage) {
|
|
157
|
-
let time = 200/pen.fanSpeed/percentage
|
|
172
|
+
let time = 200 / pen.fanSpeed / percentage
|
|
158
173
|
const state = JSON.parse(JSON.stringify(pen))
|
|
159
174
|
delete state.TID
|
|
160
175
|
delete state.animateFrames
|
|
@@ -169,3 +184,11 @@ export function addAnimateByRevolve(pen, percentage) {
|
|
|
169
184
|
pen.animateDuration = time;
|
|
170
185
|
|
|
171
186
|
}
|
|
187
|
+
|
|
188
|
+
export function getOpenValue(explain) {
|
|
189
|
+
let value = 1
|
|
190
|
+
if (!explain) return value
|
|
191
|
+
value = explain.split(',')[0].split('=')[0];
|
|
192
|
+
return value
|
|
193
|
+
|
|
194
|
+
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
arrowAnchors,
|
|
3
|
+
leftArrow, leftArrowIconRect, leftArrowTextRect,
|
|
4
|
+
rightArrow, rightArrowIconRect, rightArrowTextRect,
|
|
5
|
+
twowayArrow, twowayArrowIconRect, twowayArrowTextRect,
|
|
6
|
+
rectangle, rectangleIconRect, rectangleTextRect,
|
|
7
|
+
diamond, diamondIconRect, diamondTextRect,
|
|
8
|
+
text, file, formtable, tablePagination, iframePrimeval, formSelect, fromDatePicker,
|
|
9
|
+
line as nodeLine, lineAnchors, lineIconRect, lineTextRect,
|
|
10
|
+
circle, circleIconRect, circleTextRect, circleAnchors,
|
|
11
|
+
triangle, triangleIconRect, triangleTextRect, triangleAnchors,
|
|
12
|
+
pentagon, pentagonIconRect, pentagonTextRect, pentagonAnchors,
|
|
13
|
+
hexagon, hexagonAnchors, hexagonIconRect, hexagonTextRect,
|
|
14
|
+
pentagram, pentagramAnchors, pentagramIconRect, pentagramTextRect,
|
|
15
|
+
cloud, cloudAnchors, cloudIconRect, cloudTextRect,
|
|
16
|
+
message, messageIconRect, messageTextRect, messageAnchors,
|
|
17
|
+
imageIconRect, imageTextRect,
|
|
18
|
+
cube, cubeAnchors, cubeIconRect, cubeTextRect,
|
|
19
|
+
people, peopleIconRect, peopleTextRect,
|
|
20
|
+
arbitraryGraph, arbitraryGraphAnchors, time, switchs, progress
|
|
21
21
|
} from './nodes';
|
|
22
22
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
line,
|
|
24
|
+
lineControlPoints,
|
|
25
|
+
calcLineControlPoints,
|
|
26
|
+
polyline,
|
|
27
|
+
polylineControlPoints,
|
|
28
|
+
pointInPolyline,
|
|
29
|
+
calcPolylineControlPoints,
|
|
30
|
+
dockPolylineControlPoint,
|
|
31
|
+
curve,
|
|
32
|
+
curveControlPoints,
|
|
33
|
+
pointInCurve,
|
|
34
|
+
calcCurveControlPoints,
|
|
35
|
+
mind,
|
|
36
|
+
calcMindControlPoints,
|
|
37
|
+
mindControlPoints,
|
|
38
|
+
pointInMind
|
|
39
39
|
} from './lines';
|
|
40
40
|
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
triangleSolid,
|
|
42
|
+
triangle as arrowTriangle,
|
|
43
|
+
diamondSolid,
|
|
44
|
+
diamond as arrowDiamond,
|
|
45
|
+
circleSolid, circle as arrowCircle,
|
|
46
|
+
lineUp,
|
|
47
|
+
lineDown,
|
|
48
|
+
line as arrowLine
|
|
49
49
|
} from './arrows';
|
|
50
50
|
// Functions of drawing a node.
|
|
51
51
|
export var drawNodeFns = {};
|
|
@@ -205,6 +205,12 @@ function init() {
|
|
|
205
205
|
drawNodeFns.time = time;
|
|
206
206
|
iconRectFns.time = rectangleIconRect;
|
|
207
207
|
textRectFns.time = rectangleTextRect;
|
|
208
|
+
// 开关
|
|
209
|
+
drawNodeFns.switchs = switchs;
|
|
210
|
+
iconRectFns.switchs = rectangleIconRect;
|
|
211
|
+
textRectFns.switchs = rectangleTextRect;
|
|
212
|
+
// 进度条
|
|
213
|
+
drawNodeFns.progress = progress;
|
|
208
214
|
}
|
|
209
215
|
init();
|
|
210
216
|
// registerNode: Register a custom node.
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {Store} from
|
|
1
|
+
import {Store} from "le5le-store";
|
|
2
2
|
import {rectangle} from './rectangle';
|
|
3
3
|
import { createDatePickerElement, loadJS, setDataPickerElementStyle } from '../../element';
|
|
4
|
-
import { s8 } from '../../utils';
|
|
4
|
+
import { s8, datePickerValueFormatting } from '../../utils';
|
|
5
5
|
import {commonStore} from "../../store";
|
|
6
|
+
import {datePickerType} from "../../../../store";
|
|
6
7
|
|
|
7
8
|
export async function fromDatePicker(ctx, node) {
|
|
8
|
-
// 绘制一个底图,类似于占位符。
|
|
9
|
+
// 绘制一个底图,类似于占位符。
|
|
9
10
|
rectangle(ctx, node);
|
|
10
11
|
|
|
11
12
|
if (!window.datePickerRegister) {
|
|
12
13
|
//未注册datePicker插件
|
|
14
|
+
window.datePickerRegister = true;
|
|
13
15
|
const datePickerRegisterData = await loadJS(`${window.location.origin}/libary/laydate/laydate.js`).catch((e) => {
|
|
14
16
|
console.error('datePicker插件加载失败>>>', e);
|
|
15
17
|
});
|
|
@@ -21,12 +23,35 @@ export async function fromDatePicker(ctx, node) {
|
|
|
21
23
|
if (!currentStore.pickerDataPool[node.id]) {
|
|
22
24
|
// 未创建该元件
|
|
23
25
|
node.elementId = s8();
|
|
26
|
+
|
|
27
|
+
if(currentStore.mqttParams.dataConfig.picker){
|
|
28
|
+
// 日期元件关联绑定的元件数据
|
|
29
|
+
const pickerConfig = currentStore.mqttParams.dataConfig.picker;
|
|
30
|
+
for (let [key, config] of pickerConfig.entries()){
|
|
31
|
+
if(config.dateId === node.id) {
|
|
32
|
+
node.formData.realIds = node.formData.realIds ? `${node.formData.realIds},${key}` : key;
|
|
33
|
+
node.formData.selected = config.dateStr;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const format = node.pickerOptions.format;
|
|
39
|
+
const valueType = node.formData.valueType;
|
|
40
|
+
const dateType = node.pickerOptions.type;
|
|
41
|
+
node.pickerOptions.value = node.formData.selected || datePickerValueFormatting({
|
|
42
|
+
formatType: format,
|
|
43
|
+
valueType
|
|
44
|
+
}).dateStr;
|
|
24
45
|
const datePicker = createDatePickerElement(node);
|
|
25
46
|
currentStore.pickerDataPool[node.id] = {
|
|
47
|
+
format,
|
|
48
|
+
valueType,
|
|
49
|
+
dateType,
|
|
26
50
|
dom: {
|
|
27
51
|
container: datePicker
|
|
28
52
|
}
|
|
29
|
-
}
|
|
53
|
+
};
|
|
54
|
+
|
|
30
55
|
document.body.appendChild(datePicker);
|
|
31
56
|
// 添加当前节点到div层
|
|
32
57
|
node.addToDiv();
|
|
@@ -38,27 +63,44 @@ export async function fromDatePicker(ctx, node) {
|
|
|
38
63
|
if(pickerOptions.min && isValidInteger(pickerOptions.min)) pickerOptions.min = Number(pickerOptions.min);
|
|
39
64
|
if(pickerOptions.max && isValidInteger(pickerOptions.max)) pickerOptions.max = Number(pickerOptions.max);
|
|
40
65
|
}
|
|
66
|
+
let layDatePicker = null;
|
|
41
67
|
pickerOptions.elem = `#picker${node.id}`;
|
|
42
68
|
pickerOptions.done = function (val, date) {
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
const { year, month, hours, minutes, seconds } = date;
|
|
70
|
+
const map = {
|
|
71
|
+
yyyy: year,
|
|
72
|
+
MM: String(month).padStart(2, '0'),
|
|
73
|
+
dd: String(date.date).padStart(2, '0'),
|
|
74
|
+
HH: String(hours).padStart(2, '0'),
|
|
75
|
+
mm: String(minutes).padStart(2, '0'),
|
|
76
|
+
ss: String(seconds).padStart(2, '0')
|
|
77
|
+
};
|
|
78
|
+
node.formData.selected = val;
|
|
79
|
+
date.valueStr = val;
|
|
80
|
+
date.value = datePickerType[layDatePicker.config.type].replace(/yyyy|MM|dd|HH|mm|ss/g, match => map[match]);
|
|
45
81
|
Store.set(`${node.TID}-EVENT:change`, {node, date});
|
|
46
82
|
}
|
|
47
83
|
setTimeout(() => {
|
|
48
84
|
|
|
49
|
-
laydate.render(pickerOptions);
|
|
85
|
+
layDatePicker = laydate.render(pickerOptions);
|
|
50
86
|
|
|
51
87
|
}, 100)
|
|
52
88
|
}else {
|
|
53
89
|
if(node.formData.resetStyle) {
|
|
90
|
+
// 重置样式
|
|
54
91
|
setDataPickerElementStyle(node);
|
|
55
92
|
node.formData.resetStyle = false;
|
|
56
93
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
94
|
+
if(node.formData.render) {
|
|
95
|
+
// 重置数据
|
|
96
|
+
node.formData.render = false;
|
|
97
|
+
const params = {
|
|
98
|
+
format: node.pickerOptions.format,
|
|
99
|
+
valueType: node.formData.valueType,
|
|
100
|
+
dateType: node.pickerOptions.type
|
|
101
|
+
};
|
|
102
|
+
Object.assign(currentStore.pickerDataPool[node.id], params);
|
|
103
|
+
}
|
|
62
104
|
}
|
|
63
105
|
}
|
|
64
106
|
function isValidInteger(str) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {rectangle, createDiv, s8, Topology} from '../../../../core';
|
|
1
|
+
import {rectangle, createDiv, s8, Preview} from '../../../../core';
|
|
3
2
|
import {commonStore} from "../../store";
|
|
4
3
|
|
|
5
4
|
export async function formOverflow(ctx, node) {
|
|
6
5
|
// 绘制一个底图,类似于占位符。
|
|
7
6
|
rectangle(ctx, node)
|
|
8
|
-
console.log('绘制滚动组件--')
|
|
9
7
|
// 添加当前节点到div层
|
|
10
8
|
if (!node.elementId) {
|
|
11
9
|
node.elementId = s8()
|
|
@@ -17,7 +15,6 @@ export async function formOverflow(ctx, node) {
|
|
|
17
15
|
const scrollbarColor = color + ' ' + colorBg
|
|
18
16
|
|
|
19
17
|
if (!node.elementLoaded && !formoverData) {
|
|
20
|
-
console.log('是否存在--formoverData--0-',formoverData)
|
|
21
18
|
if(!formoverData) {
|
|
22
19
|
formoverData = {
|
|
23
20
|
div: createDiv(node)
|
|
@@ -33,29 +30,33 @@ export async function formOverflow(ctx, node) {
|
|
|
33
30
|
document.body.appendChild(formoverData.div)
|
|
34
31
|
// 添加当前节点到div层
|
|
35
32
|
node.addToDiv()
|
|
33
|
+
node.createOverflow()
|
|
36
34
|
commonStore[node.TID].formoverDataPool[node.id] = formoverData;
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
// 兼容topology项目中渲染
|
|
37
|
+
if (window.location.pathname.includes('workspace') || window.location.pathname.includes('Preview')) {
|
|
38
|
+
let canvas = new Preview(node.id, {
|
|
39
|
+
rotateCursor: '/img/rotate.cur',
|
|
40
|
+
})
|
|
41
|
+
canvas.formOverflowOpen(node.formData.detailPageData)
|
|
42
|
+
commonStore[node.TID].formoverCanvasDataPool[node.id] = canvas
|
|
43
|
+
}
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
// 可优化,图片元件加载不出图片的方案
|
|
46
|
+
formOverflowChange(node);
|
|
47
|
+
}, 200);
|
|
45
48
|
}else if(formoverData && id){
|
|
46
|
-
console.log('是否存在--formoverData--1-',formoverData)
|
|
47
49
|
formoverData.div.style.setProperty('scrollbar-color', scrollbarColor);
|
|
48
|
-
formOverflowChange(node)
|
|
49
50
|
}
|
|
51
|
+
formOverflowChange(node)
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
// 更新滚动组件中子页面
|
|
53
55
|
export function formOverflowChange(node) {
|
|
54
|
-
|
|
55
|
-
console.log('更新滚动组件中子页面-',node)
|
|
56
|
+
// 绘制画布
|
|
57
|
+
// console.log('更新滚动组件中子页面-',node)
|
|
56
58
|
let canvas = commonStore[node.TID].formoverCanvasDataPool[node.id]
|
|
57
59
|
let data = node.formData.detailPageData
|
|
58
|
-
console.log('改变滚动组件中子页面-',data)
|
|
59
60
|
canvas.formOverflowOpen(data)
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -15,8 +15,13 @@ export function formSelect(ctx, node) {
|
|
|
15
15
|
const currentStore = commonStore[node.TID];
|
|
16
16
|
node.elementId = s8();
|
|
17
17
|
node.dash = 4;
|
|
18
|
+
// 下拉切换类型
|
|
19
|
+
const selectedType = node.events && node.events.find((item) => {
|
|
20
|
+
return !!item.dcimStaticForType
|
|
21
|
+
});
|
|
18
22
|
currentStore.selectDataPool[node.id] = {
|
|
19
23
|
slideState: node.selectDropdown,
|
|
24
|
+
staticType: selectedType,
|
|
20
25
|
node: {
|
|
21
26
|
id: node.id,
|
|
22
27
|
color: node.font.color,
|
|
@@ -35,26 +40,30 @@ export function formSelect(ctx, node) {
|
|
|
35
40
|
// 去空格重新赋值
|
|
36
41
|
node.formData.bindBlockTag = node.formData.bindBlockTag.trim();
|
|
37
42
|
}
|
|
43
|
+
|
|
38
44
|
let selectRealData = bindBlockId && currentStore.selectRealDataPool[bindBlockId];
|
|
39
|
-
if(
|
|
40
|
-
// select与echarts互相关联
|
|
45
|
+
if(selectRealData) {
|
|
46
|
+
// 数据统计之 select与echarts互相关联
|
|
41
47
|
if(node.formData.ids) {
|
|
48
|
+
// 显示隐藏类型下的数据统计,下拉节点数据处理
|
|
42
49
|
const optionIds = node.formData.ids.split(',');
|
|
43
50
|
for (let i = 0; i < optionIds.length; i++) {
|
|
44
51
|
if(selectRealData[i]) selectRealData[i].optionId = optionIds[i];
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
|
-
currentStore.selectDataPool[node.id]
|
|
48
|
-
|
|
54
|
+
const selectData = currentStore.selectDataPool[node.id];
|
|
55
|
+
selectData.data = selectRealData;
|
|
56
|
+
selectData.node.selected ? selectData.node.selected.id = selectRealData[0].id : selectData.node.selected = { id: selectRealData[0].id };
|
|
49
57
|
const echartsData = currentStore.echartsDataPool[bindBlockId];
|
|
50
58
|
echartsData ? echartsData.bindId = node.id : currentStore.echartsDataPool[bindBlockId] = {
|
|
51
59
|
bindId: node.id
|
|
52
60
|
};
|
|
53
|
-
// select与Tab
|
|
61
|
+
// select与Tab关联,主要用于下拉切换时当前画面绑定了tab切换的情况
|
|
54
62
|
const bindBlockTagData = currentStore.switchTabDataPool[`${node.formData.bindBlockTag}Data`];
|
|
55
63
|
if(bindBlockTagData) currentStore.echartsDataPool[bindBlockId].tabCorrelationType = 'select';
|
|
56
64
|
}else {
|
|
57
65
|
if(node.formData.ids) {
|
|
66
|
+
// 下拉显示隐藏
|
|
58
67
|
const optionIds = node.formData.ids.split(',');
|
|
59
68
|
const optionNames = node.formData.names.split(',');
|
|
60
69
|
const optionsData = [];
|
|
@@ -47,4 +47,6 @@ export * from './triangle.anchor';
|
|
|
47
47
|
export * from './triangle.rect';
|
|
48
48
|
export * from './formoverflow';
|
|
49
49
|
export * from './time';
|
|
50
|
-
export * from './formDatePicker';
|
|
50
|
+
export * from './formDatePicker';
|
|
51
|
+
export * from './switchs';
|
|
52
|
+
export * from './progress';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export function progress(ctx, node) {
|
|
2
|
+
|
|
3
|
+
var wr = node.borderRadius;
|
|
4
|
+
var hr = node.borderRadius;
|
|
5
|
+
if (node.borderRadius < 1) {
|
|
6
|
+
wr = node.rect.width * node.borderRadius;
|
|
7
|
+
hr = node.rect.height * node.borderRadius;
|
|
8
|
+
}
|
|
9
|
+
var r = wr < hr ? wr : hr;
|
|
10
|
+
if (node.rect.width < 2 * r) {
|
|
11
|
+
r = node.rect.width / 2;
|
|
12
|
+
}
|
|
13
|
+
if (node.rect.height < 2 * r) {
|
|
14
|
+
r = node.rect.height / 2;
|
|
15
|
+
}
|
|
16
|
+
//进度条背景
|
|
17
|
+
ctx.beginPath();
|
|
18
|
+
ctx.moveTo(node.rect.x + r, node.rect.y);
|
|
19
|
+
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r);
|
|
20
|
+
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r);
|
|
21
|
+
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r);
|
|
22
|
+
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r);
|
|
23
|
+
ctx.closePath();
|
|
24
|
+
ctx.fillStyle = node.fillStyle;
|
|
25
|
+
node.fillStyle && ctx.fill();
|
|
26
|
+
ctx.stroke();
|
|
27
|
+
ctx.restore();
|
|
28
|
+
//绘制进度条
|
|
29
|
+
let maxValue = node.maxValue || 100;
|
|
30
|
+
let percent = node.value / maxValue > 1 ? 1 : node.value / maxValue;
|
|
31
|
+
let gradient = ctx.createLinearGradient(node.rect.x, node.rect.y, node.rect.x + node.rect.width * percent, node.rect.y);
|
|
32
|
+
gradient.addColorStop(0, node.strokeStyle || 'red'); // 开始色
|
|
33
|
+
gradient.addColorStop(1, node.visitStrokeStyle || 'blue'); // 结束色
|
|
34
|
+
|
|
35
|
+
ctx.beginPath();
|
|
36
|
+
ctx.moveTo(node.rect.x + r, node.rect.y);
|
|
37
|
+
ctx.arcTo(node.rect.x + node.rect.width * percent, node.rect.y, node.rect.x + node.rect.width * percent, node.rect.y + node.rect.height, r);
|
|
38
|
+
ctx.arcTo(node.rect.x + node.rect.width * percent, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r);
|
|
39
|
+
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r);
|
|
40
|
+
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width * percent, node.rect.y, r);
|
|
41
|
+
ctx.closePath();
|
|
42
|
+
ctx.fillStyle = gradient;
|
|
43
|
+
node.strokeStyle && ctx.fill();
|
|
44
|
+
|
|
45
|
+
//绘制数值
|
|
46
|
+
ctx.font = '' + node.font.fontSize + "px " + node.font.fontFamily;
|
|
47
|
+
ctx.textBaseline = 'middle';
|
|
48
|
+
//计算文字的长度 如果超出了100% 那么从右侧开始写 防止溢出 样式错乱
|
|
49
|
+
ctx.fillStyle = node.font.color;
|
|
50
|
+
//保留小数位数
|
|
51
|
+
let text = parseFloat((percent * 100).toFixed(node.retationDecimalPlaces || 0)) + (node.isShowPercent ? '%' : '');
|
|
52
|
+
let tWidth = ctx.measureText(text).width;
|
|
53
|
+
if ((tWidth + node.rect.width * percent + 5) > node.rect.width) { //如果溢出
|
|
54
|
+
ctx.fillText(text, node.rect.x + node.rect.width - tWidth - 5, node.rect.y + node.rect.height / 2);
|
|
55
|
+
|
|
56
|
+
} else {
|
|
57
|
+
ctx.fillText(text, node.rect.x + node.rect.width * percent + 5, node.rect.y + node.rect.height / 2);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
ctx.fillStyle = "#fff"
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["progress.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAA6B,EAAE,IAAU;IACtE,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE;QACvB,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;QACzC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;KAC7C;IACD,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE;QACzB,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;KAC3B;IACD,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,EAAE;QAC1B,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;KAC5B;IACD,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxH,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACzH,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnF,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,CAAC;AACjB,CAAC"}
|