@mapgis/webclient-vue-cesium 10.5.5-1 → 10.5.5-6

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 (124) hide show
  1. package/README.md +46 -49
  2. package/dist-libs/webclient-vue-cesium.common.js +191087 -0
  3. package/dist-libs/webclient-vue-cesium.css +1 -1
  4. package/dist-libs/webclient-vue-cesium.umd.js +191097 -0
  5. package/dist-libs/webclient-vue-cesium.umd.min.js +204 -194
  6. package/docs/.vuepress/config.js +47 -46
  7. package/docs/README.md +5 -4
  8. package/docs/api/analysis/Aspect.md +236 -0
  9. package/docs/api/analysis/Contour.md +240 -0
  10. package/docs/api/analysis/CutFill.md +306 -0
  11. package/docs/api/analysis/DynamicSection.md +336 -0
  12. package/docs/api/analysis/Excavate.md +3 -11
  13. package/docs/api/analysis/Flood.md +177 -200
  14. package/docs/api/analysis/HeightLimited.md +7 -4
  15. package/docs/api/analysis/ParticleEffects.md +549 -0
  16. package/docs/api/analysis/Profile.md +464 -0
  17. package/docs/api/analysis/Shadow.md +76 -13
  18. package/docs/api/analysis/Sightline.md +66 -13
  19. package/docs/api/analysis/Skyline.md +144 -29
  20. package/docs/api/analysis/Slope.md +236 -0
  21. package/docs/api/analysis/Viewshed.md +100 -21
  22. package/docs/api/layer/IGServer/IgsDocLayer.md +10 -0
  23. package/docs/api/layer/IGServer/IgsFeatureLayer.md +253 -0
  24. package/docs/api/layer/IGServer/IgsTileLayer.md +11 -0
  25. package/docs/api/layer/OGC/CesiumOgcWmsLayer.md +20 -19
  26. package/docs/api/layer/OGC/Wms.png +0 -0
  27. package/docs/api/layer/marker/DynamicMarker.md +81 -0
  28. package/docs/api/layer/marker/dynamicmarker.png +0 -0
  29. package/docs/api/layer/marker/selects.png +0 -0
  30. package/docs/api/layer/vectortile/vectortile.md +10 -0
  31. package/docs/api/m3d/image/layer_control_1.png +0 -0
  32. package/docs/api/m3d/image/layer_control_2.png +0 -0
  33. package/docs/api/m3d/image/layer_control_3.png +0 -0
  34. package/docs/api/m3d/m3d.md +13 -2
  35. package/docs/api/service/comprehensiveQuery/comprehensiveQuery.md +946 -0
  36. package/docs/api/ui/draw.md +68 -40
  37. package/docs/api/ui/link.md +8 -1
  38. package/docs/api/ui/marker.md +19 -1
  39. package/docs/api/ui/measure.md +82 -10
  40. package/docs/api/ui/table.md +6 -6
  41. package/docs/guide/README.md +26 -23
  42. package/docs/guide/basemap.md +35 -33
  43. package/docs/guide/markers&popups.md +46 -53
  44. package/docs/plugin_components/create_storybook.md +241 -0
  45. package/docs/plugin_components/img.png +0 -0
  46. package/docs/plugin_components/img_1.png +0 -0
  47. package/docs/plugin_components/img_10.png +0 -0
  48. package/docs/plugin_components/img_2.png +0 -0
  49. package/docs/plugin_components/img_3.png +0 -0
  50. package/docs/plugin_components/img_4.png +0 -0
  51. package/docs/plugin_components/img_5.png +0 -0
  52. package/docs/plugin_components/img_6.png +0 -0
  53. package/docs/plugin_components/img_7.png +0 -0
  54. package/docs/plugin_components/img_8.png +0 -0
  55. package/docs/version/diff.md +4 -4
  56. package/docs/version/version.md +81 -0
  57. package/package.json +5 -5
  58. package/src/cdn/cdn_component.js +62 -0
  59. package/src/component.js +20 -2
  60. package/src/components/Analysis/Aspect.vue +318 -0
  61. package/src/components/Analysis/Contour.vue +257 -0
  62. package/src/components/Analysis/CutFill.vue +581 -0
  63. package/src/components/Analysis/DynamicCutting.vue +98 -59
  64. package/src/components/Analysis/DynamicSection.vue +494 -0
  65. package/src/components/Analysis/Excavate.vue +133 -87
  66. package/src/components/Analysis/Flood.vue +395 -487
  67. package/src/components/Analysis/Flood.vue-- +630 -0
  68. package/src/components/Analysis/HeightLimited.vue +66 -47
  69. package/src/components/Analysis/ModelFlatten.vue +2 -2
  70. package/src/components/Analysis/Profile.vue +503 -0
  71. package/src/components/Analysis/Shadow.vue +220 -309
  72. package/src/components/Analysis/Sightline.vue +393 -375
  73. package/src/components/Analysis/SkyLine.vue +283 -93
  74. package/src/components/Analysis/Slope.vue +317 -0
  75. package/src/components/Analysis/Viewshed.vue +806 -373
  76. package/src/components/Analysis/skyline2dChartOptions.js +66 -0
  77. package/src/components/DataSource/Geojson/GeoJsonDataSource.vue +201 -3
  78. package/src/components/Layer/GeoJSON/GeoJsonLayer.vue +345 -0
  79. package/src/components/Layer/IGServer/IgsFeatureLayer.vue +227 -0
  80. package/src/components/Layer/Marker/DynamicMarkerLayer.vue +487 -0
  81. package/src/components/Layer/Marker/Marker3dPro.vue +196 -0
  82. package/src/components/Layer/Marker/Marker3dSetPro.vue +67 -0
  83. package/src/components/Layer/VectorTile/VectorTileLayer.vue +117 -33
  84. package/src/components/Layer/VectorTile/VectorTileOptions.js +1 -1
  85. package/src/components/M3D/3DTilesetOptions.js +23 -1
  86. package/src/components/M3D/G3D.vue +150 -0
  87. package/src/components/M3D/M3d.vue +142 -32
  88. package/src/components/M3D/M3dSet.vue +118 -0
  89. package/src/components/M3D/M3dType.js +24 -0
  90. package/src/components/Overlay/Mapv3dLayer.vue +2 -0
  91. package/src/components/Overlay/ParticleEffects.vue +545 -0
  92. package/src/components/Overlay/mapv/MapvBaseLayer.js +351 -172
  93. package/src/components/Overlay/mapv/MapvLayer.js +372 -324
  94. package/src/components/Overlay/mapv/SuperCluster.js +611 -0
  95. package/src/components/Overlay/themeLayer/heater/CesiumHeater.vue +152 -0
  96. package/src/components/Overlay/themeLayer/heater/MapvHeater.vue +161 -0
  97. package/src/components/UI/Controls/Draw/Draw.vue +320 -92
  98. package/src/components/UI/Controls/Legend/Legend.vue +55 -51
  99. package/src/components/UI/Controls/Link/Link.vue +59 -37
  100. package/src/components/UI/Controls/Measure/Measure.vue +75 -33
  101. package/src/components/UI/Controls/Measure/components/MeasureResult.vue +71 -0
  102. package/src/components/UI/Controls/Measure/components/MeasureSetting.vue +63 -0
  103. package/src/components/UI/Controls/Measure/components/MeasureTool.vue +155 -0
  104. package/src/components/UI/Geojson/Popup.vue +101 -0
  105. package/src/components/UI/Marker/Marker.vue +185 -48
  106. package/src/components/UI/Popup/Popup.vue +21 -64
  107. package/src/components/Utils/common/color-util.js +159 -0
  108. package/src/components/Utils/util.js +311 -231
  109. package/src/components/WebGlobe/manager.js +81 -3
  110. package/src/components/WebGlobe/mixins/withPrivateMethods.js +4 -2
  111. package/src/components/WebGlobe/util.js +173 -0
  112. package/src/components/service/comprehensive-query/ComprehensiveQuery.vue +156 -0
  113. package/src/components/service/comprehensive-query/PlaceNameCesium.vue +102 -0
  114. package/src/components/service/comprehensive-query/util/catalog/document.js +626 -0
  115. package/src/components/service/comprehensive-query/util/feature/arcgis-feature-query.js +448 -0
  116. package/src/components/service/comprehensive-query/util/feature/feature-convert.js +408 -0
  117. package/src/components/service/comprehensive-query/util/feature/feature-edit.js +50 -0
  118. package/src/components/service/comprehensive-query/util/feature/feature-geojson.js +100 -0
  119. package/src/components/service/comprehensive-query/util/feature/feature-query.js +723 -0
  120. package/src/components/service/comprehensive-query/util/feature/feature.js +1 -0
  121. package/src/components/service/comprehensive-query/util/feature/index.js +9 -0
  122. package/src/components/service/comprehensive-query/util/objects/geometry.js +58 -0
  123. package/src/components/Overlay/Mapv.vue +0 -142
  124. package/src/components/Overlay/MapvHeater.vue +0 -98
