coolcare-lite-scada-component 1.0.2 → 1.0.4

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,282 @@
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 { useModel } from 'umi';
16
+ import emitter from "../../utils/events";
17
+ import { pointValueFormat } from "../../utils/pointValueFormat";
18
+ import { GetDevicePoint } from "../../services/gateway/Device";
19
+ var Link = Typography.Link;
20
+ var ModalFanDevicePoint = function ModalFanDevicePoint(_ref) {
21
+ var open = _ref.open,
22
+ deviceId = _ref.deviceId,
23
+ onCancel = _ref.onCancel;
24
+ var _useModel = useModel('usePlayer', function (model) {
25
+ return {
26
+ mittMeta: model.mittMeta
27
+ };
28
+ }),
29
+ mittMeta = _useModel.mittMeta;
30
+
31
+ // 制冷状态
32
+ var _useState = useState(),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ coolingStatus = _useState2[0],
35
+ setCoolingStatus = _useState2[1];
36
+ // 风机状态
37
+ var _useState3 = useState(),
38
+ _useState4 = _slicedToArray(_useState3, 2),
39
+ fanStatus = _useState4[0],
40
+ setFanStatus = _useState4[1];
41
+ // 化霜状态
42
+ var _useState5 = useState(),
43
+ _useState6 = _slicedToArray(_useState5, 2),
44
+ defrostStatus = _useState6[0],
45
+ setDefrostStatus = _useState6[1];
46
+ // 风机温度
47
+ var _useState7 = useState(),
48
+ _useState8 = _slicedToArray(_useState7, 2),
49
+ fanTemperature = _useState8[0],
50
+ setFanTemperature = _useState8[1];
51
+ // 控制温度
52
+ var _useState9 = useState(),
53
+ _useState10 = _slicedToArray(_useState9, 2),
54
+ controlTemperature = _useState10[0],
55
+ setControlTemperature = _useState10[1];
56
+ // 温度设定值
57
+ var _useState11 = useState(),
58
+ _useState12 = _slicedToArray(_useState11, 2),
59
+ temperatureSetting = _useState12[0],
60
+ setTemperatureSetting = _useState12[1];
61
+ // 出风温度
62
+ var _useState13 = useState(),
63
+ _useState14 = _slicedToArray(_useState13, 2),
64
+ outletTemperature = _useState14[0],
65
+ setOutletTemperature = _useState14[1];
66
+ // 回风温度
67
+ var _useState15 = useState(),
68
+ _useState16 = _slicedToArray(_useState15, 2),
69
+ returnFanTemperature = _useState16[0],
70
+ setReturnFanTemperature = _useState16[1];
71
+ // 化霜温度
72
+ var _useState17 = useState(),
73
+ _useState18 = _slicedToArray(_useState17, 2),
74
+ defrostTemperature = _useState18[0],
75
+ setDefrostTemperature = _useState18[1];
76
+ // 蒸发温度
77
+ var _useState19 = useState(),
78
+ _useState20 = _slicedToArray(_useState19, 2),
79
+ evaporationTemperature = _useState20[0],
80
+ setEvaporationTemperature = _useState20[1];
81
+ // 回气温度
82
+ var _useState21 = useState(),
83
+ _useState22 = _slicedToArray(_useState21, 2),
84
+ returnAirTemperature = _useState22[0],
85
+ setReturnAirTemperature = _useState22[1];
86
+ // 过热度
87
+ var _useState23 = useState(),
88
+ _useState24 = _slicedToArray(_useState23, 2),
89
+ superheat = _useState24[0],
90
+ setSuperheat = _useState24[1];
91
+ // 阀开度
92
+ var _useState25 = useState(),
93
+ _useState26 = _slicedToArray(_useState25, 2),
94
+ valveOpening = _useState26[0],
95
+ setValveOpening = _useState26[1];
96
+ var _useState27 = useState(true),
97
+ _useState28 = _slicedToArray(_useState27, 2),
98
+ loading = _useState28[0],
99
+ setLoading = _useState28[1];
100
+ var fetchPointList = useCallback( /*#__PURE__*/function () {
101
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(deviceId) {
102
+ var res, _res$data;
103
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
104
+ while (1) switch (_context.prev = _context.next) {
105
+ case 0:
106
+ _context.prev = 0;
107
+ setLoading(true);
108
+ _context.next = 4;
109
+ return GetDevicePoint({
110
+ deviceIdList: [deviceId]
111
+ });
112
+ case 4:
113
+ res = _context.sent;
114
+ if (res.success) {
115
+ (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.forEach(function (v) {
116
+ 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;
117
+ 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);
118
+ });
119
+ } else {
120
+ message.error('设备点位加载失败');
121
+ }
122
+ _context.next = 12;
123
+ break;
124
+ case 8:
125
+ _context.prev = 8;
126
+ _context.t0 = _context["catch"](0);
127
+ console.error(_context.t0);
128
+ message.error('设备点位加载失败');
129
+ case 12:
130
+ _context.prev = 12;
131
+ setLoading(false);
132
+ return _context.finish(12);
133
+ case 15:
134
+ case "end":
135
+ return _context.stop();
136
+ }
137
+ }, _callee, null, [[0, 8, 12, 15]]);
138
+ }));
139
+ return function (_x2) {
140
+ return _ref2.apply(this, arguments);
141
+ };
142
+ }(), []);
143
+ useEffect(function () {
144
+ if (deviceId && open) {
145
+ fetchPointList(deviceId);
146
+ }
147
+ }, [deviceId, open, fetchPointList]);
148
+ var handleCancel = function handleCancel() {
149
+ setLoading(false);
150
+ // 清空所有的状态
151
+ setCoolingStatus(undefined);
152
+ setFanStatus(undefined);
153
+ setDefrostStatus(undefined);
154
+ setFanTemperature(undefined);
155
+ setControlTemperature(undefined);
156
+ setTemperatureSetting(undefined);
157
+ setOutletTemperature(undefined);
158
+ setReturnFanTemperature(undefined);
159
+ setDefrostTemperature(undefined);
160
+ setEvaporationTemperature(undefined);
161
+ setReturnAirTemperature(undefined);
162
+ setSuperheat(undefined);
163
+ setValveOpening(undefined);
164
+ onCancel();
165
+ };
166
+ var onClickRefresh = function onClickRefresh() {
167
+ if (deviceId) {
168
+ fetchPointList(deviceId);
169
+ }
170
+ };
171
+ var TitleNode = /*#__PURE__*/React.createElement("div", null, "\u8BBE\u5907\u70B9\u4F4D", /*#__PURE__*/React.createElement("a", {
172
+ onClick: onClickRefresh,
173
+ style: {
174
+ float: 'right',
175
+ paddingRight: '10px',
176
+ marginRight: '14px',
177
+ zIndex: 10000
178
+ }
179
+ }, /*#__PURE__*/React.createElement(SyncOutlined, null)));
180
+ var onClickPointValue = function onClickPointValue(point) {
181
+ if (!mittMeta || !point) return;
182
+ var eventName = "show-point-history-".concat(mittMeta.namespace);
183
+ emitter.emit(eventName, [{
184
+ deviceId: point.deviceId,
185
+ identifierName: point.identifierName
186
+ }]);
187
+ };
188
+ return /*#__PURE__*/React.createElement(Modal, {
189
+ title: TitleNode,
190
+ open: open,
191
+ width: 550,
192
+ zIndex: 40000,
193
+ onCancel: handleCancel,
194
+ footer: null,
195
+ getContainer: false
196
+ }, /*#__PURE__*/React.createElement(Spin, {
197
+ spinning: loading
198
+ }, /*#__PURE__*/React.createElement(Descriptions, {
199
+ column: 2
200
+ }, /*#__PURE__*/React.createElement(Descriptions.Item, {
201
+ label: "\u5236\u51B7\u72B6\u6001"
202
+ }, /*#__PURE__*/React.createElement(Link, {
203
+ onClick: function onClick() {
204
+ return onClickPointValue(coolingStatus);
205
+ }
206
+ }, pointValueFormat(coolingStatus))), /*#__PURE__*/React.createElement(Descriptions.Item, {
207
+ label: "\u98CE\u673A\u72B6\u6001"
208
+ }, /*#__PURE__*/React.createElement(Link, {
209
+ onClick: function onClick() {
210
+ return onClickPointValue(fanStatus);
211
+ }
212
+ }, pointValueFormat(fanStatus))), /*#__PURE__*/React.createElement(Descriptions.Item, {
213
+ label: "\u5316\u971C\u72B6\u6001"
214
+ }, /*#__PURE__*/React.createElement(Link, {
215
+ onClick: function onClick() {
216
+ return onClickPointValue(defrostStatus);
217
+ }
218
+ }, pointValueFormat(defrostStatus))), /*#__PURE__*/React.createElement(Descriptions.Item, {
219
+ label: "\u98CE\u673A\u6E29\u5EA6"
220
+ }, /*#__PURE__*/React.createElement(Link, {
221
+ onClick: function onClick() {
222
+ return onClickPointValue(fanTemperature);
223
+ }
224
+ }, pointValueFormat(fanTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
225
+ label: "\u63A7\u5236\u6E29\u5EA6"
226
+ }, /*#__PURE__*/React.createElement(Link, {
227
+ onClick: function onClick() {
228
+ return onClickPointValue(controlTemperature);
229
+ }
230
+ }, pointValueFormat(controlTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
231
+ label: "\u6E29\u5EA6\u8BBE\u5B9A\u503C"
232
+ }, /*#__PURE__*/React.createElement(Link, {
233
+ onClick: function onClick() {
234
+ return onClickPointValue(temperatureSetting);
235
+ }
236
+ }, pointValueFormat(temperatureSetting)))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Descriptions, {
237
+ column: 2
238
+ }, /*#__PURE__*/React.createElement(Descriptions.Item, {
239
+ label: "\u51FA\u98CE\u6E29\u5EA6"
240
+ }, /*#__PURE__*/React.createElement(Link, {
241
+ onClick: function onClick() {
242
+ return onClickPointValue(outletTemperature);
243
+ }
244
+ }, pointValueFormat(outletTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
245
+ label: "\u56DE\u98CE\u6E29\u5EA6"
246
+ }, /*#__PURE__*/React.createElement(Link, {
247
+ onClick: function onClick() {
248
+ return onClickPointValue(returnFanTemperature);
249
+ }
250
+ }, pointValueFormat(returnFanTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
251
+ label: "\u5316\u971C\u6E29\u5EA6"
252
+ }, /*#__PURE__*/React.createElement(Link, {
253
+ onClick: function onClick() {
254
+ return onClickPointValue(defrostTemperature);
255
+ }
256
+ }, pointValueFormat(defrostTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
257
+ label: "\u84B8\u53D1\u6E29\u5EA6"
258
+ }, /*#__PURE__*/React.createElement(Link, {
259
+ onClick: function onClick() {
260
+ return onClickPointValue(evaporationTemperature);
261
+ }
262
+ }, pointValueFormat(evaporationTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
263
+ label: "\u56DE\u6C14\u6E29\u5EA6"
264
+ }, /*#__PURE__*/React.createElement(Link, {
265
+ onClick: function onClick() {
266
+ return onClickPointValue(returnAirTemperature);
267
+ }
268
+ }, pointValueFormat(returnAirTemperature))), /*#__PURE__*/React.createElement(Descriptions.Item, {
269
+ label: "\u8FC7\u70ED\u5EA6"
270
+ }, /*#__PURE__*/React.createElement(Link, {
271
+ onClick: function onClick() {
272
+ return onClickPointValue(superheat);
273
+ }
274
+ }, pointValueFormat(superheat))), /*#__PURE__*/React.createElement(Descriptions.Item, {
275
+ label: "\u9600\u5F00\u5EA6"
276
+ }, /*#__PURE__*/React.createElement(Link, {
277
+ onClick: function onClick() {
278
+ return onClickPointValue(valveOpening);
279
+ }
280
+ }, pointValueFormat(valveOpening))))));
281
+ };
282
+ 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();
@@ -61,7 +61,7 @@ var EleDeviceNameComponent = function EleDeviceNameComponent(_ref) {
61
61
  console.error(err);
62
62
  },
63
63
  refreshDeps: [deviceId, fetchAble],
64
- pollingInterval: 2 * 60 * 1000
64
+ pollingInterval: 10 * 60 * 1000
65
65
  }),
66
66
  deviceInfo = _useRequest.data;
67
67
  var tooltipTitle = (deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceName) || '设备名称';
@@ -76,7 +76,7 @@ var EleDeviceStateComponent = function EleDeviceStateComponent(_ref) {
76
76
  console.error(err);
77
77
  },
78
78
  refreshDeps: [deviceId, fetchAble],
79
- pollingInterval: 2 * 60 * 1000
79
+ pollingInterval: 10 * 60 * 1000
80
80
  }),
81
81
  deviceInfo = _useRequest.data;
82
82
  var tooltipTitle = null;
@@ -62,7 +62,7 @@ var EleDeviceUpdateTimeComponent = function EleDeviceUpdateTimeComponent(_ref) {
62
62
  console.error(err);
63
63
  },
64
64
  refreshDeps: [deviceId, fetchAble],
65
- pollingInterval: 2 * 60 * 1000
65
+ pollingInterval: 10 * 60 * 1000
66
66
  }),
