coolcare-lite-scada-component 1.0.73 → 1.0.74

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.
@@ -0,0 +1,6 @@
1
+ import { createFromIconfontCN } from '@ant-design/icons';
2
+ var IconFont = createFromIconfontCN({
3
+ // scriptUrl: '//at.alicdn.com/t/c/font_3235821_qypojfizzen.js',
4
+ scriptUrl: 'https://coolcare-lite-assets.oss-cn-shanghai.aliyuncs.com/pc-common/iconfont/iconfont.js'
5
+ });
6
+ export default IconFont;
@@ -0,0 +1,273 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, catch: function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
4
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
5
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
6
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
11
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
12
+ import React from "react";
13
+ import { Modal, Form, InputNumber, message, Space, Button, Switch, Select } from 'antd';
14
+ import { CommonMqttWritePointData, ModbusMqttWritePointData } from "../services/gateway/Point";
15
+ import { useState, useEffect } from 'react';
16
+ var Option = Select.Option;
17
+ var layout = {
18
+ labelCol: {
19
+ span: 0
20
+ },
21
+ wrapperCol: {
22
+ span: 24
23
+ }
24
+ };
25
+ var tailLayout = {
26
+ wrapperCol: {
27
+ offset: 2,
28
+ span: 22
29
+ }
30
+ };
31
+ var ModalChangePointValue = function ModalChangePointValue(_ref) {
32
+ var _ref$protocol = _ref.protocol,
33
+ protocol = _ref$protocol === void 0 ? 0 : _ref$protocol,
34
+ pointValue = _ref.pointValue,
35
+ _ref$pointIdList = _ref.pointIdList,
36
+ pointIdList = _ref$pointIdList === void 0 ? [] : _ref$pointIdList,
37
+ _ref$pointEnumItemLis = _ref.pointEnumItemList,
38
+ pointEnumItemList = _ref$pointEnumItemLis === void 0 ? [] : _ref$pointEnumItemLis,
39
+ visible = _ref.visible,
40
+ onSubmit = _ref.onSubmit,
41
+ onCancel = _ref.onCancel;
42
+ var _Form$useForm = Form.useForm(),
43
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
44
+ form = _Form$useForm2[0];
45
+ /** 点位写入弹框 */
46
+ var _useState = useState(false),
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ loading = _useState2[0],
49
+ setLoading = _useState2[1];
50
+ /** 点位类型 1:数值类型 */
51
+ var _useState3 = useState(1),
52
+ _useState4 = _slicedToArray(_useState3, 2),
53
+ pointEnumId = _useState4[0],
54
+ setPointEnumId = _useState4[1];
55
+ /** 枚举类型选择方式是否为开关 */
56
+ var _useState5 = useState(false),
57
+ _useState6 = _slicedToArray(_useState5, 2),
58
+ isSwitch = _useState6[0],
59
+ setIsSwitch = _useState6[1];
60
+ var closeModal = function closeModal() {
61
+ setPointEnumId(1);
62
+ setIsSwitch(false);
63
+ form.resetFields();
64
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
65
+ };
66
+ useEffect(function () {
67
+ if (visible && form) {
68
+ var switchFlag = false;
69
+ if (pointEnumItemList.length) {
70
+ var _pointEnumItemList$;
71
+ // 如果点位是枚举类型,并且为0:关,1:开,表单交互为开关
72
+ switchFlag = Boolean(pointEnumItemList[0].pointEnumId !== 1 && (pointEnumItemList[0].pointEnumItemKey === '开' && pointEnumItemList[0].pointEnumItemValue === 1 || pointEnumItemList[0].pointEnumItemKey === '关' && pointEnumItemList[0].pointEnumItemValue === 0));
73
+ setIsSwitch(switchFlag);
74
+
75
+ // 设置点位枚举id
76
+ setPointEnumId((pointEnumItemList === null || pointEnumItemList === void 0 ? void 0 : (_pointEnumItemList$ = pointEnumItemList[0]) === null || _pointEnumItemList$ === void 0 ? void 0 : _pointEnumItemList$.pointEnumId) || 1);
77
+ }
78
+ // 设置初始值
79
+ if (typeof pointValue === 'number') {
80
+ var _pointEnumItemList$2;
81
+ if ((pointEnumItemList === null || pointEnumItemList === void 0 ? void 0 : (_pointEnumItemList$2 = pointEnumItemList[0]) === null || _pointEnumItemList$2 === void 0 ? void 0 : _pointEnumItemList$2.pointEnumId) === 1) {
82
+ form.setFieldsValue({
83
+ value1: pointValue
84
+ });
85
+ } else if (switchFlag) {
86
+ form.setFieldsValue({
87
+ value2: Boolean(pointValue)
88
+ });
89
+ } else {
90
+ form.setFieldsValue({
91
+ value3: pointValue
92
+ });
93
+ }
94
+ }
95
+ }
96
+ }, [pointEnumItemList, visible, form, pointValue]);
97
+
98
+ /** 提交表单且数据验证成功后回调事件 */
99
+ var onFinish = /*#__PURE__*/function () {
100
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
101
+ var value1, value2, value3, data, value, res, _res$data, _res$data2, _res, _res$data3, _res$data4;
102
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
103
+ while (1) switch (_context.prev = _context.next) {
104
+ case 0:
105
+ value1 = values.value1, value2 = values.value2, value3 = values.value3;
106
+ data = {};
107
+ if (pointEnumId === 1) {
108
+ value = value1;
109
+ } else if (isSwitch) {
110
+ value = value2 ? 1 : 0;
111
+ } else {
112
+ value = value3;
113
+ }
114
+ if (!(typeof value !== 'number')) {
115
+ _context.next = 6;
116
+ break;
117
+ }
118
+ message.error('写入数据只能为数值类型');
119
+ return _context.abrupt("return");
120
+ case 6:
121
+ pointIdList.forEach(function (item) {
122
+ data[item] = value;
123
+ });
124
+ setLoading(true);
125
+ _context.prev = 8;
126
+ if (!(protocol === 0)) {
127
+ _context.next = 17;
128
+ break;
129
+ }
130
+ _context.next = 12;
131
+ return ModbusMqttWritePointData(data);
132
+ case 12:
133
+ res = _context.sent;
134
+ if (res.success) {
135
+ if ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.key) {
136
+ message.info((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.key);
137
+ } else {
138
+ message.success(res.data);
139
+ }
140
+ message.success('写入成功,请等待下轮数据刷新');
141
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(Number(value));
142
+ closeModal();
143
+ } else {
144
+ message.error(res.message);
145
+ }
146
+ setLoading(false);
147
+ _context.next = 26;
148
+ break;
149
+ case 17:
150
+ if (!(protocol === 1)) {
151
+ _context.next = 25;
152
+ break;
153
+ }
154
+ _context.next = 20;
155
+ return CommonMqttWritePointData(data);
156
+ case 20:
157
+ _res = _context.sent;
158
+ if (_res.success) {
159
+ if ((_res$data3 = _res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.key) {
160
+ message.info((_res$data4 = _res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.key);
161
+ } else {
162
+ message.success(_res.data);
163
+ }
164
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(Number(value));
165
+ message.success('写入成功,请等待下轮数据刷新');
166
+ closeModal();
167
+ } else {
168
+ message.error(_res.message);
169
+ }
170
+ setLoading(false);
171
+ _context.next = 26;
172
+ break;
173
+ case 25:
174
+ message.info('暂不支持该协议网关的写入');
175
+ case 26:
176
+ _context.next = 32;
177
+ break;
178
+ case 28:
179
+ _context.prev = 28;
180
+ _context.t0 = _context["catch"](8);
181
+ message.error('写入数据失败');
182
+ setLoading(false);
183
+ case 32:
184
+ case "end":
185
+ return _context.stop();
186
+ }
187
+ }, _callee, null, [[8, 28]]);
188
+ }));
189
+ return function onFinish(_x) {
190
+ return _ref2.apply(this, arguments);
191
+ };
192
+ }();
193
+ return /*#__PURE__*/React.createElement(Modal, {
194
+ title: "\u5199\u5165\u6570\u636E",
195
+ visible: visible,
196
+ closable: false,
197
+ width: 330,
198
+ maskClosable: true,
199
+ footer: null,
200
+ onCancel: closeModal,
201
+ afterClose: closeModal,
202
+ wrapClassName: 'form-modal'
203
+ }, /*#__PURE__*/React.createElement(Form, _extends({}, layout, {
204
+ form: form,
205
+ name: "form",
206
+ onFinish: onFinish,
207
+ initialValues: {
208
+ value1: undefined,
209
+ value2: false,
210
+ value3: undefined
211
+ }
212
+ }), pointEnumId === 1 ? /*#__PURE__*/React.createElement(Form.Item, {
213
+ name: "value1",
214
+ rules: [{
215
+ required: true,
216
+ message: '请输入'
217
+ }]
218
+ }, /*#__PURE__*/React.createElement(InputNumber, {
219
+ placeholder: "\u8BF7\u8F93\u5165\u8981\u5199\u5165\u7684\u503C",
220
+ disabled: loading,
221
+ style: {
222
+ width: '100%'
223
+ }
224
+ })) : isSwitch ? /*#__PURE__*/React.createElement(Form.Item, {
225
+ name: "value2",
226
+ valuePropName: "checked",
227
+ rules: [{
228
+ required: true,
229
+ message: '请选择'
230
+ }]
231
+ }, /*#__PURE__*/React.createElement(Switch, {
232
+ checkedChildren: "\u5F00",
233
+ unCheckedChildren: "\u5173"
234
+ })) : /*#__PURE__*/React.createElement(Form.Item, {
235
+ name: "value3",
236
+ rules: [{
237
+ required: true,
238
+ message: '请选择'
239
+ }]
240
+ }, /*#__PURE__*/React.createElement(Select, {
241
+ style: {
242
+ width: '100%'
243
+ },
244
+ placeholder: '请选择'
245
+ }, pointEnumItemList === null || pointEnumItemList === void 0 ? void 0 : pointEnumItemList.map(function (item) {
246
+ return /*#__PURE__*/React.createElement(Option, {
247
+ value: item.pointEnumItemValue,
248
+ key: item.pointEnumItemValue
249
+ }, item.pointEnumItemKey);
250
+ }))), /*#__PURE__*/React.createElement(Form.Item, _extends({}, tailLayout, {
251
+ noStyle: true,
252
+ className: "modelFooterItem"
253
+ }), /*#__PURE__*/React.createElement("div", {
254
+ className: "form-modal-footer"
255
+ }, /*#__PURE__*/React.createElement(Space, {
256
+ align: "center",
257
+ size: 15
258
+ }, /*#__PURE__*/React.createElement(Button, {
259
+ onClick: onCancel,
260
+ htmlType: "button",
261
+ style: {
262
+ float: 'right'
263
+ }
264
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
265
+ loading: loading,
266
+ type: "primary",
267
+ htmlType: "submit",
268
+ style: {
269
+ float: 'right'
270
+ }
271
+ }, "\u786E\u5B9A"))))));
272
+ };
273
+ export default ModalChangePointValue;
@@ -1,4 +1,7 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, catch: function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
2
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
7
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -11,13 +14,16 @@ import { getValueByExpression } from "../utils";
11
14
  import { reactShapeNodeAreEqual } from "../utils";
