coolcare-lite-scada-component 4.0.12 → 4.1.1
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 +42 -4
- package/es/components/FormBindPoint/ProductionOrDeviceScene.js +42 -4
- package/es/components/FormBindPoint/index.js +6 -3
- package/es/components/ImageUploader/index.js +15 -7
- package/es/element/EleGauge/Component.js +5 -3
- package/es/element/EleGauge/PropsSet/index.js +2 -1
- package/es/element/ElePointList/Component.js +5 -3
- package/es/element/ElePointList/PropsSet/index.js +2 -1
- package/es/element/ElePointValue/Component.js +3 -1
- package/es/element/ElePointValue/PropsSet/index.js +2 -1
- package/es/element/PointCard/PointCard1/Component.js +5 -3
- package/es/element/PointCard/PointCard1/PropsSet/index.js +2 -1
- package/es/element/PointCard/PointListCard/Component.js +13 -10
- package/es/element/PointCard/PointListCard/PropsSet/index.js +2 -1
- package/es/element/PointControl/PointControl1/Component.js +5 -3
- package/es/element/PointControl/PointControl1/PropsSet/index.js +3 -1
- package/es/element/PointControl/PointControl3/Component.js +5 -3
- package/es/element/PointControl/PointControl3/PropsSet/index.js +2 -1
- package/es/element/type.d.ts +6 -0
- package/es/pages/editor/PanelTop/Save/index.js +1 -1
- package/es/services/common/Uploader.js +2 -3
- package/es/services/request.js +5 -4
- package/es/utils/pointValueFormat.js +13 -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, useState } from 'react';
|
|
19
|
-
import { Form, Button, Space, Typography, Input, Switch, Select } from 'antd';
|
|
19
|
+
import { Form, Button, Space, Typography, Input, InputNumber, Switch, Select } from 'antd';
|
|
20
20
|
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
|
|
21
21
|
import { useModel } from 'umi';
|
|
22
22
|
import { cloneDeep } from 'lodash-es';
|
|
@@ -44,7 +44,8 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
44
44
|
pointItemTool = _ref.pointItemTool,
|
|
45
45
|
pointListLimitOverride = _ref.pointListLimit,
|
|
46
46
|
_ref$pointItemToolPla = _ref.pointItemToolPlacement,
|
|
47
|
-
pointItemToolPlacement = _ref$pointItemToolPla === void 0 ? 'header' : _ref$pointItemToolPla
|
|
47
|
+
pointItemToolPlacement = _ref$pointItemToolPla === void 0 ? 'header' : _ref$pointItemToolPla,
|
|
48
|
+
enableDecimalConfig = _ref.enableDecimalConfig;
|
|
48
49
|
var _Form$useForm = Form.useForm(),
|
|
49
50
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
50
51
|
form = _Form$useForm2[0];
|
|
@@ -150,7 +151,10 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
150
151
|
dataType: v.dataType,
|
|
151
152
|
meterId: v.meterId,
|
|
152
153
|
valueType: v.indicatorNo ? 'indicator' : 'point',
|
|
153
|
-
indicatorNo: v.indicatorNo
|
|
154
|
+
indicatorNo: v.indicatorNo,
|
|
155
|
+
decimalEnabled: v.decimalEnabled,
|
|
156
|
+
decimalPlaces: v.decimalPlaces,
|
|
157
|
+
decimalTrailingZeros: v.decimalTrailingZeros
|
|
154
158
|
});
|
|
155
159
|
}),
|
|
156
160
|
unitShow: unitShow
|
|
@@ -364,7 +368,41 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
|
|
|
364
368
|
label: 'name',
|
|
365
369
|
value: 'id'
|
|
366
370
|
}
|
|
367
|
-
})), pointItemToolPlacement === 'afterBindField' && typeof pointItemTool === 'function' && pointItemTool(index))
|
|
371
|
+
})), pointItemToolPlacement === 'afterBindField' && typeof pointItemTool === 'function' && pointItemTool(index)), enableDecimalConfig && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
|
|
372
|
+
label: "\u663E\u793A\u5C0F\u6570",
|
|
373
|
+
name: [name, 'decimalEnabled'],
|
|
374
|
+
valuePropName: "checked",
|
|
375
|
+
className: "!ml-3"
|
|
376
|
+
}), /*#__PURE__*/React.createElement(Switch, {
|
|
377
|
+
checkedChildren: "\u663E\u793A",
|
|
378
|
+
unCheckedChildren: "\u9690\u85CF"
|
|
379
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
380
|
+
noStyle: true,
|
|
381
|
+
shouldUpdate: function shouldUpdate(prev, next) {
|
|
382
|
+
var _prev$pointList, _prev$pointList$index, _next$pointList, _next$pointList$index;
|
|
383
|
+
return ((_prev$pointList = prev.pointList) === null || _prev$pointList === void 0 ? void 0 : (_prev$pointList$index = _prev$pointList[index]) === null || _prev$pointList$index === void 0 ? void 0 : _prev$pointList$index.decimalEnabled) !== ((_next$pointList = next.pointList) === null || _next$pointList === void 0 ? void 0 : (_next$pointList$index = _next$pointList[index]) === null || _next$pointList$index === void 0 ? void 0 : _next$pointList$index.decimalEnabled);
|
|
384
|
+
}
|
|
385
|
+
}, function () {
|
|
386
|
+
return form.getFieldValue(['pointList', index, 'decimalEnabled']) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
|
|
387
|
+
label: "\u5C0F\u6570\u4F4D\u6570",
|
|
388
|
+
name: [name, 'decimalPlaces'],
|
|
389
|
+
initialValue: 2,
|
|
390
|
+
className: "!ml-3"
|
|
391
|
+
}), /*#__PURE__*/React.createElement(InputNumber, {
|
|
392
|
+
min: 0,
|
|
393
|
+
max: 6,
|
|
394
|
+
precision: 0
|
|
395
|
+
})), /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
|
|
396
|
+
label: "\u662F\u5426\u8865\u96F6",
|
|
397
|
+
name: [name, 'decimalTrailingZeros'],
|
|
398
|
+
initialValue: true,
|
|
399
|
+
valuePropName: "checked",
|
|
400
|
+
className: "!ml-3"
|
|
401
|
+
}), /*#__PURE__*/React.createElement(Switch, {
|
|
402
|
+
checkedChildren: "\u8865\u96F6",
|
|
403
|
+
unCheckedChildren: "\u4E0D\u8865\u96F6"
|
|
404
|
+
}))) : null;
|
|
405
|
+
})));
|
|
368
406
|
}), pointListLimit > fields.length ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
369
407
|
wrapperCol: {
|
|
370
408
|
span: 15,
|
|
@@ -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, Switch } from 'antd';
|
|
19
|
+
import { Form, Button, InputNumber, 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';
|
|
@@ -41,7 +41,8 @@ var ProductionSceneFormBindPoint = function ProductionSceneFormBindPoint(_ref) {
|
|
|
41
41
|
pointItemTool = _ref.pointItemTool,
|
|
42
42
|
pointListLimitOverride = _ref.pointListLimit,
|
|
43
43
|
_ref$pointItemToolPla = _ref.pointItemToolPlacement,
|
|
44
|
-
pointItemToolPlacement = _ref$pointItemToolPla === void 0 ? 'header' : _ref$pointItemToolPla
|
|
44
|
+
pointItemToolPlacement = _ref$pointItemToolPla === void 0 ? 'header' : _ref$pointItemToolPla,
|
|
45
|
+
enableDecimalConfig = _ref.enableDecimalConfig;
|
|
45
46
|
var _Form$useForm = Form.useForm(),
|
|
46
47
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
47
48
|
form = _Form$useForm2[0];
|
|
@@ -105,7 +106,10 @@ var ProductionSceneFormBindPoint = function ProductionSceneFormBindPoint(_ref) {
|
|
|
105
106
|
pointList: list.map(function (v, index) {
|
|
106
107
|
var _payload$pointList;
|
|
107
108
|
return _objectSpread(_objectSpread({}, (_payload === null || _payload === void 0 ? void 0 : (_payload$pointList = _payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[index]) || {}), {}, {
|
|
108
|
-
identifierName: v.identifierName
|
|
109
|
+
identifierName: v.identifierName,
|
|
110
|
+
decimalEnabled: v.decimalEnabled,
|
|
111
|
+
decimalPlaces: v.decimalPlaces,
|
|
112
|
+
decimalTrailingZeros: v.decimalTrailingZeros
|
|
109
113
|
});
|
|
110
114
|
}),
|
|
111
115
|
unitShow: unitShow
|
|
@@ -164,7 +168,41 @@ var ProductionSceneFormBindPoint = function ProductionSceneFormBindPoint(_ref) {
|
|
|
164
168
|
deviceId: query.scene === 'device' ? Number(query.deviceId) : undefined,
|
|
165
169
|
disabledUnWriteable: payload === null || payload === void 0 ? void 0 : payload.pointSelect_disabledUnWriteable,
|
|
166
170
|
productId: query.scene === 'product' ? Number(query.productId) : undefined
|
|
167
|
-
})), pointItemToolPlacement === 'afterBindField' && typeof pointItemTool === 'function' && pointItemTool(index)
|
|
171
|
+
})), pointItemToolPlacement === 'afterBindField' && typeof pointItemTool === 'function' && pointItemTool(index), enableDecimalConfig && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
|
|
172
|
+
label: "\u663E\u793A\u5C0F\u6570",
|
|
173
|
+
name: [name, 'decimalEnabled'],
|
|
174
|
+
valuePropName: "checked",
|
|
175
|
+
className: "!ml-3"
|
|
176
|
+
}), /*#__PURE__*/React.createElement(Switch, {
|
|
177
|
+
checkedChildren: "\u663E\u793A",
|
|
178
|
+
unCheckedChildren: "\u9690\u85CF"
|
|
179
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
180
|
+
noStyle: true,
|
|
181
|
+
shouldUpdate: function shouldUpdate(prev, next) {
|
|
182
|
+
var _prev$pointList, _prev$pointList$index, _next$pointList, _next$pointList$index;
|
|
183
|
+
return ((_prev$pointList = prev.pointList) === null || _prev$pointList === void 0 ? void 0 : (_prev$pointList$index = _prev$pointList[index]) === null || _prev$pointList$index === void 0 ? void 0 : _prev$pointList$index.decimalEnabled) !== ((_next$pointList = next.pointList) === null || _next$pointList === void 0 ? void 0 : (_next$pointList$index = _next$pointList[index]) === null || _next$pointList$index === void 0 ? void 0 : _next$pointList$index.decimalEnabled);
|
|
184
|
+
}
|
|
185
|
+
}, function () {
|
|
186
|
+
return form.getFieldValue(['pointList', index, 'decimalEnabled']) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
|
|
187
|
+
label: "\u5C0F\u6570\u4F4D\u6570",
|
|
188
|
+
name: [name, 'decimalPlaces'],
|
|
189
|
+
initialValue: 2,
|
|
190
|
+
className: "!ml-3"
|
|
191
|
+
}), /*#__PURE__*/React.createElement(InputNumber, {
|
|
192
|
+
min: 0,
|
|
193
|
+
max: 6,
|
|
194
|
+
precision: 0
|
|
195
|
+
})), /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
|
|
196
|
+
label: "\u662F\u5426\u8865\u96F6",
|
|
197
|
+
name: [name, 'decimalTrailingZeros'],
|
|
198
|
+
initialValue: true,
|
|
199
|
+
valuePropName: "checked",
|
|
200
|
+
className: "!ml-3"
|
|
201
|
+
}), /*#__PURE__*/React.createElement(Switch, {
|
|
202
|
+
checkedChildren: "\u8865\u96F6",
|
|
203
|
+
unCheckedChildren: "\u4E0D\u8865\u96F6"
|
|
204
|
+
}))) : null;
|
|
205
|
+
})));
|
|
168
206
|
}), pointListLimit > fields.length ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
169
207
|
wrapperCol: {
|
|
170
208
|
span: 15,
|
|
@@ -6,18 +6,21 @@ var FormBindPoint = function FormBindPoint(_ref) {
|
|
|
6
6
|
var onChange = _ref.onChange,
|
|
7
7
|
pointItemTool = _ref.pointItemTool,
|
|
8
8
|
pointListLimit = _ref.pointListLimit,
|
|
9
|
-
pointItemToolPlacement = _ref.pointItemToolPlacement
|
|
9
|
+
pointItemToolPlacement = _ref.pointItemToolPlacement,
|
|
10
|
+
enableDecimalConfig = _ref.enableDecimalConfig;
|
|
10
11
|
var query = useQuery();
|
|
11
12
|
return /*#__PURE__*/React.createElement(React.Fragment, null, ['product', 'device'].includes(query.scene) && /*#__PURE__*/React.createElement(ProductionOrDeviceScene, {
|
|
12
13
|
onChange: onChange,
|
|
13
14
|
pointItemTool: pointItemTool,
|
|
14
15
|
pointListLimit: pointListLimit,
|
|
15
|
-
pointItemToolPlacement: pointItemToolPlacement
|
|
16
|
+
pointItemToolPlacement: pointItemToolPlacement,
|
|
17
|
+
enableDecimalConfig: enableDecimalConfig
|
|
16
18
|
}), query.scene === 'freedom' && /*#__PURE__*/React.createElement(FreedomScene, {
|
|
17
19
|
onChange: onChange,
|
|
18
20
|
pointItemTool: pointItemTool,
|
|
19
21
|
pointListLimit: pointListLimit,
|
|
20
|
-
pointItemToolPlacement: pointItemToolPlacement
|
|
22
|
+
pointItemToolPlacement: pointItemToolPlacement,
|
|
23
|
+
enableDecimalConfig: enableDecimalConfig
|
|
21
24
|
}));
|
|
22
25
|
};
|
|
23
26
|
export default FormBindPoint;
|
|
@@ -19,6 +19,12 @@ import { useState } from 'react';
|
|
|
19
19
|
import { Button, Upload, message, notification } from 'antd';
|
|
20
20
|
import { UploadOutlined, LoadingOutlined } from '@ant-design/icons';
|
|
21
21
|
import { Upload as uploadFile } from "../../services/common/Uploader";
|
|
22
|
+
var MINIO_INTERNAL_URL = 'http://minio:9000';
|
|
23
|
+
|
|
24
|
+
/** 只保存 OSS 路径,避免将容器内部地址写入图片配置。 */
|
|
25
|
+
var normalizeUploadUrl = function normalizeUploadUrl(url) {
|
|
26
|
+
return url.startsWith(MINIO_INTERNAL_URL) ? url.slice(MINIO_INTERNAL_URL.length) : url;
|
|
27
|
+
};
|
|
22
28
|
/** 计算图片大小 */
|
|
23
29
|
var calculateSize = function calculateSize(file) {
|
|
24
30
|
return new Promise(function (resolve) {
|
|
@@ -81,7 +87,8 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
81
87
|
duration: 10,
|
|
82
88
|
description: /*#__PURE__*/React.createElement("div", null, "\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ", size, "M, \u5EFA\u8BAE\u538B\u7F29\u540E\u518D\u4E0A\u4F20\u3002", ' ', /*#__PURE__*/React.createElement("a", {
|
|
83
89
|
target: "_blank",
|
|
84
|
-
href: "https://squoosh.app/"
|
|
90
|
+
href: "https://squoosh.app/",
|
|
91
|
+
rel: "noreferrer"
|
|
85
92
|
}, "\u56FE\u7247\u5728\u7EBF\u538B\u7F29"))
|
|
86
93
|
});
|
|
87
94
|
}
|
|
@@ -89,7 +96,7 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
89
96
|
};
|
|
90
97
|
var customUploadRequest = /*#__PURE__*/function () {
|
|
91
98
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
92
|
-
var onSuccess, onError, file, size, _yield$uploadFile,
|
|
99
|
+
var onSuccess, onError, file, size, _yield$uploadFile, code, data, url, _t;
|
|
93
100
|
return _regenerator().w(function (_context) {
|
|
94
101
|
while (1) switch (_context.p = _context.n) {
|
|
95
102
|
case 0:
|
|
@@ -108,19 +115,20 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
108
115
|
});
|
|
109
116
|
case 3:
|
|
110
117
|
_yield$uploadFile = _context.v;
|
|
111
|
-
|
|
118
|
+
code = _yield$uploadFile.code;
|
|
112
119
|
data = _yield$uploadFile.data;
|
|
113
|
-
if (
|
|
120
|
+
if (String(code) === '200' && typeof data === 'string' && data.length > 0) {
|
|
121
|
+
url = normalizeUploadUrl(data);
|
|
114
122
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
115
|
-
url:
|
|
123
|
+
url: url,
|
|
116
124
|
size: size,
|
|
117
125
|
name: file.name
|
|
118
126
|
});
|
|
119
127
|
// @ts-ignore
|
|
120
128
|
onSuccess({}, // @ts-ignore
|
|
121
129
|
_objectSpread(_objectSpread({}, options.file), {}, {
|
|
122
|
-
uid:
|
|
123
|
-
url:
|
|
130
|
+
uid: url,
|
|
131
|
+
url: url
|
|
124
132
|
}));
|
|
125
133
|
} else {
|
|
126
134
|
onError === null || onError === void 0 ? void 0 : onError(new Error('文件上传失败'));
|
|
@@ -16,6 +16,7 @@ import { Tooltip } from 'antd';
|
|
|
16
16
|
import { usePointWatch, useEleEventHandle } from "../../hooks";
|
|
17
17
|
import { reactShapeNodeAreEqual } from "../utils";
|
|
18
18
|
import ECharts from "../../components/ECharts";
|
|
19
|
+
import { formatPointDisplayValue } from "../../utils/pointValueFormat";
|
|
19
20
|
import styles from "./index.css";
|
|
20
21
|
var EleGaugeComponent = function EleGaugeComponent(_ref) {
|
|
21
22
|
var _payload$pointList, _payload$mittMeta, _payload$mittMeta$nam, _payload$mittMeta2;
|
|
@@ -100,15 +101,16 @@ var EleGaugeComponent = function EleGaugeComponent(_ref) {
|
|
|
100
101
|
optionsCopy.series.min = (_extraData$minValue = extraData === null || extraData === void 0 ? void 0 : extraData.minValue) !== null && _extraData$minValue !== void 0 ? _extraData$minValue : 0;
|
|
101
102
|
optionsCopy.series.data[0].value = pointData.value;
|
|
102
103
|
optionsCopy.series.data[0].name = (extraData === null || extraData === void 0 ? void 0 : extraData.label) || '';
|
|
104
|
+
var displayValue = formatPointDisplayValue(pointData.value, configPoint);
|
|
103
105
|
if (extraData === null || extraData === void 0 ? void 0 : extraData.isShowUnit) {
|
|
104
|
-
optionsCopy.series.detail.formatter = "
|
|
106
|
+
optionsCopy.series.detail.formatter = "".concat(displayValue).concat(pointData.unit);
|
|
105
107
|
} else {
|
|
106
|
-
optionsCopy.series.detail.formatter = "
|
|
108
|
+
optionsCopy.series.detail.formatter = "".concat(displayValue);
|
|
107
109
|
}
|
|
108
110
|
return optionsCopy;
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
|
-
}, [pointData, node]);
|
|
113
|
+
}, [pointData, node, configPoint]);
|
|
112
114
|
return /*#__PURE__*/React.createElement("div", {
|
|
113
115
|
className: styles.wrap,
|
|
114
116
|
onClick: function onClick(e) {
|
|
@@ -20,7 +20,8 @@ var PropsSet = function PropsSet() {
|
|
|
20
20
|
header: "\u7ED1\u5B9A\u70B9\u4F4D",
|
|
21
21
|
key: "1"
|
|
22
22
|
}, /*#__PURE__*/React.createElement(FormBindPoint, {
|
|
23
|
-
onChange: forceUpdate
|
|
23
|
+
onChange: forceUpdate,
|
|
24
|
+
enableDecimalConfig: true
|
|
24
25
|
})), /*#__PURE__*/React.createElement(Panel, {
|
|
25
26
|
header: "\u5176\u4ED6",
|
|
26
27
|
key: "2"
|
|
@@ -14,12 +14,14 @@ import React from "react";
|
|
|
14
14
|
import { memo, useState, useEffect, useRef } from 'react';
|
|
15
15
|
import { Tooltip } from 'antd';
|
|
16
16
|
import emitter from "../../utils/events";
|
|
17
|
+
import { formatPointDisplayValue } from "../../utils/pointValueFormat";
|
|
17
18
|
import { reactShapeNodeAreEqual, handleEleEvent } from "../utils";
|
|
18
19
|
import styles from "./index.css";
|
|
19
20
|
var PointTooltipTitle = function PointTooltipTitle(_ref) {
|
|
20
|
-
var _point$
|
|
21
|
+
var _point$unit;
|
|
21
22
|
var point = _ref.point;
|
|
22
|
-
|
|
23
|
+
var displayValue = formatPointDisplayValue(point === null || point === void 0 ? void 0 : point.value, point);
|
|
24
|
+
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", displayValue !== null && displayValue !== void 0 ? displayValue : '-', " ", (_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) || '-'));
|
|
23
25
|
};
|
|
24
26
|
var ElePointPanelComponent = function ElePointPanelComponent(_ref2) {
|
|
25
27
|
var node = _ref2.node;
|
|
@@ -139,7 +141,7 @@ var ElePointPanelComponent = function ElePointPanelComponent(_ref2) {
|
|
|
139
141
|
className: styles.name
|
|
140
142
|
}, (_point$pointName = point.pointName) !== null && _point$pointName !== void 0 ? _point$pointName : '-'), /*#__PURE__*/React.createElement("span", {
|
|
141
143
|
className: styles.value
|
|
142
|
-
}, (_ref3 = point.pointEnumItemKey || point.value) !== null && _ref3 !== void 0 ? _ref3 : '-', unitShow && point.unit))));
|
|
144
|
+
}, (_ref3 = point.pointEnumItemKey || formatPointDisplayValue(point.value, point)) !== null && _ref3 !== void 0 ? _ref3 : '-', unitShow && point.unit))));
|
|
143
145
|
}), (window.scadaMode === 'edit' || !pointList.length) && /*#__PURE__*/React.createElement("div", {
|
|
144
146
|
className: styles.item
|
|
145
147
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -19,7 +19,8 @@ var PropsSet = function PropsSet() {
|
|
|
19
19
|
header: "\u7ED1\u5B9A\u70B9\u4F4D",
|
|
20
20
|
key: "1"
|
|
21
21
|
}, /*#__PURE__*/React.createElement(FormBindPoint, {
|
|
22
|
-
onChange: forceUpdate
|
|
22
|
+
onChange: forceUpdate,
|
|
23
|
+
enableDecimalConfig: true
|
|
23
24
|
})));
|
|
24
25
|
};
|
|
25
26
|
export default PropsSet;
|
|
@@ -18,6 +18,7 @@ import styles from "./index.css";
|
|
|
18
18
|
import IconFont from "../../components/IconFont";
|
|
19
19
|
import { useRequest } from 'ahooks';
|
|
20
20
|
import { GetDeviceInfo } from "../../services/gateway/Device";
|
|
21
|
+
import { formatPointDisplayValue } from "../../utils/pointValueFormat";
|
|
21
22
|
var directionClassNameMap = {
|
|
22
23
|
top: 'flex-col',
|
|
23
24
|
left: 'flex-row',
|
|
@@ -74,6 +75,7 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
|
|
|
74
75
|
unit: ['kWh', 't', 'm³', 't', 't'][pointData.type - 1]
|
|
75
76
|
});
|
|
76
77
|
}
|
|
78
|
+
var displayValue = formatPointDisplayValue(typeof value === 'string' && value !== '' ? Number(value) : value, configPoint);
|
|
77
79
|
var pointValue = '';
|
|
78
80
|
if (window.scadaMode === 'edit') {
|
|
79
81
|
pointValue = '点位值';
|
|
@@ -82,7 +84,7 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
|
|
|
82
84
|
if (configPoint === null || configPoint === void 0 ? void 0 : configPoint.expressions) {
|
|
83
85
|
pointValue = getValueByExpression(value, configPoint === null || configPoint === void 0 ? void 0 : configPoint.expressions);
|
|
84
86
|
}
|
|
85
|
-
pointValue = ((_pointData6 = pointData) === null || _pointData6 === void 0 ? void 0 : _pointData6.pointEnumItemKey) ||
|
|
87
|
+
pointValue = ((_pointData6 = pointData) === null || _pointData6 === void 0 ? void 0 : _pointData6.pointEnumItemKey) || displayValue;
|
|
86
88
|
}
|
|
87
89
|
var tooltipTitle = null;
|
|
88
90
|
if (!configPoint) {
|
|
@@ -24,7 +24,8 @@ var PropsSet = function PropsSet() {
|
|
|
24
24
|
header: "\u7ED1\u5B9A\u70B9\u4F4D",
|
|
25
25
|
key: "1"
|
|
26
26
|
}, /*#__PURE__*/React.createElement(FormBindPoint, {
|
|
27
|
-
onChange: forceUpdate
|
|
27
|
+
onChange: forceUpdate,
|
|
28
|
+
enableDecimalConfig: true
|
|
28
29
|
})), /*#__PURE__*/React.createElement(Panel, {
|
|
29
30
|
header: "\u5168\u5C40",
|
|
30
31
|
key: "2"
|
|
@@ -11,6 +11,7 @@ import { RightOutlined } from '@ant-design/icons';
|
|
|
11
11
|
import Icon from "../../../components/Icon";
|
|
12
12
|
import emitter from "../../../utils/events";
|
|
13
13
|
import { usePointWatch, useEleEventHandle } from "../../../hooks";
|
|
14
|
+
import { formatPointDisplayValue } from "../../../utils/pointValueFormat";
|
|
14
15
|
import { reactShapeNodeAreEqual, getValueByExpression } from "../../utils";
|
|
15
16
|
import styles from "./index.css";
|
|
16
17
|
var defaultIconColor = '#5b6b73';
|
|
@@ -32,6 +33,7 @@ var ElePointCardComponent = function ElePointCardComponent(_ref) {
|
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
var pointData = usePointWatch(configPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta2 = payload.mittMeta) === null || _payload$mittMeta2 === void 0 ? void 0 : _payload$mittMeta2.namespace);
|
|
36
|
+
var displayValue = formatPointDisplayValue(pointData === null || pointData === void 0 ? void 0 : pointData.value, configPoint);
|
|
35
37
|
var onClickBtn = function onClickBtn(e) {
|
|
36
38
|
var _payload$mittMeta$nam2, _payload$mittMeta3;
|
|
37
39
|
e.stopPropagation();
|
|
@@ -57,8 +59,8 @@ var ElePointCardComponent = function ElePointCardComponent(_ref) {
|
|
|
57
59
|
if (!configPoint) {
|
|
58
60
|
tooltipTitle = '未绑定点位';
|
|
59
61
|
} else {
|
|
60
|
-
var _pointData$
|
|
61
|
-
tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A",
|
|
62
|
+
var _pointData$unit;
|
|
63
|
+
tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", displayValue !== null && displayValue !== void 0 ? displayValue : '-', " ", (_pointData$unit = pointData === null || pointData === void 0 ? void 0 : pointData.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.updateTime) || '-'));
|
|
62
64
|
}
|
|
63
65
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
64
66
|
title: tooltipTitle
|
|
@@ -95,7 +97,7 @@ var ElePointCardComponent = function ElePointCardComponent(_ref) {
|
|
|
95
97
|
style: {
|
|
96
98
|
marginRight: 4
|
|
97
99
|
}
|
|
98
|
-
}, (_ref2 = (pointData === null || pointData === void 0 ? void 0 : pointData.pointEnumItemKey) ||
|
|
100
|
+
}, (_ref2 = (pointData === null || pointData === void 0 ? void 0 : pointData.pointEnumItemKey) || displayValue) !== null && _ref2 !== void 0 ? _ref2 : '-'), /*#__PURE__*/React.createElement("span", {
|
|
99
101
|
className: styles.unit
|
|
100
102
|
}, (pointData === null || pointData === void 0 ? void 0 : pointData.unit) || '')), /*#__PURE__*/React.createElement("button", {
|
|
101
103
|
onClick: onClickBtn,
|
|
@@ -22,7 +22,8 @@ var PropsSet = function PropsSet() {
|
|
|
22
22
|
header: "\u7ED1\u5B9A\u70B9\u4F4D",
|
|
23
23
|
key: "1"
|
|
24
24
|
}, /*#__PURE__*/React.createElement(FormBindPoint, {
|
|
25
|
-
onChange: forceUpdate
|
|
25
|
+
onChange: forceUpdate,
|
|
26
|
+
enableDecimalConfig: true
|
|
26
27
|
})), /*#__PURE__*/React.createElement(Panel, {
|
|
27
28
|
header: "\u56FE\u6807",
|
|
28
29
|
key: "2"
|
|
@@ -19,15 +19,17 @@ import { memo, useState, useEffect, useRef } from 'react';
|
|
|
19
19
|
import { Tooltip } from 'antd';
|
|
20
20
|
import emitter from "../../../utils/events";
|
|
21
21
|
import { useEleEventHandle } from "../../../hooks";
|
|
22
|
+
import { formatPointDisplayValue } from "../../../utils/pointValueFormat";
|
|
22
23
|
import { reactShapeNodeAreEqual } from "../../utils";
|
|
23
24
|
import styles from "./index.css";
|
|
24
25
|
var PointTooltipTitle = function PointTooltipTitle(_ref) {
|
|
25
|
-
var _point$
|
|
26
|
+
var _point$unit;
|
|
26
27
|
var point = _ref.point;
|
|
27
|
-
|
|
28
|
+
var displayValue = formatPointDisplayValue(point === null || point === void 0 ? void 0 : point.value, point);
|
|
29
|
+
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", displayValue !== null && displayValue !== void 0 ? displayValue : '-', " ", (_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
30
|
};
|
|
29
31
|
var PointItem = function PointItem(_ref2) {
|
|
30
|
-
var
|
|
32
|
+
var _point$deviceName, _point$pointName;
|
|
31
33
|
var point = _ref2.point,
|
|
32
34
|
style = _ref2.style,
|
|
33
35
|
valueStyles = _ref2.valueStyles,
|
|
@@ -35,6 +37,7 @@ var PointItem = function PointItem(_ref2) {
|
|
|
35
37
|
bindEvents = _ref2.bindEvents,
|
|
36
38
|
eventNamespace = _ref2.eventNamespace,
|
|
37
39
|
unitShow = _ref2.unitShow;
|
|
40
|
+
var displayValue = formatPointDisplayValue(point === null || point === void 0 ? void 0 : point.value, point);
|
|
38
41
|
var eventHandles = useEleEventHandle({
|
|
39
42
|
events: bindEvents,
|
|
40
43
|
payload: {
|
|
@@ -66,16 +69,16 @@ var PointItem = function PointItem(_ref2) {
|
|
|
66
69
|
style: _objectSpread({
|
|
67
70
|
marginBottom: 4
|
|
68
71
|
}, valueStyles)
|
|
69
|
-
}, 'value' in point ? "".concat(
|
|
72
|
+
}, 'value' in point ? "".concat(point.pointEnumItemKey || displayValue || '-').concat(unitShow ? point.unit || '' : '') : '点位状态'), /*#__PURE__*/React.createElement("div", {
|
|
70
73
|
style: labelStyles
|
|
71
74
|
}, '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", {
|
|
72
75
|
style: labelStyles
|
|
73
76
|
}, 'value' in point ? (_point$pointName = point === null || point === void 0 ? void 0 : point.pointName) !== null && _point$pointName !== void 0 ? _point$pointName : '-' : '点位名称')));
|
|
74
77
|
};
|
|
75
|
-
var PointItemPlaceholder = function PointItemPlaceholder(
|
|
76
|
-
var style =
|
|
77
|
-
valueStyles =
|
|
78
|
-
labelStyles =
|
|
78
|
+
var PointItemPlaceholder = function PointItemPlaceholder(_ref3) {
|
|
79
|
+
var style = _ref3.style,
|
|
80
|
+
valueStyles = _ref3.valueStyles,
|
|
81
|
+
labelStyles = _ref3.labelStyles;
|
|
79
82
|
return /*#__PURE__*/React.createElement("div", {
|
|
80
83
|
style: style,
|
|
81
84
|
className: styles.item
|
|
@@ -87,9 +90,9 @@ var PointItemPlaceholder = function PointItemPlaceholder(_ref4) {
|
|
|
87
90
|
style: labelStyles
|
|
88
91
|
}, "\u70B9\u4F4D\u540D\u79F0"));
|
|
89
92
|
};
|
|
90
|
-
var ElePointListCardComponent = function ElePointListCardComponent(
|
|
93
|
+
var ElePointListCardComponent = function ElePointListCardComponent(_ref4) {
|
|
91
94
|
var _payload$title, _payload$title2;
|
|
92
|
-
var node =
|
|
95
|
+
var node = _ref4.node;
|
|
93
96
|
var _useState = useState([]),
|
|
94
97
|
_useState2 = _slicedToArray(_useState, 2),
|
|
95
98
|
pointList = _useState2[0],
|
|
@@ -23,7 +23,8 @@ var PropsSet = function PropsSet() {
|
|
|
23
23
|
header: "\u7ED1\u5B9A\u70B9\u4F4D",
|
|
24
24
|
key: "1"
|
|
25
25
|
}, /*#__PURE__*/React.createElement(FormBindPoint, {
|
|
26
|
-
onChange: forceUpdate
|
|
26
|
+
onChange: forceUpdate,
|
|
27
|
+
enableDecimalConfig: true
|
|
27
28
|
})), /*#__PURE__*/React.createElement(Panel, {
|
|
28
29
|
header: "\u5168\u5C40",
|
|
29
30
|
key: "2"
|
|
@@ -16,6 +16,7 @@ import { Tooltip } from 'antd';
|
|
|
16
16
|
import { PlusCircleFilled, MinusCircleFilled } from '@ant-design/icons';
|
|
17
17
|
import { usePointWatch, useEleEventHandle } from "../../../hooks";
|
|
18
18
|
import { reactShapeNodeAreEqual, pointWriteDebounce } from "../../utils";
|
|
19
|
+
import { formatPointDisplayValue } from "../../../utils/pointValueFormat";
|
|
19
20
|
import styles from "./index.css";
|
|
20
21
|
export var defaultIconName = 'zhileng';
|
|
21
22
|
var ElePointControl1Component = function ElePointControl1Component(_ref) {
|
|
@@ -39,6 +40,7 @@ var ElePointControl1Component = function ElePointControl1Component(_ref) {
|
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
var pointData = usePointWatch(configPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta2 = payload.mittMeta) === null || _payload$mittMeta2 === void 0 ? void 0 : _payload$mittMeta2.namespace);
|
|
43
|
+
var displayValue = formatPointDisplayValue(pointValue, configPoint);
|
|
42
44
|
useEffect(function () {
|
|
43
45
|
setPointValue(pointData === null || pointData === void 0 ? void 0 : pointData.value);
|
|
44
46
|
}, [pointData]);
|
|
@@ -46,8 +48,8 @@ var ElePointControl1Component = function ElePointControl1Component(_ref) {
|
|
|
46
48
|
if (!configPoint) {
|
|
47
49
|
tooltipTitle = '未绑定点位';
|
|
48
50
|
} else {
|
|
49
|
-
var
|
|
50
|
-
tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", (
|
|
51
|
+
var _formatPointDisplayVa, _pointData$unit;
|
|
52
|
+
tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", (_formatPointDisplayVa = formatPointDisplayValue(pointData === null || pointData === void 0 ? void 0 : pointData.value, configPoint)) !== null && _formatPointDisplayVa !== void 0 ? _formatPointDisplayVa : '-', ' ', (_pointData$unit = pointData === null || pointData === void 0 ? void 0 : pointData.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.updateTime) || '-'));
|
|
51
53
|
}
|
|
52
54
|
var pointValueStyle = _objectSpread(_objectSpread({}, payload === null || payload === void 0 ? void 0 : (_payload$pointValue = payload.pointValue) === null || _payload$pointValue === void 0 ? void 0 : _payload$pointValue.fontStyles), payload === null || payload === void 0 ? void 0 : (_payload$pointValue2 = payload.pointValue) === null || _payload$pointValue2 === void 0 ? void 0 : _payload$pointValue2.margin_padding);
|
|
53
55
|
var handleClick = function handleClick(e, type) {
|
|
@@ -104,7 +106,7 @@ var ElePointControl1Component = function ElePointControl1Component(_ref) {
|
|
|
104
106
|
}
|
|
105
107
|
}), /*#__PURE__*/React.createElement("div", {
|
|
106
108
|
style: pointValueStyle
|
|
107
|
-
},
|
|
109
|
+
}, displayValue !== null && displayValue !== void 0 ? displayValue : '-'), /*#__PURE__*/React.createElement(PlusCircleFilled, {
|
|
108
110
|
onClick: function onClick(e) {
|
|
109
111
|
return handleClick(e, 'plus');
|
|
110
112
|
},
|
|
@@ -19,7 +19,9 @@ var PropsSet = function PropsSet() {
|
|
|
19
19
|
}, /*#__PURE__*/React.createElement(Panel, {
|
|
20
20
|
header: "\u7ED1\u5B9A\u70B9\u4F4D",
|
|
21
21
|
key: "1"
|
|
22
|
-
}, /*#__PURE__*/React.createElement(FormBindPoint,
|
|
22
|
+
}, /*#__PURE__*/React.createElement(FormBindPoint, {
|
|
23
|
+
enableDecimalConfig: true
|
|
24
|
+
})), /*#__PURE__*/React.createElement(Panel, {
|
|
23
25
|
header: "\u5168\u5C40",
|
|
24
26
|
key: "2"
|
|
25
27
|
}, /*#__PURE__*/React.createElement(GlobalPropsSet, null)), /*#__PURE__*/React.createElement(Panel, {
|
|
@@ -17,6 +17,7 @@ import Icon from "../../../components/Icon";
|
|
|
17
17
|
import { usePointWatch, useEleEventHandle } from "../../../hooks";
|
|
18
18
|
import Switch from "../../../components/Switch";
|
|
19
19
|
import { isNumber } from "../../../utils";
|
|
20
|
+
import { formatPointDisplayValue } from "../../../utils/pointValueFormat";
|
|
20
21
|
import { pointWrite } from "../../utils/pointWrite";
|
|
21
22
|
import { reactShapeNodeAreEqual, getValueByExpression } from "../../utils";
|
|
22
23
|
import styles from "./index.css";
|
|
@@ -43,6 +44,7 @@ var ElePointControl3Component = function ElePointControl3Component(_ref) {
|
|
|
43
44
|
}
|
|
44
45
|
});
|
|
45
46
|
var pointData = usePointWatch(configPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta2 = payload.mittMeta) === null || _payload$mittMeta2 === void 0 ? void 0 : _payload$mittMeta2.namespace);
|
|
47
|
+
var displayValue = formatPointDisplayValue(pointData === null || pointData === void 0 ? void 0 : pointData.value, configPoint);
|
|
46
48
|
var iconColor = (payload === null || payload === void 0 ? void 0 : payload.icon.color) || defaultIconColor;
|
|
47
49
|
if (payload === null || payload === void 0 ? void 0 : payload.icon.colorExpressions) {
|
|
48
50
|
var expressionValue = getValueByExpression(pointData === null || pointData === void 0 ? void 0 : pointData.value, payload === null || payload === void 0 ? void 0 : payload.icon.colorExpressions);
|
|
@@ -54,8 +56,8 @@ var ElePointControl3Component = function ElePointControl3Component(_ref) {
|
|
|
54
56
|
if (!configPoint) {
|
|
55
57
|
tooltipTitle = '未绑定点位';
|
|
56
58
|
} else {
|
|
57
|
-
var _pointData$
|
|
58
|
-
tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A",
|
|
59
|
+
var _pointData$unit;
|
|
60
|
+
tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", displayValue !== null && displayValue !== void 0 ? displayValue : '-', " ", (_pointData$unit = pointData === null || pointData === void 0 ? void 0 : pointData.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.updateTime) || '-'));
|
|
59
61
|
}
|
|
60
62
|
var subTitle = function subTitle() {
|
|
61
63
|
var _payload$subTitle, _payload$subTitle2, _payload$subTitle3, _ref2, _payload$subTitle4;
|
|
@@ -64,7 +66,7 @@ var ElePointControl3Component = function ElePointControl3Component(_ref) {
|
|
|
64
66
|
}
|
|
65
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
68
|
style: _objectSpread(_objectSpread({}, payload === null || payload === void 0 ? void 0 : (_payload$subTitle2 = payload.subTitle) === null || _payload$subTitle2 === void 0 ? void 0 : _payload$subTitle2.fontStyles), payload === null || payload === void 0 ? void 0 : (_payload$subTitle3 = payload.subTitle) === null || _payload$subTitle3 === void 0 ? void 0 : _payload$subTitle3.margin_padding)
|
|
67
|
-
}, /*#__PURE__*/React.createElement("span", null, (_ref2 = (payload === null || payload === void 0 ? void 0 : (_payload$subTitle4 = payload.subTitle) === null || _payload$subTitle4 === void 0 ? void 0 : _payload$subTitle4.text) || (pointData === null || pointData === void 0 ? void 0 : pointData.pointEnumItemKey) ||
|
|
69
|
+
}, /*#__PURE__*/React.createElement("span", null, (_ref2 = (payload === null || payload === void 0 ? void 0 : (_payload$subTitle4 = payload.subTitle) === null || _payload$subTitle4 === void 0 ? void 0 : _payload$subTitle4.text) || (pointData === null || pointData === void 0 ? void 0 : pointData.pointEnumItemKey) || displayValue) !== null && _ref2 !== void 0 ? _ref2 : '副标题'));
|
|
68
70
|
};
|
|
69
71
|
var handleSwitchChange = function handleSwitchChange(val, e) {
|
|
70
72
|
var _payload$switch;
|
|
@@ -23,7 +23,8 @@ var PropsSet = function PropsSet() {
|
|
|
23
23
|
header: "\u7ED1\u5B9A\u70B9\u4F4D",
|
|
24
24
|
key: "1"
|
|
25
25
|
}, /*#__PURE__*/React.createElement(FormBindPoint, {
|
|
26
|
-
onChange: forceUpdate
|
|
26
|
+
onChange: forceUpdate,
|
|
27
|
+
enableDecimalConfig: true
|
|
27
28
|
})), /*#__PURE__*/React.createElement(Panel, {
|
|
28
29
|
header: "\u56FE\u6807",
|
|
29
30
|
key: "2"
|
package/es/element/type.d.ts
CHANGED
|
@@ -64,6 +64,9 @@ declare namespace Ele {
|
|
|
64
64
|
dataType?: string;
|
|
65
65
|
deviceType?: string;
|
|
66
66
|
meterId?: string;
|
|
67
|
+
decimalEnabled?: boolean;
|
|
68
|
+
decimalPlaces?: number;
|
|
69
|
+
decimalTrailingZeros?: boolean;
|
|
67
70
|
}
|
|
68
71
|
| {
|
|
69
72
|
// 单个产品(scene === 'product')或设备(scene === 'device')的时候绑定点位的数据结构
|
|
@@ -71,6 +74,9 @@ declare namespace Ele {
|
|
|
71
74
|
identifierName: string;
|
|
72
75
|
/** 范围表达式 */
|
|
73
76
|
expressions?: RangeExpression[];
|
|
77
|
+
decimalEnabled?: boolean;
|
|
78
|
+
decimalPlaces?: number;
|
|
79
|
+
decimalTrailingZeros?: boolean;
|
|
74
80
|
};
|
|
75
81
|
|
|
76
82
|
/** 文字样式 */
|
|
@@ -64,7 +64,7 @@ var Save = function Save(_ref) {
|
|
|
64
64
|
}, (_window$graph = window.graph) === null || _window$graph === void 0 ? void 0 : _window$graph.toJSON())),
|
|
65
65
|
configChangeLog: JSON.stringify(configChangePayload),
|
|
66
66
|
configHasChanged: configChangePayload.hasChanged,
|
|
67
|
-
operationUserId:
|
|
67
|
+
operationUserId: operatorUserId,
|
|
68
68
|
graphSnapshot: graphSnapshot
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -11,8 +11,7 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
|
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
/* eslint-disable */
|
|
13
13
|
import request from "../request";
|
|
14
|
-
|
|
15
|
-
/** 上传图片 POST /api/CommonMicro/Uploader/Upload */
|
|
14
|
+
/** 上传图片,使用 yimin 的 EnergyMicro 接口。 */
|
|
16
15
|
export function Upload(_x, _x2) {
|
|
17
16
|
return _Upload.apply(this, arguments);
|
|
18
17
|
}
|
|
@@ -29,7 +28,7 @@ function _Upload() {
|
|
|
29
28
|
formData.append(ele, item);
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
|
-
return _context.a(2, request('/api/
|
|
31
|
+
return _context.a(2, request('/api/EnergyMicro/upload', _objectSpread({
|
|
33
32
|
method: 'POST',
|
|
34
33
|
// headers: {
|
|
35
34
|
// 'Content-Type': 'multipart/form-data',
|
package/es/services/request.js
CHANGED
|
@@ -34,8 +34,8 @@ var codeMessage = {
|
|
|
34
34
|
|
|
35
35
|
/** 判断是否已显示登录过期 Modal ,防止同时多个请求,显示多个 Modal 的情况 */
|
|
36
36
|
var isShowLoginOverdueModal = false;
|
|
37
|
-
/**
|
|
38
|
-
* 异常处理程序
|
|
37
|
+
/**
|
|
38
|
+
* 异常处理程序
|
|
39
39
|
*/
|
|
40
40
|
var errorHandler = function errorHandler(error) {
|
|
41
41
|
var data = error.data,
|
|
@@ -216,7 +216,7 @@ requestClient.interceptors.request.use(function (url, options) {
|
|
|
216
216
|
/** 响应拦截器 */
|
|
217
217
|
requestClient.interceptors.response.use(/*#__PURE__*/function () {
|
|
218
218
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(response, options) {
|
|
219
|
-
var _response$headers, _response$headers2, xAccessToken, accessToken, data, _data$code, errorText;
|
|
219
|
+
var _response$headers, _response$headers2, _data$success, xAccessToken, accessToken, data, succeeded, _data$code, errorText;
|
|
220
220
|
return _regenerator().w(function (_context2) {
|
|
221
221
|
while (1) switch (_context2.n) {
|
|
222
222
|
case 0:
|
|
@@ -249,7 +249,8 @@ requestClient.interceptors.response.use(/*#__PURE__*/function () {
|
|
|
249
249
|
return response.clone().json();
|
|
250
250
|
case 4:
|
|
251
251
|
data = _context2.v;
|
|
252
|
-
|
|
252
|
+
succeeded = (_data$success = data.success) !== null && _data$success !== void 0 ? _data$success : data.code === 200;
|
|
253
|
+
if (!succeeded) {
|
|
253
254
|
if (Object.keys(codeMessage).includes((_data$code = data.code) === null || _data$code === void 0 ? void 0 : _data$code.toString())) {
|
|
254
255
|
errorText = codeMessage[data.code];
|
|
255
256
|
notification.error({
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { isNumber } from "./type";
|
|
2
|
+
/**
|
|
3
|
+
* 格式化数值型点位的展示文本。
|
|
4
|
+
* 只用于渲染,不应将结果用于表达式判断、状态计算或点位写入。
|
|
5
|
+
*/
|
|
6
|
+
export function formatPointDisplayValue(value, config) {
|
|
7
|
+
var _config$decimalPlaces;
|
|
8
|
+
if (typeof value !== 'number' || !(config === null || config === void 0 ? void 0 : config.decimalEnabled)) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
var decimalPlaces = Math.min(6, Math.max(0, Math.trunc((_config$decimalPlaces = config.decimalPlaces) !== null && _config$decimalPlaces !== void 0 ? _config$decimalPlaces : 2)));
|
|
12
|
+
var fixedValue = value.toFixed(decimalPlaces);
|
|
13
|
+
return config.decimalTrailingZeros === false ? String(Number(fixedValue)) : fixedValue;
|
|
14
|
+
}
|
|
2
15
|
|
|
3
16
|
/** 格式化点位数据 */
|
|
4
17
|
export function pointValueFormat(point) {
|