react-base-client 1.0.151 → 1.1.0

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 (33) hide show
  1. package/package.json +2 -3
  2. package/src/.umi/core/EmptyRoute.tsx +9 -0
  3. package/src/.umi/core/defineApp.ts +18 -0
  4. package/src/.umi/core/history.ts +64 -0
  5. package/src/.umi/core/plugin.ts +52 -0
  6. package/src/.umi/core/pluginConfig.d.ts +327 -0
  7. package/src/.umi/core/polyfill.ts +163 -0
  8. package/src/.umi/core/route.tsx +13 -0
  9. package/src/.umi/core/terminal.ts +38 -0
  10. package/src/.umi/exports.ts +19 -0
  11. package/src/.umi/plugin-access/context.ts +5 -0
  12. package/src/.umi/plugin-access/index.tsx +87 -0
  13. package/src/.umi/plugin-access/runtime.tsx +23 -0
  14. package/src/.umi/plugin-initialState/@@initialState.ts +50 -0
  15. package/src/.umi/plugin-initialState/Provider.tsx +19 -0
  16. package/src/.umi/plugin-initialState/runtime.tsx +8 -0
  17. package/src/.umi/plugin-initialState/runtimeConfig.d.ts +5 -0
  18. package/src/.umi/plugin-model/index.tsx +181 -0
  19. package/src/.umi/plugin-model/model.ts +8 -0
  20. package/src/.umi/plugin-model/runtime.tsx +20 -0
  21. package/src/.umi/plugin-request/index.ts +9 -0
  22. package/src/.umi/plugin-request/request.ts +265 -0
  23. package/src/.umi/plugin-request/runtimeConfig.d.ts +6 -0
  24. package/src/.umi/plugin-request/types.d.ts +10 -0
  25. package/src/.umi/testBrowser.tsx +88 -0
  26. package/src/.umi/tsconfig.json +35 -0
  27. package/src/.umi/typings.d.ts +136 -0
  28. package/src/.umi/umi.ts +74 -0
  29. package/src/components/AMap/index.tsx +90 -32
  30. package/src/components/AMap/typing.d.ts +41 -36
  31. package/src/components/SubmitForm/index.tsx +138 -133
  32. package/src/components/XAMap/index.tsx +167 -0
  33. package/tsconfig.json +0 -29