12
15
  import { usePointWatch, useEleEventHandle } from "../../hooks";
13
16
  import styles from "./index.css";
17
+ import IconFont from "../../components/IconFont";
18
+ import { useRequest } from 'ahooks';
19
+ import { GetDeviceInfo } from "../../services/gateway/Device";
14
20
  var directionClassNameMap = {
15
21
  top: 'flex-col',
16
22
  left: 'flex-row',
17
23
  bottom: 'flex-col-reverse'
18
24
  };
19
25
  var ElePointValueComponent = function ElePointValueComponent(_ref) {
20
- var _payload$pointList, _payload$label, _payload$unit, _payload$unit2, _payload$value, _payload$value2, _payload$mittMeta$nam, _payload$mittMeta, _payload$mittMeta2, _payload$label2, _payload$unit3, _pointData10;
26
+ var _payload$pointList, _payload$label, _payload$unit, _payload$unit2, _payload$value, _payload$value2, _payload$mittMeta$nam, _payload$mittMeta, _payload$mittMeta2, _pointData12, _pointData13, _pointData14, _pointData15, _pointData16, _payload$mittMeta$nam2, _payload$mittMeta3, _payload$label2, _payload$unit3, _pointData17, _pointData18;
21
27
  var node = _ref.node;
22
28
  var payload = node === null || node === void 0 ? void 0 : node.getData();
23
29
  var configPoint = payload === null || payload === void 0 ? void 0 : (_payload$pointList = payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[0];
@@ -84,6 +90,59 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
84
90
  pointValue = ((_pointData1 = pointData) === null || _pointData1 === void 0 ? void 0 : _pointData1.pointEnumItemKey) || value;
85
91
  }
86
92
  var numberColor = getValueByExpression(value, payload === null || payload === void 0 ? void 0 : payload.colorExpressions);
93
+ var _useRequest = useRequest(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
94
+ var _pointData10, _pointData11;
95
+ var _yield$GetDeviceInfo, success, data;
96
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
97
+ while (1) switch (_context.prev = _context.next) {
98
+ case 0:
99
+ if ((_pointData10 = pointData) === null || _pointData10 === void 0 ? void 0 : _pointData10.deviceId) {
100
+ _context.next = 2;
101
+ break;
102
+ }
103
+ return _context.abrupt("return");
104
+ case 2:
105
+ _context.next = 4;
106
+ return GetDeviceInfo({
107
+ deviceId: (_pointData11 = pointData) === null || _pointData11 === void 0 ? void 0 : _pointData11.deviceId
108
+ });
109
+ case 4:
110
+ _yield$GetDeviceInfo = _context.sent;
111
+ success = _yield$GetDeviceInfo.success;
112
+ data = _yield$GetDeviceInfo.data;
113
+ if (success) {
114
+ _context.next = 9;
115
+ break;
116
+ }
117
+ return _context.abrupt("return");
118
+ case 9:
119
+ return _context.abrupt("return", data);
120
+ case 10:
121
+ case "end":
122
+ return _context.stop();
123
+ }
124
+ }, _callee);
125
+ })), {
126
+ cacheKey: "device-info-".concat((_pointData12 = pointData) === null || _pointData12 === void 0 ? void 0 : _pointData12.deviceId),
127
+ onError: function onError(err) {
128
+ console.error(err);
129
+ },
130
+ refreshDeps: [(_pointData13 = pointData) === null || _pointData13 === void 0 ? void 0 : _pointData13.deviceId],
131
+ pollingInterval: 10 * 60 * 1000
132
+ }),
133
+ deviceInfo = _useRequest.data;
134
+ var eventHandles2 = useEleEventHandle({
135
+ events: payload === null || payload === void 0 ? void 0 : payload.events2,
136
+ payload: {
137
+ points: [{
138
+ pointIdList: [(_pointData14 = pointData) === null || _pointData14 === void 0 ? void 0 : _pointData14.pointId],
139
+ protocol: deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.protocol,
140
+ pointEnumItemList: (_pointData15 = pointData) === null || _pointData15 === void 0 ? void 0 : _pointData15.pointEnumItemList,
141
+ pointValue: (_pointData16 = pointData) === null || _pointData16 === void 0 ? void 0 : _pointData16.value
142
+ }],
143
+ namespace: (_payload$mittMeta$nam2 = payload === null || payload === void 0 ? void 0 : (_payload$mittMeta3 = payload.mittMeta) === null || _payload$mittMeta3 === void 0 ? void 0 : _payload$mittMeta3.namespace) !== null && _payload$mittMeta$nam2 !== void 0 ? _payload$mittMeta$nam2 : 0
144
+ }
145
+ });
87
146
  return /*#__PURE__*/React.createElement("div", {
88
147
  onClick: function onClick(e) {
89
148
  if ((payload === null || payload === void 0 ? void 0 : payload.pointList.length) && (payload === null || payload === void 0 ? void 0 : payload.pointList[0].deviceType) === 'virtual') {
@@ -117,6 +176,17 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
117
176
  }, pointValue === null ? '-' : pointValue), (payload === null || payload === void 0 ? void 0 : (_payload$unit3 = payload.unit) === null || _payload$unit3 === void 0 ? void 0 : _payload$unit3.isShow) ? /*#__PURE__*/React.createElement("span", {
118
177
  style: unitStyle,
119
178
  className: styles.unit
120
- }, (payload === null || payload === void 0 ? void 0 : payload.unit.text) || ((_pointData10 = pointData) === null || _pointData10 === void 0 ? void 0 : _pointData10.unit)) : null)));
179
+ }, (payload === null || payload === void 0 ? void 0 : payload.unit.text) || ((_pointData17 = pointData) === null || _pointData17 === void 0 ? void 0 : _pointData17.unit)) : null)), ((_pointData18 = pointData) === null || _pointData18 === void 0 ? void 0 : _pointData18.isWrite) ? /*#__PURE__*/React.createElement("div", {
180
+ className: styles.write,
181
+ onClick: function onClick(e) {
182
+ e.stopPropagation();
183
+ eventHandles2.current.onClick(e);
184
+ }
185
+ }, /*#__PURE__*/React.createElement(IconFont, {
186
+ type: 'icon-edit_active',
187
+ style: {
188
+ fontSize: '18px'
189
+ }
190
+ })) : undefined);
121
191
  };
