From b4fa7ad9c8e0051e9851c3bfbe398d5ff4cbfafe Mon Sep 17 00:00:00 2001
From: 陈泽平 <chenzeping>
Date: 星期三, 19 五月 2021 16:05:39 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop

---
 src/components/helpers/WfsHelper.js |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/components/helpers/WfsHelper.js b/src/components/helpers/WfsHelper.js
index 2ea5c7e..d590b0a 100644
--- a/src/components/helpers/WfsHelper.js
+++ b/src/components/helpers/WfsHelper.js
@@ -2,6 +2,7 @@
  * 鍔犺浇WMS,鎷兼帴FILTER,LAYERS鍙傛暟绛�
  */
 import { WFS_URL } from '../../conf/Constants'
+import { lrtrim } from '../../utils/utils'
 function WfsHelper () {
   this.filters = []
   this.typeNames = []
@@ -12,12 +13,39 @@
     REQUEST: 'getfeature',
     OUTPUTFORMAT: 'application/json',
     maxFeatures: 10,
-    version: '1.0.0',
-    startIndex: 0
+    version: '1.0.0'
   }
 
   this.setTypeName = (typeName) => {
-    this.typeNames = 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 = () => {
@@ -106,6 +134,14 @@
     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