@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.
Files changed (78) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +40 -40
  3. package/lib/ConfluenceLineLayer/index.d.ts +4 -0
  4. package/lib/ConfluenceLineLayer/index.js +51 -0
  5. package/lib/ConfluenceManholeLayer/index.d.ts +4 -0
  6. package/lib/ConfluenceManholeLayer/index.js +51 -0
  7. package/lib/ConfluencePointLayer/index.d.ts +4 -0
  8. package/lib/ConfluencePointLayer/index.js +51 -0
  9. package/lib/DeviceLayer/index.d.ts +11 -0
  10. package/lib/DeviceLayer/index.js +155 -0
  11. package/lib/DivisionLayer/index.d.ts +4 -0
  12. package/lib/DivisionLayer/index.js +26 -0
  13. package/lib/FacilityLayer/index.d.ts +13 -0
  14. package/lib/FacilityLayer/index.js +75 -0
  15. package/lib/Layer/index.d.ts +5 -0
  16. package/lib/Layer/index.js +105 -0
  17. package/lib/Layer/layerConfig.d.ts +82 -0
  18. package/lib/Layer/layerConfig.js +370 -0
  19. package/lib/RainLineLayer/index.d.ts +4 -0
  20. package/lib/RainLineLayer/index.js +54 -0
  21. package/lib/RainManholeLayer/index.d.ts +4 -0
  22. package/lib/RainManholeLayer/index.js +54 -0
  23. package/lib/RainPointLayer/index.d.ts +4 -0
  24. package/lib/RainPointLayer/index.js +54 -0
  25. package/lib/RawWaterLineLayer/index.d.ts +4 -0
  26. package/lib/RawWaterLineLayer/index.js +63 -0
  27. package/lib/RawWaterPointLayer/index.d.ts +4 -0
  28. package/lib/RawWaterPointLayer/index.js +63 -0
  29. package/lib/SewageLineLayer/index.d.ts +4 -0
  30. package/lib/SewageLineLayer/index.js +51 -0
  31. package/lib/SewageManholeLayer/index.d.ts +4 -0
  32. package/lib/SewageManholeLayer/index.js +51 -0
  33. package/lib/SewagePointLayer/index.d.ts +4 -0
  34. package/lib/SewagePointLayer/index.js +51 -0
  35. package/lib/WaterDrainLineLayer/index.d.ts +4 -0
  36. package/lib/WaterDrainLineLayer/index.js +50 -0
  37. package/lib/WaterDrainManholeLayer/index.d.ts +4 -0
  38. package/lib/WaterDrainManholeLayer/index.js +50 -0
  39. package/lib/WaterDrainPointLayer/index.d.ts +4 -0
  40. package/lib/WaterDrainPointLayer/index.js +50 -0
  41. package/lib/WaterSupplyLineLayer/index.d.ts +4 -0
  42. package/lib/WaterSupplyLineLayer/index.js +97 -0
  43. package/lib/WaterSupplyPointLayer/index.d.ts +8 -0
  44. package/lib/WaterSupplyPointLayer/index.js +85 -0
  45. package/lib/_components/Template/CloseBtn.d.ts +8 -0
  46. package/lib/_components/Template/CloseBtn.js +21 -0
  47. package/lib/_components/Template/CloseBtnV2.d.ts +8 -0
  48. package/lib/_components/Template/CloseBtnV2.js +24 -0
  49. package/lib/_components/Template/DeviceCustomContent.d.ts +21 -0
  50. package/lib/_components/Template/DeviceCustomContent.js +96 -0
  51. package/lib/_components/Template/DeviceTemplate.d.ts +7 -0
  52. package/lib/_components/Template/DeviceTemplate.js +81 -0
  53. package/lib/_components/Template/DeviceTemplateV2.d.ts +7 -0
  54. package/lib/_components/Template/DeviceTemplateV2.js +151 -0
  55. package/lib/_components/Template/FacilityCustomContent.d.ts +21 -0
  56. package/lib/_components/Template/FacilityCustomContent.js +171 -0
  57. package/lib/_components/Template/FacilityTemplate.d.ts +13 -0
  58. package/lib/_components/Template/FacilityTemplate.js +115 -0
  59. package/lib/_components/Template/FacilityTemplateV2.d.ts +14 -0
  60. package/lib/_components/Template/FacilityTemplateV2.js +119 -0
  61. package/lib/_components/Template/index.less +15 -0
  62. package/lib/_components/Template/indexV2.less +589 -0
  63. package/lib/_util/http.d.ts +42 -0
  64. package/lib/_util/http.js +161 -0
  65. package/lib/_util/interface.d.ts +389 -0
  66. package/lib/_util/interface.js +110 -0
  67. package/lib/_util/layerConfig.d.ts +39 -0
  68. package/lib/_util/layerConfig.js +779 -0
  69. package/lib/_util/transform.d.ts +1 -0
  70. package/lib/_util/transform.js +111 -0
  71. package/lib/_util/util.d.ts +2 -0
  72. package/lib/_util/util.js +24 -0
  73. package/lib/assets/address-dark.png +0 -0
  74. package/lib/assets/address.png +0 -0
  75. package/lib/index.d.ts +22 -0
  76. package/lib/index.js +22 -0
  77. package/lib/typings.d.ts +4 -0
  78. package/package.json +2 -1