67
67
  deviceInfo = _useRequest.data;
68
68
  var tooltipTitle = null;
@@ -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
  }
@@ -0,0 +1,17 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useState } from 'react';
8
+ export default function usePlayer() {
9
+ var _useState = useState(),
10
+ _useState2 = _slicedToArray(_useState, 2),
11
+ mittMeta = _useState2[0],
12
+ setMittMeta = _useState2[1];
13
+ return {
14
+ mittMeta: mittMeta,
15
+ setMittMeta: setMittMeta
16
+ };
17
+ }
@@ -18,10 +18,12 @@ import { useState, useEffect, useRef } from 'react';
18
18
  import { Graph } from '@antv/x6';
19
19
  import { message } from 'antd';
20
20
  import { useSize } from 'ahooks';
21
+ import { useModel } from 'umi';
21
22
  import { getInfoFromPointId, getMittMeta } from "../../../utils";
22
23
  import isInIframe from "../../../utils/isInIframe";
23
24
  import DialogHistory from "../../../components/DialogHistory";
24
25
  import DialogPointWrite from "../../../components/DialogPointWrite";
26
+ import ModalFanDevicePoint from "../../../components/ModalFanDevicePoint";
25
27
  import emitter from "../../../utils/events";
26
28
  import { GetDevicePoint } from "../../../services/gateway/Device";
