@vtx/cs-map-layer 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +40 -40
- package/lib/ConfluenceLineLayer/index.d.ts +4 -0
- package/lib/ConfluenceLineLayer/index.js +51 -0
- package/lib/ConfluenceManholeLayer/index.d.ts +4 -0
- package/lib/ConfluenceManholeLayer/index.js +51 -0
- package/lib/ConfluencePointLayer/index.d.ts +4 -0
- package/lib/ConfluencePointLayer/index.js +51 -0
- package/lib/DeviceLayer/index.d.ts +11 -0
- package/lib/DeviceLayer/index.js +155 -0
- package/lib/DivisionLayer/index.d.ts +4 -0
- package/lib/DivisionLayer/index.js +26 -0
- package/lib/FacilityLayer/index.d.ts +13 -0
- package/lib/FacilityLayer/index.js +75 -0
- package/lib/Layer/index.d.ts +5 -0
- package/lib/Layer/index.js +105 -0
- package/lib/Layer/layerConfig.d.ts +82 -0
- package/lib/Layer/layerConfig.js +370 -0
- package/lib/RainLineLayer/index.d.ts +4 -0
- package/lib/RainLineLayer/index.js +54 -0
- package/lib/RainManholeLayer/index.d.ts +4 -0
- package/lib/RainManholeLayer/index.js +54 -0
- package/lib/RainPointLayer/index.d.ts +4 -0
- package/lib/RainPointLayer/index.js +54 -0
- package/lib/RawWaterLineLayer/index.d.ts +4 -0
- package/lib/RawWaterLineLayer/index.js +63 -0
- package/lib/RawWaterPointLayer/index.d.ts +4 -0
- package/lib/RawWaterPointLayer/index.js +63 -0
- package/lib/SewageLineLayer/index.d.ts +4 -0
- package/lib/SewageLineLayer/index.js +51 -0
- package/lib/SewageManholeLayer/index.d.ts +4 -0
- package/lib/SewageManholeLayer/index.js +51 -0
- package/lib/SewagePointLayer/index.d.ts +4 -0
- package/lib/SewagePointLayer/index.js +51 -0
- package/lib/WaterDrainLineLayer/index.d.ts +4 -0
- package/lib/WaterDrainLineLayer/index.js +50 -0
- package/lib/WaterDrainManholeLayer/index.d.ts +4 -0
- package/lib/WaterDrainManholeLayer/index.js +50 -0
- package/lib/WaterDrainPointLayer/index.d.ts +4 -0
- package/lib/WaterDrainPointLayer/index.js +50 -0
- package/lib/WaterSupplyLineLayer/index.d.ts +4 -0
- package/lib/WaterSupplyLineLayer/index.js +97 -0
- package/lib/WaterSupplyPointLayer/index.d.ts +8 -0
- package/lib/WaterSupplyPointLayer/index.js +85 -0
- package/lib/_components/Template/CloseBtn.d.ts +8 -0
- package/lib/_components/Template/CloseBtn.js +21 -0
- package/lib/_components/Template/CloseBtnV2.d.ts +8 -0
- package/lib/_components/Template/CloseBtnV2.js +24 -0
- package/lib/_components/Template/DeviceCustomContent.d.ts +21 -0
- package/lib/_components/Template/DeviceCustomContent.js +96 -0
- package/lib/_components/Template/DeviceTemplate.d.ts +7 -0
- package/lib/_components/Template/DeviceTemplate.js +81 -0
- package/lib/_components/Template/DeviceTemplateV2.d.ts +7 -0
- package/lib/_components/Template/DeviceTemplateV2.js +151 -0
- package/lib/_components/Template/FacilityCustomContent.d.ts +21 -0
- package/lib/_components/Template/FacilityCustomContent.js +171 -0
- package/lib/_components/Template/FacilityTemplate.d.ts +13 -0
- package/lib/_components/Template/FacilityTemplate.js +115 -0
- package/lib/_components/Template/FacilityTemplateV2.d.ts +14 -0
- package/lib/_components/Template/FacilityTemplateV2.js +119 -0
- package/lib/_components/Template/index.less +15 -0
- package/lib/_components/Template/indexV2.less +589 -0
- package/lib/_util/http.d.ts +42 -0
- package/lib/_util/http.js +161 -0
- package/lib/_util/interface.d.ts +389 -0
- package/lib/_util/interface.js +110 -0
- package/lib/_util/layerConfig.d.ts +39 -0
- package/lib/_util/layerConfig.js +779 -0
- package/lib/_util/transform.d.ts +1 -0
- package/lib/_util/transform.js +111 -0
- package/lib/_util/util.d.ts +2 -0
- package/lib/_util/util.js +24 -0
- package/lib/assets/address-dark.png +0 -0
- package/lib/assets/address.png +0 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.js +22 -0
- package/lib/typings.d.ts +4 -0
- package/package.json +2 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["params", "showModal", "customKeys", "popup", "customButton"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import { ImageLayer } from '@vtx/cs-map';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import FacilityTemplate from "../_components/Template/FacilityTemplate";
|
|
14
|
+
import FacilityTemplateV2 from "../_components/Template/FacilityTemplateV2";
|
|
15
|
+
import { FACILITY_CODE } from "../_util/interface";
|
|
16
|
+
import { facilityCodeMap } from "../_util/layerConfig";
|
|
17
|
+
import { getTenantId } from "../_util/util";
|
|
18
|
+
var WaterSupplyLineLayer = function WaterSupplyLineLayer(props) {
|
|
19
|
+
var _props$params = props.params,
|
|
20
|
+
params = _props$params === void 0 ? {} : _props$params,
|
|
21
|
+
showModal = props.showModal,
|
|
22
|
+
_props$customKeys = props.customKeys,
|
|
23
|
+
customKeys = _props$customKeys === void 0 ? [] : _props$customKeys,
|
|
24
|
+
_props$popup = props.popup,
|
|
25
|
+
popup = _props$popup === void 0 ? {
|
|
26
|
+
version: '1'
|
|
27
|
+
} : _props$popup,
|
|
28
|
+
customButton = props.customButton,
|
|
29
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
var code = FACILITY_CODE.WATER_SUPPLY_LINE;
|
|
31
|
+
var _facilityCodeMap$code = facilityCodeMap[code],
|
|
32
|
+
name = _facilityCodeMap$code.name,
|
|
33
|
+
labelField = _facilityCodeMap$code.labelField;
|
|
34
|
+
var tenantId = getTenantId();
|
|
35
|
+
return /*#__PURE__*/React.createElement(ImageLayer, _extends({
|
|
36
|
+
url: "/geoserver/zhsw/wms",
|
|
37
|
+
params: _objectSpread({
|
|
38
|
+
viewparams: "tenantId:".concat(tenantId),
|
|
39
|
+
typeName: 'zhsw:zhsw_water_supply_line'
|
|
40
|
+
}, params),
|
|
41
|
+
name: name,
|
|
42
|
+
labelField: labelField,
|
|
43
|
+
zIndex: 2,
|
|
44
|
+
legend: "GD_GD",
|
|
45
|
+
id: code,
|
|
46
|
+
template: function template(feature) {
|
|
47
|
+
if (popup.version == '2') {
|
|
48
|
+
return /*#__PURE__*/React.createElement(FacilityTemplateV2, {
|
|
49
|
+
feature: feature,
|
|
50
|
+
showModal: showModal,
|
|
51
|
+
customKeys: customKeys,
|
|
52
|
+
customButton: customButton
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return /*#__PURE__*/React.createElement(FacilityTemplate, {
|
|
56
|
+
feature: feature,
|
|
57
|
+
showModal: showModal,
|
|
58
|
+
customKeys: customKeys,
|
|
59
|
+
customButton: customButton
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
group: [{
|
|
63
|
+
name: '管径:0~400',
|
|
64
|
+
key: 'JCSS_GD_GD_1',
|
|
65
|
+
filter: '(ds < 400)',
|
|
66
|
+
legend: {
|
|
67
|
+
icon: 'GD_GD',
|
|
68
|
+
color: '#df8787'
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
name: '管径:400~600',
|
|
72
|
+
key: 'JCSS_GD_GD_2',
|
|
73
|
+
filter: '(ds < 600 and ds >= 400)',
|
|
74
|
+
legend: {
|
|
75
|
+
icon: 'GD_GD',
|
|
76
|
+
color: '#9fd741'
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
name: '管径:600~800',
|
|
80
|
+
key: 'JCSS_GD_GD_3',
|
|
81
|
+
filter: '(ds < 800 and ds >= 600)',
|
|
82
|
+
legend: {
|
|
83
|
+
icon: 'GD_GD',
|
|
84
|
+
color: '#4143d7'
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
name: '管径:800以上',
|
|
88
|
+
key: 'JCSS_GD_GD_4',
|
|
89
|
+
filter: '(ds > 800)',
|
|
90
|
+
legend: {
|
|
91
|
+
icon: 'GD_GD',
|
|
92
|
+
color: '#d741bc'
|
|
93
|
+
}
|
|
94
|
+
}]
|
|
95
|
+
}, otherProps));
|
|
96
|
+
};
|
|
97
|
+
export default WaterSupplyLineLayer;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { CommonPropsI, POINT_CHARACTERISTICS } from '../_util/interface';
|
|
3
|
+
interface PropsI {
|
|
4
|
+
groupKey?: POINT_CHARACTERISTICS[] | false;
|
|
5
|
+
customKeys?: any;
|
|
6
|
+
}
|
|
7
|
+
declare const WaterSupplyPointLayer: FC<CommonPropsI & PropsI>;
|
|
8
|
+
export default WaterSupplyPointLayer;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["params", "showModal", "groupKey", "customKeys", "popup", "customButton"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
/**
|
|
12
|
+
*供水管点
|
|
13
|
+
*/
|
|
14
|
+
import { ImageLayer } from '@vtx/cs-map';
|
|
15
|
+
import { isArray, isEmpty } from 'lodash';
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import FacilityTemplate from "../_components/Template/FacilityTemplate";
|
|
18
|
+
import FacilityTemplateV2 from "../_components/Template/FacilityTemplateV2";
|
|
19
|
+
import { FACILITY_CODE, POINT_CHARACTERISTICS, POINT_CHARACTERISTICS_STR } from "../_util/interface";
|
|
20
|
+
import { facilityCodeMap } from "../_util/layerConfig";
|
|
21
|
+
import { getTenantId } from "../_util/util";
|
|
22
|
+
var WaterSupplyPointLayer = function WaterSupplyPointLayer(props) {
|
|
23
|
+
var _props$params = props.params,
|
|
24
|
+
params = _props$params === void 0 ? {} : _props$params,
|
|
25
|
+
showModal = props.showModal,
|
|
26
|
+
groupKey = props.groupKey,
|
|
27
|
+
_props$customKeys = props.customKeys,
|
|
28
|
+
customKeys = _props$customKeys === void 0 ? [] : _props$customKeys,
|
|
29
|
+
_props$popup = props.popup,
|
|
30
|
+
popup = _props$popup === void 0 ? {
|
|
31
|
+
version: '1'
|
|
32
|
+
} : _props$popup,
|
|
33
|
+
customButton = props.customButton,
|
|
34
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
35
|
+
var code = FACILITY_CODE.WATER_SUPPLY_POINT;
|
|
36
|
+
var _facilityCodeMap$code = facilityCodeMap[code],
|
|
37
|
+
name = _facilityCodeMap$code.name,
|
|
38
|
+
labelField = _facilityCodeMap$code.labelField;
|
|
39
|
+
var tenantId = getTenantId();
|
|
40
|
+
var newGroupKey = [POINT_CHARACTERISTICS.GD_BZ, POINT_CHARACTERISTICS.GD_CSK, POINT_CHARACTERISTICS.GD_BJG, POINT_CHARACTERISTICS.GD_FM, POINT_CHARACTERISTICS.GD_JCJ, POINT_CHARACTERISTICS.GD_PQF, POINT_CHARACTERISTICS.GD_PSF, POINT_CHARACTERISTICS.GD_SB, POINT_CHARACTERISTICS.GD_XFS, POINT_CHARACTERISTICS.GD_YLD, POINT_CHARACTERISTICS.GD_PNJ, POINT_CHARACTERISTICS.GD_PXJ, POINT_CHARACTERISTICS.GD_XSJ, POINT_CHARACTERISTICS.GD_DTFB];
|
|
41
|
+
if (groupKey === false) {
|
|
42
|
+
newGroupKey = [];
|
|
43
|
+
} else if (isArray(groupKey) && !isEmpty(groupKey)) {
|
|
44
|
+
newGroupKey = groupKey;
|
|
45
|
+
}
|
|
46
|
+
var group = newGroupKey.map(function (key) {
|
|
47
|
+
var code = POINT_CHARACTERISTICS[key];
|
|
48
|
+
return {
|
|
49
|
+
name: POINT_CHARACTERISTICS_STR[code],
|
|
50
|
+
key: code,
|
|
51
|
+
filter: "append = ".concat(key),
|
|
52
|
+
legend: code
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
return /*#__PURE__*/React.createElement(ImageLayer, _extends({
|
|
56
|
+
url: "/geoserver/zhsw/wms",
|
|
57
|
+
params: _objectSpread({
|
|
58
|
+
viewparams: "tenantId:".concat(tenantId),
|
|
59
|
+
typeName: 'zhsw:zhsw_water_supply_point'
|
|
60
|
+
}, params),
|
|
61
|
+
name: name,
|
|
62
|
+
labelField: labelField,
|
|
63
|
+
zIndex: 2,
|
|
64
|
+
legend: "GD_POINT",
|
|
65
|
+
id: code,
|
|
66
|
+
template: function template(feature) {
|
|
67
|
+
if (popup.version == '2') {
|
|
68
|
+
return /*#__PURE__*/React.createElement(FacilityTemplateV2, {
|
|
69
|
+
feature: feature,
|
|
70
|
+
showModal: showModal,
|
|
71
|
+
customKeys: customKeys,
|
|
72
|
+
customButton: customButton
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return /*#__PURE__*/React.createElement(FacilityTemplate, {
|
|
76
|
+
feature: feature,
|
|
77
|
+
showModal: showModal,
|
|
78
|
+
customKeys: customKeys,
|
|
79
|
+
customButton: customButton
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
group: group
|
|
83
|
+
}, otherProps));
|
|
84
|
+
};
|
|
85
|
+
export default WaterSupplyPointLayer;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
import { useProps } from '@vtx/cs-map';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
var CloseBtn = function CloseBtn(props) {
|
|
6
|
+
var feature = props.feature,
|
|
7
|
+
type = props.type;
|
|
8
|
+
var _useProps = useProps(),
|
|
9
|
+
showModal = _useProps.showModal;
|
|
10
|
+
return /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
|
|
11
|
+
onClick: function onClick() {
|
|
12
|
+
if (props.showModal) {
|
|
13
|
+
props.showModal(feature);
|
|
14
|
+
} else if (showModal) {
|
|
15
|
+
showModal(feature, type);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
className: "close-btn"
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export default CloseBtn;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useProps } from '@vtx/cs-map';
|
|
4
|
+
var CloseBtn = function CloseBtn(props) {
|
|
5
|
+
var feature = props.feature,
|
|
6
|
+
type = props.type,
|
|
7
|
+
facilityDetail = props.facilityDetail;
|
|
8
|
+
var _useProps = useProps(),
|
|
9
|
+
showModal = _useProps.showModal;
|
|
10
|
+
if (!props.showModal && !showModal) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
|
|
14
|
+
onClick: function onClick() {
|
|
15
|
+
if (props.showModal) {
|
|
16
|
+
props.showModal(feature, type, facilityDetail);
|
|
17
|
+
} else if (showModal) {
|
|
18
|
+
showModal(feature, type, facilityDetail);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
className: "close-btn"
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export default CloseBtn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare function CustomContent(props: any): React.JSX.Element;
|
|
4
|
+
declare namespace CustomContent {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
dark: PropTypes.Requireable<boolean>;
|
|
7
|
+
type: PropTypes.Requireable<string>;
|
|
8
|
+
code: PropTypes.Requireable<string>;
|
|
9
|
+
params: PropTypes.Requireable<object>;
|
|
10
|
+
styleOption: PropTypes.Requireable<object>;
|
|
11
|
+
showModal: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
+
deviceDetail: PropTypes.Requireable<object>;
|
|
14
|
+
deviceData: PropTypes.Requireable<object>;
|
|
15
|
+
valueField: PropTypes.Requireable<string>;
|
|
16
|
+
customButton: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
|
|
17
|
+
popup: PropTypes.Requireable<object>;
|
|
18
|
+
detail: PropTypes.Requireable<object>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export default CustomContent;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
2
|
+
import { getVtxToken } from '@vtx/utils';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Tooltip } from "antd";
|
|
7
|
+
function CustomContent(props) {
|
|
8
|
+
var _ref = getVtxToken() || {},
|
|
9
|
+
token = _ref.token,
|
|
10
|
+
tenantId = _ref.tenantId,
|
|
11
|
+
userId = _ref.userId;
|
|
12
|
+
var _onClick = props.onClick,
|
|
13
|
+
deviceDetail = props.deviceDetail,
|
|
14
|
+
deviceData = props.deviceData,
|
|
15
|
+
dark = props.dark;
|
|
16
|
+
// console.log(showModal, valueField, customButton, popup, otherProps, 'CustomContent');
|
|
17
|
+
var handleClassName = function handleClassName(str) {
|
|
18
|
+
var commonClassnames = "device-layer-custom-content".concat(dark ? '-dark' : '');
|
|
19
|
+
return str ? "".concat(commonClassnames, "-").concat(str) : commonClassnames;
|
|
20
|
+
};
|
|
21
|
+
var getLastUpdateTime = function getLastUpdateTime(arr) {
|
|
22
|
+
var _arr$sort;
|
|
23
|
+
return ((_arr$sort = arr.sort(function (a, b) {
|
|
24
|
+
return new Date(b.updateTime).getTime() - new Date(a.updateTime).getTime();
|
|
25
|
+
})) === null || _arr$sort === void 0 || (_arr$sort = _arr$sort[0]) === null || _arr$sort === void 0 ? void 0 : _arr$sort.updateTime) || '';
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: classnames(handleClassName()),
|
|
29
|
+
onClick: function onClick() {
|
|
30
|
+
_onClick && _onClick();
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: classnames(handleClassName('title'))
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: classnames(handleClassName('title-left')),
|
|
36
|
+
title: (deviceDetail === null || deviceDetail === void 0 ? void 0 : deviceDetail.name) || ''
|
|
37
|
+
}, (deviceDetail === null || deviceDetail === void 0 ? void 0 : deviceDetail.name) || ''), /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: classnames(handleClassName('title-right'))
|
|
39
|
+
}, (deviceDetail === null || deviceDetail === void 0 ? void 0 : deviceDetail.deviceTypeName) || '-')), /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: classnames(handleClassName('contentBox'))
|
|
41
|
+
}, (deviceDetail === null || deviceDetail === void 0 ? void 0 : deviceDetail.installAddress) && /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: classnames(handleClassName('keyParam'))
|
|
43
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: classnames(handleClassName('keyParam-deviceDetail'))
|
|
45
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
46
|
+
src: require("../../assets/address".concat(dark ? '-dark' : '', ".png"))
|
|
47
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: classnames(handleClassName('keyParam-deviceDetail-address')),
|
|
49
|
+
title: (deviceDetail === null || deviceDetail === void 0 ? void 0 : deviceDetail.installAddress) || ''
|
|
50
|
+
}, (deviceDetail === null || deviceDetail === void 0 ? void 0 : deviceDetail.installAddress) || '')), /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: classnames(handleClassName('keyParam-line'))
|
|
52
|
+
})), deviceData !== null && deviceData !== void 0 && deviceData.length ? /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: classnames(handleClassName('keyIndicators'))
|
|
54
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: classnames(handleClassName('keyIndicators-item'))
|
|
56
|
+
}, getLastUpdateTime(deviceData.filter(function (v) {
|
|
57
|
+
return v.updateTime;
|
|
58
|
+
}) || [])), deviceData === null || deviceData === void 0 ? void 0 : deviceData.map(function (v) {
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
key: v === null || v === void 0 ? void 0 : v.name,
|
|
61
|
+
className: classnames(handleClassName('keyIndicators-item'))
|
|
62
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: classnames(handleClassName('keyIndicators-item-left'))
|
|
64
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: classnames(handleClassName('keyIndicators-item-round'))
|
|
66
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
67
|
+
className: classnames(handleClassName('keyIndicators-item-left-name'))
|
|
68
|
+
}, v.name || ''), /*#__PURE__*/React.createElement("span", null, v.unit ? "\uFF08".concat(v.unit, "\uFF09") : '', ":"), /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
className: classnames(handleClassName('keyIndicators-item-left-value'), {
|
|
70
|
+
'is-alarm': v.onAlarm
|
|
71
|
+
})
|
|
72
|
+
}, v.value || v.value == 0 ? v.value : '', v.onAlarm ? /*#__PURE__*/React.createElement(React.Fragment, null, " (".concat(v.alarmLevel, "\u7EA7\u62A5\u8B66) "), /*#__PURE__*/React.createElement(Tooltip, {
|
|
73
|
+
title: v.alarmDescription
|
|
74
|
+
}, /*#__PURE__*/React.createElement(QuestionCircleOutlined, {
|
|
75
|
+
style: {
|
|
76
|
+
color: '#fff'
|
|
77
|
+
}
|
|
78
|
+
}))) : '')));
|
|
79
|
+
})) : null));
|
|
80
|
+
}
|
|
81
|
+
CustomContent.propTypes = {
|
|
82
|
+
dark: PropTypes.bool,
|
|
83
|
+
type: PropTypes.string,
|
|
84
|
+
code: PropTypes.string,
|
|
85
|
+
params: PropTypes.object,
|
|
86
|
+
styleOption: PropTypes.object,
|
|
87
|
+
showModal: PropTypes.func,
|
|
88
|
+
onClick: PropTypes.func,
|
|
89
|
+
deviceDetail: PropTypes.object,
|
|
90
|
+
deviceData: PropTypes.object,
|
|
91
|
+
valueField: PropTypes.string,
|
|
92
|
+
customButton: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
|
|
93
|
+
popup: PropTypes.object,
|
|
94
|
+
detail: PropTypes.object
|
|
95
|
+
};
|
|
96
|
+
export default CustomContent;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { Col, Empty, Row, Spin } from 'antd';
|
|
12
|
+
import React, { useEffect, useState } from 'react';
|
|
13
|
+
import http from "../../_util/http";
|
|
14
|
+
import CloseBtn from "./CloseBtn";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
var DeviceTemplate = function DeviceTemplate(props) {
|
|
17
|
+
var feature = props.feature,
|
|
18
|
+
showModal = props.showModal;
|
|
19
|
+
var _useState = useState(false),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
loading = _useState2[0],
|
|
22
|
+
setLoading = _useState2[1];
|
|
23
|
+
var _useState3 = useState([]),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
deviceData = _useState4[0],
|
|
26
|
+
setDeviceData = _useState4[1];
|
|
27
|
+
var _ref = (feature === null || feature === void 0 ? void 0 : feature.values_) || {},
|
|
28
|
+
id = _ref.id;
|
|
29
|
+
var getDeviceData = function getDeviceData(id) {
|
|
30
|
+
setLoading(true);
|
|
31
|
+
http.get('/cloud/zhsw-jcyj/api/dataQuery/getFactorReal', {
|
|
32
|
+
body: {
|
|
33
|
+
deviceId: id
|
|
34
|
+
}
|
|
35
|
+
}).then(function (res) {
|
|
36
|
+
var _res$data;
|
|
37
|
+
setLoading(false);
|
|
38
|
+
var data = [];
|
|
39
|
+
if (String(res === null || res === void 0 ? void 0 : res.result) === '0') {
|
|
40
|
+
data = res.data.map(function (item) {
|
|
41
|
+
return {
|
|
42
|
+
label: item !== null && item !== void 0 && item.unit ? "".concat(item.factorName, "(").concat(item === null || item === void 0 ? void 0 : item.unit, ")") : item.factorName,
|
|
43
|
+
key: item.factorCode,
|
|
44
|
+
value: item.monitorValue
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// // 默认最多展示4条数据
|
|
49
|
+
// if (data?.length > 4) {
|
|
50
|
+
// data = data.slice(0, 4);
|
|
51
|
+
// }
|
|
52
|
+
// 固定加入
|
|
53
|
+
setDeviceData([].concat(_toConsumableArray(data), [{
|
|
54
|
+
label: '数据采集时间',
|
|
55
|
+
key: 'monitorTime',
|
|
56
|
+
value: (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data[0]) === null || _res$data === void 0 ? void 0 : _res$data.monitorTime
|
|
57
|
+
}]));
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (id) {
|
|
62
|
+
getDeviceData(id);
|
|
63
|
+
}
|
|
64
|
+
}, [id]);
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "cesium-popup-v1"
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
68
|
+
spinning: loading,
|
|
69
|
+
size: "small"
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Row, null, deviceData === null || deviceData === void 0 ? void 0 : deviceData.map(function (item, index) {
|
|
71
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
72
|
+
span: 24,
|
|
73
|
+
key: index
|
|
74
|
+
}, item.label, "\uFF1A", item.value || String(item.value) === '0' ? item.value : '--');
|
|
75
|
+
})), !(deviceData !== null && deviceData !== void 0 && deviceData.length) && /*#__PURE__*/React.createElement(Empty, null)), /*#__PURE__*/React.createElement(CloseBtn, {
|
|
76
|
+
showModal: showModal,
|
|
77
|
+
feature: feature,
|
|
78
|
+
type: "2"
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
export default DeviceTemplate;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import { Spin } from 'antd';
|
|
18
|
+
import React, { useEffect, useState } from 'react';
|
|
19
|
+
import http from "../../_util/http";
|
|
20
|
+
import CloseBtn from "./CloseBtnV2";
|
|
21
|
+
import CustomContent from "./DeviceCustomContent";
|
|
22
|
+
import { getVtxToken } from '@vtx/utils';
|
|
23
|
+
var _ref = getVtxToken() || {},
|
|
24
|
+
token = _ref.token,
|
|
25
|
+
tenantId = _ref.tenantId,
|
|
26
|
+
userId = _ref.userId;
|
|
27
|
+
import "./indexV2.less";
|
|
28
|
+
var DeviceTemplate = function DeviceTemplate(props) {
|
|
29
|
+
var feature = props.feature,
|
|
30
|
+
showModal = props.showModal;
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
loading = _useState2[0],
|
|
34
|
+
setLoading = _useState2[1];
|
|
35
|
+
var _useState3 = useState([]),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
deviceData = _useState4[0],
|
|
38
|
+
setDeviceData = _useState4[1];
|
|
39
|
+
var _useState5 = useState({}),
|
|
40
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
+
deviceDetail = _useState6[0],
|
|
42
|
+
setDeviceDetail = _useState6[1];
|
|
43
|
+
var _useState7 = useState([]),
|
|
44
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
45
|
+
factorValuesList = _useState8[0],
|
|
46
|
+
setFactorValuesList = _useState8[1];
|
|
47
|
+
var _ref2 = (feature === null || feature === void 0 ? void 0 : feature.values_) || {},
|
|
48
|
+
id = _ref2.id;
|
|
49
|
+
var getDeviceDetail = function getDeviceDetail(id) {
|
|
50
|
+
http.get('/cloud/device/entity/getBasicInfo', {
|
|
51
|
+
body: {
|
|
52
|
+
deviceId: id,
|
|
53
|
+
coordinateType: 'wgs84'
|
|
54
|
+
}
|
|
55
|
+
}).then(function (res) {
|
|
56
|
+
if (String(res === null || res === void 0 ? void 0 : res.result) === '0') {
|
|
57
|
+
setDeviceDetail(res.data || {});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var getDeviceData = function getDeviceData(id) {
|
|
62
|
+
setLoading(true);
|
|
63
|
+
http.get('/cloud/zhsw-jcyj/api/dataQuery/getFactorReal', {
|
|
64
|
+
body: {
|
|
65
|
+
deviceId: id
|
|
66
|
+
}
|
|
67
|
+
}).then(function (res) {
|
|
68
|
+
var _res$data;
|
|
69
|
+
setLoading(false);
|
|
70
|
+
var data = [];
|
|
71
|
+
if (String(res === null || res === void 0 ? void 0 : res.result) === '0') {
|
|
72
|
+
data = res.data.map(function (item) {
|
|
73
|
+
return {
|
|
74
|
+
label: item !== null && item !== void 0 && item.unit ? "".concat(item.factorName, "(").concat(item === null || item === void 0 ? void 0 : item.unit, ")") : item.factorName,
|
|
75
|
+
key: item.factorCode,
|
|
76
|
+
value: item.monitorValue
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// // 默认最多展示4条数据
|
|
81
|
+
// if (data?.length > 4) {
|
|
82
|
+
// data = data.slice(0, 4);
|
|
83
|
+
// }
|
|
84
|
+
// 固定加入
|
|
85
|
+
setDeviceData([].concat(_toConsumableArray(data), [{
|
|
86
|
+
label: '数据采集时间',
|
|
87
|
+
key: 'monitorTime',
|
|
88
|
+
value: (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data[0]) === null || _res$data === void 0 ? void 0 : _res$data.monitorTime
|
|
89
|
+
}]));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
var getDeviceValues = function getDeviceValues(id) {
|
|
93
|
+
http.get('/cloud/device/sdk/factor/realTime/deviceValues', {
|
|
94
|
+
body: {
|
|
95
|
+
tenantId: tenantId,
|
|
96
|
+
deviceId: id
|
|
97
|
+
}
|
|
98
|
+
}).then(function (res) {
|
|
99
|
+
var data = [];
|
|
100
|
+
if (String(res === null || res === void 0 ? void 0 : res.result) === '0') {
|
|
101
|
+
var _res$data2;
|
|
102
|
+
res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 || _res$data2.map(function (item) {
|
|
103
|
+
var _item$factorValues;
|
|
104
|
+
item === null || item === void 0 || (_item$factorValues = item.factorValues) === null || _item$factorValues === void 0 || _item$factorValues.map(function (v) {
|
|
105
|
+
data.push(_objectSpread(_objectSpread({}, v), {}, {
|
|
106
|
+
name: v === null || v === void 0 ? void 0 : v.monitorItemName,
|
|
107
|
+
unit: v === null || v === void 0 ? void 0 : v.unit,
|
|
108
|
+
value: v === null || v === void 0 ? void 0 : v.formatValue,
|
|
109
|
+
updateTime: v === null || v === void 0 ? void 0 : v.timeDesc
|
|
110
|
+
}));
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
setFactorValuesList(data);
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
useEffect(function () {
|
|
118
|
+
if (id) {
|
|
119
|
+
getDeviceData(id);
|
|
120
|
+
// 获取设备详情
|
|
121
|
+
getDeviceDetail(id);
|
|
122
|
+
// 获取设备的实时因子
|
|
123
|
+
getDeviceValues(id);
|
|
124
|
+
}
|
|
125
|
+
}, [id]);
|
|
126
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: "cesium-popup-v2"
|
|
128
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
129
|
+
spinning: loading,
|
|
130
|
+
size: "small"
|
|
131
|
+
}, /*#__PURE__*/React.createElement(CustomContent, {
|
|
132
|
+
dark: true,
|
|
133
|
+
deviceData: factorValuesList,
|
|
134
|
+
deviceDetail: deviceDetail
|
|
135
|
+
// feature={feature}
|
|
136
|
+
,
|
|
137
|
+
onClick: function onClick() {
|
|
138
|
+
// if (props.showModal) {
|
|
139
|
+
// props.showModal(feature, map, '1');
|
|
140
|
+
// } else {
|
|
141
|
+
// showModal && showModal(feature, map, '1');
|
|
142
|
+
// }
|
|
143
|
+
}
|
|
144
|
+
})), /*#__PURE__*/React.createElement(CloseBtn, {
|
|
145
|
+
facilityDetail: deviceDetail,
|
|
146
|
+
showModal: showModal,
|
|
147
|
+
feature: feature,
|
|
148
|
+
type: "2"
|
|
149
|
+
}));
|
|
150
|
+
};
|
|
151
|
+
export default DeviceTemplate;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
declare function CustomContent(props: any): React.JSX.Element;
|
|
4
|
+
declare namespace CustomContent {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
dark: PropTypes.Requireable<boolean>;
|
|
7
|
+
type: PropTypes.Requireable<string>;
|
|
8
|
+
code: PropTypes.Requireable<string>;
|
|
9
|
+
params: PropTypes.Requireable<object>;
|
|
10
|
+
styleOption: PropTypes.Requireable<object>;
|
|
11
|
+
showModal: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
+
facilityDetail: PropTypes.Requireable<object>;
|
|
14
|
+
valueField: PropTypes.Requireable<string>;
|
|
15
|
+
customButton: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
|
|
16
|
+
popup: PropTypes.Requireable<object>;
|
|
17
|
+
detail: PropTypes.Requireable<object>;
|
|
18
|
+
extraKeyParamList: PropTypes.Requireable<any[]>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export default CustomContent;
|