122
192
  export default /*#__PURE__*/memo(ElePointValueComponent, reactShapeNodeAreEqual);
@@ -1,4 +1,5 @@
1
1
  .wrap {
2
+ position: relative;
2
3
  display: flex;
3
4
  flex-direction: column;
4
5
  justify-content: space-between;
@@ -15,6 +16,16 @@
15
16
  white-space: nowrap;
16
17
  cursor: pointer;
17
18
  }
19
+ .write {
20
+ position: absolute;
21
+ top: 4px;
22
+ right: -16px;
23
+ display: none;
24
+ cursor: pointer;
25
+ }
26
+ .wrap:hover .write {
27
+ display: block;
28
+ }
18
29
  .unit {
19
30
  margin-left: 4px;
20
31
  font-size: 0.5em;
@@ -50,6 +50,10 @@ export var defaultConfig = {
50
50
  events: [{
51
51
  type: 'click',
52
52
  action: 'show-point-history'
53
+ }],
54
+ events2: [{
55
+ type: 'click',
56
+ action: 'show-point-write'
53
57
  }]
54
58
  },
55
59
  component: registerComponentName
@@ -53,6 +53,16 @@ export default function handleEleEvent() {
53
53
  return isString(v.identifierName);
54
54
  }));
55
55
  return;
