coolcare-lite-scada-component 4.1.0 → 4.1.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.
Files changed (96) hide show
  1. package/es/app.js +23 -0
  2. package/es/components/BoxShadowPicker/index.less.d.ts +9 -9
  3. package/es/components/ColorPicker/util.js +4 -4
  4. package/es/components/DialogHistory/index.css +22 -0
  5. package/es/components/DialogHistory/index.js +388 -79
  6. package/es/components/DialogImagePicker/GroupPanel/index.js +1 -12
  7. package/es/components/ECharts/index.js +31 -23
  8. package/es/components/FormBindPoint/FreedomScene.js +181 -11
  9. package/es/components/FormBindPoint/ProductionOrDeviceScene.js +12 -5
  10. package/es/components/FormBindPoint/index.js +6 -0
  11. package/es/components/Icon/index.js +1 -1
  12. package/es/components/IconFont/index.js +6 -0
  13. package/es/components/ImageUploader/index.js +8 -7
  14. package/es/components/ModalChangePointValue.js +272 -0
  15. package/es/components/ModalChoosePoint/index.js +53 -16
  16. package/es/components/PointSelect/DeviceIndicatorTable.js +111 -0
  17. package/es/components/PointSelect/IndicatorSelect.js +182 -0
  18. package/es/constant.js +2 -2
  19. package/es/element/BorderBox/util/typings.d.ts +9 -9
  20. package/es/element/Decoration/util/typings.d.ts +9 -9
  21. package/es/element/EleFan/Component.js +1 -1
  22. package/es/element/EleFanBySvg/index.js +3 -3
  23. package/es/element/EleImage/index.js +1 -1
  24. package/es/element/ElePointImage/Component.js +30 -41
  25. package/es/element/ElePointImage/index.js +1 -1
  26. package/es/element/ElePointValue/Component.js +117 -17
  27. package/es/element/ElePointValue/PropsSet/StatisticsPropsSet/index.js +6 -0
  28. package/es/element/ElePointValue/index.css +11 -0
  29. package/es/element/ElePointValue/index.js +6 -0
  30. package/es/element/EleShine/Component.js +133 -23
  31. package/es/element/EleShine/PropsSet/OtherPropsSet/index.js +27 -34
  32. package/es/element/EleShine/PropsSet/PointAlarmTool.js +99 -0
  33. package/es/element/EleShine/PropsSet/index.js +9 -1
  34. package/es/element/EleShine/index.js +2 -1
  35. package/es/element/EleState/index.js +1 -1
  36. package/es/element/EleSwitch/Component.js +2 -12
  37. package/es/element/PipeNodes/NodeBL/index.js +1 -1
  38. package/es/element/PipeNodes/NodeBR/index.js +1 -1
  39. package/es/element/PipeNodes/NodeBottom/index.js +1 -1
  40. package/es/element/PipeNodes/NodeCenter/index.js +1 -1
  41. package/es/element/PipeNodes/NodeHorizontal/index.js +1 -1
  42. package/es/element/PipeNodes/NodeLeft/index.js +1 -1
  43. package/es/element/PipeNodes/NodeRight/index.js +1 -1
  44. package/es/element/PipeNodes/NodeTL/index.js +1 -1
  45. package/es/element/PipeNodes/NodeTR/index.js +1 -1
  46. package/es/element/PipeNodes/NodeTop/index.js +1 -1
  47. package/es/element/PipeNodes/NodeVertical/index.js +1 -1
  48. package/es/element/PointCard/PointListCard/Component.js +3 -2
  49. package/es/element/PointCard/PointListCard/index.js +1 -0
  50. package/es/element/type.d.ts +4 -6
  51. package/es/element/utils/getValueByExpression.js +3 -0
  52. package/es/element/utils/handleEleEvent.js +11 -1
  53. package/es/element/utils/pointWrite.js +4 -5
  54. package/es/hooks/usePointWatch.js +1 -1
  55. package/es/models/useEditor.js +14 -8
  56. package/es/pages/display/Player/index.js +444 -123
  57. package/es/pages/display/index.js +2 -2
  58. package/es/pages/document.ejs +1 -1
  59. package/es/pages/editor/PanelLeft/BasicShapeList/listData.js +8 -8
  60. package/es/pages/editor/PanelLeft/BorderBoxEleList/index.less.d.ts +7 -7
  61. package/es/pages/editor/PanelLeft/DecorationEleList/index.less.d.ts +7 -7
  62. package/es/pages/editor/PanelLeft/GroupManageDialog/index.js +4 -4
  63. package/es/pages/editor/PanelLeft/ImgGroup/index.js +1 -12
  64. package/es/pages/editor/PanelLeft/MetaEleList/listData.js +14 -14
  65. package/es/pages/editor/PanelLeft/PipeEleList/listData.js +11 -11
  66. package/es/pages/editor/PanelLeft/PointCardEleList/listData.js +6 -6
  67. package/es/pages/editor/PanelLeft/RecommendEleList/listData.js +4 -4
  68. package/es/pages/editor/PanelLeft/index.js +3 -3
  69. package/es/pages/editor/PanelRight/components/FormLayer/index.js +3 -1
  70. package/es/pages/editor/PanelRight/index.less.d.ts +7 -7
  71. package/es/pages/editor/PanelTop/HotKeyDescribe/index.js +1 -1
  72. package/es/pages/editor/PanelTop/Save/index.js +120 -67
  73. package/es/pages/editor/index.js +223 -135
  74. package/es/pages/editor/utils/scadaChangeLog.js +237 -0
  75. package/es/services/common/Uploader.js +1 -1
  76. package/es/services/common/typings.d.ts +15 -15
  77. package/es/services/energy/index.js +56 -0
  78. package/es/services/gateway/Device.js +22 -0
  79. package/es/services/gateway/Point.js +46 -25
  80. package/es/services/gateway/typings.d.ts +3 -0
  81. package/es/services/master/typings.d.ts +362 -362
  82. package/es/services/product/typings.d.ts +1045 -1045
  83. package/es/services/project/typings.d.ts +1609 -1609
  84. package/es/services/request.js +126 -13
  85. package/es/shims.x6.d.ts +15 -15
  86. package/es/typings.d.ts +12 -0
  87. package/es/utils/auth.js +6 -2
  88. package/es/utils/cssStyle.js +4 -4
  89. package/es/utils/dataURItoBlob.js +25 -0
  90. package/es/utils/date.js +7 -0
  91. package/es/utils/decomposeMatrix.js +5 -5
  92. package/es/utils/events.js +3 -3
  93. package/es/utils/index.js +34 -34
  94. package/es/utils/pointValueFormat.js +3 -3
  95. package/package.json +16 -15
  96. package/es/elementCss.css +0 -19
