更新编辑计划任务key未传值的问题

This commit is contained in:
姜棚 2021-12-14 11:00:31 +08:00
parent 23fae21d84
commit 297433dde0
4 changed files with 65 additions and 29 deletions

View File

@ -12,7 +12,7 @@ import Menu from "../menu/main.js"
super(props);
console.log("数据777")
console.log(props.data.menuList)
console.log(props.data)
let menuList = _.map(props.data.menuList,(item)=>{
item.check = false;
@ -33,6 +33,7 @@ import Menu from "../menu/main.js"
menuList:menuList,
visible:true,
menuShow:true,
propName:props.data.prop
}
this.state.text = props.data.menuList[0].name;
@ -48,9 +49,9 @@ import Menu from "../menu/main.js"
this.setState({text:seleted.name})
this.setState({menuShow:false})
//点击选择菜单
console.log("菜单选择")
this.props.selectFn(id);
this.props.selectFn(id,this.state.propName);
}
onMenuHide(){
@ -62,7 +63,7 @@ import Menu from "../menu/main.js"
}
onClose(e,id){
this.props.onClose(e,this.state.id)
this.props.onClose(e,this.state.id,this.state.propName)
let menuList = _.map(this.state.menuList,(item)=>{
item.check = false;
return item

View File

@ -9,8 +9,8 @@ import FilterSelect from "../filterSelect/main.js"
export default class filterbar extends React.Component {
constructor(props) {
super(props);
console.log("属性")
console.log(props)
this.state = {
//数据源结构后面可能会变
filterList:props.filterList,
@ -23,17 +23,18 @@ import FilterSelect from "../filterSelect/main.js"
}
componentDidMount(){
document.addEventListener('click', this.hideMenu);
}
//点击叉叉关闭下拉菜单
onCloseSelect(e,id){
this.removeItem(e,id);
onCloseSelect(e,id,prop){
this.removeItem(e,id,prop);
this.refs.menu.clearIndexCheck(id);
console.log("关闭叉叉",prop)
this.props.onClose()
this.props.onClose(prop)
}
//移除筛选项
removeItem(e,id){
removeItem(e,id,prop){
this.state.showItemList.forEach((item,index,arr) => {
if(item.id === id){
@ -41,7 +42,7 @@ import FilterSelect from "../filterSelect/main.js"
console.log(this.state.filterList)
console.log()
this.props.onClose();
this.props.onClose(prop);
delete this.state.showItemList[index]
@ -55,8 +56,8 @@ import FilterSelect from "../filterSelect/main.js"
e.nativeEvent.stopImmediatePropagation();
this.setState({menuShow:!this.state.menuShow})
}
onselectFn(e){
this.props.selectFn(e);
onselectFn(e,prop){
this.props.selectFn(e,prop);
}
//菜单点击
onMenuClick(e,id){
@ -66,7 +67,7 @@ import FilterSelect from "../filterSelect/main.js"
this.state.showItemList.push(menu)
}
else{
this.removeItem(e,id)
this.removeItem(e,id,menu.prop)
}
this.setState({showItemList:this.state.showItemList})
@ -105,7 +106,7 @@ import FilterSelect from "../filterSelect/main.js"
{
this.state.showItemList.map((item,index)=>{
return(
<FilterSelect data={item} selectFn={(e)=>{this.onselectFn(e)}} onClose={(e,id)=>{this.onCloseSelect(e,id)}} key={index}>
<FilterSelect data={item} selectFn={(e,prop)=>{this.onselectFn(e,prop)}} onClose={(e,id,prop)=>{this.onCloseSelect(e,id,prop)}} key={index}>
</FilterSelect>
)
})

View File

@ -13,7 +13,7 @@ export default class add extends React.Component{
constructor(props){
super(props)
this.state={
keys:["step2-0"],
keys:[],
step1_pagetitle:"修改计划",
step2_pagetitle:"生成key",
step3_pagetitle:"绑定卡券",
@ -91,7 +91,13 @@ export default class add extends React.Component{
{
this.setState({curstep:2})
this.setState({keys:req.keys})
for(let i = 0;i < req.keys.length;i++)
{
this.addNewkey()
}
// this.setState({keys:req.keys})
setTimeout(()=>{
for(let i = 0;i < this.state.keys.length;i++)
@ -99,6 +105,7 @@ export default class add extends React.Component{
this.refs["step2-"+i].edit(req.keys[i])
}
},500)
}
},(err)=>{
@ -126,6 +133,8 @@ export default class add extends React.Component{
let temp=[]
console.log("当前keys")
console.log(this.state.keys)
for(let i = 0;i < this.state.keys.length;i++)
{
@ -138,6 +147,8 @@ export default class add extends React.Component{
data = this.refs[this.state.keys[i]].submit();
}
else{
@ -149,6 +160,10 @@ export default class add extends React.Component{
if(data)
{
temp.push(data)
console.log("key的数据")
console.log(temp)
}
else{

View File

@ -24,7 +24,7 @@ export default class acclist extends React.Component{
limit:10,
tabList:[{title:"营销计划列表"}],
distdata:[{title:'士大夫大师傅'}],
filterList:[{id:0,label:"状态",menuList:[{id:999,name:"全部"},{id:0,name:"创建中"},{id:2,name:"审核中"},{id:3,name:"待生效"},{id:4,name:"进行中"},{id:5,name:"暂停中"},{id:6,name:"已完结"}]},
filterList:[{id:0,label:"状态", prop:"status", menuList:[{id:999,name:"全部"},{id:0,name:"创建中"},{id:2,name:"审核中"},{id:3,name:"待生效"},{id:4,name:"进行中"},{id:5,name:"暂停中"},{id:6,name:"已完结"}]},
],
tableHeight:500,
menuList:[{id:0,name:"状态",check:false}],
@ -455,26 +455,28 @@ export default class acclist extends React.Component{
});
this.setState({grantTotal,receiveTotal,usageTotal,silentTotal,receive_total,usage_total,silent_total});
}
onFilter(e){
onFilter(e,prop){
this.setState({page:1})
this.setState({limit:10})
let data = {
page:1,
limit:10,
status:e,
key_word:this.state.key_word
}
console.log(prop)
data[prop] = e
if(e==999)
{
delete data.status;
delete data[prop];
}
else{
this.setState({status:e})
this.setState({prop:e})
}
this.getPlanList(data)
console.log(data)
}
phoneChange=(e)=>
{
@ -547,9 +549,19 @@ export default class acclist extends React.Component{
sessionStorage.setItem('breaknav',JSON.stringify(arr));
sessionStorage.setItem('linkshowname',"营销计划管理");
}
onFilterClose(){
console.log("关闭")
this.setState({status:null})
onFilterClose(prop){
console.log("关闭",prop)
// this.setState()
let data = {}
data[prop] = null;
console.log(data)
this.setState(data)
}
@ -580,6 +592,13 @@ export default class acclist extends React.Component{
type: "slot",
width:'50px'
},
{
title: '创建人',
name: 'status',
prop:'status',
type: "normal",
width:'50px'
},
{
title: '时间范围',
type: "slot",
@ -673,7 +692,7 @@ export default class acclist extends React.Component{
}} alignment={'left'}/>
</div>
<Filterbar filterList={this.state.filterList} menuList={this.state.menuList} selectFn={(e)=>{this.onFilter(e)}} onClose={(e)=>{this.onFilterClose(e) }} ></Filterbar>
<Filterbar filterList={this.state.filterList} menuList={this.state.menuList} selectFn={(e,prop)=>{this.onFilter(e,prop)}} onClose={(e)=>{this.onFilterClose(e) }} ></Filterbar>
<div>
{this.state.selectiondata.length>0?(<Alert
type="info"