From 00b89e4c17c3d34301be0bd51604b0c29ed77c3a Mon Sep 17 00:00:00 2001
From: seatonwan9 <seatonwan9@163.com>
Date: 星期五, 28 五月 2021 09:27:17 +0800
Subject: [PATCH] 修改风险统计图加载
---
src/components/helpers/WfsHelper.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 54 insertions(+), 1 deletions(-)
diff --git a/src/components/helpers/WfsHelper.js b/src/components/helpers/WfsHelper.js
index 9f9b781..d590b0a 100644
--- a/src/components/helpers/WfsHelper.js
+++ b/src/components/helpers/WfsHelper.js
@@ -2,15 +2,54 @@
* 鍔犺浇WMS,鎷兼帴FILTER,LAYERS鍙傛暟绛�
*/
import { WFS_URL } from '../../conf/Constants'
+import { lrtrim } from '../../utils/utils'
function WfsHelper () {
this.filters = []
this.typeNames = []
this.url = WFS_URL
+ this.page = 1
+ this.pageSize = 10
this.params = {
REQUEST: 'getfeature',
OUTPUTFORMAT: 'application/json',
- maxFeatures: 20000,
+ maxFeatures: 10,
version: '1.0.0'
+ }
+
+ this.setTypeName = (typeName) => {
+ if (typeof typeName === 'string' || typeName instanceof String) {
+ const comma = typeName.indexOf(',')
+ if (comma >= 0) {
+ const typeNameArr = typeName.split(',')
+ for (let i = 0; i < typeNameArr.length; i++) {
+ this.addTypeName(lrtrim(typeNameArr[i]))
+ }
+ }
+ } else if (Array.isArray(typeName)) {
+ this.typeNames = typeName
+ }
+ }
+
+ this.setFilter = (filter) => {
+ console.log(filter)
+ if (typeof filter === 'string' || filter instanceof String) {
+ const eq = filter.indexOf('=')
+ const lk = filter.indexOf('like')
+ if (eq >= 0) {
+ const filterArr = filter.split('=')
+ this.addEquals(lrtrim(filterArr[0]), lrtrim(filterArr[1]))
+ }
+ if (lk >= 0) {
+ const filterArr = filter.split('like')
+ this.addLike(lrtrim(filterArr[0]), lrtrim(filterArr[1]))
+ }
+ } else if (Array.isArray(filter)) {
+ this.filters = filter
+ }
+ }
+
+ this.clearFilter = () => {
+ this.filters = []
}
this.addTypeName = (typeName) => {
@@ -89,6 +128,20 @@
}
return url + this.getUrlParams()
}
+
+ this.setPage = (page) => {
+ const startIndex = page * this.pageSize
+ this.params.startIndex = startIndex
+ this.page = page
+ }
+
+ this.setPageSize = (pageSize) => {
+ this.pageSize = pageSize
+ }
+
+ this.setMaxFeatures = (maxFeatures) => {
+ this.params.maxFeatures = maxFeatures
+ }
}
export default WfsHelper
--
Gitblit v1.8.0