@@ -0,0 +1,167 @@
1
+ import { Popup, Button } from 'antd-mobile';
2
+ import React, { useState } from 'react';
3
+ import AMapComponent from '../AMap';
4
+ import { AMapType } from '../AMap/typing.d';
5
+
6
+ export type XAMapProps = {
7
+ value?: any;
8
+ onChange?: (value: any) => void;
9
+ placeholder?: string;
10
+ mapStyle?: React.CSSProperties;
11
+ rowData?: Array<AMapType.RowData>;
12
+ dragMapSetting?: AMapType.dragMapSettingType;
13
+ wmsJSON?: any;
14
+ mapLayers?: any;
15
+ showLayersPanel?: boolean;
16
+ realTime?: number;
17
+ mapId?: string;
18
+ onWmsFeatureClick?: (featureProps: any) => void;
19
+ };
20
+
21
+ const XAMap: React.FC<XAMapProps> = (props) => {
22
+ const {
23
+ value,
24
+ onChange,
25
+ placeholder = '点击查看地图',
26
+ mapStyle = { height: '400px' },
27
+ rowData = [],
28
+ dragMapSetting,
29
+ wmsJSON,
30
+ mapLayers,
31
+ showLayersPanel = false,
32
+ realTime,
33
+ mapId,
34
+ onWmsFeatureClick,
35
+ } = props;
36
+
37
+ const [visible, setVisible] = useState(false);
38
+ const [selectedFeature, setSelectedFeature] = useState<any>(undefined);
39
+ const [geometry, setGeometry] = useState<any>(undefined);
40
+
41
+ const handleMapClick = () => {
42
+ setVisible(true);
43
+ };
44
+
45
+ const handleClose = () => {
46
+ setVisible(false);
47
+ };
48
+
49
+ const handleWmsFeatureClick = (featureProps: any, geometry: any) => {
50
+ console.log('>>>> aMap - handleWmsFeatureClick', geometry);
51
+ onChange?.(featureProps);
52
+ onWmsFeatureClick?.(featureProps);
53
+ setSelectedFeature(featureProps);
54
+ setGeometry(geometry);
55
+ console.log('选中的WMS设备属性:', featureProps);
56
+ };
57
+
58
+ return (
59
+ <>
60
+ <div
61
+ onClick={handleMapClick}
62
+ style={{
63
+ padding: '12px',
64
+ border: '1px solid #d9d9d9',
65
+ borderRadius: '6px',
66
+ backgroundColor: '#fafafa',
67
+ cursor: 'pointer',
68
+ minHeight: '40px',
69
+ display: 'flex',
70
+ alignItems: 'center',
71
+ color: value ? '#000' : '#999'
72
+ }}
73
+ >
74
+ {value ? '点击查看地图' : placeholder}
75
+ </div>
76
+
77
+ <Popup
78
+ visible={visible}
79
+ position="right"
80
+ bodyStyle={{ width: '100vw', height: '100vh' }}
81
+ onClose={handleClose}
82
+ >
83
+ <div style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
84
+ <div style={{
85
+ padding: '10px',
86
+ borderBottom: '1px solid #eee',
87
+ display: 'flex',
88
+ justifyContent: 'space-between',
89
+ alignItems: 'center'
90
+ }}>
91
+ <span style={{ fontSize: '16px', fontWeight: 'bold' }}>地图</span>
92
+ <button
93
+ onClick={handleClose}
94
+ style={{
95
+ border: 'none',
96
+ background: 'none',
97
+ fontSize: '18px',
98
+ cursor: 'pointer',
99
+ color: '#666'
100
+ }}
101
+ >
102
+
103
+ </button>
104
+ </div>
105
+
106
+ <div style={{ flex: 1 }}>
107
+ <AMapComponent
108
+ mapId={mapId}
109
+ mapLayers={mapLayers}
110
+ rowData={rowData}
111
+ dragMapSetting={dragMapSetting}
112
+ wmsJSON={wmsJSON}
113
+ showLayersPanel={showLayersPanel}
114
+ realTime={realTime}
115
+ mapStyle={mapStyle}
116
+ onWmsFeatureClick={handleWmsFeatureClick}
117
+ />
118
+ </div>
119
+ <div style={{
120
+ padding: '16px',
121
+ borderTop: '1px solid #eee',
122
+ background: '#fafbfc',
123
+ minHeight: '120px',
124
+ maxHeight: '200px',
125
+ overflow: 'auto',
126
+ fontSize: '14px',
127
+ color: '#333',
128
+ }}>
129
+ <div style={{ fontWeight: 'bold', marginBottom: 8 }}>选中设备属性:</div>
130
+ {selectedFeature ? (
131
+ <div>
132
+ <div>设备类型:{selectedFeature['附属设施'] || '-'}</div>
133
+ <div>地址:{selectedFeature['address'] || '-'}</div>
134
+ <div>设备编号:{selectedFeature['sid'] || '-'}</div>
135
+ <div>坐标: {geometry?.coordinates || '-'}</div>
136
+ </div>
137
+ ) : (
138
+ <span style={{ color: '#aaa' }}>请点击地图上的设备进行选择</span>
139
+ )}
140
+ <Button
141
+ block
142
+ color="primary"
143
+ disabled={!selectedFeature}
144
+ style={{ marginTop: 12 }}
145
+ onClick={() => {
146
+ if (selectedFeature) {
147
+ const result = {
148
+ 设备类型: selectedFeature['附属设施'],
149
+ 地址: selectedFeature['address'],
150
+ 设备编号: selectedFeature['sid'],
151
+ geometry: geometry
152
+ };
153
+ onChange?.(result);
154
+ setVisible(false);
155
+ }
156
+ }}
157
+ >
158
+ 确认
159
+ </Button>
160
+ </div>
161
+ </div>
162
+ </Popup>
163
+ </>
164
+ );
165
+ };
166
+
167
+ export default XAMap;
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "build/dist",
4
- "module": "esnext",
5
- "target": "esnext",
6
- "lib": ["esnext", "dom"],
7
- "sourceMap": true,
8
- "baseUrl": ".",
9
- "jsx": "react",
10
- "resolveJsonModule": true,
11
- "allowSyntheticDefaultImports": true,
12
- "moduleResolution": "node",
13
- "forceConsistentCasingInFileNames": false,
14
- "noImplicitReturns": true,
15
- "noUnusedLocals": true,
16
- "allowJs": true,
17
- "skipLibCheck": true,
18
- "experimentalDecorators": true,
19
- "strict": true,
20
- "paths": {
21
- "@af-react-mobile-base-client/*": ["./src/*"],
22
- "@@/*": ["./src/.umi/*"],
23
- "@umijs/max": ["./node_modules/umi"],
24
- "@umijs/max/typings": ["./src/.umi/typings"],
25
- "@af-react-mobile-base-client-config/*": ["./config/*"]
26
- }
27
- },
28
- "include": ["mock/**/*", "src/**/*", "config/**/*"]
29
- }