27
29
  import "./index.css";
@@ -39,18 +41,32 @@ var Player = function Player(_ref) {
39
41
  _useState2 = _slicedToArray(_useState, 2),
40
42
  visibleDialogHistory = _useState2[0],
41
43
  setVisibleDialogHistory = _useState2[1];
42
- var _useState3 = useState([]),
44
+ var _useState3 = useState(false),
43
45
  _useState4 = _slicedToArray(_useState3, 2),
44
- activePointIds = _useState4[0],
45
- setActivePointIds = _useState4[1];
46
- var _useState5 = useState([]),
46
+ visibleModalFanDevicePoint = _useState4[0],
47
+ setVisibleModalFanDevicePoint = _useState4[1];
48
+ var _useState5 = useState(false),
47
49
  _useState6 = _slicedToArray(_useState5, 2),
48
- activePoints = _useState6[0],
49
- setActivePoints = _useState6[1];
50
- var _useState7 = useState(false),
50
+ visibleDialogPointWrite = _useState6[0],
51
+ setVisibleDialogPointWrite = _useState6[1];
52
+ var _useState7 = useState([]),
51
53
  _useState8 = _slicedToArray(_useState7, 2),
52
- visibleDialogPointWrite = _useState8[0],
53
- setVisibleDialogPointWrite = _useState8[1];
54
+ activePointIds = _useState8[0],
55
+ setActivePointIds = _useState8[1];
56
+ var _useState9 = useState([]),
57
+ _useState10 = _slicedToArray(_useState9, 2),
58
+ activePoints = _useState10[0],
59
+ setActivePoints = _useState10[1];
60
+ var _useState11 = useState(),
61
+ _useState12 = _slicedToArray(_useState11, 2),
62
+ activeDeviceId = _useState12[0],
63
+ setActiveDeviceId = _useState12[1];
64
+ var _useModel = useModel('usePlayer', function (model) {
65
+ return {
66
+ setMittMeta: model.setMittMeta
67
+ };
68
+ }),
69
+ setMittMeta = _useModel.setMittMeta;
54
70
  var wrapSize = useSize(wrapRef);
55
71
  useEffect(function () {
56
72
  window.scadaMode = 'player';
@@ -161,12 +177,15 @@ var Player = function Player(_ref) {
161
177
  };
162
178
  }();
163
179
  var mittMeta = getMittMeta(query);
180
+ setMittMeta(mittMeta);
164
181
  var eventName = "show-point-history-".concat(mittMeta.namespace);
165
182
  emitter.on(eventName, handler);
166
183
  return function () {
167
184
  emitter.off(eventName, handler);
168
185
  };
169
- }, [query]);
186
+ }, [query, setMittMeta]);
187
+
188
+ // 监听显示点位写入弹窗事件
170
189
  useEffect(function () {
171
190
  var handler = /*#__PURE__*/function () {
172
191
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(points) {
@@ -199,12 +218,50 @@ var Player = function Player(_ref) {
199
218
  };
200
219
  }();
201
220
  var mittMeta = getMittMeta(query);
221
+ setMittMeta(mittMeta);
202
222
  var eventName = "show-point-write-modal-".concat(mittMeta.namespace);
203
223
  emitter.on(eventName, handler);
204
224
  return function () {
205
225
  emitter.off(eventName, handler);
206
226
  };
207
- }, [query]);
227
+ }, [query, setMittMeta]);
228
+
229
+ // 监听显示风机设备点位弹窗事件
230
+ useEffect(function () {
231
+ var handler = /*#__PURE__*/function () {
232
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
233
+ var deviceId, id;
234
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
235
+ while (1) switch (_context3.prev = _context3.next) {
236
+ case 0:
237
+ deviceId = _ref4.deviceId;
238
+ if (!(query.scene === 'product')) {
239
+ _context3.next = 3;
240
+ break;
241
+ }
242
+ return _context3.abrupt("return");
243
+ case 3:
244
+ id = query.scene === 'device' ? Number(query.deviceId) : deviceId;
245
+ setActiveDeviceId(id);
246
+ setVisibleModalFanDevicePoint(true);
247
+ case 6:
248
+ case "end":
249
+ return _context3.stop();
250
+ }
251
+ }, _callee3);
252
+ }));
253
+ return function handler(_x4) {
254
+ return _ref5.apply(this, arguments);
255
+ };
256
+ }();
257
+ var mittMeta = getMittMeta(query);
258
+ setMittMeta(mittMeta);
259
+ var eventName = "show-fan-device-point-modal-".concat(mittMeta.namespace);
260
+ emitter.on(eventName, handler);
261
+ return function () {
262
+ emitter.off(eventName, handler);
263
+ };
264
+ }, [query, setMittMeta]);
208
265
  useEffect(function () {
209
266
  if (!playerRef.current) return;
210
267
  graphRef.current = new Graph({
@@ -264,24 +321,25 @@ var Player = function Player(_ref) {
264
321
  // scene === 'device' 加载设备点位数据
265
322
  useEffect(function () {
266
323
  var mittMeta = getMittMeta(query);
324
+ setMittMeta(mittMeta);
267
325
  var fetchDevicePoints = /*#__PURE__*/function () {
268
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(deviceId) {
326
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(deviceId) {
269
327
  var res, pointList;
270
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
271
- while (1) switch (_context3.prev = _context3.next) {
328
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
329
+ while (1) switch (_context4.prev = _context4.next) {
272
330
  case 0:
273
- _context3.next = 2;
331
+ _context4.next = 2;
274
332
  return GetDevicePoint({
275
333
  deviceIdList: [deviceId]
276
334
  }, []);
277
335
  case 2:
278
- res = _context3.sent;
336
+ res = _context4.sent;
279
337
  if (res.success) {
280
- _context3.next = 6;
338
+ _context4.next = 6;
281
339
  break;
282
340
  }
283
341
  message.error('设备点位数据获取失败');
284
- return _context3.abrupt("return");
342
+ return _context4.abrupt("return");
285
343
  case 6:
286
344
  pointList = res.data || [];
287
345
  pointList.forEach(function (v) {
@@ -290,12 +348,12 @@ var Player = function Player(_ref) {
290
348
  });
291
349
  case 8:
292
350
  case "end":
293
- return _context3.stop();
351
+ return _context4.stop();
294
352
  }
295
- }, _callee3);
353
+ }, _callee4);
296
354
  }));
297
- return function fetchDevicePoints(_x4) {
298
- return _ref4.apply(this, arguments);
355
+ return function fetchDevicePoints(_x5) {
356
+ return _ref6.apply(this, arguments);
299
357
  };
300
358
  }();
301
359
  var timer;
@@ -310,29 +368,30 @@ var Player = function Player(_ref) {
310
368
  clearInterval(timer);
311
369
  }
312
370
  };
313
- }, [query, jsonConfig]);
371
+ }, [query, jsonConfig, setMittMeta]);
314
372
 