56
+ // 点位写入2
57
+ case 'show-point-write':
58
+ if (!Array.isArray(payload.points)) {
59
+ return;
60
+ }
61
+ if (!payload.points.length) {
62
+ return;
63
+ }
64
+ emitter.emit("show-point-write-".concat(payload.namespace), payload.points);
65
+ return;
56
66
  case 'freedom-scene-switch':
57
67
  emitter.emit("freedom-scene-switch-".concat(payload.namespace), event.value ? Number(event.value) : undefined);
58
68
  return;
@@ -33,6 +33,7 @@ import "./index.css";
33
33
  import { GetTdIndicatorAggregateData } from "../../../services/gateway/Point";
34
34
  import dayjs from 'dayjs';
35
35
  import { GetEnergyByMeterList } from "../../../services/energy";
36
+ import ModalChangePointValue from "../../../components/ModalChangePointValue";
36
37
  var Player = function Player(_ref) {
37
38
  var _jsonConfig$pageConfi;
38
39
  var jsonConfig = _ref.jsonConfig,
@@ -53,22 +54,30 @@ var Player = function Player(_ref) {
53
54
  _useState6 = _slicedToArray(_useState5, 2),
54
55
  visibleDialogPointWrite = _useState6[0],
55
56
  setVisibleDialogPointWrite = _useState6[1];
56
- var _useState7 = useState([]),
57
+ var _useState7 = useState(false),
57
58
  _useState8 = _slicedToArray(_useState7, 2),
58
- activePointIds = _useState8[0],
59
- setActivePointIds = _useState8[1];
59
+ visibleModalChangePointValue = _useState8[0],
60
+ setVisibleModalChangePointValue = _useState8[1];
60
61
  var _useState9 = useState([]),
61
62
  _useState0 = _slicedToArray(_useState9, 2),
62
- activeIndicatorNos = _useState0[0],
63
- setActiveIndicatorNos = _useState0[1];
63
+ activePointIds = _useState0[0],
64
+ setActivePointIds = _useState0[1];
64
65
  var _useState1 = useState([]),
65
66
  _useState10 = _slicedToArray(_useState1, 2),
66
- activePoints = _useState10[0],
67
- setActivePoints = _useState10[1];
68
- var _useState11 = useState(),
67
+ activeIndicatorNos = _useState10[0],
68
+ setActiveIndicatorNos = _useState10[1];
69
+ var _useState11 = useState({}),
69
70
  _useState12 = _slicedToArray(_useState11, 2),
70
- activeDeviceId = _useState12[0],
71
- setActiveDeviceId = _useState12[1];
71
+ changePointValueProps = _useState12[0],
72
+ setChangePointValueProps = _useState12[1];
73
+ var _useState13 = useState([]),
74
+ _useState14 = _slicedToArray(_useState13, 2),
75
+ activePoints = _useState14[0],
76
+ setActivePoints = _useState14[1];
77
+ var _useState15 = useState(),
78
+ _useState16 = _slicedToArray(_useState15, 2),
79
+ activeDeviceId = _useState16[0],
80
+ setActiveDeviceId = _useState16[1];
72
81
  var wrapSize = useSize(wrapRef);
73
82
  var mittMeta = useMemo(function () {
74
83
  return getMittMeta(query);
@@ -266,32 +275,67 @@ var Player = function Player(_ref) {
266
275
  };
267
276
  }, [query, mittMeta]);
268
277
 
269
- // 监听显示风机设备点位弹窗事件
278
+ // 监听显示点位写入弹窗事件2
270
279
  useEffect(function () {
271
280
  var handler = /*#__PURE__*/function () {
272
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
273
- var deviceId, id;
281
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(points) {
274
282
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
275
283
  while (1) switch (_context3.prev = _context3.next) {
276
284
  case 0:
277
- deviceId = _ref4.deviceId;
278
285
  if (!(query.scene === 'product')) {
279
- _context3.next = 3;
286
+ _context3.next = 2;
280
287
  break;
281
288
  }
282
289
  return _context3.abrupt("return");
290
+ case 2:
291
+ setVisibleModalChangePointValue(true);
292
+ setChangePointValueProps(function () {
293
+ debugger;
294
+ return points[0];
295
+ });
296
+ case 4:
297
+ case "end":
298
+ return _context3.stop();
299
+ }
300
+ }, _callee3);
301
+ }));
302
+ return function handler(_x3) {
303
+ return _ref4.apply(this, arguments);
304
+ };
305
+ }();
306
+ var eventName = "show-point-write-".concat(mittMeta.namespace);
307
+ emitter.on(eventName, handler);
308
+ return function () {
309
+ emitter.off(eventName, handler);
310
+ };
311
+ }, [query, mittMeta]);
312
+
313
+ // 监听显示风机设备点位弹窗事件
314
+ useEffect(function () {
315
+ var handler = /*#__PURE__*/function () {
316
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
317
+ var deviceId, id;
318
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
319
+ while (1) switch (_context4.prev = _context4.next) {
320
+ case 0:
321
+ deviceId = _ref5.deviceId;
322
+ if (!(query.scene === 'product')) {
323
+ _context4.next = 3;
324
+ break;
325
+ }
326
+ return _context4.abrupt("return");
283
327
  case 3:
284
328
  id = query.scene === 'device' ? Number(query.deviceId) : deviceId;
285
329
  setActiveDeviceId(id);
286
330
  setVisibleModalFanDevicePoint(true);
287
331
  case 6:
288
332
  case "end":
289
- return _context3.stop();
333
+ return _context4.stop();
290
334
  }
291
- }, _callee3);
335
+ }, _callee4);
292
336
  }));
