修复立减金组件字段兼容

This commit is contained in:
wangsongsole 2022-08-11 10:39:14 +08:00
parent 114c40ae16
commit 06b62673d5
1 changed files with 12 additions and 8 deletions

View File

@ -214,9 +214,12 @@ export default class addKnockGold extends Component {
model.usable_time = this.props.data.time_limit.use_time.type model.usable_time = this.props.data.time_limit.use_time.type
model.early_notifier = this.props.data.early_notifier?.map((item) => { model.early_notifier = this.props.data.early_notifier?.map((item) => {
return UserSelectList?.map((items) => { return UserSelectList?.map((items) => {
if (item.mobile === items.key) return items if (item?.mobile === items.key || item?.real_name === items.text) {
return items
}
}).filter((item1) => item1)[0] }).filter((item1) => item1)[0]
}) })
model.origin = this.props.data model.origin = this.props.data
/* 以下操作 筛选出输入框的预警值并经行填充 */ /* 以下操作 筛选出输入框的预警值并经行填充 */
const copy_early_per = this.props.data?.early_per || [] const copy_early_per = this.props.data?.early_per || []
@ -232,22 +235,23 @@ export default class addKnockGold extends Component {
// //
getUserSelectList(cb) { getUserSelectList(cb) {
const model = this.state.model
getVoucherWarningAccount().then((res) => getVoucherWarningAccount().then((res) =>
handelResponse( handelResponse(
res, res,
(req, msg) => { (req, msg) => {
const defaultData = req.default.map((item) => item.real_name) const defaultDataName = req.default.map((item) => item.real_name)
const defaultDataMobile = req.default.map((item) => item.mobile)
const newData = req.data.map((item) => { const newData = req.data.map((item) => {
if (defaultData.indexOf(item.real_name) !== -1) { if (
const obj = { defaultDataName.indexOf(item.real_name) !== -1 ||
defaultDataMobile.indexOf(item.mobile) !== -1
) {
return {
key: item.mobile, key: item.mobile,
text: item.real_name, text: item.real_name,
disabled: true, disabled: true,
closable: false closable: false
} }
model.early_notifier.push(obj)
return obj
} else { } else {
return { return {
key: item.mobile, key: item.mobile,
@ -256,7 +260,7 @@ export default class addKnockGold extends Component {
} }
} }
}) })
this.setState({ userSelectList: newData, model: model }) this.setState({ userSelectList: newData })
this.echoFun(newData) this.echoFun(newData)
}, },
(err) => { (err) => {