@@ -22,12 +22,7 @@ import { useModel } from 'umi';
22
22
  import { EditDeviceConfiguration } from "../../../../services/gateway/Device";
23
23
  import { AddOrUpdateCompanyConfiguration } from "../../../../services/gateway/CompanyConfiguration";
24
24
  import { useQuery } from "../../../../hooks";
25
- // async function dataUrlToFile(dataUrl: string, fileName: string) {
26
- // const res = await fetch(dataUrl)
27
- // const blob = await res.blob()
28
- // return new File([blob], fileName, { type: 'image/jpeg' })
29
- // }
30
-
25
+ import { buildScadaConfigChangePayload, buildScadaConfigSnapshot, captureScadaScreenshot, getCurrentOperatorId, getScadaConfigSnapshotFromStorage, setScadaConfigSnapshotToStorage } from "../../utils/scadaChangeLog";
31
26
  var Save = function Save(_ref) {
32
27
  var className = _ref.className,
33
28
  iconClassName = _ref.iconClassName,
@@ -38,126 +33,184 @@ var Save = function Save(_ref) {
38
33
  setLoading = _useState2[1];
39
34
  var _useModel = useModel('useEditor', function (model) {
40
35
  return {
41
- pageConfig: model.pageConfig
36
+ pageConfig: model.pageConfig,
37
+ setInitialScadaConfigSnapshot: model.setInitialScadaConfigSnapshot
42
38
  };
43
39
  }),
44
- pageConfig = _useModel.pageConfig;
40
+ pageConfig = _useModel.pageConfig,
41
+ setInitialScadaConfigSnapshot = _useModel.setInitialScadaConfigSnapshot;
45
42
  var query = useQuery();
46
-
47
- /** 保存 */
48
- var handleSave = /*#__PURE__*/function () {
43
+ var buildSaveConfigPayload = /*#__PURE__*/function () {
49
44
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
50
- var _window, _window$opener, _window$graph, _window$graph2, _window$opener2, res, msg, _window$graph3, _res, _t, _t2;
45
+ var _window$graph;
46
+ var graph, graphSnapshot, previousSnapshot, operatorUserId, configChangePayload, _t, _t2, _t3;
51
47
  return _regenerator().w(function (_context) {
52
- while (1) switch (_context.p = _context.n) {
48
+ while (1) switch (_context.n) {
49
+ case 0:
50
+ graph = window.graph;
51
+ _t = buildScadaConfigSnapshot;
52
+ _t2 = pageConfig;
53
+ _t3 = graph;
54
+ _context.n = 1;
55
+ return captureScadaScreenshot(graph);
56
+ case 1:
57
+ graphSnapshot = _t(_t2, _t3, _context.v);
58
+ previousSnapshot = getScadaConfigSnapshotFromStorage(query);
59
+ operatorUserId = getCurrentOperatorId();
60
+ configChangePayload = buildScadaConfigChangePayload(previousSnapshot, graphSnapshot, operatorUserId, graphSnapshot.screenshot);
61
+ return _context.a(2, {
62
+ config: JSON.stringify(_objectSpread({
63
+ pageConfig: pageConfig
64
+ }, (_window$graph = window.graph) === null || _window$graph === void 0 ? void 0 : _window$graph.toJSON())),
65
+ configChangeLog: JSON.stringify(configChangePayload),
66
+ configHasChanged: configChangePayload.hasChanged,
67
+ operationUserId: operatorUserId,
68
+ graphSnapshot: graphSnapshot
69
+ });
70
+ }
71
+ }, _callee);
72
+ }));
73
+ return function buildSaveConfigPayload() {
74
+ return _ref2.apply(this, arguments);
75
+ };
76
+ }();
77
+ var handleSave = /*#__PURE__*/function () {
78
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
79
+ var _yield$buildSaveConfi, config, configChangeLog, configHasChanged, operationUserId, graphSnapshot, _window, _window$opener, payload, _window$opener2, res, msg, _payload, _res, _payload2, _t4, _t5;
80
+ return _regenerator().w(function (_context2) {
81
+ while (1) switch (_context2.p = _context2.n) {
53
82
  case 0:
83
+ _context2.n = 1;
84
+ return buildSaveConfigPayload();
85
+ case 1:
86
+ _yield$buildSaveConfi = _context2.v;
87
+ config = _yield$buildSaveConfi.config;
88
+ configChangeLog = _yield$buildSaveConfi.configChangeLog;
89
+ configHasChanged = _yield$buildSaveConfi.configHasChanged;
90
+ operationUserId = _yield$buildSaveConfi.operationUserId;
91
+ graphSnapshot = _yield$buildSaveConfi.graphSnapshot;
54
92
  if (query.scene === 'product') {
55
93
  (_window = window) === null || _window === void 0 ? void 0 : (_window$opener = _window.opener) === null || _window$opener === void 0 ? void 0 : _window$opener.postMessage({
56
94
  event: 'product-scada-config-change',
57
95
  payload: {
58
- data: JSON.stringify(_objectSpread({
59
- pageConfig: pageConfig
60
- }, (_window$graph = window.graph) === null || _window$graph === void 0 ? void 0 : _window$graph.toJSON())),
96
+ data: config,
61
97
  productId: Number(query.productId),
62
98
  productVersionId: query.productVersionId ? Number(query.productVersionId) : undefined,
63
- scadaType: Number(query.scadaType)
99
+ scadaType: Number(query.scadaType),
100
+ configHasChanged: configHasChanged,
101
+ configChangeLog: configChangeLog,
102
+ operationUserId: operationUserId
64
103
  }
65
104
  }, '*');
105
+ payload = JSON.stringify(graphSnapshot);
106
+ setInitialScadaConfigSnapshot(payload);
107
+ setScadaConfigSnapshotToStorage(query, graphSnapshot);
66
108
  notification.success({
67
- message: '保存成功',
68
- description: /*#__PURE__*/React.createElement("div", null, "\u7EC4\u6001\u4FDD\u5B58\u6210\u529F\uFF0C\u8BF7\u8FD4\u56DE\u4EA7\u54C1\u914D\u7F6E\u9875\u9762\xA0", /*#__PURE__*/React.createElement("strong", null, "\u4FDD\u5B58\u6216\u53D1\u5E03"), "\xA0\u4EA7\u54C1"),
109
+ message: 'Save success',
110
+ description: 'Save finished, ready for synchronize.',
69
111
  duration: 10,
70
112
  top: 100
71
113
  });
72
114
  }
73
115
  if (!(query.scene === 'device')) {
74
- _context.n = 6;
116
+ _context2.n = 7;
75
117
  break;
76
118
  }
77
- _context.p = 1;
119
+ _context2.p = 2;
78
120
  setLoading(true);
79
- _context.n = 2;
121
+ _context2.n = 3;
80
122
  return EditDeviceConfiguration({
81
123
  deviceId: Number(query.deviceId),
82
- config: JSON.stringify(_objectSpread({
83
- pageConfig: pageConfig
84
- }, (_window$graph2 = window.graph) === null || _window$graph2 === void 0 ? void 0 : _window$graph2.toJSON())),
124
+ config: config,
125
+ operationUserId: operationUserId,
126
+ configChangeLog: configChangeLog,
127
+ configHasChanged: configHasChanged,
85
128
  deviceConfigurationType: Number(query.scadaType)
86
129
  });
87
- case 2:
88
- res = _context.v;
130
+ case 3:
131
+ res = _context2.v;
89
132
  if (res.success) {
90
- _context.n = 3;
133
+ _context2.n = 4;
91
134
  break;
92
135
  }
93
- message.error('更新失败');
94
- return _context.a(2);
95
- case 3:
96
- message.success('更新成功');
136
+ message.error('Update failed');
137
+ return _context2.a(2);
138
+ case 4:
139
+ message.success('Update success');
97
140
  msg = {
98
141
  event: 'device-scada-config-change',
99
142
  payload: {
100
- deviceId: Number(query.deviceId)
143
+ deviceId: Number(query.deviceId),
144
+ operationUserId: operationUserId,
145
+ configHasChanged: configHasChanged,
146
+ configChangeLog: configChangeLog
101
147
  }
102
148
  };
149
+ _payload = JSON.stringify(graphSnapshot);
150
+ setInitialScadaConfigSnapshot(_payload);
151
+ setScadaConfigSnapshotToStorage(query, graphSnapshot);
103
152
  (_window$opener2 = window.opener) === null || _window$opener2 === void 0 ? void 0 : _window$opener2.postMessage(msg, '*');
104
- _context.n = 5;
153
+ _context2.n = 6;
105
154
  break;
106
- case 4:
107
- _context.p = 4;
108
- _t = _context.v;
109
- console.error(_t);
110
- message.error('更新失败');
111
155
  case 5:
112
- _context.p = 5;
113
- setLoading(false);
114
- return _context.f(5);
156
+ _context2.p = 5;
157
+ _t4 = _context2.v;
158
+ console.error(_t4);
159
+ message.error('Update failed');
115
160
  case 6:
161
+ _context2.p = 6;
162
+ setLoading(false);
163
+ return _context2.f(6);
164
+ case 7:
116
165
  if (!(query.scene === 'freedom')) {
117
- _context.n = 12;
166
+ _context2.n = 13;
118
167
  break;
119
168
  }
120
169
  setLoading(true);
121
- _context.p = 7;
122
- _context.n = 8;
170
+ _context2.p = 8;
171
+ _context2.n = 9;
123
172
  return AddOrUpdateCompanyConfiguration({
124
173
  companyId: Number(query.companyId),
125
174
  companyConfigurationId: Number(query.scadaId),
126
175
  remark: pageConfig.remark,
127
176
  imgUrl: 'scada has config',
128
177
  configurationName: pageConfig.title,
129
- config: JSON.stringify(_objectSpread({
130
- pageConfig: pageConfig
131
- }, (_window$graph3 = window.graph) === null || _window$graph3 === void 0 ? void 0 : _window$graph3.toJSON()))
178
+ config: config,
179
+ operationUserId: operationUserId,
180
+ configChangeLog: configChangeLog,
181
+ configHasChanged: configHasChanged
132
182
  });
133
- case 8:
134
- _res = _context.v;
183
+ case 9:
184
+ _res = _context2.v;
135
185
  if (_res.success) {
136
- _context.n = 9;
186
+ _context2.n = 10;
137
187
  break;
138
188
  }
139
- message.error('更新失败');
140
- return _context.a(2);
141
- case 9:
142
- message.success('更新成功');
143
- _context.n = 11;
144
- break;
189
+ message.error('Update failed');
190
+ return _context2.a(2);
145
191
  case 10:
146
- _context.p = 10;
147
- _t2 = _context.v;
148
- console.error(_t2);
149
- message.error('更新失败');
192
+ message.success('Update success');
193
+ _payload2 = JSON.stringify(graphSnapshot);
194
+ setInitialScadaConfigSnapshot(_payload2);
195
+ setScadaConfigSnapshotToStorage(query, graphSnapshot);
196
+ _context2.n = 12;
197
+ break;
150
198
  case 11:
151
- _context.p = 11;
152
- setLoading(false);
153
- return _context.f(11);
199
+ _context2.p = 11;
200
+ _t5 = _context2.v;
201
+ console.error(_t5);
202
+ message.error('Update failed');
154
203
  case 12:
155
- return _context.a(2);
204
+ _context2.p = 12;
205
+ setLoading(false);
206
+ return _context2.f(12);
207
+ case 13:
208
+ return _context2.a(2);
156
209
  }
157
- }, _callee, null, [[7, 10, 11, 12], [1, 4, 5, 6]]);
210
+ }, _callee2, null, [[8, 11, 12, 13], [2, 5, 6, 7]]);
158
211
  }));
159
212
  return function handleSave() {
160
- return _ref2.apply(this, arguments);
213
+ return _ref3.apply(this, arguments);
161
214
  };
162
215
  }();
163
216
  return /*#__PURE__*/React.createElement(Tooltip, {