diff --git a/client/containers/AddInterface/ReqHeader/ReqList.js b/client/containers/AddInterface/ReqHeader/ReqList.js index 47e8da5a..4e3a6f83 100644 --- a/client/containers/AddInterface/ReqHeader/ReqList.js +++ b/client/containers/AddInterface/ReqHeader/ReqList.js @@ -50,7 +50,11 @@ class ReqList extends Component { if (url.includes(dir)) { const { seqGroup, value: { id } } = this.props - seqGroup[id].name = value + seqGroup.forEach(v => { + if (id == v.id) { + v.name = value + } + }) seqGroup.forEach(v => { const {id, name, value} = v newObject.push({id, name, value}) @@ -58,8 +62,16 @@ class ReqList extends Component { this.props.addReqHeader( newObject ) } else { const { seqGroup, dataNum } = this.props - seqGroup[dataNum].name = value - this.props.addReqHeader(Object.create(seqGroup)) + seqGroup.forEach(v => { + if (dataNum == v.id) { + v.name = value + } + }) + seqGroup.forEach(v => { + const {id, name, value} = v + newObject.push({id, name, value}) + }) + this.props.addReqHeader(newObject) } } @@ -68,7 +80,11 @@ class ReqList extends Component { const value = e.target.value const { seqGroup, value: { id } } = this.props const newObject = [] - seqGroup[id].value = value + seqGroup.forEach(v => { + if (id == v.id) { + v.value = value + } + }) seqGroup.forEach(v => { const {id, name, value} = v newObject.push({id, name, value}) @@ -93,9 +109,9 @@ class ReqList extends Component { render () { const propsValue = this.props.value const Option = Select.Option - const value = propsValue.value + const value = propsValue.value || '' const name = propsValue.name || '' - + console.log(name) return (