293
- return function handler(_x3) {
294
- return _ref5.apply(this, arguments);
337
+ return function handler(_x4) {
338
+ return _ref6.apply(this, arguments);
295
339
  };
296
340
  }();
297
341
  var eventName = "show-fan-device-point-modal-".concat(mittMeta.namespace);
@@ -304,9 +348,9 @@ var Player = function Player(_ref) {
304
348
  // 监听场景组态切换事件
305
349
  useEffect(function () {
306
350
  var handler = /*#__PURE__*/function () {
307
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(scadaId) {
308
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
309
- while (1) switch (_context4.prev = _context4.next) {
351
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(scadaId) {
352
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
353
+ while (1) switch (_context5.prev = _context5.next) {
310
354
  case 0:
311
355
  onEvent === null || onEvent === void 0 ? void 0 : onEvent({
312
356
  event: 'freedom-scene-switch',
@@ -322,12 +366,12 @@ var Player = function Player(_ref) {
322
366
  });
323
367
  case 2:
324
368
  case "end":
325
- return _context4.stop();
369
+ return _context5.stop();
326
370
  }
327
- }, _callee4);
371
+ }, _callee5);
328
372
  }));
329
- return function handler(_x4) {
330
- return _ref6.apply(this, arguments);
373
+ return function handler(_x5) {
374
+ return _ref7.apply(this, arguments);
331
375
  };
332
376
  }();
333
377
  var mittMeta = getMittMeta(query);
@@ -395,23 +439,23 @@ var Player = function Player(_ref) {
395
439
  // scene === 'device' 加载设备点位数据
396
440
  useEffect(function () {
397
441
  var fetchDevicePoints = /*#__PURE__*/function () {
398
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(deviceId) {
442
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(deviceId) {
399
443
  var res, pointList;
400
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
401
- while (1) switch (_context5.prev = _context5.next) {
444
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
445
+ while (1) switch (_context6.prev = _context6.next) {
402
446
  case 0:
403
- _context5.next = 2;
447
+ _context6.next = 2;
404
448
  return GetDevicePoint({
405
449
  deviceIdList: [deviceId]
406
450
  }, []);
407
451
  case 2:
408
- res = _context5.sent;
452
+ res = _context6.sent;
409
453
  if (res.success) {
410
- _context5.next = 6;
454
+ _context6.next = 6;
411
455
  break;
412
456
  }
413
457
  message.error('设备点位数据获取失败');
414
- return _context5.abrupt("return");
458
+ return _context6.abrupt("return");
415
459
  case 6:
416
460
  pointList = res.data || [];
417
461
  pointList.forEach(function (v) {
@@ -420,12 +464,12 @@ var Player = function Player(_ref) {
420
464
  });
421
465
  case 8:
422
466
  case "end":
423
- return _context5.stop();
467
+ return _context6.stop();
424
468
  }
425
- }, _callee5);
469
+ }, _callee6);
426
470
  }));
427
- return function fetchDevicePoints(_x5) {
428
- return _ref7.apply(this, arguments);
471
+ return function fetchDevicePoints(_x6) {
472
+ return _ref8.apply(this, arguments);
429
473
  };
430
474
  }();
431
475
  var timer;
@@ -445,23 +489,23 @@ var Player = function Player(_ref) {
445
489
  // scene === 'freedom' 加载设备点位数据
446
490
  useEffect(function () {
447
491
  var fetchDevicePoints = /*#__PURE__*/function () {
448
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(ids) {
492
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids) {
449
493
  var res, pointList;
450
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
451
- while (1) switch (_context6.prev = _context6.next) {
494
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
495
+ while (1) switch (_context7.prev = _context7.next) {
452
496
  case 0:
453
- _context6.next = 2;
497
+ _context7.next = 2;
454
498
  return GetDevicePoint({
455
499
  pointIdList: ids
456
500
  }, []);
457
501
  case 2:
458
- res = _context6.sent;
502
+ res = _context7.sent;
459
503
  if (res.success) {
460
- _context6.next = 6;
504
+ _context7.next = 6;
461
505
  break;
462
506
  }
463
507
  message.error('设备点位数据获取失败');
464
- return _context6.abrupt("return");
508
+ return _context7.abrupt("return");
465
509
  case 6:
466
510
  pointList = res.data || [];
467
511
  pointList.forEach(function (v) {
@@ -469,33 +513,33 @@ var Player = function Player(_ref) {
469
513
  });
470
514
  case 8:
471
515
  case "end":
472
- return _context6.stop();
516
+ return _context7.stop();
473
517
  }
474
- }, _callee6);
518
+ }, _callee7);
475
519
  }));
476
- return function fetchDevicePoints(_x6) {
477
- return _ref8.apply(this, arguments);
520
+ return function fetchDevicePoints(_x7) {
521
+ return _ref9.apply(this, arguments);
478
522
  };
479
523
  }();
480
524
  var fetchDeviceIndicator = /*#__PURE__*/function () {
481
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids) {
525
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids) {
482
526
  var res, pointList;
483
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
484
- while (1) switch (_context7.prev = _context7.next) {
527
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
528
+ while (1) switch (_context8.prev = _context8.next) {
485
529
  case 0:
486
- _context7.next = 2;
530
+ _context8.next = 2;
487
531
  return GetDeviceIndicator({
488
532
  indicatorNoList: ids,
489
533
  isGetIndicatorData: true
490
534
  }, []);
491
535
  case 2:
492
- res = _context7.sent;
536
+ res = _context8.sent;
493
537
  if (res.success) {
494
- _context7.next = 6;
538
+ _context8.next = 6;
495
539
  break;
496
540
  }
497
541
  message.error('设备点位数据获取失败');
498
- return _context7.abrupt("return");
542
+ return _context8.abrupt("return");
499
543
  case 6:
500
544
  pointList = res.data || [];
501
545
  pointList.forEach(function (v) {
@@ -503,21 +547,21 @@ var Player = function Player(_ref) {
503
547
  });
504
548
  case 8:
505
549
  case "end":
506
- return _context7.stop();
550
+ return _context8.stop();
507
551
  }
508
- }, _callee7);
552
+ }, _callee8);
509
553
  }));
