Commit 22bcd25a by peii

过滤修改

parent d3540216
......@@ -722,7 +722,7 @@ class ChooseProductPage extends Component {
rightNameFilter(list = [], isChildFilter = false) {
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') {
const curSupplier = topProcOptionList[topActiveIndex]
const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations)
......@@ -738,18 +738,15 @@ class ChooseProductPage extends Component {
}
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 includes = item => {
const preds = R.compose(
R.map(val => R.test(R.__, val)),
R.map(val => R.includes(R.__, val)),
R.filter(isNotBlank),
R.map(key => item[key])
)(keys)
return R.anyPass(preds)(reg)
return R.anyPass(preds)(searchValue)
}
return R.filter(includes, list)
......@@ -875,7 +872,6 @@ class ChooseProductPage extends Component {
superReduceBack={() => this.handleSubSelected()}
superLeftData={curSuperLeftOption}
rightNameFilter={this.rightNameFilter.bind(this)}
inputSearchValue={this.inputSearchValue.bind(this)}
/>
</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