315
373
  // scene === 'freedom' 加载设备点位数据
316
374
  useEffect(function () {
317
375
  var mittMeta = getMittMeta(query);
376
+ setMittMeta(mittMeta);
318
377
  var fetchDevicePoints = /*#__PURE__*/function () {
319
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(ids) {
378
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(ids) {
320
379
  var res, pointList;
321
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
322
- while (1) switch (_context4.prev = _context4.next) {
380
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
381
+ while (1) switch (_context5.prev = _context5.next) {
323
382
  case 0:
324
- _context4.next = 2;
383
+ _context5.next = 2;
325
384
  return GetDevicePoint({
326
385
  pointIdList: ids
327
386
  }, []);
328
387
  case 2:
329
- res = _context4.sent;
388
+ res = _context5.sent;
330
389
  if (res.success) {
331
- _context4.next = 6;
390
+ _context5.next = 6;
332
391
  break;
333
392
  }
334
393
  message.error('设备点位数据获取失败');
335
- return _context4.abrupt("return");
394
+ return _context5.abrupt("return");
336
395
  case 6:
337
396
  pointList = res.data || [];
338
397
  pointList.forEach(function (v) {
@@ -340,12 +399,12 @@ var Player = function Player(_ref) {
340
399
  });
341
400
  case 8:
342
401
  case "end":
343
- return _context4.stop();
402
+ return _context5.stop();
344
403
  }
345
- }, _callee4);
404
+ }, _callee5);
346
405
  }));