510
- return function fetchDeviceIndicator(_x7) {
511
- return _ref9.apply(this, arguments);
554
+ return function fetchDeviceIndicator(_x8) {
555
+ return _ref0.apply(this, arguments);
512
556
  };
513
557
  }();
514
558
  var fetchDeviceSpecialPoint = /*#__PURE__*/function () {
515
- var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids, dateType) {
559
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(ids, dateType) {
516
560
  var res, pointList;
517
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
518
- while (1) switch (_context8.prev = _context8.next) {
561
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
562
+ while (1) switch (_context9.prev = _context9.next) {
519
563
  case 0:
520
- _context8.next = 2;
564
+ _context9.next = 2;
521
565
  return GetTdIndicatorAggregateData(ids.map(function (v) {
522
566
  var productNo = {
523
567
  emqktt: 'energy',
@@ -535,13 +579,13 @@ var Player = function Player(_ref) {
535
579
  };
536
580
  }));
537
581
  case 2:
538
- res = _context8.sent;
582
+ res = _context9.sent;
539
583
  if (res.success) {
540
- _context8.next = 6;
584
+ _context9.next = 6;
541
585
  break;
542
586
  }
543
587
  message.error('设备点位数据获取失败');
544
- return _context8.abrupt("return");
588
+ return _context9.abrupt("return");
545
589
  case 6:
546
590
  pointList = res.data || [];
547
591
  pointList.forEach(function (v) {
@@ -552,18 +596,18 @@ var Player = function Player(_ref) {
552
596
  });
553
597
  case 8:
554
598
  case "end":
555
- return _context8.stop();
599
+ return _context9.stop();
556
600
  }
557
- }, _callee8);
601
+ }, _callee9);
558
602
  }));
