@@ -8,6 +8,7 @@ import { ColorsPickerUtil } from '@supermap/iclient-common/util/ColorsPickerUtil
88import { SecurityManager } from '@supermap/iclient-common/security/SecurityManager' ;
99import { Events } from '@supermap/iclient-common/commontypes/Events' ;
1010import { Util as CommonUtil } from '@supermap/iclient-common/commontypes/Util' ;
11+ import { parseCondition , parseConditionFeature } from '@supermap/iclient-common/util/FilterCondition' ;
1112import {
1213 Util
1314} from '../core/Util' ;
@@ -2749,15 +2750,16 @@ export class WebMap extends Observable {
27492750 */
27502751 getFiterFeatures ( filterCondition , allFeatures ) {
27512752 let condition = this . parseFilterCondition ( filterCondition ) ;
2752- let sql = "select * from json where (" + condition + ")" ;
27532753 let filterFeatures = [ ] ;
27542754 for ( let i = 0 ; i < allFeatures . length ; i ++ ) {
27552755 let feature = allFeatures [ i ] ;
27562756 let filterResult = false ;
27572757 try {
2758- filterResult = window . jsonsql . query ( sql , {
2759- attributes : feature . get ( 'attributes' )
2760- } ) ;
2758+ const properties = feature . get ( 'attributes' ) ;
2759+ const conditions = parseCondition ( condition , Object . keys ( properties ) ) ;
2760+ const filterFeature = parseConditionFeature ( properties ) ;
2761+ const sql = 'select * from json where (' + conditions + ')' ;
2762+ filterResult = window . jsonsql . query ( sql , { attributes : filterFeature } ) ;
27612763 } catch ( err ) {
27622764 //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题
27632765 continue ;
@@ -3459,11 +3461,12 @@ export class WebMap extends Observable {
34593461 } ) ;
34603462 if ( layerInfo . filterCondition ) {
34613463 //过滤条件
3462- let condition = that . parseFilterCondition ( layerInfo . filterCondition ) ;
3463- let sql = "select * from json where (" + condition + ")" ;
3464- let filterResult = window . jsonsql . query ( sql , {
3465- attributes : feature . get ( 'attributes' )
3466- } ) ;
3464+ const condition = that . parseFilterCondition ( layerInfo . filterCondition ) ;
3465+ const properties = feature . get ( 'attributes' ) ;
3466+ const conditions = parseCondition ( condition , Object . keys ( properties ) ) ;
3467+ const filterFeature = parseConditionFeature ( properties ) ;
3468+ const sql = 'select * from json where (' + conditions + ')' ;
3469+ let filterResult = window . jsonsql . query ( sql , { attributes : filterFeature } ) ;
34673470 if ( filterResult && filterResult . length > 0 ) {
34683471 that . addDataflowFeature ( feature , layerInfo . identifyField , {
34693472 dataflowSource : source ,
@@ -3610,10 +3613,11 @@ export class WebMap extends Observable {
36103613 if ( layerInfo . filterCondition ) {
36113614 //过滤条件
36123615 let condition = that . parseFilterCondition ( layerInfo . filterCondition ) ;
3613- let sql = "select * from json where (" + condition + ")" ;
3614- let filterResult = window . jsonsql . query ( sql , {
3615- attributes : feature . get ( 'attributes' )
3616- } ) ;
3616+ const properties = feature . get ( 'attributes' ) ;
3617+ const conditions = parseCondition ( condition , Object . keys ( properties ) ) ;
3618+ const filterFeature = parseConditionFeature ( properties ) ;
3619+ const sql = 'select * from json where (' + conditions + ')' ;
3620+ let filterResult = window . jsonsql . query ( sql , { attributes : filterFeature } ) ;
36173621 if ( filterResult && filterResult . length > 0 ) {
36183622 that . addDataflowFeature ( feature , layerInfo . identifyField , {
36193623 dataflowSource : source ,
0 commit comments