347
- return function fetchDevicePoints(_x5) {
348
- return _ref5.apply(this, arguments);
406
+ return function fetchDevicePoints(_x6) {
407
+ return _ref7.apply(this, arguments);
349
408
  };
350
409
  }();
351
410
  var timer;
@@ -390,12 +449,13 @@ var Player = function Player(_ref) {
390
449
  clearInterval(timer);
391
450
  }
392
451
  };
393
- }, [query, jsonConfig]);
452
+ }, [query, jsonConfig, setMittMeta]);
394
453
  useEffect(function () {
395
454
  var graph = graphRef.current;
396
455
  if (jsonConfig && graph && query) {
397
456
  var _jsonConfig$cells2;
398
457
  var mittMeta = getMittMeta(query);
458
+ setMittMeta(mittMeta);
399
459
  jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$cells2 = jsonConfig.cells) === null || _jsonConfig$cells2 === void 0 ? void 0 : _jsonConfig$cells2.forEach(function (v) {
400
460
  if (v.data) {
401
461
  v.data.mittMeta = mittMeta;
@@ -410,13 +470,19 @@ var Player = function Player(_ref) {
410
470
  preserveAspectRatio: true // 是否保持长宽比。
411
471
  });
412
472
  }
413
- }, [jsonConfig, query]);
473
+ }, [jsonConfig, query, setMittMeta]);
414
474
  return /*#__PURE__*/React.createElement("div", {
415
475
  ref: wrapRef,
416
476
  id: "scada-player-wrap"
417
477
  }, /*#__PURE__*/React.createElement("div", {
418
478
  id: "scada-player",
419
479
  ref: playerRef
480
+ }), /*#__PURE__*/React.createElement(ModalFanDevicePoint, {
481
+ deviceId: activeDeviceId,
482
+ open: visibleModalFanDevicePoint,
483
+ onCancel: function onCancel() {
484
+ return setVisibleModalFanDevicePoint(false);
485
+ }
420
486
  }), /*#__PURE__*/React.createElement(DialogHistory, {
421
487
  visible: visibleDialogHistory,
422
488
  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.2",
3
+ "version": "1.0.4",
4
4
  "scripts": {
5
5
  "start": "umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",