coolcare-lite-scada-component 1.0.3 → 1.0.5

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.
@@ -70,9 +70,9 @@ var ColorPicker = function ColorPicker(_ref) {
70
70
  return /*#__PURE__*/React.createElement(Popover, {
71
71
  arrowContent: false,
72
72
  trigger: "click",
73
- visible: visible,
73
+ open: visible,
74
74
  overlayClassName: "color-picker-popover",
75
- onVisibleChange: handleVisibleChange,
75
+ onOpenChange: handleVisibleChange,
76
76
  content: function content() {
77
77
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SketchPicker, {
78
78
  width: "250px",
@@ -86,11 +86,11 @@ var DeviceSelect = function DeviceSelect(_ref) {
86
86
  }),
87
87
  placement: "leftTop",
88
88
  trigger: "click",
89
- visible: visible,
89
+ open: visible,
90
90
  overlayInnerStyle: {
91
91
  width: 520
92
92
  },
93
- onVisibleChange: setVisible
93
+ onOpenChange: setVisible
94
94
  }, /*#__PURE__*/React.createElement(Input, {
95
95
  value: deviceName || (deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceName),
96
96
  size: size,
@@ -95,7 +95,7 @@ var DialogExpressionBind = function DialogExpressionBind(_ref) {
95
95
  }, "\u786E\u5B9A")];
96
96
  return /*#__PURE__*/React.createElement(Modal, {
97
97
  title: false,
98
- visible: visible,
98
+ open: visible,
99
99
  width: 440,
100
100
  closable: false,
101
101
  onCancel: handleCancel,
@@ -313,9 +313,10 @@ var DialogHistory = function DialogHistory(_ref) {
313
313
  }, [visible, form, pointIdListProp, dateRangeProp, intervalProp, fetchPointHistory]);
314
314
  return /*#__PURE__*/React.createElement(Modal, {
315
315
  title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
316
- visible: visible,
316
+ open: visible,
317
317
  closable: true,
318
318
  width: 1300,
319
+ zIndex: 42000,
319
320
  footer: null,
320
321
  onCancel: closeModal,
321
322
  afterClose: closeModal,
@@ -62,7 +62,7 @@ var DialogIconPicker = function DialogIconPicker(_ref) {
62
62
  }));
63
63
  return /*#__PURE__*/React.createElement(Modal, {
64
64
  title: Title,
65
- visible: visible,
65
+ open: visible,
66
66
  width: 856,
67
67
  bodyStyle: {
68
68
  padding: 0,
@@ -39,7 +39,7 @@ var DialogImagePicker = function DialogImagePicker(_ref) {
39
39
  };
40
40
  return /*#__PURE__*/React.createElement(Modal, {
41
41
  title: false,
42
- visible: visible,
42
+ open: visible,
43
43
  width: 600,
44
44
  closable: false,
45
45
  bodyStyle: {
@@ -86,10 +86,12 @@ var DialogPointWrite = function DialogPointWrite(_ref) {
86
86
  }, [visible]);
87
87
  return /*#__PURE__*/React.createElement(Modal, {
88
88
  title: false,
89
- visible: visible,
89
+ open: visible,
90
90
  width: "300px",
91
91
  footer: false,
92
+ zIndex: 41000,
92
93
  onCancel: onCancel,
94
+ getContainer: false,
93
95
  bodyStyle: {
94
96
  padding: 0,
95
97
  paddingBottom: 12
File without changes
@@ -0,0 +1,275 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ 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."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import React from "react";
12
+ import { Modal, Descriptions, Divider, Spin, message, Typography } from 'antd';
13
+ import { useState, useEffect, useCallback } from 'react';
14
+ import { SyncOutlined } from '@ant-design/icons';
15
+ import emitter from "../../utils/events";
16
+ import { pointValueFormat } from "../../utils/pointValueFormat";
17
+ import { GetDevicePoint } from "../../services/gateway/Device";
18
+ var Link = Typography.Link;
19
+ var ModalFanDevicePoint = function ModalFanDevicePoint(_ref) {
20
+ var open = _ref.open,
21
+ deviceId = _ref.deviceId,
22
+ onCancel = _ref.onCancel,
23
+ mittMeta = _ref.mittMeta;
24
+ // 制冷状态
25
+ var _useState = useState(),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ coolingStatus = _useState2[0],
28
+ setCoolingStatus = _useState2[1];
29
+ // 风机状态
30
+ var _useState3 = useState(),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ fanStatus = _useState4[0],
33
+ setFanStatus = _useState4[1];
34
+ // 化霜状态
35
+ var _useState5 = useState(),
36
+ _useState6 = _slicedToArray(_useState5, 2),
37
+ defrostStatus = _useState6[0],
38
+ setDefrostStatus = _useState6[1];
39
+ // 风机温度
40
+ var _useState7 = useState(),
41
+ _useState8 = _slicedToArray(_useState7, 2),
42
+ fanTemperature = _useState8[0],
43
+ setFanTemperature = _useState8[1];
44
+ // 控制温度
45
+ var _useState9 = useState(),
46
+ _useState10 = _slicedToArray(_useState9, 2),
47
+ controlTemperature = _useState10[0],
48
+ setControlTemperature = _useState10[1];
49
+ // 温度设定值
50
+ var _useState11 = useState(),
51
+ _useState12 = _slicedToArray(_useState11, 2),
52
+ temperatureSetting = _useState12[0],
53
+ setTemperatureSetting = _useState12[1];
54
+ // 出风温度
55
+ var _useState13 = useState(),
56
+ _useState14 = _slicedToArray(_useState13, 2),
57
+ outletTemperature = _useState14[0],
58
+ setOutletTemperature = _useState14[1];
59
+ // 回风温度
60
+ var _useState15 = useState(),
61
+ _useState16 = _slicedToArray(_useState15, 2),
62
+ returnFanTemperature = _useState16[0],
63
+ setReturnFanTemperature = _useState16[1];
64
+ // 化霜温度
65
+ var _useState17 = useState(),
66
+ _useState18 = _slicedToArray(_useState17, 2),
67
+ defrostTemperature = _useState18[0],
68
+ setDefrostTemperature = _useState18[1];
69
+ // 蒸发温度
70
+ var _useState19 = useState(),
71
+ _useState20 = _slicedToArray(_useState19, 2),
72
+ evaporationTemperature = _useState20[0],
73
+ setEvaporationTemperature = _useState20[1];
74
+ // 回气温度
75
+ var _useState21 = useState(),
76
+ _useState22 = _slicedToArray(_useState21, 2),
77
+ returnAirTemperature = _useState22[0],
78
+ setReturnAirTemperature = _useState22[1];
79
+ // 过热度
80
+ var _useState23 = useState(),
81
+ _useState24 = _slicedToArray(_useState23, 2),
82
+ superheat = _useState24[0],
83
+ setSuperheat = _useState24[1];
84
+ // 阀开度
85
+ var _useState25 = useState(),
86
+ _useState26 = _slicedToArray(_useState25, 2),
87
+ valveOpening = _useState26[0],
88
+ setValveOpening = _useState26[1];
89
+ var _useState27 = useState(true),
90
+ _useState28 = _slicedToArray(_useState27, 2),
91
+ loading = _useState28[0],
92
+ setLoading = _useState28[1];
93
+ var fetchPointList = useCallback( /*#__PURE__*/function () {
94
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(deviceId) {
95
+ var res, _res$data;
96
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
97
+ while (1) switch (_context.prev = _context.next) {
98
+ case 0:
99
+ _context.prev = 0;
100
+ setLoading(true);
101
+ _context.next = 4;
102
+ return GetDevicePoint({
103
+ deviceIdList: [deviceId]
104
+ });
105
+ case 4:
106
+ res = _context.sent;
107
+ if (res.success) {
108
+ (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.forEach(function (v) {
109
+ var _v$pointName, _v$pointName2, _v$pointName3, _v$pointName4, _v$pointName5, _v$pointName6, _v$pointName7, _v$pointName8, _v$pointName9, _v$pointName10, _v$pointName11, _v$pointName12, _v$pointName13;
110
+ if ((_v$pointName = v.pointName) === null || _v$pointName === void 0 ? void 0 : _v$pointName.includes('制冷状态')) setCoolingStatus(v);else if ((_v$pointName2 = v.pointName) === null || _v$pointName2 === void 0 ? void 0 : _v$pointName2.includes('风机状态')) setFanStatus(v);else if ((_v$pointName3 = v.pointName) === null || _v$pointName3 === void 0 ? void 0 : _v$pointName3.includes('化霜状态')) setDefrostStatus(v);else if ((_v$pointName4 = v.pointName) === null || _v$pointName4 === void 0 ? void 0 : _v$pointName4.includes('风机温度')) setFanTemperature(v);else if ((_v$pointName5 = v.pointName) === null || _v$pointName5 === void 0 ? void 0 : _v$pointName5.includes('控制温度')) setControlTemperature(v);else if ((_v$pointName6 = v.pointName) === null || _v$pointName6 === void 0 ? void 0 : _v$pointName6.includes('温度设定值')) setTemperatureSetting(v);else if ((_v$pointName7 = v.pointName) === null || _v$pointName7 === void 0 ? void 0 : _v$pointName7.includes('出风温度')) setOutletTemperature(v);else if ((_v$pointName8 = v.pointName) === null || _v$pointName8 === void 0 ? void 0 : _v$pointName8.includes('回风温度')) setReturnFanTemperature(v);else if ((_v$pointName9 = v.pointName) === null || _v$pointName9 === void 0 ? void 0 : _v$pointName9.includes('化霜温度')) setDefrostTemperature(v);else if ((_v$pointName10 = v.pointName) === null || _v$pointName10 === void 0 ? void 0 : _v$pointName10.includes('蒸发温度')) setEvaporationTemperature(v);else if ((_v$pointName11 = v.pointName) === null || _v$pointName11 === void 0 ? void 0 : _v$pointName11.includes('回气温度')) setReturnAirTemperature(v);else if ((_v$pointName12 = v.pointName) === null || _v$pointName12 === void 0 ? void 0 : _v$pointName12.includes('过热度')) setSuperheat(v);else if ((_v$pointName13 = v.pointName) === null || _v$pointName13 === void 0 ? void 0 : _v$pointName13.includes('阀开度')) setValveOpening(v);
111
+ });
112
+ } else {
113
+ message.error('设备点位加载失败');
114
+ }
115
+ _context.next = 12;
116
+ break;
117
+ case 8:
118
+ _context.prev = 8;
119
+ _context.t0 = _context["catch"](0);
120
+ console.error(_context.t0);
121
+ message.error('设备点位加载失败');
122
+ case 12:
123
+ _context.prev = 12;
124
+ setLoading(false);
125
+ return _context.finish(12);
126
+ case 15:
127
+ case "end":
128
+ return _context.stop();
129
+ }
130
+ }, _callee, null, [[0, 8, 12, 15]]);
131
+ }));
132
+ return function (_x2) {
133
+ return _ref2.apply(this, arguments);
134
+ };
135
+ }(), []);
136
+ useEffect(function () {
137
+ if (deviceId && open) {
138
+ fetchPointList(deviceId);
139
+ }
140
+ }, [deviceId, open, fetchPointList]);
141
+ var handleCancel = function handleCancel() {
142
+ setLoading(false);
143
+ // 清空所有的状态
144
+ setCoolingStatus(undefined);
145
+ setFanStatus(undefined);
146
+ setDefrostStatus(undefined);
147
+ setFanTemperature(undefined);
148
+ setControlTemperature(undefined);
149
+ setTemperatureSetting(undefined);
150
+ setOutletTemperature(undefined);
151
+ setReturnFanTemperature(undefined);
152
+ setDefrostTemperature(undefined);
153
+ setEvaporationTemperature(undefined);
154
+ setReturnAirTemperature(undefined);
155
+ setSuperheat(undefined);
156
+ setValveOpening(undefined);
157
+ onCancel();
158
+ };
159
+ var onClickRefresh = function onClickRefresh() {
160
+ if (deviceId) {
161
+ fetchPointList(deviceId);
162
+ }
163
+ };
164
+ var TitleNode = /*#__PURE__*/React.createElement("div", null, "\u8BBE\u5907\u70B9\u4F4D", /*#__PURE__*/React.createElement("a", {
165
+ onClick: onClickRefresh,
166
+ style: {
167
+ float: 'right',
168
+ paddingRight: '10px',
169
+ marginRight: '14px',
170
+ zIndex: 10000
171
+ }
172
+ }, /*#__PURE__*/React.createElement(SyncOutlined, null)));
173
+ var onClickPointValue = function onClickPointValue(point) {
174
+ if (!mittMeta || !point) return;
175
+ var eventName = "show-point-history-".concat(mittMeta.namespace);
176
+ emitter.emit(eventName, [{
177
+ deviceId: point.deviceId,
178
+ identifierName: point.identifierName
179
+ }]);
180
+ };
181
+ return /*#__PURE__*/React.createElement(Modal, {
182
+ title: TitleNode,
183
+ open: open,
184
+ width: 550,
185
+ zIndex: 40000,
186
+ onCancel: handleCancel,
187
+ footer: null,
188
+ getContainer: false
189
+ }, /*#__PURE__*/React.createElement(Spin, {
190
+ spinning: loading
191
+ }, /*#__PURE__*/React.createElement(Descriptions, {
192
+ column: 2
193
+ }, /*#__PURE__*/React.createElement(Descriptions.Item, {
194
+ label: "\u5236\u51B7\u72B6\u6001"
195
+ }, /*#__PURE__*/React.createElement(Link, {
196
+ onClick: function onClick() {
197
+ return onClickPointValue(coolingStatus);
198
+ }
199
+ }, pointValueFormat(coolingStatus))), /*#__PURE__*/React.createElement(Descriptions.Item, {
200
+ label: "\u98CE\u673A\u72B6\u6001"
201
+ }, /*#__PURE__*/React.createElement(Link, {
202
+ onClick: function onClick() {
203
+ return onClickPointValue(fanStatus);
204
+ }
205
+ }, pointValueFormat(fanStatus))), /*#__PURE__*/React.createElement(Descriptions.Item, {
206
+ label: "\u5316\u971C\u72B6\u6001"
207
+ }, /*#__PURE__*/React.createElement(Link, {
208
+ onClick: function onClick() {
209
+ return onClickPointValue(defrostStatus);
210
+ }
211
+ }, pointValueFormat(defrostStatus))), /*#__PURE__*/React.createElement(Descriptions.Item, {
212
+ label: "\u98CE\u673A\u6E29\u5EA6"
213
+ }, /*#__PURE__*/React.createElement(Link, {
214
+ onClick: function onClick() {
215
+ return onClickPointValue(fanTemperature);
216
+ }
217
+ }, pointValueFormat(fanTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
218
+ label: "\u63A7\u5236\u6E29\u5EA6"
219
+ }, /*#__PURE__*/React.createElement(Link, {
220
+ onClick: function onClick() {
221
+ return onClickPointValue(controlTemperature);
222
+ }
223
+ }, pointValueFormat(controlTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
224
+ label: "\u6E29\u5EA6\u8BBE\u5B9A\u503C"
225
+ }, /*#__PURE__*/React.createElement(Link, {
226
+ onClick: function onClick() {
227
+ return onClickPointValue(temperatureSetting);
228
+ }
229
+ }, pointValueFormat(temperatureSetting)))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Descriptions, {
230
+ column: 2
231
+ }, /*#__PURE__*/React.createElement(Descriptions.Item, {
232
+ label: "\u51FA\u98CE\u6E29\u5EA6"
233
+ }, /*#__PURE__*/React.createElement(Link, {
234
+ onClick: function onClick() {
235
+ return onClickPointValue(outletTemperature);
236
+ }
237
+ }, pointValueFormat(outletTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
238
+ label: "\u56DE\u98CE\u6E29\u5EA6"
239
+ }, /*#__PURE__*/React.createElement(Link, {
240
+ onClick: function onClick() {
241
+ return onClickPointValue(returnFanTemperature);
242
+ }
243
+ }, pointValueFormat(returnFanTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
244
+ label: "\u5316\u971C\u6E29\u5EA6"
245
+ }, /*#__PURE__*/React.createElement(Link, {
246
+ onClick: function onClick() {
247
+ return onClickPointValue(defrostTemperature);
248
+ }
249
+ }, pointValueFormat(defrostTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
250
+ label: "\u84B8\u53D1\u6E29\u5EA6"
251
+ }, /*#__PURE__*/React.createElement(Link, {
252
+ onClick: function onClick() {
253
+ return onClickPointValue(evaporationTemperature);
254
+ }
255
+ }, pointValueFormat(evaporationTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
256
+ label: "\u56DE\u6C14\u6E29\u5EA6"
257
+ }, /*#__PURE__*/React.createElement(Link, {
258
+ onClick: function onClick() {
259
+ return onClickPointValue(returnAirTemperature);
260
+ }
261
+ }, pointValueFormat(returnAirTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
262
+ label: "\u8FC7\u70ED\u5EA6"
263
+ }, /*#__PURE__*/React.createElement(Link, {
264
+ onClick: function onClick() {
265
+ return onClickPointValue(superheat);
266
+ }
267
+ }, pointValueFormat(superheat))), /*#__PURE__*/React.createElement(Descriptions.Item, {
268
+ label: "\u9600\u5F00\u5EA6"
269
+ }, /*#__PURE__*/React.createElement(Link, {
270
+ onClick: function onClick() {
271
+ return onClickPointValue(valveOpening);
272
+ }
273
+ }, pointValueFormat(valveOpening))))));
274
+ };
275
+ export default ModalFanDevicePoint;
@@ -181,8 +181,8 @@ var PointInfoTip = function PointInfoTip(_ref) {
181
181
  return null;
182
182
  }
183
183
  return /*#__PURE__*/React.createElement(Popover, {
184
- visible: visible,
185
- onVisibleChange: onVisibleChange,
184
+ open: visible,
185
+ onOpenChange: onVisibleChange,
186
186
  overlayClassName: styles['point-info-tip'],
187
187
  content: contentFormat(),
188
188
  title: false
@@ -252,11 +252,11 @@ var PointSelect = function PointSelect(_ref) {
252
252
  }),
253
253
  placement: "leftTop",
254
254
  trigger: "click",
255
- visible: visible,
255
+ open: visible,
256
256
  overlayInnerStyle: {
257
257
  width: deviceId ? 620 : 360
258
258
  },
259
- onVisibleChange: setVisible
259
+ onOpenChange: setVisible
260
260
  }, /*#__PURE__*/React.createElement(Input, {
261
261
  value: pointInfo === null || pointInfo === void 0 ? void 0 : pointInfo.name,
262
262
  size: size,
@@ -74,7 +74,7 @@ function Prompt(_ref2) {
74
74
  };
75
75
  }();
76
76
  return /*#__PURE__*/React.createElement(Modal, _extends({}, modalProps, {
77
- visible: visible,
77
+ open: visible,
78
78
  onOk: handleOk,
79
79
  onCancel: function onCancel() {
80
80
  return close();
@@ -5,8 +5,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  import React from "react";
8
- import { memo } from 'react';
8
+ import { memo, useMemo } from 'react';
9
9
  import { Tooltip } from 'antd';
10
+ import { RightOutlined } from '@ant-design/icons';
11
+ import emitter from "../../utils/events";
10
12
  import { getValueByExpression } from "../utils";
11
13
  import { reactShapeNodeAreEqual } from "../utils";
12
14
  import { usePointWatch, useEleEventHandle } from "../../hooks";
@@ -26,6 +28,9 @@ var EleFanComponent = function EleFanComponent(_ref) {
26
28
  var refrigerationPointData = usePointWatch(payload === null || payload === void 0 ? void 0 : payload.refrigerationPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta3 = payload.mittMeta) === null || _payload$mittMeta3 === void 0 ? void 0 : _payload$mittMeta3.namespace);
27
29
  var faultPointData = usePointWatch(payload === null || payload === void 0 ? void 0 : payload.faultPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta4 = payload.mittMeta) === null || _payload$mittMeta4 === void 0 ? void 0 : _payload$mittMeta4.namespace);
28
30
  var switchPointData = usePointWatch(payload === null || payload === void 0 ? void 0 : payload.switchPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta5 = payload.mittMeta) === null || _payload$mittMeta5 === void 0 ? void 0 : _payload$mittMeta5.namespace);
31
+ var deviceName = useMemo(function () {
32
+ return (frostPointData === null || frostPointData === void 0 ? void 0 : frostPointData.deviceName) || (refrigerationPointData === null || refrigerationPointData === void 0 ? void 0 : refrigerationPointData.deviceName) || (faultPointData === null || faultPointData === void 0 ? void 0 : faultPointData.deviceName) || (switchPointData === null || switchPointData === void 0 ? void 0 : switchPointData.deviceName);
33
+ }, [frostPointData, refrigerationPointData, faultPointData, switchPointData]);
29
34
 
30
35
  /** 风机是否开启 */
31
36
  var fanIsOn = getValueByExpression(switchPointData === null || switchPointData === void 0 ? void 0 : switchPointData.value, payload === null || payload === void 0 ? void 0 : (_payload$switchPoint = payload.switchPoint) === null || _payload$switchPoint === void 0 ? void 0 : _payload$switchPoint.expressions) === '风机开';
@@ -35,12 +40,29 @@ var EleFanComponent = function EleFanComponent(_ref) {
35
40
  var frostIsOn = getValueByExpression(frostPointData === null || frostPointData === void 0 ? void 0 : frostPointData.value, payload === null || payload === void 0 ? void 0 : (_payload$frostPoint = payload.frostPoint) === null || _payload$frostPoint === void 0 ? void 0 : _payload$frostPoint.expressions) === '制冷开';
36
41
  /** 是否存在故障 */
37
42
  var faultIsOn = getValueByExpression(faultPointData === null || faultPointData === void 0 ? void 0 : faultPointData.value, payload === null || payload === void 0 ? void 0 : (_payload$faultPoint = payload.faultPoint) === null || _payload$faultPoint === void 0 ? void 0 : _payload$faultPoint.expressions) === '故障';
43
+ var onClickDeviceName = function onClickDeviceName() {
44
+ var _payload$mittMeta6;
45
+ if (!(payload === null || payload === void 0 ? void 0 : (_payload$mittMeta6 = payload.mittMeta) === null || _payload$mittMeta6 === void 0 ? void 0 : _payload$mittMeta6.namespace)) {
46
+ return;
47
+ }
48
+ var deviceId = (frostPointData === null || frostPointData === void 0 ? void 0 : frostPointData.deviceId) || (refrigerationPointData === null || refrigerationPointData === void 0 ? void 0 : refrigerationPointData.deviceId) || (faultPointData === null || faultPointData === void 0 ? void 0 : faultPointData.deviceId) || (switchPointData === null || switchPointData === void 0 ? void 0 : switchPointData.deviceId);
49
+ emitter.emit("show-fan-device-point-modal-".concat(payload.mittMeta.namespace), {
50
+ deviceId: deviceId
51
+ });
52
+ };
38
53
  var tooltipTitle = null;
39
54
  if (!(payload === null || payload === void 0 ? void 0 : payload.frostPoint) && !(payload === null || payload === void 0 ? void 0 : payload.refrigerationPoint) && !(payload === null || payload === void 0 ? void 0 : payload.faultPoint) && !(payload === null || payload === void 0 ? void 0 : payload.switchPoint)) {
40
55
  tooltipTitle = '未绑定点位';
41
56
  } else if (window.scadaMode == 'player') {
42
57
  var _switchPointData$valu, _refrigerationPointDa, _frostPointData$value, _faultPointData$value;
43
- tooltipTitle = /*#__PURE__*/React.createElement("div", null, switchPointData && /*#__PURE__*/React.createElement("div", null, "\u98CE\u673A\u72B6\u6001\uFF1A", (_switchPointData$valu = switchPointData.value) !== null && _switchPointData$valu !== void 0 ? _switchPointData$valu : '-'), refrigerationPointData && /*#__PURE__*/React.createElement("div", null, "\u5316\u971C\u72B6\u6001\uFF1A", (_refrigerationPointDa = refrigerationPointData.value) !== null && _refrigerationPointDa !== void 0 ? _refrigerationPointDa : '-'), frostPointData && /*#__PURE__*/React.createElement("div", null, "\u5236\u51B7\u72B6\u6001\uFF1A", (_frostPointData$value = frostPointData.value) !== null && _frostPointData$value !== void 0 ? _frostPointData$value : '-'), faultPointData && /*#__PURE__*/React.createElement("div", null, "\u6545\u969C\u72B6\u6001\uFF1A", (_faultPointData$value = faultPointData.value) !== null && _faultPointData$value !== void 0 ? _faultPointData$value : '-'));
58
+ tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
59
+ onClick: onClickDeviceName,
60
+ className: styles['device-name']
61
+ }, deviceName || '-', /*#__PURE__*/React.createElement(RightOutlined, {
62
+ style: {
63
+ marginLeft: '8px'
64
+ }
65
+ })), switchPointData && /*#__PURE__*/React.createElement("div", null, "\u98CE\u673A\u72B6\u6001\uFF1A", (_switchPointData$valu = switchPointData.value) !== null && _switchPointData$valu !== void 0 ? _switchPointData$valu : '-'), refrigerationPointData && /*#__PURE__*/React.createElement("div", null, "\u5316\u971C\u72B6\u6001\uFF1A", (_refrigerationPointDa = refrigerationPointData.value) !== null && _refrigerationPointDa !== void 0 ? _refrigerationPointDa : '-'), frostPointData && /*#__PURE__*/React.createElement("div", null, "\u5236\u51B7\u72B6\u6001\uFF1A", (_frostPointData$value = frostPointData.value) !== null && _frostPointData$value !== void 0 ? _frostPointData$value : '-'), faultPointData && /*#__PURE__*/React.createElement("div", null, "\u6545\u969C\u72B6\u6001\uFF1A", (_faultPointData$value = faultPointData.value) !== null && _faultPointData$value !== void 0 ? _faultPointData$value : '-'));
44
66
  }
45
67
  var getStatusColor = function getStatusColor() {
46
68
  var color = '#8FADC7';
@@ -8,6 +8,15 @@
8
8
  border-radius: 4px;
9
9
  cursor: pointer;
10
10
  }
11
+ .device-name {
12
+ margin-right: -8px;
13
+ margin-bottom: 4px;
14
+ margin-left: -8px;
15
+ padding: 0 8px;
16
+ padding-bottom: 4px;
17
+ border-bottom: 1px solid #fff;
18
+ cursor: pointer;
19
+ }
11
20
  .fan-img {
12
21
  width: 80%;
13
22
  height: 80%;
@@ -156,7 +156,7 @@ var PointItemSetDrawer = function PointItemSetDrawer(_ref) {
156
156
  onClose: function onClose() {
157
157
  return setVisible(false);
158
158
  },
159
- visible: visible
159
+ open: visible
160
160
  }, content))
161
161
  // <Popover
162
162
  // content={content}
@@ -68,7 +68,7 @@ var TooltipTool = /*#__PURE__*/function (_ToolsView$ToolItem) {
68
68
  }
69
69
  ReactDom.render( /*#__PURE__*/React.createElement(Tooltip, {
70
70
  title: title,
71
- visible: true,
71
+ open: true,
72
72
  mouseLeaveDelay: 300
73
73
  }, /*#__PURE__*/React.createElement("div", null)), this.knob);
74
74
  }
@@ -14,7 +14,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
14
14
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  import React from "react";
17
- import { useState, useEffect, useRef } from 'react';
17
+ import { useState, useEffect, useRef, useMemo } from 'react';
18
18
  import { Graph } from '@antv/x6';
19
19
  import { message } from 'antd';
20
20
  import { useSize } from 'ahooks';
@@ -22,6 +22,7 @@ import { getInfoFromPointId, getMittMeta } from "../../../utils";
22
22
  import isInIframe from "../../../utils/isInIframe";
23
23
  import DialogHistory from "../../../components/DialogHistory";
24
24
  import DialogPointWrite from "../../../components/DialogPointWrite";
25
+ import ModalFanDevicePoint from "../../../components/ModalFanDevicePoint";
25
26
  import emitter from "../../../utils/events";
26
27
  import { GetDevicePoint } from "../../../services/gateway/Device";
27
28
  import "./index.css";
@@ -33,25 +34,34 @@ var Player = function Player(_ref) {
33
34
  var graphRef = useRef(null);
34
35
  var wrapRef = useRef(null);
35
36
  var playerRef = useRef(null);
36
- // const query = useQuery<PlayerQuery>();
37
-
38
37
  var _useState = useState(false),
39
38
  _useState2 = _slicedToArray(_useState, 2),
40
39
  visibleDialogHistory = _useState2[0],
41
40
  setVisibleDialogHistory = _useState2[1];
42
- var _useState3 = useState([]),
41
+ var _useState3 = useState(false),
43
42
  _useState4 = _slicedToArray(_useState3, 2),
44
- activePointIds = _useState4[0],
45
- setActivePointIds = _useState4[1];
46
- var _useState5 = useState([]),
43
+ visibleModalFanDevicePoint = _useState4[0],
44
+ setVisibleModalFanDevicePoint = _useState4[1];
45
+ var _useState5 = useState(false),
47
46
  _useState6 = _slicedToArray(_useState5, 2),
48
- activePoints = _useState6[0],
49
- setActivePoints = _useState6[1];
50
- var _useState7 = useState(false),
47
+ visibleDialogPointWrite = _useState6[0],
48
+ setVisibleDialogPointWrite = _useState6[1];
49
+ var _useState7 = useState([]),
51
50
  _useState8 = _slicedToArray(_useState7, 2),
52
- visibleDialogPointWrite = _useState8[0],
53
- setVisibleDialogPointWrite = _useState8[1];
51
+ activePointIds = _useState8[0],
52
+ setActivePointIds = _useState8[1];
53
+ var _useState9 = useState([]),
54
+ _useState10 = _slicedToArray(_useState9, 2),
55
+ activePoints = _useState10[0],
56
+ setActivePoints = _useState10[1];
57
+ var _useState11 = useState(),
58
+ _useState12 = _slicedToArray(_useState11, 2),
59
+ activeDeviceId = _useState12[0],
60
+ setActiveDeviceId = _useState12[1];
54
61
  var wrapSize = useSize(wrapRef);
62
+ var mittMeta = useMemo(function () {
63
+ return getMittMeta(query);
64
+ }, [query]);
55
65
  useEffect(function () {
56
66
  window.scadaMode = 'player';
57
67
  return function () {
@@ -160,13 +170,14 @@ var Player = function Player(_ref) {
160
170
  return _ref2.apply(this, arguments);
161
171
  };
162
172
  }();
163
- var mittMeta = getMittMeta(query);
164
173
  var eventName = "show-point-history-".concat(mittMeta.namespace);
165
174
  emitter.on(eventName, handler);
166
175
  return function () {
167
176
  emitter.off(eventName, handler);
168
177
  };
169
- }, [query]);
178
+ }, [query, mittMeta]);
179
+
180
+ // 监听显示点位写入弹窗事件
170
181
  useEffect(function () {
171
182
  var handler = /*#__PURE__*/function () {
172
183
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(points) {
@@ -198,13 +209,47 @@ var Player = function Player(_ref) {
198
209
  return _ref3.apply(this, arguments);
199
210
  };
200
211
  }();
201
- var mittMeta = getMittMeta(query);
202
212
  var eventName = "show-point-write-modal-".concat(mittMeta.namespace);
203
213
  emitter.on(eventName, handler);
204
214
  return function () {
205
215
  emitter.off(eventName, handler);
206
216
  };
207
- }, [query]);
217
+ }, [query, mittMeta]);
218
+
219
+ // 监听显示风机设备点位弹窗事件
220
+ useEffect(function () {
221
+ var handler = /*#__PURE__*/function () {
222
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
223
+ var deviceId, id;
224
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
225
+ while (1) switch (_context3.prev = _context3.next) {
226
+ case 0:
227
+ deviceId = _ref4.deviceId;
228
+ if (!(query.scene === 'product')) {
229
+ _context3.next = 3;
230
+ break;
231
+ }
232
+ return _context3.abrupt("return");
233
+ case 3:
234
+ id = query.scene === 'device' ? Number(query.deviceId) : deviceId;
235
+ setActiveDeviceId(id);
236
+ setVisibleModalFanDevicePoint(true);
237
+ case 6:
238
+ case "end":
239
+ return _context3.stop();
240
+ }
241
+ }, _callee3);
242
+ }));
243
+ return function handler(_x4) {
244
+ return _ref5.apply(this, arguments);
245
+ };
246
+ }();
247
+ var eventName = "show-fan-device-point-modal-".concat(mittMeta.namespace);
248
+ emitter.on(eventName, handler);
249
+ return function () {
250
+ emitter.off(eventName, handler);
251
+ };
252
+ }, [query, mittMeta]);
208
253
  useEffect(function () {
209
254
  if (!playerRef.current) return;
210
255
  graphRef.current = new Graph({
@@ -237,7 +282,7 @@ var Player = function Player(_ref) {
237
282
  modifiers: ['ctrl', 'meta']
238
283
  }
239
284
  });
240
- }, [query]);
285
+ }, [query, mittMeta]);
241
286
  useEffect(function () {
242
287
  var _jsonConfig$pageConfi2, _graphRef$current3;
243
288
  if (!wrapSize || !jsonConfig || !query) return;
@@ -263,25 +308,24 @@ var Player = function Player(_ref) {
263
308
 
264
309
  // scene === 'device' 加载设备点位数据
265
310
  useEffect(function () {
266
- var mittMeta = getMittMeta(query);
267
311
  var fetchDevicePoints = /*#__PURE__*/function () {
268
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(deviceId) {
312
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(deviceId) {
269
313
  var res, pointList;
270
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
271
- while (1) switch (_context3.prev = _context3.next) {
314
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
315
+ while (1) switch (_context4.prev = _context4.next) {
272
316
  case 0:
273
- _context3.next = 2;
317
+ _context4.next = 2;
274
318
  return GetDevicePoint({
275
319
  deviceIdList: [deviceId]
276
320
  }, []);
277
321
  case 2:
278
- res = _context3.sent;
322
+ res = _context4.sent;
279
323
  if (res.success) {
280
- _context3.next = 6;
324
+ _context4.next = 6;
281
325
  break;
282
326
  }
283
327
  message.error('设备点位数据获取失败');
284
- return _context3.abrupt("return");
328
+ return _context4.abrupt("return");
285
329
  case 6:
286
330
  pointList = res.data || [];
287
331
  pointList.forEach(function (v) {
@@ -290,12 +334,12 @@ var Player = function Player(_ref) {
290
334
  });
291
335
  case 8:
292
336
  case "end":
293
- return _context3.stop();
337
+ return _context4.stop();
294
338
  }
295
- }, _callee3);
339
+ }, _callee4);
296
340
  }));
297
- return function fetchDevicePoints(_x4) {
298
- return _ref4.apply(this, arguments);
341
+ return function fetchDevicePoints(_x5) {
342
+ return _ref6.apply(this, arguments);
299
343
  };
300
344
  }();
301
345
  var timer;
@@ -310,29 +354,28 @@ var Player = function Player(_ref) {
310
354
  clearInterval(timer);
311
355
  }
312
356
  };
313
- }, [query, jsonConfig]);
357
+ }, [query, jsonConfig, mittMeta]);
314
358
 
315
359
  // scene === 'freedom' 加载设备点位数据
316
360
  useEffect(function () {
317
- var mittMeta = getMittMeta(query);
318
361
  var fetchDevicePoints = /*#__PURE__*/function () {
319
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(ids) {
362
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(ids) {
320
363
  var res, pointList;
321
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
322
- while (1) switch (_context4.prev = _context4.next) {
364
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
365
+ while (1) switch (_context5.prev = _context5.next) {
323
366
  case 0:
324
- _context4.next = 2;
367
+ _context5.next = 2;
325
368
  return GetDevicePoint({
326
369
  pointIdList: ids
327
370
  }, []);
328
371
  case 2:
329
- res = _context4.sent;
372
+ res = _context5.sent;
330
373
  if (res.success) {
331
- _context4.next = 6;
374
+ _context5.next = 6;
332
375
  break;
333
376
  }
334
377
  message.error('设备点位数据获取失败');
335
- return _context4.abrupt("return");
378
+ return _context5.abrupt("return");
336
379
  case 6:
337
380
  pointList = res.data || [];
338
381
  pointList.forEach(function (v) {
@@ -340,12 +383,12 @@ var Player = function Player(_ref) {
340
383
  });
341
384
  case 8:
342
385
  case "end":
343
- return _context4.stop();
386
+ return _context5.stop();
344
387
  }
345
- }, _callee4);
388
+ }, _callee5);
346
389
  }));
347
- return function fetchDevicePoints(_x5) {
348
- return _ref5.apply(this, arguments);
390
+ return function fetchDevicePoints(_x6) {
391
+ return _ref7.apply(this, arguments);
349
392
  };
350
393
  }();
351
394
  var timer;
@@ -390,12 +433,11 @@ var Player = function Player(_ref) {
390
433
  clearInterval(timer);
391
434
  }
392
435
  };
393
- }, [query, jsonConfig]);
436
+ }, [query, jsonConfig, mittMeta]);
394
437
  useEffect(function () {
395
438
  var graph = graphRef.current;
396
439
  if (jsonConfig && graph && query) {
397
440
  var _jsonConfig$cells2;
398
- var mittMeta = getMittMeta(query);
399
441
  jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$cells2 = jsonConfig.cells) === null || _jsonConfig$cells2 === void 0 ? void 0 : _jsonConfig$cells2.forEach(function (v) {
400
442
  if (v.data) {
401
443
  v.data.mittMeta = mittMeta;
@@ -410,13 +452,20 @@ var Player = function Player(_ref) {
410
452
  preserveAspectRatio: true // 是否保持长宽比。
411
453
  });
412
454
  }
413
- }, [jsonConfig, query]);
455
+ }, [jsonConfig, query, mittMeta]);
414
456
  return /*#__PURE__*/React.createElement("div", {
415
457
  ref: wrapRef,
416
458
  id: "scada-player-wrap"
417
459
  }, /*#__PURE__*/React.createElement("div", {
418
460
  id: "scada-player",
419
461
  ref: playerRef
462
+ }), /*#__PURE__*/React.createElement(ModalFanDevicePoint, {
463
+ deviceId: activeDeviceId,
464
+ open: visibleModalFanDevicePoint,
465
+ mittMeta: mittMeta,
466
+ onCancel: function onCancel() {
467
+ return setVisibleModalFanDevicePoint(false);
468
+ }
420
469
  }), /*#__PURE__*/React.createElement(DialogHistory, {
421
470
  visible: visibleDialogHistory,
422
471
  onCancel: function onCancel() {
@@ -275,7 +275,7 @@ var GroupManageDialog = function GroupManageDialog(_ref3) {
275
275
  size: "small",
276
276
  className: "btn-hover-effect"
277
277
  }, "\u65B0\u5EFA\u5206\u7EC4")),
278
- visible: visible,
278
+ open: visible,
279
279
  width: 400,
280
280
  onCancel: handleCancel,
281
281
  className: "group-manage-dialog",
@@ -129,7 +129,7 @@ var ImgConfigDialog = function ImgConfigDialog(_ref) {
129
129
  }();
130
130
  return /*#__PURE__*/React.createElement(Modal, {
131
131
  title: "Img Config",
132
- visible: visible,
132
+ open: visible,
133
133
  onOk: handleOk,
134
134
  footer: [/*#__PURE__*/React.createElement(Popconfirm, {
135
135
  key: "1",
@@ -296,7 +296,7 @@ var PanelTop = function PanelTop() {
296
296
  placement: "top",
297
297
  height: "100vh",
298
298
  className: "preview-drawer",
299
- afterVisibleChange: function afterVisibleChange(val) {
299
+ afterOpenChange: function afterOpenChange(val) {
300
300
  return setPreviewVisible(val);
301
301
  },
302
302
  closable: false,
@@ -307,7 +307,7 @@ var PanelTop = function PanelTop() {
307
307
  onClose: function onClose() {
308
308
  return setPreviewDrawerVisible(false);
309
309
  },
310
- visible: previewDrawerVisible
310
+ open: previewDrawerVisible
311
311
  }, /*#__PURE__*/React.createElement("a", {
312
312
  onClick: function onClick() {
313
313
  return setPreviewDrawerVisible(false);
@@ -681,6 +681,8 @@ declare namespace GatewayAPI {
681
681
  pointId?: string;
682
682
  /** 设备id */
683
683
  deviceId?: number;
684
+ /** 设备名称 */
685
+ deviceName?: string;
684
686
  /** 分组id */
685
687
  pointGroupId?: number;
686
688
  /** 点位分组名称 */
@@ -695,6 +697,8 @@ declare namespace GatewayAPI {
695
697
  value?: number;
696
698
  /** 是否可写 */
697
699
  isWrite?: boolean;
700
+ /** 点位标识符 */
701
+ identifierName?: string;
698
702
  /** 点位枚举id(如果是数值类型,点位枚举对应的是最大值和最小值) */
699
703
  pointEnumId?: number;
700
704
  /** 点位枚举名称 */
@@ -92,7 +92,7 @@ export function setRequrl(val) {
92
92
  reqUrl = val;
93
93
  }
94
94
  var requestPrefixMap = {
95
- dev: 'https://dev.sinocold.com:30443',
95
+ dev: '',
96
96
  prod: 'https://iot.sinocold.net',
97
97
  staging: 'https://dev.sinocold.com:30443',
98
98
  generalfushi: 'https://iot.generalfushi.com'
@@ -0,0 +1,25 @@
1
+ import { isNumber } from "./type";
2
+
3
+ /** 格式化点位数据 */
4
+ export function pointValueFormat(point) {
5
+ var res = '-';
6
+ if (!point) return res;
7
+ if (point.pointEnumId === 1) {
8
+ if (isNumber(point.value)) {
9
+ res = isNumber(point.decimalPlace) && point.decimalPlace > 0 ? "".concat(Math.floor(point.value * Math.pow(10, point.decimalPlace)) / Math.pow(10, point.decimalPlace)).concat(point.unit) : "".concat(point.value).concat(point.unit);
10
+ }
11
+ } else if (isNumber(point.value)) {
12
+ var _point$pointEnumItemL;
13
+ if ((_point$pointEnumItemL = point.pointEnumItemList) === null || _point$pointEnumItemL === void 0 ? void 0 : _point$pointEnumItemL.length) {
14
+ var pointEnumArr = point.pointEnumItemList.filter(function (item) {
15
+ return item.pointEnumItemValue === point.value;
16
+ });
17
+ if (pointEnumArr === null || pointEnumArr === void 0 ? void 0 : pointEnumArr.length) {
18
+ res = "".concat(pointEnumArr[0].pointEnumItemKey);
19
+ }
20
+ } else {
21
+ res = "".concat(point.value).concat(point.unit || '');
22
+ }
23
+ }
24
+ return res;
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "scripts": {
5
5
  "start": "umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",