下拉框联动

This commit is contained in:
wangsongsole 2022-05-19 15:51:16 +08:00
parent a49305a979
commit 21805a9bab
1 changed files with 12 additions and 2 deletions

View File

@ -292,11 +292,17 @@ export default class exchangedit extends React.Component {
.catch((err) => {})
}
}
/* select事件 */
onRankChange(e) {
_.forEach(this.state.tempdata, (item) => {
item.checked =
e.findIndex((checks) => {
if (item.type === 'addProduct') {
return checks.key == item.product_id
} else {
return checks.key == item.batch_number
}
}) > -1
})
this.setState({ tempdata: this.state.tempdata })
@ -1171,7 +1177,11 @@ export default class exchangedit extends React.Component {
let arr = []
_.map(selection, (res) => {
let obj = {}
if (res.type === 'addProduct') {
obj.key = res.product_id
} else {
obj.key = res.batch_number
}
obj.text = res.product_name
arr.push(obj)
return obj