点击新增插入DOM对象
state = {
size: 'large',
notWorkPlane: [
{
type: '',//工作类型
customer_info_id: '',//订单id
content: ''//工作内容
}
]
};
//订单号 监听下拉菜单更新对应信息
bindorderList = (value,key) => {
console.log(`${value}`)
console.log(key)
let arr = this.state.notWorkPlane;
arr.map((item,index)=>{
if (key == index){
item.customer_info_id = value
}
return item
})
this.setState({notWorkPlane:arr})
}
//点击新增插入
addPlane = () => {
console.log(111)
let arr = this.state.notWorkPlane
arr.push({
type: '',//工作类型
customer_info_id: '',//订单id
content: ''//工作内容
})
this.setState({notWorkPlane: arr})
console.log(this.state.notWorkPlane)
}
<div className='programme' style={{padding: '14px'}}>
//遍历循环插入DOM对象
{
this.state.notWorkPlane.map((item, index) => {
return (
<div key={index} style={{marginTop: '14px'}}>
<div style={{display: 'flex'}}>
<div style={{width: '33.333%'}}>
<div style={{paddingBottom: '8px'}}>订单号</div>
<Select
showSearch
style={{width: '80%'}}
placeholder="订单号"
optionFilterProp="children"
onChange={(value)=>this.bindorderList(value,index)}
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{orderList}
</Select>
</div>
<div style={{width: '33.333%'}}>
<div style={{paddingBottom: '8px'}}>工作类型</div>
<Select
showSearch
style={{width: '80%'}}
placeholder="请选择工作类型"
optionFilterProp="children"
onChange={this.workType}
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option value="1">客户跟进</Option>
<Option value="2">方案对接</Option>
<Option value="3">带看</Option>
<Option value="4">商务谈判</Option>
<Option value="5">签约</Option>
</Select>
</div>
</div>
<div style={{paddingBottom: '8px', marginTop: '15px'}}>工作内容</div>
<div>
<TextArea onChange={this.workContent} rows={4} placeholder='请输入工作内容'/>
</div>
</div>
)
})
}
<div style={{paddingTop: '12px', display: 'flex'}}>
<div style={{
width: '73px',
height: '23px',
textAlign: 'center',
border: '1px solid #1890FF',
backgroundColor: '#fff',
color: '#1890FF',
fontSize: '10px',
lineHeight: '23px',
marginRight: '32px',
borderRadius: '4px'
}}>
签约中
</div>
</div>
<div style={{paddingTop: '12px', display: 'flex'}}>
<div onClick={this.addPlane} style={{
width: '75px',
height: '25px',
textAlign: 'center',
backgroundColor: '#1890FF',
color: '#fff',
fontSize: '10px',
lineHeight: '25px',
marginRight: '32px',
borderRadius: '4px'
}}>
新增计划
</div>
<div onClick={this.bindSave} style={{
width: '75px',
height: '25px',
textAlign: 'center',
backgroundColor: '#6BC33F',
color: '#fff',
fontSize: '10px',
lineHeight: '25px',
marginRight: '32px',
borderRadius: '4px'
}}>
保存日报
</div>
</div>
</div>