@supermapgis/vue-iclient-leaflet 11.2.1 → 11.3.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.
- package/dist/iclient-leaflet-vue.css +23 -9
- package/dist/iclient-leaflet-vue.js +21689 -44354
- package/dist/iclient-leaflet-vue.min.css +2 -2
- package/dist/iclient-leaflet-vue.min.js +39 -293
- package/lib/_assets/iconfont/icon-sm-components.css +21 -7
- package/lib/_assets/iconfont/icon-sm-components.ttf +0 -0
- package/lib/_assets/iconfont/icon-sm-components.woff +0 -0
- package/lib/_assets/iconfont/icon-sm-components.woff2 +0 -0
- package/lib/_lang/en.js +20 -8
- package/lib/_lang/index.js +18 -18
- package/lib/_lang/zh.js +20 -8
- package/lib/_mixin/AntdRender.js +15 -17
- package/lib/_mixin/Card.js +10 -11
- package/lib/_mixin/GridLayer.js +4 -4
- package/lib/_mixin/Layer.js +4 -4
- package/lib/_mixin/Options.js +2 -2
- package/lib/_mixin/Popper.js +2 -2
- package/lib/_mixin/Theme.js +13 -15
- package/lib/_mixin/ThirdService.js +15 -16
- package/lib/_mixin/TileLayer.js +4 -4
- package/lib/_mixin/Timer.js +8 -9
- package/lib/_mixin/VmUpdater.js +10 -11
- package/lib/_mixin/map-events.js +8 -9
- package/lib/_mixin/map-getter.js +13 -14
- package/lib/_types/AddressMatchParameter.js +2 -2
- package/lib/_types/GeoJSONParamter.js +2 -2
- package/lib/_types/RestDataParameter.js +5 -6
- package/lib/_types/RestMapParameter.js +5 -6
- package/lib/_types/RestParameter.js +2 -2
- package/lib/_types/event/BaseTypes.js +2 -2
- package/lib/_types/event/Event.js +4 -4
- package/lib/_types/event/Events.js +10 -10
- package/lib/_types/event/Pixel.js +2 -2
- package/lib/_types/event/Util.js +2 -2
- package/lib/_types/iPortalDataParameter.js +3 -2
- package/lib/_types/iServerBaseParameter.js +3 -2
- package/lib/_types/iServerDataParameter.js +5 -6
- package/lib/_types/iServerMapParameter.js +5 -6
- package/lib/_types/index.js +18 -18
- package/lib/_types/map-event.js +6 -6
- package/lib/_utils/EchartsDataService.js +24 -24
- package/lib/_utils/RestService.js +1345 -1149
- package/lib/_utils/epsg-define.js +45 -34
- package/lib/_utils/get-features.js +23 -10
- package/lib/_utils/global-event.js +6 -6
- package/lib/_utils/iPortalDataService.js +1368 -1147
- package/lib/_utils/iServerRestService.js +1518 -1269
- package/lib/_utils/props-binder.js +2 -2
- package/lib/_utils/statistics.js +8 -17
- package/lib/_utils/style/color/colorPalette.js +4 -4
- package/lib/_utils/style/color/serialColors.js +8 -8
- package/lib/_utils/style/theme/chart.js +1343 -1146
- package/lib/_utils/style/theme/set-theme.js +10 -10
- package/lib/_utils/style/theme/theme.json +6 -6
- package/lib/_utils/util.js +12 -12
- package/lib/_utils/vue-types/utils.js +2 -2
- package/lib/attribute-panel/style/attribute-panel.css +1 -0
- package/lib/attribute-panel/style/css.js +7 -0
- package/lib/attribute-panel/style/index.js +7 -0
- package/lib/avatar/index.js +25 -25
- package/lib/border/index.js +77 -77
- package/lib/breadcrumb/index.js +47 -41
- package/lib/button/index.js +53 -50
- package/lib/card/index.js +47 -41
- package/lib/chart/index.js +1437 -1238
- package/lib/checkbox/index.js +36 -33
- package/lib/collapse/index.js +39 -36
- package/lib/collapse-card/index.js +71 -76
- package/lib/color-picker/index.js +48 -49
- package/lib/date-picker/index.js +107 -95
- package/lib/dropdown/index.js +27 -27
- package/lib/empty/index.js +27 -27
- package/lib/icon/index.js +25 -25
- package/lib/identify/index.js +58 -59
- package/lib/iframe/index.js +31 -31
- package/lib/image/index.js +226 -42
- package/lib/image/style/image.css +1 -1
- package/lib/index.js +4 -4
- package/lib/indicator/index.js +70 -67
- package/lib/init.js +8 -8
- package/lib/input/index.js +150 -135
- package/lib/input-number/index.js +100 -97
- package/lib/layout/index.js +72 -60
- package/lib/liquid-fill/index.js +73 -73
- package/lib/marker/index.js +43 -44
- package/lib/menu/index.js +47 -41
- package/lib/message/index.js +3 -3
- package/lib/message/style/message.css +1 -1
- package/lib/modal/index.js +67 -67
- package/lib/modal/style/modal.css +1 -1
- package/lib/notification/index.js +6 -6
- package/lib/notification/style/notification.css +1 -1
- package/lib/pagination/index.js +34 -34
- package/lib/popup/index.js +45 -46
- package/lib/progress/index.js +440 -440
- package/lib/radio/index.js +48 -42
- package/lib/select/index.js +47 -41
- package/lib/slider/index.js +27 -27
- package/lib/slideshow/index.js +103 -160
- package/lib/spin/index.js +30 -30
- package/lib/steps/index.js +35 -32
- package/lib/switch/index.js +25 -25
- package/lib/table/index.js +50 -44
- package/lib/table/style/table.css +1 -1
- package/lib/table-popup/index.js +43 -37
- package/lib/table-popup/style/table-popup.css +1 -1
- package/lib/tabs/index.js +35 -32
- package/lib/text/index.js +39 -39
- package/lib/tile-layer/index.js +35 -36
- package/lib/time-line/index.js +41 -43
- package/lib/time-picker/index.js +27 -27
- package/lib/time-range/index.js +53 -55
- package/lib/time-slider/index.js +73 -75
- package/lib/time-text/index.js +31 -31
- package/lib/tooltip/index.js +25 -25
- package/lib/tooltip/style/tooltip.css +1 -0
- package/lib/transfer/index.js +27 -27
- package/lib/tree/index.js +48 -42
- package/lib/tree-select/index.js +37 -34
- package/lib/video-player/index.js +98 -97
- package/lib/video-player/style/video-player.css +1 -1
- package/lib/web-map/index.js +2336 -103
- package/package.json +2 -4
- package/src/common/_assets/iconfont/icon-sm-components.css +21 -7
- package/src/common/_assets/iconfont/icon-sm-components.ttf +0 -0
- package/src/common/_assets/iconfont/icon-sm-components.woff +0 -0
- package/src/common/_assets/iconfont/icon-sm-components.woff2 +0 -0
- package/src/common/_lang/en.js +19 -8
- package/src/common/_lang/zh.js +18 -6
- package/src/common/_mixin/Card.ts +1 -1
- package/src/common/_types/iPortalDataParameter.js +1 -0
- package/src/common/_types/iServerBaseParameter.ts +3 -0
- package/src/common/_utils/epsg-define.js +32 -27
- package/src/common/_utils/get-features.js +13 -2
- package/src/common/_utils/iPortalDataService.js +14 -3
- package/src/common/_utils/iServerRestService.js +144 -78
- package/src/common/_utils/statistics.js +6 -14
- package/src/common/_utils/style/theme/theme.json +6 -6
- package/src/common/attribute-panel/AttributePanel.vue +58 -0
- package/src/common/attribute-panel/__test__/AttributePanel.spec.js +39 -0
- package/src/common/attribute-panel/index.js +9 -0
- package/src/common/attribute-panel/style/attribute-panel.scss +35 -0
- package/src/common/attribute-panel/style/index.js +4 -0
- package/src/common/collapse-card/style/collapse-card.scss +2 -2
- package/src/common/iframe/Iframe.vue +1 -1
- package/src/common/image/Image.vue +68 -6
- package/src/common/image/style/image.scss +32 -0
- package/src/common/message/style/message.scss +1 -0
- package/src/common/modal/style/modal.scss +36 -0
- package/src/common/notification/style/notification.scss +9 -0
- package/src/common/slideshow/Slideshow.vue +42 -95
- package/src/common/slideshow/Swiper.js +1 -1
- package/src/common/table/style/table.scss +36 -0
- package/src/common/table-popup/TablePopup.vue +5 -0
- package/src/common/tooltip/style/tooltip.scss +3 -0
- package/src/common/video-player/style/video-player.scss +1 -1
- package/src/leaflet/entrys.json +0 -2
- package/src/leaflet/package.json +2 -4
- package/src/leaflet/web-map/WebMap.vue +4 -4
- package/src/leaflet/web-map/WebMapViewModel.ts +64 -17
- package/static/libs/iclient-common/iclient-common-webmapv2base.js +2 -0
- package/static/libs/iclient-common/iclient-common.js +1 -1
- package/static/libs/iclient-leaflet/iclient-leaflet.min.js +5 -1738
- package/lib/_assets/iconfont/icon-sm-components.eot +0 -0
- package/lib/_assets/iconfont/icon-sm-components.svg +0 -197
- package/lib/_mixin/WebMapBase.js +0 -3467
- package/lib/_utils/WebMapService.js +0 -1607
- package/src/common/_assets/iconfont/icon-sm-components.eot +0 -0
- package/src/common/_assets/iconfont/icon-sm-components.svg +0 -197
- package/src/common/_utils/WebMapService.ts +0 -1292
- package/src/common/web-map/WebMapBase.ts +0 -1178
- package/src/common/web-map/config/MunicipalCenter.json +0 -1
- package/src/common/web-map/config/ProvinceCenter.json +0 -1
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
QueryBySQLParameters,
|
|
3
|
+
QueryByGeometryParameters,
|
|
3
4
|
FilterParameter,
|
|
4
5
|
QueryBySQLService,
|
|
5
6
|
FetchRequest,
|
|
7
|
+
FeatureService,
|
|
8
|
+
QueryService,
|
|
6
9
|
GetFeaturesBySQLParameters,
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
GetFeaturesByBoundsParameters,
|
|
11
|
+
Util,
|
|
12
|
+
GeometryPolygon,
|
|
13
|
+
GeometryLinearRing,
|
|
14
|
+
GeometryPoint
|
|
9
15
|
} from 'vue-iclient/static/libs/iclient-common/iclient-common';
|
|
10
16
|
import { Events } from 'vue-iclient/src/common/_types/event/Events';
|
|
11
17
|
import { getProjection } from 'vue-iclient/src/common/_utils/epsg-define';
|
|
@@ -17,11 +23,6 @@ import cloneDeep from 'lodash.clonedeep';
|
|
|
17
23
|
export function _getValueOfEpsgCode(epsgCode) {
|
|
18
24
|
const defName = `EPSG:${epsgCode}`;
|
|
19
25
|
const defValue = getProjection(defName);
|
|
20
|
-
if (!defValue) {
|
|
21
|
-
console.error(`${defName} not define`);
|
|
22
|
-
} else {
|
|
23
|
-
!proj4.defs(defName) && proj4.defs(defName, defValue);
|
|
24
|
-
}
|
|
25
26
|
return {
|
|
26
27
|
name: defName,
|
|
27
28
|
value: defValue
|
|
@@ -66,9 +67,9 @@ export function vertifyEpsgCode(firstFeature) {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
export function transformFeatures(epsgCode, features) {
|
|
69
|
-
const projName = _getValueOfEpsgCode(epsgCode)
|
|
70
|
+
const { name: projName, value: projValue } = _getValueOfEpsgCode(epsgCode);
|
|
70
71
|
const transformedFeatures = features.map(feature => {
|
|
71
|
-
if (
|
|
72
|
+
if (projValue && feature.geometry && feature.geometry.coordinates) {
|
|
72
73
|
const coordinates = feature.geometry.coordinates;
|
|
73
74
|
feature.geometry.coordinates = _transformCoordinates(coordinates, projName);
|
|
74
75
|
}
|
|
@@ -134,7 +135,10 @@ export default class iServerRestService extends Events {
|
|
|
134
135
|
super();
|
|
135
136
|
this.url = url;
|
|
136
137
|
this.options = options || {};
|
|
138
|
+
this.options.fromIndex = this.options.fromIndex ?? 0;
|
|
137
139
|
this.eventTypes = ['getdatasucceeded', 'getdatafailed', 'featureisempty'];
|
|
140
|
+
this._defaultMaxFeatures = 1000;
|
|
141
|
+
this._queryResultHandler = this._queryResultHandler.bind(this);
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
getData(datasetInfo, queryInfo) {
|
|
@@ -173,19 +177,19 @@ export default class iServerRestService extends Events {
|
|
|
173
177
|
getMapFeatures(datasetInfo, queryInfo) {
|
|
174
178
|
let { dataUrl, mapName } = datasetInfo;
|
|
175
179
|
queryInfo.name = mapName;
|
|
176
|
-
this.projectionUrl =
|
|
180
|
+
this.projectionUrl = Util.urlPathAppend(dataUrl, 'prjCoordSys');
|
|
177
181
|
if (queryInfo.keyWord) {
|
|
178
182
|
this._getRestMapFields(
|
|
179
183
|
dataUrl,
|
|
180
184
|
mapName,
|
|
181
185
|
fields => {
|
|
182
|
-
|
|
183
|
-
this.
|
|
186
|
+
const attributeFilter = this._getAttributeFilterByKeywords(fields, queryInfo.keyWord);
|
|
187
|
+
this._queryMapFeatures(dataUrl, { ...queryInfo, attributeFilter });
|
|
184
188
|
},
|
|
185
189
|
queryInfo.withCredentials
|
|
186
190
|
);
|
|
187
191
|
} else {
|
|
188
|
-
this.
|
|
192
|
+
this._queryMapFeatures(dataUrl, queryInfo);
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
195
|
|
|
@@ -205,15 +209,15 @@ export default class iServerRestService extends Events {
|
|
|
205
209
|
let { datasetName, dataSourceName, dataUrl } = datasetInfo;
|
|
206
210
|
queryInfo.name = datasetName + '@' + dataSourceName;
|
|
207
211
|
queryInfo.datasetNames = [dataSourceName + ':' + datasetName];
|
|
208
|
-
this.projectionUrl =
|
|
212
|
+
this.projectionUrl = Util.urlPathAppend(dataUrl, `datasources/${dataSourceName}/datasets/${datasetName}`);
|
|
209
213
|
if (queryInfo.keyWord) {
|
|
210
|
-
let fieldsUrl = dataUrl
|
|
214
|
+
let fieldsUrl = Util.urlAppend(Util.urlPathAppend(dataUrl, `datasources/${dataSourceName}/datasets/${datasetName}/fields`), 'returnAll=true');
|
|
211
215
|
this._getRestDataFields(fieldsUrl, queryInfo, fields => {
|
|
212
|
-
|
|
213
|
-
this.
|
|
216
|
+
const attributeFilter = this._getAttributeFilterByKeywords(fields, queryInfo.keyWord);
|
|
217
|
+
this._queryDataFeatures(dataUrl, { ...queryInfo, attributeFilter });
|
|
214
218
|
});
|
|
215
219
|
} else {
|
|
216
|
-
this.
|
|
220
|
+
this._queryDataFeatures(dataUrl, queryInfo);
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
223
|
|
|
@@ -261,61 +265,129 @@ export default class iServerRestService extends Events {
|
|
|
261
265
|
});
|
|
262
266
|
}
|
|
263
267
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
268
|
+
_queryMapFeatures(url, queryInfo) {
|
|
269
|
+
const queryService = new QueryService(url, {
|
|
270
|
+
proxy: this.options.proxy,
|
|
271
|
+
withCredentials: queryInfo.withCredentials
|
|
272
|
+
});
|
|
273
|
+
const expectCountOptions = this._calcFeaturesExpectCountOptions(queryInfo);
|
|
274
|
+
const pickedCommonParams = {
|
|
275
|
+
startRecord: expectCountOptions.fromIndex,
|
|
276
|
+
expectCount: expectCountOptions.maxFeatures,
|
|
277
|
+
prjCoordSys: {
|
|
278
|
+
epsgCode: 4326
|
|
279
|
+
},
|
|
267
280
|
queryParams: [
|
|
268
281
|
{
|
|
269
282
|
name: queryInfo.name,
|
|
270
283
|
attributeFilter: queryInfo.attributeFilter,
|
|
271
284
|
orderBy: queryInfo.orderBy
|
|
272
285
|
}
|
|
273
|
-
]
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
286
|
+
]
|
|
287
|
+
};
|
|
288
|
+
if (queryInfo.bounds) {
|
|
289
|
+
const params = this._getMapFeaturesParamsByGeometry(queryInfo, pickedCommonParams);
|
|
290
|
+
queryService.queryByGeometry(params, this._queryResultHandler);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const params = this._getMapFeaturesParamsBySql(queryInfo, pickedCommonParams);
|
|
294
|
+
queryService.queryBySQL(params, this._queryResultHandler);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
_queryDataFeatures(url, queryInfo) {
|
|
298
|
+
const featureService = new FeatureService(url, {
|
|
279
299
|
proxy: this.options.proxy,
|
|
280
|
-
withCredentials: queryInfo.withCredentials
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
300
|
+
withCredentials: queryInfo.withCredentials
|
|
301
|
+
});
|
|
302
|
+
const expectCountOptions = this._calcFeaturesExpectCountOptions(queryInfo);
|
|
303
|
+
const pickedCommonParams = {
|
|
304
|
+
...expectCountOptions,
|
|
305
|
+
targetPrj: {
|
|
306
|
+
epsgCode: 4326
|
|
307
|
+
},
|
|
308
|
+
returnFeaturesOnly: this.options.returnFeaturesOnly
|
|
309
|
+
};
|
|
310
|
+
if (queryInfo.bounds) {
|
|
311
|
+
const params = this._getDataFeaturesParamsByGeometry(queryInfo, pickedCommonParams);
|
|
312
|
+
featureService.getFeaturesByGeometry(params, this._queryResultHandler);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const params = this._getDataFeaturesParamsBySql(queryInfo, pickedCommonParams);
|
|
316
|
+
featureService.getFeaturesBySQL(params, this._queryResultHandler);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
_getMapFeaturesParamsBySql(queryInfo, commonParams) {
|
|
320
|
+
return new QueryBySQLParameters({
|
|
321
|
+
...commonParams,
|
|
322
|
+
queryOption: this.options.hasGeometry === false ? 'ATTRIBUTE' : 'ATTRIBUTEANDGEOMETRY'
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
_getMapFeaturesParamsByGeometry(queryInfo, commonParams) {
|
|
327
|
+
return new QueryByGeometryParameters({
|
|
328
|
+
...commonParams,
|
|
329
|
+
spatialQueryMode: 'INTERSECT',
|
|
330
|
+
geometry: this._transBoundsToGeometry(queryInfo)
|
|
288
331
|
});
|
|
289
|
-
queryBySQLService.processAsync(queryBySQLParams);
|
|
290
332
|
}
|
|
291
333
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
334
|
+
_getDataFeaturesParamsBySql(queryInfo, commonParams) {
|
|
335
|
+
return new GetFeaturesBySQLParameters({
|
|
336
|
+
...commonParams,
|
|
295
337
|
queryParameter: {
|
|
296
338
|
name: queryInfo.name,
|
|
297
339
|
attributeFilter: queryInfo.attributeFilter,
|
|
298
340
|
orderBy: queryInfo.orderBy
|
|
299
341
|
},
|
|
300
342
|
hasGeometry: this.options.hasGeometry,
|
|
301
|
-
datasetNames: queryInfo.datasetNames
|
|
302
|
-
fromIndex: this.options.fromIndex || 0,
|
|
303
|
-
toIndex: this.options.toIndex || (queryInfo.maxFeatures >= 1000 ? -1 : queryInfo.maxFeatures - 1),
|
|
304
|
-
maxFeatures: -1,
|
|
305
|
-
returnFeaturesOnly: this.options.returnFeaturesOnly
|
|
343
|
+
datasetNames: queryInfo.datasetNames
|
|
306
344
|
});
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
_getDataFeaturesParamsByGeometry(queryInfo, commonParams) {
|
|
348
|
+
return new GetFeaturesByBoundsParameters({
|
|
349
|
+
...commonParams,
|
|
350
|
+
attributeFilter: queryInfo.attributeFilter,
|
|
351
|
+
datasetNames: queryInfo.datasetNames,
|
|
352
|
+
spatialQueryMode: 'INTERSECT',
|
|
353
|
+
geometry: this._transBoundsToGeometry(queryInfo)
|
|
317
354
|
});
|
|
318
|
-
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
_transBoundsToGeometry(queryInfo) {
|
|
358
|
+
const lnglatBounds = queryInfo.bounds;
|
|
359
|
+
const west = lnglatBounds.getWest();
|
|
360
|
+
const east = lnglatBounds.getEast();
|
|
361
|
+
const sourth = lnglatBounds.getSouth();
|
|
362
|
+
const north = lnglatBounds.getNorth();
|
|
363
|
+
const geometry = new GeometryPolygon([
|
|
364
|
+
new GeometryLinearRing([
|
|
365
|
+
new GeometryPoint(west, sourth),
|
|
366
|
+
new GeometryPoint(east, sourth),
|
|
367
|
+
new GeometryPoint(east, north),
|
|
368
|
+
new GeometryPoint(west, north)
|
|
369
|
+
])
|
|
370
|
+
]);
|
|
371
|
+
geometry.SRID = 4326;
|
|
372
|
+
return geometry;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
_calcFeaturesExpectCountOptions(queryInfo) {
|
|
376
|
+
const maxFeatures = queryInfo.maxFeatures ?? this._defaultMaxFeatures;
|
|
377
|
+
const toIndex = this.options.toIndex ?? maxFeatures - 1;
|
|
378
|
+
return {
|
|
379
|
+
fromIndex: this.options.fromIndex,
|
|
380
|
+
toIndex,
|
|
381
|
+
maxFeatures: toIndex - this.options.fromIndex + 1
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
_queryResultHandler(serviceResult) {
|
|
386
|
+
if (serviceResult.type === 'processCompleted') {
|
|
387
|
+
this._getFeaturesSucceed(serviceResult);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
this._getFeaturesFailed(serviceResult);
|
|
319
391
|
}
|
|
320
392
|
|
|
321
393
|
async _getFeaturesSucceed(results) {
|
|
@@ -344,10 +416,17 @@ export default class iServerRestService extends Events {
|
|
|
344
416
|
// 数据来自restdata---results.result.features
|
|
345
417
|
this.features = results.result.features;
|
|
346
418
|
features = this.features.features || this.features;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
419
|
+
if (results.result.totalCount === 0) {
|
|
420
|
+
this.triggerEvent('featureisempty', {
|
|
421
|
+
results
|
|
422
|
+
});
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
let fields, fieldCaptions, fieldTypes;
|
|
350
426
|
if (results.result.datasetInfos) {
|
|
427
|
+
fields = [];
|
|
428
|
+
fieldCaptions = [];
|
|
429
|
+
fieldTypes = [];
|
|
351
430
|
const fieldInfos = results.result.datasetInfos[0].fieldInfos;
|
|
352
431
|
fieldInfos.forEach(fieldInfo => {
|
|
353
432
|
if (fieldInfo.name) {
|
|
@@ -357,31 +436,14 @@ export default class iServerRestService extends Events {
|
|
|
357
436
|
}
|
|
358
437
|
});
|
|
359
438
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
results.result.totalCount && (data.totalCount = results.result.totalCount);
|
|
363
|
-
} else {
|
|
364
|
-
this.triggerEvent('featureisempty', {
|
|
365
|
-
results
|
|
366
|
-
});
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
439
|
+
data = statisticsFeatures(features, fields, fieldCaptions, fieldTypes);
|
|
440
|
+
data.totalCount = results.result.totalCount;
|
|
369
441
|
} else {
|
|
370
442
|
this.triggerEvent('getdatafailed', {
|
|
371
443
|
results
|
|
372
444
|
});
|
|
373
445
|
return;
|
|
374
446
|
}
|
|
375
|
-
// vertified 表示已经验证过 epsgCode且转化了features 比如iportalData从content.json获取的features
|
|
376
|
-
if (!results.result.vertified) {
|
|
377
|
-
// 关系型存储发布成服务后坐标一定是4326,但真实数据可能不是4326,判断一下暂时按照3857处理
|
|
378
|
-
data.features = await checkAndRectifyFeatures({
|
|
379
|
-
features: data.features,
|
|
380
|
-
epsgCode: this.options.epsgCode,
|
|
381
|
-
projectionUrl: this.projectionUrl,
|
|
382
|
-
options: { proxy: this.options.proxy }
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
447
|
|
|
386
448
|
/**
|
|
387
449
|
* @event iServerRestService#getdatasucceeded
|
|
@@ -391,6 +453,10 @@ export default class iServerRestService extends Events {
|
|
|
391
453
|
this.triggerEvent('getdatasucceeded', data);
|
|
392
454
|
}
|
|
393
455
|
|
|
456
|
+
_getFeaturesFailed(serviceResult) {
|
|
457
|
+
this.fetchFailed(serviceResult.error);
|
|
458
|
+
}
|
|
459
|
+
|
|
394
460
|
_getRestDataFields(fieldsUrl, queryInfo, callBack) {
|
|
395
461
|
FetchRequest.get(fieldsUrl, null, {
|
|
396
462
|
proxy: this.options.proxy,
|
|
@@ -426,7 +492,7 @@ export default class iServerRestService extends Events {
|
|
|
426
492
|
let fields;
|
|
427
493
|
if (serviceResult.result) {
|
|
428
494
|
let result = serviceResult.result.recordsets[0];
|
|
429
|
-
fields = this._getFiledsByType(['CHAR', 'TEXT', 'WTEXT'], result.
|
|
495
|
+
fields = this._getFiledsByType(['CHAR', 'TEXT', 'WTEXT'], result.fields, result.fieldTypes);
|
|
430
496
|
}
|
|
431
497
|
fields && callBack(fields, serviceResult.result.recordsets[0]);
|
|
432
498
|
},
|
|
@@ -2,25 +2,17 @@ export function statisticsFeatures(features, fields, fieldCaptions, fieldTypes)
|
|
|
2
2
|
const data = {
|
|
3
3
|
features,
|
|
4
4
|
fields: fields || [],
|
|
5
|
+
fieldCaptions: fieldCaptions || [],
|
|
5
6
|
fieldValues: [],
|
|
6
7
|
fieldTypes
|
|
7
8
|
};
|
|
8
|
-
if(features && !!features.length) {
|
|
9
|
-
if(fieldCaptions && fieldCaptions.length) {
|
|
10
|
-
features.forEach(feature => {
|
|
11
|
-
const newProperties = {};
|
|
12
|
-
for (const field in feature.properties) {
|
|
13
|
-
const index = fields.indexOf(field);
|
|
14
|
-
const fieldCaption = fieldCaptions[index];
|
|
15
|
-
newProperties[fieldCaption || field] = feature.properties[field];
|
|
16
|
-
}
|
|
17
|
-
feature.properties = newProperties;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
9
|
+
if (features && !!features.length && !fieldCaptions && !fields) {
|
|
20
10
|
const properties = Object.assign({}, features[0].properties, features[features.length - 1].properties);
|
|
21
|
-
|
|
11
|
+
for (let attr in properties) {
|
|
12
|
+
data.fieldCaptions.push(attr);
|
|
13
|
+
data.fields.push(attr);
|
|
14
|
+
}
|
|
22
15
|
}
|
|
23
|
-
|
|
24
16
|
for (let m in data.fields) {
|
|
25
17
|
const fieldValue = [];
|
|
26
18
|
for (let j in features) {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"btnHoverColor": "#EA7568",
|
|
31
31
|
"btnActiveColor": "#CC211C",
|
|
32
32
|
|
|
33
|
-
"successColor": "#
|
|
33
|
+
"successColor": "#3DAB1B",
|
|
34
34
|
"infoColor": "#3499E5",
|
|
35
|
-
"warningColor": "#
|
|
35
|
+
"warningColor": "#E2CA34",
|
|
36
36
|
"dangerColor": "#DC5849",
|
|
37
37
|
"shadowBase": "rgba(0, 0, 0, 0.35)",
|
|
38
38
|
"shadowTooltip": "rgba(0, 0, 0, 0.35)",
|
|
@@ -145,9 +145,9 @@
|
|
|
145
145
|
"l100": "#FFFFFF",
|
|
146
146
|
"btnHoverColor": "#F6241D",
|
|
147
147
|
"btnActiveColor": "#D7000E",
|
|
148
|
-
"successColor": "#
|
|
148
|
+
"successColor": "#00BC00",
|
|
149
149
|
"infoColor": "#0081E2",
|
|
150
|
-
"warningColor": "#
|
|
150
|
+
"warningColor": "#F2B200",
|
|
151
151
|
"dangerColor": "#FF4D4F",
|
|
152
152
|
"shadowBase": "rgba(0, 0, 0, 0.14)",
|
|
153
153
|
"shadowTooltip": "rgba(0, 0, 0, 0.14)",
|
|
@@ -252,9 +252,9 @@
|
|
|
252
252
|
"hoverColor": "#e5666f",
|
|
253
253
|
"hoverBg": "rgba(255, 255, 255, 0.04)",
|
|
254
254
|
"clickColor": "#dc333f",
|
|
255
|
-
"successColor": "#
|
|
255
|
+
"successColor": "#3DAB1B",
|
|
256
256
|
"infoColor": "#3499E5",
|
|
257
|
-
"warningColor": "#
|
|
257
|
+
"warningColor": "#E2CA34",
|
|
258
258
|
"dangerColor": "#DC5849",
|
|
259
259
|
"iconColorHover": "rgba(255, 255, 255, 0.75)",
|
|
260
260
|
"headingColor": "rgba(255, 255, 255, 0.85)",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sm-component-attribute-panel" :style="[getTextColorStyle, !showBorder && { border: 'none' }]">
|
|
3
|
+
<div class="sm-component-attribute-panel__header">
|
|
4
|
+
<div v-if="!$slots.header && title !== undefined" class="title ellipsis" :title="title">{{ title }}</div>
|
|
5
|
+
<slot name="header" />
|
|
6
|
+
</div>
|
|
7
|
+
<div class="sm-component-attribute-panel__content">
|
|
8
|
+
<sm-table-popup v-bind="tablePopupProps" />
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { Component, Prop, Mixins } from 'vue-property-decorator';
|
|
15
|
+
import Theme from 'vue-iclient/src/common/_mixin/Theme';
|
|
16
|
+
import SmTablePopup from 'vue-iclient/src/common/table-popup/TablePopup.vue';
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
name: 'SmAttributePanel',
|
|
20
|
+
components: { SmTablePopup }
|
|
21
|
+
})
|
|
22
|
+
class SmAttributePanel extends Mixins(Theme) {
|
|
23
|
+
@Prop() title: String;
|
|
24
|
+
|
|
25
|
+
@Prop({ default: true }) showBorder: Boolean;
|
|
26
|
+
|
|
27
|
+
@Prop() titleRender: Function;
|
|
28
|
+
|
|
29
|
+
@Prop() valueRender: Function;
|
|
30
|
+
|
|
31
|
+
@Prop({
|
|
32
|
+
default: () => {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
attributes: Array<Object>;
|
|
37
|
+
|
|
38
|
+
get tablePopupProps() {
|
|
39
|
+
return {
|
|
40
|
+
data: this.attributes,
|
|
41
|
+
columns: [
|
|
42
|
+
{
|
|
43
|
+
dataIndex: 'title',
|
|
44
|
+
customRender: this.titleRender
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
dataIndex: 'value',
|
|
48
|
+
customRender: this.valueRender
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
showHeader: false,
|
|
52
|
+
background: 'transparent',
|
|
53
|
+
textColor: this.textColor
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export default SmAttributePanel;
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { mount, createLocalVue } from '@vue/test-utils';
|
|
2
|
+
import SmAttributePanel from '../AttributePanel.vue';
|
|
3
|
+
const localVue = createLocalVue();
|
|
4
|
+
|
|
5
|
+
describe('AttributePanel.vue', () => {
|
|
6
|
+
let wrapper;
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = null;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
if (wrapper) {
|
|
13
|
+
wrapper.destroy();
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('render', async done => {
|
|
18
|
+
let attr = [
|
|
19
|
+
{
|
|
20
|
+
"title": "video",
|
|
21
|
+
"value": "https://www.runoob.com/try/demo_source/mov_bbb.mp4",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"title": "image",
|
|
25
|
+
"value": "http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960",
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
wrapper = mount(SmAttributePanel, {
|
|
29
|
+
localVue,
|
|
30
|
+
propsData: {
|
|
31
|
+
attributes: attr
|
|
32
|
+
},
|
|
33
|
+
attachToDocument: 'body'
|
|
34
|
+
});
|
|
35
|
+
await wrapper.vm.$nextTick();
|
|
36
|
+
expect(wrapper.vm.tablePopupProps.data).toEqual(attr);
|
|
37
|
+
done();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import AttributePanel from './AttributePanel';
|
|
2
|
+
import init from 'vue-iclient/src/init';
|
|
3
|
+
|
|
4
|
+
AttributePanel.install = function(Vue, opts) {
|
|
5
|
+
init(Vue, opts);
|
|
6
|
+
Vue.component(AttributePanel.options ? AttributePanel.options.name : AttributePanel.name, AttributePanel);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default AttributePanel;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@import '../../../common/_utils/style/mixins/mixins.scss';
|
|
2
|
+
@import '../../../common/_utils/style/theme/theme.scss';
|
|
3
|
+
@import '../../../common/table-popup/style/table-popup.scss';
|
|
4
|
+
|
|
5
|
+
@include b(attribute-panel) {
|
|
6
|
+
min-width: 200px;
|
|
7
|
+
height: 100%;
|
|
8
|
+
overflow: auto;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
border: 1px solid $border-color-split;
|
|
11
|
+
@include e(header) {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
width: 100%;
|
|
16
|
+
border-bottom: 1px solid $border-color-split;
|
|
17
|
+
.title {
|
|
18
|
+
padding: 8px 16px;
|
|
19
|
+
}
|
|
20
|
+
.ellipsis {
|
|
21
|
+
width: calc(100% - 80px);
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@include e(content) {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: auto;
|
|
30
|
+
padding-top: 5px;
|
|
31
|
+
.sm-component-table-content {
|
|
32
|
+
max-height: none !important;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -139,20 +139,20 @@
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
@include when(top-left) {
|
|
142
|
+
transform-origin: top left;
|
|
142
143
|
@include when(icon) {
|
|
143
144
|
& > .sm-component-collapse-card__header {
|
|
144
145
|
padding-left: 38px;
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
|
-
transform-origin: top left;
|
|
148
148
|
}
|
|
149
149
|
@include when(bottom-left) {
|
|
150
|
+
transform-origin: top left;
|
|
150
151
|
@include when(icon) {
|
|
151
152
|
& > .sm-component-collapse-card__header {
|
|
152
153
|
padding-left: 38px;
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
|
-
transform-origin: top left;
|
|
156
156
|
}
|
|
157
157
|
@include when(not-header) {
|
|
158
158
|
@include when(bottom-right) {
|