@@ -0,0 +1,171 @@
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(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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { getVtxToken } from '@vtx/utils';
8
+ import classnames from 'classnames';
9
+ import React, { useEffect, useState } from 'react';
10
+ import http from "../../_util/http";
11
+ import { facilityPopup } from "../../_util/layerConfig";
12
+ // import address from '../../assets/address.png';
13
+ // import addressDark from '../../assets/address-dark.png';
14
+ import _ from 'lodash';
15
+ import PropTypes from 'prop-types';
16
+ var _ref = getVtxToken() || {},
17
+ token = _ref.token,
18
+ tenantId = _ref.tenantId,
19
+ userId = _ref.userId;
20
+ function CustomContent(props) {
21
+ var _item$keyParamList, _item$keyParamList2, _item$factorValuesLis, _item$factorValuesLis2;
22
+ var _onClick = props.onClick,
23
+ facilityDetail = props.facilityDetail,
24
+ dark = props.dark,
25
+ _props$extraKeyParamL = props.extraKeyParamList,
26
+ extraKeyParamList = _props$extraKeyParamL === void 0 ? [] : _props$extraKeyParamL;
27
+ // !-解决因子不能及时更新问题
28
+ var _useState = useState(0),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ _refresh = _useState2[0],
31
+ setRefresh = _useState2[1];
32
+ var handleClassName = function handleClassName(str) {
33
+ var commonClassnames = "facility-layer-custom-content".concat(dark ? '-dark' : '');
34
+ return str ? "".concat(commonClassnames, "-").concat(str) : commonClassnames;
35
+ };
36
+ // 设施信息 facilityDetail
37
+ // 配置的某一个项
38
+ var item = facilityPopup[facilityDetail.typeCode];
39
+ useEffect(function () {
40
+ if (!_.isEmpty(facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.id)) {
41
+ // 获取配置因子
42
+ http.get("/cloud/device/sdk/factor/realTime/factorValues", {
43
+ body: {
44
+ tenantId: tenantId,
45
+ facilityIds: facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.id
46
+ }
47
+ }).then(function (res) {
48
+ // console.log(res, res.data, '获取配置因子');
49
+ if (!res.result && res.data) {
50
+ var _item$keyIndicatorsLi;
51
+ var list = [];
52
+ var temp = (_item$keyIndicatorsLi = item.keyIndicatorsList) === null || _item$keyIndicatorsLi === void 0 ? void 0 : _item$keyIndicatorsLi.map(function (v) {
53
+ return v.value;
54
+ });
55
+ if (temp !== null && temp !== void 0 && temp.length) {
56
+ var _res$data;
57
+ // 显示固定的一些字段
58
+ list = (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.filter(function (m) {
59
+ return temp === null || temp === void 0 ? void 0 : temp.includes(m.monitorItemCode);
60
+ })) === null || _res$data === void 0 ? void 0 : _res$data.map(function (v) {
61
+ return {
62
+ name: v === null || v === void 0 ? void 0 : v.factorName,
63
+ unit: v === null || v === void 0 ? void 0 : v.unit,
64
+ value: v === null || v === void 0 ? void 0 : v.formatValue,
65
+ updateTime: v === null || v === void 0 ? void 0 : v.timeDesc
66
+ };
67
+ });
68
+ } else {
69
+ if (item.showKeyIndicatorsListAll) {
70
+ var _res$data2;
71
+ // 展示所有的
72
+ list = (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.map(function (v) {
73
+ return {
74
+ name: v === null || v === void 0 ? void 0 : v.factorName,
75
+ unit: v === null || v === void 0 ? void 0 : v.unit,
76
+ value: v === null || v === void 0 ? void 0 : v.formatValue,
77
+ updateTime: v === null || v === void 0 ? void 0 : v.timeDesc
78
+ };
79
+ });
80
+ } else {
81
+ // 不展示配置因子
82
+ }
83
+ }
84
+ // console.log(list, item, '配置因子列表');
85
+ item.factorValuesList = _.cloneDeep(list);
86
+ setRefresh(Math.random());
87
+ }
88
+ }).catch(function () {
89
+ return {};
90
+ });
91
+ }
92
+ }, [JSON.stringify(facilityDetail)]);
93
+ var getLastUpdateTime = function getLastUpdateTime(arr) {
94
+ var _arr$sort;
95
+ return ((_arr$sort = arr.sort(function (a, b) {
96
+ return new Date(b.updateTime).getTime() - new Date(a.updateTime).getTime();
97
+ })) === null || _arr$sort === void 0 || (_arr$sort = _arr$sort[0]) === null || _arr$sort === void 0 ? void 0 : _arr$sort.updateTime) || '';
98
+ };
99
+ return /*#__PURE__*/React.createElement("div", {
100
+ className: classnames(handleClassName()),
101
+ onClick: function onClick() {
102
+ _onClick && _onClick();
103
+ }
104
+ }, /*#__PURE__*/React.createElement("div", {
105
+ className: classnames(handleClassName('title'))
106
+ }, /*#__PURE__*/React.createElement("div", {
107
+ className: classnames(handleClassName('title-left')),
108
+ title: (facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.name) || ''
109
+ }, (facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.name) || ''), /*#__PURE__*/React.createElement("div", {
110
+ className: classnames(handleClassName('title-right'))
111
+ }, item !== null && item !== void 0 && item.facilityClassName ? facilityDetail[item === null || item === void 0 ? void 0 : item.facilityClassName] : facilityDetail !== null && facilityDetail !== void 0 && facilityDetail.facilityClassName || facilityDetail !== null && facilityDetail !== void 0 && facilityDetail.typeName ? (facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.facilityClassName) || (facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.typeName) : item === null || item === void 0 ? void 0 : item.facilityClassStr)), /*#__PURE__*/React.createElement("div", {
112
+ className: classnames(handleClassName('contentBox'))
113
+ }, /*#__PURE__*/React.createElement("div", {
114
+ className: classnames(handleClassName('keyParam'))
115
+ }, /*#__PURE__*/React.createElement("div", {
116
+ className: classnames(handleClassName('keyParam-item'))
117
+ }, /*#__PURE__*/React.createElement("img", {
118
+ src: require("../../assets/address".concat(dark ? '-dark' : '', ".png"))
119
+ }), /*#__PURE__*/React.createElement("div", {
120
+ className: classnames(handleClassName('keyParam-item-address')),
121
+ title: (facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.address) || ''
122
+ }, (facilityDetail === null || facilityDetail === void 0 ? void 0 : facilityDetail.address) || '')), item === null || item === void 0 || (_item$keyParamList = item.keyParamList) === null || _item$keyParamList === void 0 ? void 0 : _item$keyParamList.map(function (v) {
123
+ var _facilityDetail$dataJ, _facilityDetail$dataJ2, _facilityDetail$dataJ3;
124
+ return /*#__PURE__*/React.createElement("div", {
125
+ key: v === null || v === void 0 ? void 0 : v.value,
126
+ className: classnames(handleClassName('keyParam-item'))
127
+ }, v.label || '', "\xA0: \xA0", v.label == '所属河道' ? (facilityDetail === null || facilityDetail === void 0 || (_facilityDetail$dataJ = facilityDetail.dataJson) === null || _facilityDetail$dataJ === void 0 ? void 0 : _facilityDetail$dataJ.regionTypeValue) == '河道' ? (facilityDetail === null || facilityDetail === void 0 || (_facilityDetail$dataJ2 = facilityDetail.dataJson) === null || _facilityDetail$dataJ2 === void 0 ? void 0 : _facilityDetail$dataJ2.regionObjectName) || '' : '' : (facilityDetail === null || facilityDetail === void 0 || (_facilityDetail$dataJ3 = facilityDetail.dataJson) === null || _facilityDetail$dataJ3 === void 0 ? void 0 : _facilityDetail$dataJ3[v.value]) || '');
128
+ }), item !== null && item !== void 0 && (_item$keyParamList2 = item.keyParamList) !== null && _item$keyParamList2 !== void 0 && _item$keyParamList2.length ? /*#__PURE__*/React.createElement("div", {
129
+ className: classnames(handleClassName('keyParam-line'))
130
+ }) : null), item !== null && item !== void 0 && (_item$factorValuesLis = item.factorValuesList) !== null && _item$factorValuesLis !== void 0 && _item$factorValuesLis.length ? /*#__PURE__*/React.createElement("div", {
131
+ className: classnames(handleClassName('keyIndicators'))
132
+ }, /*#__PURE__*/React.createElement("div", {
133
+ className: classnames(handleClassName('keyIndicators-item'))
134
+ }, getLastUpdateTime((item === null || item === void 0 ? void 0 : item.factorValuesList.filter(function (v) {
135
+ return v.updateTime;
136
+ })) || [])), item === null || item === void 0 || (_item$factorValuesLis2 = item.factorValuesList) === null || _item$factorValuesLis2 === void 0 ? void 0 : _item$factorValuesLis2.map(function (v) {
137
+ return /*#__PURE__*/React.createElement("div", {
138
+ key: v === null || v === void 0 ? void 0 : v.name,
139
+ className: classnames(handleClassName('keyIndicators-item'))
140
+ }, /*#__PURE__*/React.createElement("div", {
141
+ className: classnames(handleClassName('keyIndicators-item-left'))
142
+ }, /*#__PURE__*/React.createElement("div", {
143
+ className: classnames(handleClassName('keyIndicators-item-round'))
144
+ }), /*#__PURE__*/React.createElement("span", {
145
+ className: classnames(handleClassName('keyIndicators-item-left-name'))
146
+ }, v.name || ''), /*#__PURE__*/React.createElement("span", null, v.unit ? "\uFF08".concat(v.unit, "\uFF09") : '', ":"), /*#__PURE__*/React.createElement("span", {
147
+ className: classnames(handleClassName('keyIndicators-item-left-value'))
148
+ }, v.value || v.value == 0 ? v.value : '')));
149
+ })) : null, extraKeyParamList !== null && extraKeyParamList !== void 0 && extraKeyParamList.length ? extraKeyParamList === null || extraKeyParamList === void 0 ? void 0 : extraKeyParamList.map(function (item) {
150
+ return /*#__PURE__*/React.createElement("div", {
151
+ key: item.name,
152
+ className: item.className || ''
153
+ }, item.name && /*#__PURE__*/React.createElement("span", null, item.name || '', "\xA0: \xA0"), item.value || item.value === 0 ? item.value : '', item.unit || '');
154
+ }) : null));
155
+ }
156
+ CustomContent.propTypes = {
157
+ dark: PropTypes.bool,
158
+ type: PropTypes.string,
159
+ code: PropTypes.string,
160
+ params: PropTypes.object,
161
+ styleOption: PropTypes.object,
162
+ showModal: PropTypes.func,
163
+ onClick: PropTypes.func,
164
+ facilityDetail: PropTypes.object,
165
+ valueField: PropTypes.string,
166
+ customButton: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
167
+ popup: PropTypes.object,
168
+ detail: PropTypes.object,
169
+ extraKeyParamList: PropTypes.array
170
+ };
171
+ export default CustomContent;
@@ -0,0 +1,13 @@
1
+ import { type FC } from 'react';
2
+ import './index.less';
3
+ declare const FacilityTemplate: FC<{
4
+ feature: any;
5
+ valueField?: string;
6
+ showModal?: any;
7
+ customButton?: any;
8
+ /**
9
+ * 接收自定义字段显示
10
+ */
11
+ customKeys?: any[];
12
+ }>;
13
+ export default FacilityTemplate;
@@ -0,0 +1,115 @@
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, Row, Spin } from 'antd';
12
+ import React, { useEffect, useState } from 'react';
13
+ import http from "../../_util/http";
14
+ import { transform } from "../../_util/transform";
15
+ import CloseBtn from "./CloseBtn";
16
+ import "./index.less";
17
+ var FacilityTemplate = function FacilityTemplate(props) {
18
+ var feature = props.feature,
19
+ showModal = props.showModal,
20
+ valueField = props.valueField,
21
+ customKeys = props.customKeys,
22
+ customButton = props.customButton;
23
+ var _useState = useState([]),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ list = _useState2[0],
26
+ setList = _useState2[1];
27
+ var _useState3 = useState(false),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ loading = _useState4[0],
30
+ setLoading = _useState4[1];
31
+ var _useState5 = useState({}),
32
+ _useState6 = _slicedToArray(_useState5, 2),
33
+ facilityDetail = _useState6[0],
34
+ setFacilityDetail = _useState6[1];
35
+ var properties = (feature === null || feature === void 0 ? void 0 : feature.values_) || {};
36
+
37
+ // valueField-传入的设施id取值字段 facility_id:默认图层中设施id字段 facilityId:默认设施列表接口中设施id字段
38
+ var ID = (properties === null || properties === void 0 ? void 0 : properties[valueField || '']) || (properties === null || properties === void 0 ? void 0 : properties.facility_id) || (properties === null || properties === void 0 ? void 0 : properties.facilityId);
39
+ // 获取展示字段
40
+ var getFacilityField = function getFacilityField(typeCode, facilityDetail) {
41
+ http.get('/cloud/jcss-reborn/facility/type/view/detail', {
42
+ body: {
43
+ code: typeCode
44
+ }
45
+ }).then(function (res) {
46
+ var _list = [];
47
+ if (String(res === null || res === void 0 ? void 0 : res.result) === '0' && res.data) {
48
+ var _res$data = res.data,
49
+ _res$data$baseFields = _res$data.baseFields,
50
+ baseFields = _res$data$baseFields === void 0 ? [] : _res$data$baseFields,
51
+ _res$data$customField = _res$data.customFields,
52
+ customFields = _res$data$customField === void 0 ? [] : _res$data$customField;
53
+ var _list2 = [].concat(_toConsumableArray(baseFields), _toConsumableArray(customFields)).filter(function (r) {
54
+ return (customKeys === null || customKeys === void 0 ? void 0 : customKeys.includes(r.showKey)) || r.tableShow;
55
+ }) || [];
56
+ if (_list2.length) {
57
+ _list = transform(_toConsumableArray(_list2), facilityDetail);
58
+ }
59
+ }
60
+ setList(_list);
61
+ });
62
+ };
63
+ // 获取设施详情
64
+ var getFacilityDetail = function getFacilityDetail(id) {
65
+ setLoading(true);
66
+ http.get("/cloud/jcss-reborn/facility/get", {
67
+ body: {
68
+ id: id,
69
+ desensitization: false,
70
+ coordType: 'wgs84'
71
+ }
72
+ }).then(function (res) {
73
+ setLoading(false);
74
+ var data = {};
75
+ if (!res.result && res.data) {
76
+ var _data;
77
+ data = res.data;
78
+ setFacilityDetail(data);
79
+ getFacilityField((_data = data) === null || _data === void 0 ? void 0 : _data.typeCode, data);
80
+ }
81
+ }).catch(function () {
82
+ return {};
83
+ });
84
+ };
85
+ useEffect(function () {
86
+ if (ID) {
87
+ getFacilityDetail(ID);
88
+ }
89
+ }, [ID]);
90
+ return /*#__PURE__*/React.createElement("div", {
91
+ className: "cesium-popup-v1"
92
+ }, /*#__PURE__*/React.createElement(Spin, {
93
+ spinning: loading,
94
+ size: "small"
95
+ }, list !== null && list !== void 0 && list.length ? /*#__PURE__*/React.createElement(Row, null, list.map(function (item, index) {
96
+ return /*#__PURE__*/React.createElement(Col, {
97
+ span: 24,
98
+ key: index
99
+ }, item.label, "\uFF1A", item.value || String(item.value) === '0' ? item.value : '--');
100
+ })) : null), customButton ? /*#__PURE__*/React.createElement("div", {
101
+ className: "facility-layer-custom-button",
102
+ onClick: function onClick(e) {
103
+ return e.stopPropagation();
104
+ }
105
+ }, typeof customButton === 'function' ? customButton({
106
+ feature: feature,
107
+ facilityDetail: facilityDetail,
108
+ list: list
109
+ }) : customButton) : null, /*#__PURE__*/React.createElement(CloseBtn, {
110
+ showModal: showModal,
111
+ feature: feature,
112
+ type: "1"
113
+ }));
114
+ };
115
+ export default FacilityTemplate;
@@ -0,0 +1,14 @@
1
+ import { type FC } from 'react';
2
+ import './indexV2.less';
3
+ declare const FacilityTemplate: FC<{
4
+ feature: any;
5
+ valueField?: string;
6
+ showModal?: any;
7
+ customButton?: any;
8
+ /**
9
+ * 接收自定义字段显示
10
+ */
11
+ customKeys?: any;
12
+ extraKeyParamList?: any[];
13
+ }>;
14
+ export default FacilityTemplate;
@@ -0,0 +1,119 @@
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(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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { Spin } from 'antd';
8
+ import React, { useEffect, useState } from 'react';
9
+ import http from "../../_util/http";
10
+ import CloseBtn from "./CloseBtnV2";
11
+ import CustomContent from "./FacilityCustomContent";
12
+ import "./indexV2.less";
13
+ var FacilityTemplate = function FacilityTemplate(props) {
14
+ var feature = props.feature,
15
+ showModal = props.showModal,
16
+ valueField = props.valueField,
17
+ customKeys = props.customKeys,
18
+ customButton = props.customButton,
19
+ _props$extraKeyParamL = props.extraKeyParamList,
20
+ extraKeyParamList = _props$extraKeyParamL === void 0 ? [] : _props$extraKeyParamL;
21
+ var _useState = useState([]),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ list = _useState2[0],
24
+ setList = _useState2[1];
25
+ var _useState3 = useState(false),
26
+ _useState4 = _slicedToArray(_useState3, 2),
27
+ loading = _useState4[0],
28
+ setLoading = _useState4[1];
29
+ var _useState5 = useState({}),
30
+ _useState6 = _slicedToArray(_useState5, 2),
31
+ facilityDetail = _useState6[0],
32
+ setFacilityDetail = _useState6[1];
33
+ var properties = (feature === null || feature === void 0 ? void 0 : feature.values_) || {};
34
+
35
+ // valueField-传入的设施id取值字段 facility_id:默认图层中设施id字段 facilityId:默认设施列表接口中设施id字段
36
+ var ID = (properties === null || properties === void 0 ? void 0 : properties[valueField || '']) || (properties === null || properties === void 0 ? void 0 : properties.facility_id) || (properties === null || properties === void 0 ? void 0 : properties.facilityId);
37
+ // 获取展示字段
38
+ // const getFacilityField = (typeCode: string, facilityDetail: any) => {
39
+ // http
40
+ // .get('/cloud/jcss-reborn/facility/type/view/detail', {
41
+ // body: { code: typeCode },
42
+ // })
43
+ // .then((res: any) => {
44
+ // let _list = [];
45
+ // if (String(res?.result) === '0' && res.data) {
46
+ // let { baseFields = [], customFields = [] } = res.data;
47
+ // const list =
48
+ // [...baseFields, ...customFields].filter(
49
+ // (r: any) => customKeys?.includes(r.showKey) || r.tableShow,
50
+ // ) || [];
51
+ // console.log(list);
52
+ // if (list.length) {
53
+ // _list = transform([...list], facilityDetail);
54
+ // }
55
+ // }
56
+ // setList(_list);
57
+ // });
58
+ // };
59
+ // 获取设施详情
60
+ var getFacilityDetail = function getFacilityDetail(id) {
61
+ setLoading(true);
62
+ http.get("/cloud/jcss-reborn/facility/get", {
63
+ body: {
64
+ id: id,
65
+ desensitization: false,
66
+ coordType: 'wgs84'
67
+ }
68
+ }).then(function (res) {
69
+ setLoading(false);
70
+ var data = {};
71
+ if (!res.result && res.data) {
72
+ data = res.data;
73
+ setFacilityDetail(res.data);
74
+ // getFacilityField(data?.typeCode, data);
75
+ }
76
+ }).catch(function () {
77
+ return {};
78
+ });
79
+ };
80
+ useEffect(function () {
81
+ if (ID) {
82
+ getFacilityDetail(ID);
83
+ }
84
+ }, [ID]);
85
+ return /*#__PURE__*/React.createElement("div", {
86
+ className: "cesium-popup-v2"
87
+ }, /*#__PURE__*/React.createElement(Spin, {
88
+ spinning: loading,
89
+ size: "small"
90
+ }, /*#__PURE__*/React.createElement("div", {
91
+ className: customButton ? 'facility-layer-custom-panel facility-layer-custom-panel-has-button' : 'facility-layer-custom-panel'
92
+ }, /*#__PURE__*/React.createElement(CustomContent, {
93
+ extraKeyParamList: extraKeyParamList,
94
+ dark: true,
95
+ facilityDetail: facilityDetail,
96
+ onClick: function onClick() {
97
+ // if (props.showModal) {
98
+ // props.showModal(feature, map, '1');
99
+ // } else {
100
+ // showModal && showModal(feature, map, '1');
101
+ // }
102
+ }
103
+ }), customButton ? /*#__PURE__*/React.createElement("div", {
104
+ className: "facility-layer-custom-button",
105
+ onClick: function onClick(e) {
106
+ return e.stopPropagation();
107
+ }
108
+ }, typeof customButton === 'function' ? customButton({
109
+ feature: feature,
110
+ facilityDetail: facilityDetail,
111
+ list: list
112
+ }) : customButton) : null)), /*#__PURE__*/React.createElement(CloseBtn, {
113
+ showModal: showModal,
114
+ feature: feature,
115
+ facilityDetail: facilityDetail,
116
+ type: "1"
117
+ }));
118
+ };
119
+ export default FacilityTemplate;
@@ -0,0 +1,15 @@
1
+ .close-btn {
2
+ position: absolute;
3
+ top: 12px;
4
+ right: 30px;
5
+ cursor: pointer;
6
+ }
7
+
8
+ .cesium-popup-v1{
9
+ width: 300px;
10
+ }
11
+
12
+ .facility-layer-custom-button {
13
+ padding: 8px 10px 0;
14
+ text-align: right;
15
+ }