@vtx/cs-map-layer 1.0.14 → 1.0.16

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