更新编辑计划任务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); super(props);
console.log("数据777") console.log("数据777")
console.log(props.data.menuList) console.log(props.data)
let menuList = _.map(props.data.menuList,(item)=>{ let menuList = _.map(props.data.menuList,(item)=>{
item.check = false; item.check = false;
@ -33,6 +33,7 @@ import Menu from "../menu/main.js"
menuList:menuList, menuList:menuList,
visible:true, visible:true,
menuShow:true, menuShow:true,
propName:props.data.prop
} }
this.state.text = props.data.menuList[0].name; 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({text:seleted.name})
this.setState({menuShow:false}) this.setState({menuShow:false})
//点击选择菜单 //点击选择菜单
console.log("菜单选择")
this.props.selectFn(id); this.props.selectFn(id,this.state.propName);
} }
onMenuHide(){ onMenuHide(){
@ -62,7 +63,7 @@ import Menu from "../menu/main.js"
} }
onClose(e,id){ 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)=>{ let menuList = _.map(this.state.menuList,(item)=>{
item.check = false; item.check = false;
return item return item

View File

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

View File

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

View File

@ -24,7 +24,7 @@ export default class acclist extends React.Component{
limit:10, limit:10,
tabList:[{title:"营销计划列表"}], tabList:[{title:"营销计划列表"}],
distdata:[{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, tableHeight:500,
menuList:[{id:0,name:"状态",check:false}], 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}); this.setState({grantTotal,receiveTotal,usageTotal,silentTotal,receive_total,usage_total,silent_total});
} }
onFilter(e){ onFilter(e,prop){
this.setState({page:1}) this.setState({page:1})
this.setState({limit:10}) this.setState({limit:10})
let data = { let data = {
page:1, page:1,
limit:10, limit:10,
status:e,
key_word:this.state.key_word key_word:this.state.key_word
} }
console.log(prop)
data[prop] = e
if(e==999) if(e==999)
{ {
delete data.status; delete data[prop];
} }
else{ else{
this.setState({status:e}) this.setState({prop:e})
} }
this.getPlanList(data) this.getPlanList(data)
console.log(data)
} }
phoneChange=(e)=> phoneChange=(e)=>
{ {
@ -547,9 +549,19 @@ export default class acclist extends React.Component{
sessionStorage.setItem('breaknav',JSON.stringify(arr)); sessionStorage.setItem('breaknav',JSON.stringify(arr));
sessionStorage.setItem('linkshowname',"营销计划管理"); sessionStorage.setItem('linkshowname',"营销计划管理");
} }
onFilterClose(){ onFilterClose(prop){
console.log("关闭") console.log("关闭",prop)
this.setState({status:null})
// 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", type: "slot",
width:'50px' width:'50px'
}, },
{
title: '创建人',
name: 'status',
prop:'status',
type: "normal",
width:'50px'
},
{ {
title: '时间范围', title: '时间范围',
type: "slot", type: "slot",
@ -673,7 +692,7 @@ export default class acclist extends React.Component{
}} alignment={'left'}/> }} alignment={'left'}/>
</div> </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> <div>
{this.state.selectiondata.length>0?(<Alert {this.state.selectiondata.length>0?(<Alert
type="info" type="info"