559
- return function fetchDeviceSpecialPoint(_x8, _x9) {
560
- return _ref0.apply(this, arguments);
603
+ return function fetchDeviceSpecialPoint(_x9, _x0) {
604
+ return _ref1.apply(this, arguments);
561
605
  };
562
606
  }();
563
607
  var fetchEnergyByMeterList = /*#__PURE__*/function () {
564
- var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(type, ids, dateType) {
565
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
566
- while (1) switch (_context9.prev = _context9.next) {
608
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(type, ids, dateType) {
609
+ return _regeneratorRuntime().wrap(function _callee0$(_context0) {
610
+ while (1) switch (_context0.prev = _context0.next) {
567
611
  case 0:
568
612
  GetEnergyByMeterList({
569
613
  dataType: type,
@@ -580,12 +624,12 @@ var Player = function Player(_ref) {
580
624
  });
581
625
  case 1:
582
626
  case "end":
583
- return _context9.stop();
627
+ return _context0.stop();
584
628
  }
585
- }, _callee9);
629
+ }, _callee0);
586
630
  }));
587
- return function fetchEnergyByMeterList(_x0, _x1, _x10) {
588
- return _ref1.apply(this, arguments);
631
+ return function fetchEnergyByMeterList(_x1, _x10, _x11) {
632
+ return _ref10.apply(this, arguments);
589
633
  };
590
634
  }();
591
635
  var timer;
@@ -747,6 +791,15 @@ var Player = function Player(_ref) {
747
791
  onCancel: function onCancel() {
748
792
  return setVisibleDialogPointWrite(false);
749
793
  }
794
+ }), /*#__PURE__*/React.createElement(ModalChangePointValue, {
795
+ visible: visibleModalChangePointValue,
796
+ protocol: changePointValueProps.protocol,
797
+ pointValue: changePointValueProps.pointValue,
798
+ pointIdList: changePointValueProps.pointIdList,
799
+ pointEnumItemList: changePointValueProps.pointEnumItemList,
800
+ onCancel: function onCancel() {
801
+ return setVisibleModalChangePointValue(false);
802
+ }
750
803
  }));
751
804
  };
752
805
  export default Player;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
4
4
  "scripts": {
5
5
  "start": " PORT=8000 UMI_ENV=prod umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",