@@ -0,0 +1,448 @@
1
+ // @ts-nocheck
2
+ import axios from "axios";
3
+ import qs from "qs";
4
+ export default class ArcGISFeatureQuery {
5
+ /**
6
+ * ArcGIS查询
7
+ * geometryPrecision代表
8
+ * distance代表模糊半径范围
9
+ * outfields
10
+ * @param {object} params
11
+ * @param {string|null} params.where
12
+ * @param {number|null} params.geometryPrecision 返回要素的物理坐标精度
13
+ * @param {string|null} params.outFields 代表需要查询的字段属性名称(全部时用*)
14
+ * @param {string|null} params.f
15
+ * @param {string|null} params.text
16
+ * @param {string|null} params.objectIds
17
+ * @param {string|null} params.time
18
+ * @param {string|null} params.inSR
19
+ * @param {string|null} params.outSR
20
+ * @param {string|null} params.spatialRel
21
+ * @param {string|null} params.relationParam
22
+ * @param {string|null} params.maxAllowableOffset
23
+ * @param {string|null} params.orderByFields
24
+ * @param {string|null} params.groupByFieldsForStatistics
25
+ * @param {string|null} params.gdbVersion
26
+ * @param {string|null} params.outStatistics
27
+ * @param {string|null} params.queryByDistance
28
+ * @param {boolean|null} params.returnGeometry
29
+ * @param {boolean|null} params.returnIdsOnly
30
+ * @param {boolean|null} params.returnCountOnly
31
+ * @param {boolean|null} params.returnZ
32
+ * @param {boolean|null} params.returnM
33
+ * @param {boolean|null} params.returnDistinctValues
34
+ * @param {boolean|null} params.returnExtentsOnly
35
+ * @param {boolean|null} params.rtnLabel
36
+ * @param {number|null} params.totalCount
37
+ * @param {object} params.geometry 几何对象
38
+ * @param {string|null} params.layerIndex 索引号
39
+ * @param {number} params.page 页码
40
+ * @param {number} params.pageCount 每页显示数
41
+ */
42
+ static query(params) {
43
+ if (!params || !params.serverUrl) {
44
+ return;
45
+ }
46
+ const tempParams = this.getQueryParams(params);
47
+ tempParams.returnCountOnly = false;
48
+ const page = params.page || 0;
49
+ const pageCount = params.pageCount || 0;
50
+ tempParams.resultOffset = page * pageCount || 0;
51
+ tempParams.resultRecordCount = params.pageCount || 20;
52
+ tempParams.objectIdsTotal = params.totalCount;
53
+ const url = `${tempParams.serverUrl}/${tempParams.layerIndex}/query`;
54
+ const promise = new Promise((resolve, reject) => {
55
+ const instance = axios.create();
56
+ instance.interceptors.request.use(config => {
57
+ let url = config.url;
58
+ // get参数编码
59
+ if (config.method === "get" && config.params) {
60
+ url += "?";
61
+ const keys = Object.keys(config.params);
62
+ for (const key of keys) {
63
+ url += `${key}=${encodeURIComponent(config.params[key])}&`;
64
+ }
65
+ url =
66
+ url === null || url === void 0
67
+ ? void 0
68
+ : url.substring(0, url.length - 1);
69
+ config.params = {};
70
+ }
71
+ config.url = url;
72
+ return config;
73
+ });
74
+ instance
75
+ .get(url, {
76
+ paramsSerializer(param) {
77
+ return qs.stringify(param);
78
+ },
79
+ params: tempParams
80
+ })
81
+ .then(res => {
82
+ const { data } = res;
83
+ if (!data) {
84
+ resolve(undefined);
85
+ } else if (data.error) {
86
+ // 出现了返回data = {error: {code:400, message...}}的情况
87
+ reject(data.error.message);
88
+ } else {
89
+ // 将data转geojson
90
+ const geojsonFeatures = {
91
+ type: "FeatureCollection",
92
+ features: [],
93
+ dataCount: params.totalCount
94
+ };
95
+ const { features, geometryType } = data;
96
+ for (let i = 0; i < features.length; i += 1) {
97
+ let coordinates = [];
98
+ let type = "";
99
+ let bound = {};
100
+ if (geometryType === "esriGeometryPoint") {
101
+ // 如果为点要素
102
+ coordinates = [features[i].geometry.x, features[i].geometry.y];
103
+ type = "Point";
104
+ bound = {
105
+ xmin: features[i].geometry.x,
106
+ ymin: features[i].geometry.y,
107
+ xmax: features[i].geometry.x,
108
+ ymax: features[i].geometry.y
109
+ };
110
+ } else if (geometryType === "esriGeometryPolyline") {
111
+ // 如果为线要素
112
+ const path = features[i].geometry.paths[0];
113
+ let xmin = path[0][0];
114
+ let xmax = path[0][0];
115
+ let ymin = path[0][1];
116
+ let ymax = path[0][1];
117
+ for (let j = 0; j < path.length; j += 1) {
118
+ xmin = xmin < path[j][0] ? xmin : path[j][0];
119
+ xmax = xmax > path[j][0] ? xmax : path[j][0];
120
+ ymin = ymin < path[j][1] ? ymin : path[j][1];
121
+ ymax = ymax > path[j][1] ? ymax : path[j][1];
122
+ const coord = [...path[j]];
123
+ coordinates.push(coord);
124
+ }
125
+ type = "LineString";
126
+ bound = { xmin, ymin, xmax, ymax };
127
+ } else if (geometryType === "esriGeometryPolygon") {
128
+ // 如果为面要素
129
+ const path = features[i].geometry.rings[0];
130
+ const arc = [];
131
+ let xmin = path[0][0];
132
+ let xmax = path[0][0];
133
+ let ymin = path[0][1];
134
+ let ymax = path[0][1];
135
+ for (let j = 0; j < path.length; j += 1) {
136
+ xmin = xmin < path[j][0] ? xmin : path[j][0];
137
+ xmax = xmax > path[j][0] ? xmax : path[j][0];
138
+ ymin = ymin < path[j][1] ? ymin : path[j][1];
139
+ ymax = ymax > path[j][1] ? ymax : path[j][1];
140
+ const coord = [path[j].x, path[j].y];
141
+ arc.push(coord);
142
+ }
143
+ coordinates.push(arc);
144
+ type = "Polygon";
145
+ bound = { xmin, ymin, xmax, ymax };
146
+ }
147
+ const geometry = {
148
+ type,
149
+ coordinates
150
+ };
151
+ const feature = {
152
+ type: "Feature",
153
+ properties: Object.assign({}, features[i].attributes),
154
+ geometry,
155
+ bound
156
+ };
157
+ geojsonFeatures.features.push(feature);
158
+ }
159
+ resolve(geojsonFeatures);
160
+ }
161
+ });
162
+ });
163
+ return promise.then(data => {
164
+ return data;
165
+ });
166
+ }
167
+ static getQueryParams(params) {
168
+ const tempParams = {};
169
+ tempParams.where = params.where || "1=1";
170
+ tempParams.geometryPrecision = params.geometryPrecision || 3;
171
+ tempParams.outFields = params.outFields || "*";
172
+ tempParams.f = params.f || "pjson";
173
+ tempParams.text = params.text || "";
174
+ tempParams.objectIds = params.objectIds || "";
175
+ tempParams.time = params.time || "";
176
+ tempParams.spatialRel = params.spatialRel || "";
177
+ tempParams.relationParam = params.relationParam || "";
178
+ tempParams.maxAllowableOffset = params.maxAllowableOffset || "";
179
+ tempParams.orderByFields = params.orderByFields || "";
180
+ tempParams.groupByFieldsForStatistics =
181
+ params.groupByFieldsForStatistics || "";
182
+ tempParams.gdbVersion = params.gdbVersion || "";
183
+ tempParams.outStatistics = params.outStatistics || "";
184
+ tempParams.returnGeometry =
185
+ params.returnGeometry === false ? params.returnGeometry : true;
186
+ tempParams.returnIdsOnly = params.returnIdsOnly || false;
187
+ tempParams.returnCountOnly = params.returnCountOnly || false;
188
+ tempParams.returnZ = params.returnZ || false;
189
+ tempParams.returnM = params.returnM || false;
190
+ tempParams.returnDistinctValues = params.returnDistinctValues || false;
191
+ tempParams.returnExtentOnly = params.returnExtentsOnly || false;
192
+ tempParams.layerIndex = params.layerIndex || 0;
193
+ tempParams.returnTrueCurves = params.returnTrueCurves || false;
194
+ tempParams.serverUrl = params.serverUrl;
195
+ tempParams.totalCount = params.totalCount;
196
+ if (params.queryByDistance) {
197
+ tempParams.queryByDistance = params.queryByDistance;
198
+ } else if (params.geometry && params.geometry.nearDis) {
199
+ tempParams.queryByDistance = params.geometry.nearDis;
200
+ } else tempParams.queryByDistance = "";
201
+ let EPSGNo = "";
202
+ const { inSR } = params;
203
+ if (params.inSR) {
204
+ EPSGNo = params.inSR.split(":")[1];
205
+ }
206
+ tempParams.inSR = inSR || "";
207
+ const { outSR } = params;
208
+ tempParams.outSR = outSR || "";
209
+ if (params.geometry) {
210
+ const geoType = params.geometry.getGeometryType();
211
+ const { geometry } = params;
212
+ const pointArr = [];
213
+ let i = 0;
214
+ if (geoType === "rect") {
215
+ tempParams.geometry = JSON.stringify({
216
+ xmin: geometry.xmin,
217
+ ymin: geometry.ymin,
218
+ xmax: geometry.xmax,
219
+ ymax: geometry.ymax,
220
+ spatialReference: {
221
+ // EPSG: Zondy.OneMap.defaultData.projection.split(':')[1]
222
+ EPSG: 4326
223
+ }
224
+ }); // [geometry.xmin, geometry.ymin, geometry.xmax, geometry.ymax].toString();
225
+ tempParams.geometryType = "esriGeometryEnvelope";
226
+ tempParams.distance = params.geometry.nearDis || "";
227
+ } else if (geoType === "point") {
228
+ tempParams.geometry = JSON.stringify({
229
+ x: geometry.x,
230
+ y: geometry.y,
231
+ spatialReference: { EPSG: EPSGNo }
232
+ }); // [geometry.x, geometry.y].toString();
233
+ tempParams.geometryType = "esriGeometryPoint";
234
+ tempParams.distance = params.geometry.nearDis || "";
235
+ } else if (geoType === "polygon") {
236
+ tempParams.geometryType = "esriGeometryPolygon";
237
+ tempParams.distance === params.geometry.nearDis || "";
238
+ for (i = 0; i < geometry.pointArr.length; i++) {
239
+ pointArr.push([geometry.pointArr[i].x, geometry.pointArr[i].y]);
240
+ }
241
+ tempParams.geometry = JSON.stringify({
242
+ rings: [pointArr],
243
+ spatialReference: { EPSG: EPSGNo }
244
+ });
245
+ } else if (geoType === "line") {
246
+ tempParams.geometryType = "esriGeometryPolyline";
247
+ tempParams.distance === params.geometry.nearDis || "";
248
+ for (i = 0; i < geometry.pointArr.length; i++) {
249
+ pointArr.push([geometry.pointArr[i].x, geometry.pointArr[i].y]);
250
+ }
251
+ tempParams.geometry = JSON.stringify({
252
+ paths: [pointArr],
253
+ spatialReference: { EPSG: EPSGNo }
254
+ });
255
+ } else if (geoType === "Circle") {
256
+ // ArcGIS没有圆几何,将圆构造为polygon
257
+ // tempParams.geometryType = "esriGeometryPolygon";
258
+ // tempParams.distance === params.geometry.nearDis||'';
259
+ // const Circle = new ol.geom.Circle([geometry.point.x, geometry.point.y], geometry.radious);
260
+ // const polygon = new ol.geom.Polygon.fromCircle(Circle,16);
261
+ // tempParams.geometry = JSON.stringify({ "rings": [polygon.getCoordinates()[0]], "spatialReference": { "EPSG": EPSGNo } });
262
+ }
263
+ }
264
+ return tempParams;
265
+ }
266
+ /**
267
+ * ArcGIS查询
268
+ * geometryPrecision代表
269
+ * distance代表模糊半径范围
270
+ * outfields
271
+ * @param {object} params
272
+ * @param {string|null} params.where
273
+ * @param {number|null} params.geometryPrecision 返回要素的物理坐标精度
274
+ * @param {string|null} params.outFields 代表需要查询的字段属性名称(全部时用*)
275
+ * @param {string|null} params.f
276
+ * @param {string|null} params.text
277
+ * @param {string|null} params.objectIds
278
+ * @param {string|null} params.time
279
+ * @param {string|null} params.inSR
280
+ * @param {string|null} params.outSR
281
+ * @param {string|null} params.spatialRel
282
+ * @param {string|null} params.relationParam
283
+ * @param {string|null} params.maxAllowableOffset
284
+ * @param {string|null} params.orderByFields
285
+ * @param {string|null} params.groupByFieldsForStatistics
286
+ * @param {string|null} params.gdbVersion
287
+ * @param {string|null} params.outStatistics
288
+ * @param {string|null} params.queryByDistance
289
+ * @param {boolean|null} params.returnGeometry
290
+ * @param {boolean|null} params.returnIdsOnly
291
+ * @param {boolean|null} params.returnCountOnly
292
+ * @param {boolean|null} params.returnZ
293
+ * @param {boolean|null} params.returnM
294
+ * @param {boolean|null} params.returnDistinctValues
295
+ * @param {boolean|null} params.returnExtentsOnly
296
+ * @param {boolean|null} params.rtnLabel
297
+ * @param {number|null} params.totalCount
298
+ * @param {object} params.geometry 几何对象
299
+ * @param {string|null} params.layerIndex 索引号
300
+ * @param {string} params.serverUrl 服务地址
301
+ */
302
+ static getTotal(params) {
303
+ if (!params.serverUrl) {
304
+ return;
305
+ }
306
+ const tempParams = this.getQueryParams(params);
307
+ tempParams.returnDistinctValues = false;
308
+ if (params.totalCount) {
309
+ return params.totalCount;
310
+ }
311
+ tempParams.returnIdsOnly = false;
312
+ tempParams.returnCountOnly = true;
313
+ tempParams.returnGeometry = false;
314
+ tempParams.layerIndex = params.layerIndex || "0";
315
+ const url = `${tempParams.serverUrl}/${tempParams.layerIndex}/query`;
316
+ const promise = new Promise((resolve, reject) => {
317
+ const instance = axios.create();
318
+ instance.interceptors.request.use(config => {
319
+ let url = config.url;
320
+ // get参数编码
321
+ if (config.method === "get" && config.params) {
322
+ url += "?";
323
+ const keys = Object.keys(config.params);
324
+ for (const key of keys) {
325
+ url += `${key}=${encodeURIComponent(config.params[key])}&`;
326
+ }
327
+ url =
328
+ url === null || url === void 0
329
+ ? void 0
330
+ : url.substring(0, url.length - 1);
331
+ config.params = {};
332
+ }
333
+ config.url = url;
334
+ return config;
335
+ });
336
+ instance.get(url, { params: tempParams }).then(res => {
337
+ const { data } = res;
338
+ if (!data) {
339
+ resolve(undefined);
340
+ } else {
341
+ resolve(data);
342
+ }
343
+ });
344
+ });
345
+ return promise.then(data => {
346
+ return data;
347
+ });
348
+ }
349
+ /**
350
+ * 返回ArcGIS图层的属性结构
351
+ * geometryPrecision代表
352
+ * distance代表模糊半径范围
353
+ * outfields
354
+ * @param {object} queryParams
355
+ * @param {string|null} queryParams.layerIndex 索引号
356
+ * @param {string} queryParams.serverUrl 服务地址
357
+ * @param {string} queryParams.outFields 输出字段
358
+ * @param {string} queryParams.page 页码
359
+ * @param {string} queryParams.pageCount 每页记录数
360
+ */
361
+ static getLayerFileds(queryParams) {
362
+ if (!queryParams || !queryParams.serverUrl) {
363
+ return;
364
+ }
365
+ const tempParams = {};
366
+ tempParams.where = "1=1";
367
+ tempParams.outFields = queryParams.outFields || "*";
368
+ tempParams.f = "pjson";
369
+ tempParams.layerIndex = queryParams.layerIndex || 0;
370
+ tempParams.serverUrl = queryParams.serverUrl;
371
+ tempParams.returnGeometry = true;
372
+ tempParams.returnIdsOnly = false;
373
+ tempParams.returnCountOnly = false;
374
+ tempParams.resultOffset = queryParams.page * queryParams.pageCount || 0;
375
+ tempParams.resultRecordCount = queryParams.pageCount || 1;
376
+ const url = `${tempParams.serverUrl}/${tempParams.layerIndex}/query`;
377
+ const promise = new Promise((resolve, reject) => {
378
+ const instance = axios.create();
379
+ instance.interceptors.request.use(config => {
380
+ let url = config.url;
381
+ // get参数编码
382
+ if (config.method === "get" && config.params) {
383
+ url += "?";
384
+ const keys = Object.keys(config.params);
385
+ for (const key of keys) {
386
+ url += `${key}=${encodeURIComponent(config.params[key])}&`;
387
+ }
388
+ url =
389
+ url === null || url === void 0
390
+ ? void 0
391
+ : url.substring(0, url.length - 1);
392
+ config.params = {};
393
+ }
394
+ config.url = url;
395
+ return config;
396
+ });
397
+ axios.get(url, { params: tempParams }).then(res => {
398
+ const { data } = res;
399
+ if (!data) {
400
+ resolve(undefined);
401
+ } else {
402
+ const { fields } = data;
403
+ if (!fields) {
404
+ resolve(undefined);
405
+ } else {
406
+ const tempFields = [];
407
+ const value = [];
408
+ for (let m = 0; m < fields.length; m++) {
409
+ let type = "";
410
+ if (fields[m].type === "esriFieldTypeOID") {
411
+ type = "int";
412
+ } else if (fields[m].type === "esriFieldTypeDouble") {
413
+ type = "double";
414
+ } else if (fields[m].type === "esriFieldTypeString") {
415
+ type = "string";
416
+ } else if (fields[m].type === "esriFieldTypeInteger") {
417
+ type = "int";
418
+ } else if (fields[m].type === "esriFieldTypeFloat") {
419
+ type = "float";
420
+ } else if (fields[m].type === "esriFieldTypeDate") {
421
+ type = "date";
422
+ } else if (fields[m].type === "esriFieldTypeSmallInteger") {
423
+ type = "smallInteger";
424
+ }
425
+ tempFields.push({ name: fields[m].name, type });
426
+ }
427
+ if (tempParams.outFields && tempParams.outFields !== "*") {
428
+ // 获取单个属性的属性值
429
+ const { features } = data;
430
+ for (let i = 0; i < features.length; i += 1) {
431
+ const item = features[i].attributes[tempParams.outFields];
432
+ value.push(item);
433
+ }
434
+ }
435
+ const obj = {
436
+ fields: tempFields,
437
+ value
438
+ };
439
+ resolve(obj);
440
+ }
441
+ }
442
+ });
443
+ });
444
+ return promise.then(data => {
445
+ return data;
446
+ });
447
+ }
448
+ }