coolcare-lite-scada-component 1.0.11 → 1.0.13
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/components/FormBindPoint/FreedomScene.js +25 -9
- package/es/components/FormBindPoint/ProductionOrDeviceScene.js +22 -8
- package/es/element/ElePointList/Component.js +11 -1
- package/es/element/ElePointList/index.css +3 -0
- package/es/element/PointCard/PointListCard/Component.js +13 -3
- package/es/element/type.d.ts +2 -0
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
16
16
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
17
|
import React from "react";
|
|
18
18
|
import { useMemo, useEffect } from 'react';
|
|
19
|
-
import { Form, Button, Space, Typography, Input } from 'antd';
|
|
19
|
+
import { Form, Button, Space, Typography, Input, Switch } from 'antd';
|
|
20
20
|
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
|
|
21
21
|
import { useModel } from 'umi';
|
|
22
22
|
import { cloneDeep } from 'lodash-es';
|
|
@@ -54,7 +54,8 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
54
54
|
var data = cloneDeep(activeCell.getData());
|
|
55
55
|
if ((_data$pointList = data.pointList) === null || _data$pointList === void 0 ? void 0 : _data$pointList.length) {
|
|
56
56
|
form.setFieldsValue({
|
|
57
|
-
pointList: data.pointList
|
|
57
|
+
pointList: data.pointList,
|
|
58
|
+
unitShow: data.unintShow
|
|
58
59
|
});
|
|
59
60
|
} else if (typeof data.pointListLimit === 'number' && data.pointListLimit > 0) {
|
|
60
61
|
form.setFieldsValue({
|
|
@@ -62,16 +63,19 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
62
63
|
deviceId: undefined,
|
|
63
64
|
pointId: undefined,
|
|
64
65
|
identifierName: ''
|
|
65
|
-
}]
|
|
66
|
+
}],
|
|
67
|
+
unitShow: true
|
|
66
68
|
});
|
|
67
69
|
} else {
|
|
68
70
|
form.setFieldsValue({
|
|
69
|
-
pointList: []
|
|
71
|
+
pointList: [],
|
|
72
|
+
unitShow: true
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
75
|
} else {
|
|
73
76
|
form.setFieldsValue({
|
|
74
|
-
pointList: []
|
|
77
|
+
pointList: [],
|
|
78
|
+
unitShow: true
|
|
75
79
|
});
|
|
76
80
|
}
|
|
77
81
|
}, [activeCell, form]);
|
|
@@ -87,14 +91,17 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
87
91
|
}, [activeCell]);
|
|
88
92
|
var handleDeviceChange = function handleDeviceChange(deviceId, index) {
|
|
89
93
|
var pointList = form.getFieldValue('pointList');
|
|
94
|
+
var unitShow = form.getFieldValue('unitShow');
|
|
90
95
|
pointList[index].identifierName = undefined;
|
|
91
96
|
pointList[index].pointId = undefined;
|
|
92
97
|
form.setFieldsValue({
|
|
93
|
-
pointList: pointList
|
|
98
|
+
pointList: pointList,
|
|
99
|
+
unitShow: unitShow
|
|
94
100
|
});
|
|
95
101
|
};
|
|
96
102
|
var onValuesChange = function onValuesChange(changedValues, _ref2) {
|
|
97
|
-
var pointList = _ref2.pointList
|
|
103
|
+
var pointList = _ref2.pointList,
|
|
104
|
+
unitShow = _ref2.unitShow;
|
|
98
105
|
if (!activeCell) return;
|
|
99
106
|
var list = pointList.filter(function (v) {
|
|
100
107
|
return v.identifierName;
|
|
@@ -108,7 +115,8 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
108
115
|
identifierName: v.identifierName,
|
|
109
116
|
pointId: v.pointId
|
|
110
117
|
});
|
|
111
|
-
})
|
|
118
|
+
}),
|
|
119
|
+
unitShow: unitShow
|
|
112
120
|
}, {
|
|
113
121
|
deep: false
|
|
114
122
|
});
|
|
@@ -202,6 +210,14 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
202
210
|
block: true,
|
|
203
211
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
|
204
212
|
}, "\u6DFB\u52A0\u70B9\u4F4D")) : null);
|
|
205
|
-
})
|
|
213
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
214
|
+
name: "unitShow",
|
|
215
|
+
label: "\u5355\u4F4D",
|
|
216
|
+
className: "!ml-3"
|
|
217
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
218
|
+
defaultChecked: true,
|
|
219
|
+
checkedChildren: "\u663E\u793A",
|
|
220
|
+
unCheckedChildren: "\u9690\u85CF"
|
|
221
|
+
})));
|
|
206
222
|
};
|
|
207
223
|
export default FreedomSceneFormBindPoint;
|
|
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
16
16
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
17
|
import React from "react";
|
|
18
18
|
import { useMemo, useEffect } from 'react';
|
|
19
|
-
import { Form, Button, Space, Typography } from 'antd';
|
|
19
|
+
import { Form, Button, Space, Typography, Switch } from 'antd';
|
|
20
20
|
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
|
|
21
21
|
import { useModel } from 'umi';
|
|
22
22
|
import { cloneDeep } from 'lodash-es';
|
|
@@ -55,22 +55,26 @@ var ProductionSceneFormBindPoint = function ProductionSceneFormBindPoint(_ref) {
|
|
|
55
55
|
var data = cloneDeep(activeCell.getData());
|
|
56
56
|
if ((_data$pointList = data.pointList) === null || _data$pointList === void 0 ? void 0 : _data$pointList.length) {
|
|
57
57
|
form.setFieldsValue({
|
|
58
|
-
pointList: data.pointList
|
|
58
|
+
pointList: data.pointList,
|
|
59
|
+
unitShow: data.unitShow
|
|
59
60
|
});
|
|
60
61
|
} else if (typeof data.pointListLimit === 'number' && data.pointListLimit > 0) {
|
|
61
62
|
form.setFieldsValue({
|
|
62
63
|
pointList: [{
|
|
63
64
|
identifierName: ''
|
|
64
|
-
}]
|
|
65
|
+
}],
|
|
66
|
+
unitShow: true
|
|
65
67
|
});
|
|
66
68
|
} else {
|
|
67
69
|
form.setFieldsValue({
|
|
68
|
-
pointList: []
|
|
70
|
+
pointList: [],
|
|
71
|
+
unitShow: true
|
|
69
72
|
});
|
|
70
73
|
}
|
|
71
74
|
} else {
|
|
72
75
|
form.setFieldsValue({
|
|
73
|
-
pointList: []
|
|
76
|
+
pointList: [],
|
|
77
|
+
unitShow: true
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
80
|
}, [activeCell, form]);
|
|
@@ -83,7 +87,8 @@ var ProductionSceneFormBindPoint = function ProductionSceneFormBindPoint(_ref) {
|
|
|
83
87
|
return 0;
|
|
84
88
|
}, [activeCell]);
|
|
85
89
|
var onValuesChange = function onValuesChange(changedValues, _ref2) {
|
|
86
|
-
var pointList = _ref2.pointList
|
|
90
|
+
var pointList = _ref2.pointList,
|
|
91
|
+
unitShow = _ref2.unitShow;
|
|
87
92
|
if (activeCell) {
|
|
88
93
|
var list = pointList.filter(function (v) {
|
|
89
94
|
return v.identifierName;
|
|
@@ -95,7 +100,8 @@ var ProductionSceneFormBindPoint = function ProductionSceneFormBindPoint(_ref) {
|
|
|
95
100
|
return _objectSpread(_objectSpread({}, (_payload === null || _payload === void 0 ? void 0 : (_payload$pointList = _payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[index]) || {}), {}, {
|
|
96
101
|
identifierName: v.identifierName
|
|
97
102
|
});
|
|
98
|
-
})
|
|
103
|
+
}),
|
|
104
|
+
unitShow: unitShow
|
|
99
105
|
}, {
|
|
100
106
|
deep: false
|
|
101
107
|
});
|
|
@@ -167,6 +173,14 @@ var ProductionSceneFormBindPoint = function ProductionSceneFormBindPoint(_ref) {
|
|
|
167
173
|
block: true,
|
|
168
174
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
|
169
175
|
}, "\u6DFB\u52A0\u70B9\u4F4D")) : null);
|
|
170
|
-
})
|
|
176
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
177
|
+
name: "unitShow",
|
|
178
|
+
label: "\u5355\u4F4D",
|
|
179
|
+
className: "!ml-3"
|
|
180
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
181
|
+
defaultChecked: true,
|
|
182
|
+
checkedChildren: "\u663E\u793A",
|
|
183
|
+
unCheckedChildren: "\u9690\u85CF"
|
|
184
|
+
})));
|
|
171
185
|
};
|
|
172
186
|
export default ProductionSceneFormBindPoint;
|
|
@@ -31,6 +31,10 @@ var ElePointPanelComponent = function ElePointPanelComponent(_ref2) {
|
|
|
31
31
|
var fontStylesRef = useRef();
|
|
32
32
|
var borderStyleRef = useRef();
|
|
33
33
|
var fillStyleRef = useRef();
|
|
34
|
+
var _useState3 = useState(true),
|
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
+
unitShow = _useState4[0],
|
|
37
|
+
setUnitShow = _useState4[1];
|
|
34
38
|
var payload = node === null || node === void 0 ? void 0 : node.getData();
|
|
35
39
|
if (window.scadaMode === 'edit') {
|
|
36
40
|
fontStylesRef.current = payload === null || payload === void 0 ? void 0 : payload.fontStyles;
|
|
@@ -43,6 +47,8 @@ var ElePointPanelComponent = function ElePointPanelComponent(_ref2) {
|
|
|
43
47
|
}
|
|
44
48
|
var list = node.getData().pointList;
|
|
45
49
|
setPointList(list);
|
|
50
|
+
var _unitShow = node.getData().unitShow;
|
|
51
|
+
setUnitShow(_unitShow == false ? false : true);
|
|
46
52
|
}, [node]);
|
|
47
53
|
useEffect(function () {
|
|
48
54
|
var payload = node === null || node === void 0 ? void 0 : node.getData();
|
|
@@ -117,6 +123,10 @@ var ElePointPanelComponent = function ElePointPanelComponent(_ref2) {
|
|
|
117
123
|
point: point
|
|
118
124
|
})
|
|
119
125
|
}, /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
className: styles.deviceBox
|
|
127
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
className: styles.name
|
|
129
|
+
}, point.deviceName), /*#__PURE__*/React.createElement("div", {
|
|
120
130
|
key: point.pointId,
|
|
121
131
|
onClick: function onClick(e) {
|
|
122
132
|
return handleClickPointItem(e, point);
|
|
@@ -129,7 +139,7 @@ var ElePointPanelComponent = function ElePointPanelComponent(_ref2) {
|
|
|
129
139
|
className: styles.name
|
|
130
140
|
}, (_point$pointName = point.pointName) !== null && _point$pointName !== void 0 ? _point$pointName : '-'), /*#__PURE__*/React.createElement("span", {
|
|
131
141
|
className: styles.value
|
|
132
|
-
}, (_ref3 = point.pointEnumItemKey || point.value) !== null && _ref3 !== void 0 ? _ref3 : '-')));
|
|
142
|
+
}, (_ref3 = point.pointEnumItemKey || point.value) !== null && _ref3 !== void 0 ? _ref3 : '-', unitShow && point.unit))));
|
|
133
143
|
}), (window.scadaMode === 'edit' || !pointList.length) && /*#__PURE__*/React.createElement("div", {
|
|
134
144
|
className: styles.item
|
|
135
145
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -27,13 +27,14 @@ var PointTooltipTitle = function PointTooltipTitle(_ref) {
|
|
|
27
27
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (point === null || point === void 0 ? void 0 : point.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", (_point$value = point === null || point === void 0 ? void 0 : point.value) !== null && _point$value !== void 0 ? _point$value : '-', " ", (_point$unit = point === null || point === void 0 ? void 0 : point.unit) !== null && _point$unit !== void 0 ? _point$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (point === null || point === void 0 ? void 0 : point.updateTime) || '-'));
|
|
28
28
|
};
|
|
29
29
|
var PointItem = function PointItem(_ref2) {
|
|
30
|
-
var _ref3, _point$pointName;
|
|
30
|
+
var _ref3, _point$deviceName, _point$pointName;
|
|
31
31
|
var point = _ref2.point,
|
|
32
32
|
style = _ref2.style,
|
|
33
33
|
valueStyles = _ref2.valueStyles,
|
|
34
34
|
labelStyles = _ref2.labelStyles,
|
|
35
35
|
bindEvents = _ref2.bindEvents,
|
|
36
|
-
eventNamespace = _ref2.eventNamespace
|
|
36
|
+
eventNamespace = _ref2.eventNamespace,
|
|
37
|
+
unitShow = _ref2.unitShow;
|
|
37
38
|
var eventHandles = useEleEventHandle({
|
|
38
39
|
events: bindEvents,
|
|
39
40
|
payload: {
|
|
@@ -65,7 +66,9 @@ var PointItem = function PointItem(_ref2) {
|
|
|
65
66
|
style: _objectSpread({
|
|
66
67
|
marginBottom: 4
|
|
67
68
|
}, valueStyles)
|
|
68
|
-
}, 'value' in point ? (_ref3 = point.pointEnumItemKey || point.value) !== null && _ref3 !== void 0 ? _ref3 : '-' : '点位状态'), /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
}, 'value' in point ? (_ref3 = point.pointEnumItemKey || point.value) !== null && _ref3 !== void 0 ? _ref3 : '-' + (unitShow && point.unit) : '点位状态'), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
style: labelStyles
|
|
71
|
+
}, 'value' in point ? (_point$deviceName = point === null || point === void 0 ? void 0 : point.deviceName) !== null && _point$deviceName !== void 0 ? _point$deviceName : '-' : '设备名称'), /*#__PURE__*/React.createElement("div", {
|
|
69
72
|
style: labelStyles
|
|
70
73
|
}, 'value' in point ? (_point$pointName = point === null || point === void 0 ? void 0 : point.pointName) !== null && _point$pointName !== void 0 ? _point$pointName : '-' : '点位名称')));
|
|
71
74
|
};
|
|
@@ -93,12 +96,18 @@ var ElePointListCardComponent = function ElePointListCardComponent(_ref5) {
|
|
|
93
96
|
setPointList = _useState2[1];
|
|
94
97
|
var eventHandlerListRef = useRef([]);
|
|
95
98
|
var payload = node === null || node === void 0 ? void 0 : node.getData();
|
|
99
|
+
var _useState3 = useState(true),
|
|
100
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
101
|
+
unitShow = _useState4[0],
|
|
102
|
+
setUnitShow = _useState4[1];
|
|
96
103
|
useEffect(function () {
|
|
97
104
|
if (!payload) {
|
|
98
105
|
return;
|
|
99
106
|
}
|
|
100
107
|
var list = payload.pointList;
|
|
101
108
|
setPointList(list);
|
|
109
|
+
var _unitShow = payload.unitShow;
|
|
110
|
+
setUnitShow(_unitShow == false ? false : true);
|
|
102
111
|
}, [payload]);
|
|
103
112
|
useEffect(function () {
|
|
104
113
|
if (window.scadaMode === 'edit') {
|
|
@@ -164,6 +173,7 @@ var ElePointListCardComponent = function ElePointListCardComponent(_ref5) {
|
|
|
164
173
|
return /*#__PURE__*/React.createElement(PointItem, {
|
|
165
174
|
key: point.identifierName,
|
|
166
175
|
point: point,
|
|
176
|
+
unitShow: unitShow,
|
|
167
177
|
style: {
|
|
168
178
|
width: "".concat(100 / cols, "%")
|
|
169
179
|
},
|
package/es/element/type.d.ts
CHANGED
|
@@ -113,6 +113,8 @@ declare namespace Ele {
|
|
|
113
113
|
keepRatio?: boolean;
|
|
114
114
|
/** 绑定的点位列表 */
|
|
115
115
|
pointList?: BindPoint[];
|
|
116
|
+
/** 设置数据单位是否显示 */
|
|
117
|
+
unitShow: boolean;
|
|
116
118
|
/** 最多可绑定的点位数量, 如果是 0 的话,则不可绑定点位,不显示绑定点位的表单, 如果是 undefined, 则不限制点位数量 */
|
|
117
119
|
pointListLimit?: number;
|
|
118
120
|
/** 元件内部文字样式 (edge 不支持) */
|