Commit 22bcd25a by peii

过滤修改

parent d3540216
...@@ -722,7 +722,7 @@ class ChooseProductPage extends Component { ...@@ -722,7 +722,7 @@ class ChooseProductPage extends Component {
rightNameFilter(list = [], isChildFilter = false) { rightNameFilter(list = [], isChildFilter = false) {
if(isBlank(list)) return [] if(isBlank(list)) return []
const {searchValue, authorizations, productAuthorization, topActiveIndex, topProcOptionList, leftActiveIndex, defaultThridShow} = this.state const {searchValue, authorizations, productAuthorization, topActiveIndex, topProcOptionList } = this.state
if (productAuthorization === 'Y') { if (productAuthorization === 'Y') {
const curSupplier = topProcOptionList[topActiveIndex] const curSupplier = topProcOptionList[topActiveIndex]
const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations) const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations)
...@@ -738,18 +738,15 @@ class ChooseProductPage extends Component { ...@@ -738,18 +738,15 @@ class ChooseProductPage extends Component {
} }
if (isBlank(searchValue)) return list if (isBlank(searchValue)) return list
const reg = new RegExp(searchValue, 'g')
const keys = ['general_name', 'item_name', 'specification', 'manufacturer_product_code', 'initials_pinyin', 'serial_number', 'category_name'] const keys = ['general_name', 'item_name', 'specification', 'manufacturer_product_code', 'initials_pinyin', 'serial_number', 'category_name']
const includes = item => { const includes = item => {
const preds = R.compose( const preds = R.compose(
R.map(val => R.test(R.__, val)), R.map(val => R.includes(R.__, val)),
R.filter(isNotBlank), R.filter(isNotBlank),
R.map(key => item[key]) R.map(key => item[key])
)(keys) )(keys)
return R.anyPass(preds)(searchValue)
return R.anyPass(preds)(reg)
} }
return R.filter(includes, list) return R.filter(includes, list)
...@@ -875,7 +872,6 @@ class ChooseProductPage extends Component { ...@@ -875,7 +872,6 @@ class ChooseProductPage extends Component {
superReduceBack={() => this.handleSubSelected()} superReduceBack={() => this.handleSubSelected()}
superLeftData={curSuperLeftOption} superLeftData={curSuperLeftOption}
rightNameFilter={this.rightNameFilter.bind(this)} rightNameFilter={this.rightNameFilter.bind(this)}
inputSearchValue={this.inputSearchValue.bind(this)}
/> />
</View> </View>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment