From 589f57f28865df8f46f2ccacdcf42d2e260dbfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Mon, 24 Jan 2022 15:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0key=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/add/add.js | 47 +++++++++-- src/pages/plan/add/step2.js | 158 ++++++++++++++++++++---------------- 2 files changed, 131 insertions(+), 74 deletions(-) diff --git a/src/pages/plan/add/add.js b/src/pages/plan/add/add.js index d6eef915..a4ff8447 100644 --- a/src/pages/plan/add/add.js +++ b/src/pages/plan/add/add.js @@ -204,22 +204,54 @@ export default class add extends React.Component{ this.state.keys.push(step) this.setState({keys:this.state.keys}) this.setState({isload:true}) - if(this.refs[this.state.keys[0]].state.model.style == 5) + if(this.refs[this.state.keys[0]].state.model.style == 6) { + console.log("白名单") + this.setState({whiteStyle:true}) + this.setState({keyStyle:6}) + } + else{ + this.setState({keyStyle:1}) this.setState({whiteStyle:true}) - this.setState({keyStyle:5}) } console.log(this.state.keys) } onStyleChange(e){ console.log("状态",e.target.value) - if(e.target.value == 5) + if(e.target.value == 6) { + console.log(77777) this.setState({whiteStyle:true}) - this.setState({keyStyle:5}) + this.setState({keyStyle:6}) + sessionStorage.setItem("white",1) + for(let i = 0;i < this.state.keys.length;i++) + { + if(this.refs[this.state.keys[i]]) + { + if(i > 0) + { + this.refs[this.state.keys[i]].setkeyStyle(6) + } + } + + } } else{ - this.setState({keyStyle:e.target.value}) + console.log(88888,this.refs) + + sessionStorage.setItem("white",3) + for(let i = 0;i < this.state.keys.length;i++) + { + if(this.refs[this.state.keys[i]]) + { + if(i > 0) + { + this.refs[this.state.keys[i]].setkeyStyle(1) + } + } + + } + this.setState({whiteStyle:false}) } } @@ -350,8 +382,11 @@ export default class add extends React.Component{ }> - + {this.addNewkey()}} onStyleChange={(e)=>{this.onStyleChange(e)}} keyStyle={this.state.keyStyle} isload={this.state.isload} name={index} whiteStyle={this.state.whiteStyle} /> + + + ) : null }) diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 1aeab381..ec1cfc40 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -88,22 +88,17 @@ export default class acclist extends React.Component{ let items = dom.getElementsByClassName("form-Item"); let input = items[1].getElementsByTagName("input")[0]; input.focus(); - - //除了主key批次窗口其他都禁用 - if(this.props.name > 0) - { - - this.setState({whiteStyle:this.props.whiteStyle}) - if(this.props.keyStyle == 6) - { - this.setState({white_visible:this.props.whiteStyle}) - let model = this.state.model; - model.style = this.props.keyStyle - this.setState({model:model}) - } - - } - + + if(this.props.name > 0) + { + console.log("key样式", this.props.keyStyle) + + this.setState({whiteStyle:this.props.whiteStyle}) + this.setState({white_visible:this.props.whiteStyle}) + let model = this.state.model; + model.style = this.props.keyStyle; + this.setState({model:model}) + } } submit(){ @@ -123,13 +118,7 @@ export default class acclist extends React.Component{ data.mobile_repeat = this.state.mobile_repeat console.log("key样式",data.style) - if(data.style == 6) - { - sessionStorage.setItem("white",1) - } - else{ - sessionStorage.setItem("white",3) - } + return data; } @@ -145,12 +134,20 @@ export default class acclist extends React.Component{ onStyleChange(e){ + if(this.props.name == 0) + { + this.props.onStyleChange(e) + } + + - this.props.onStyleChange(e) let model2 = this.state.model; model2.style = e.target.value; model2.quantity = 0 this.setState({model:model2}) + + // console.log("生成key",this.state.model) + console.log("") if(e.target.value == 6) { sessionStorage.setItem("white",1) @@ -243,40 +240,76 @@ export default class acclist extends React.Component{ },500) } } - - - componentWillReceiveProps(nextProps) { - if(this.state.whiteStyle != nextProps.whiteStyle) + // initKeyStyle(){ + + // console.log("初始化") + // console.log("当前的值") + + // } + setkeyStyle(style){ + if(style == 6) { - if(this.props.name > 0) - { - this.setState({whiteStyle:nextProps.whiteStyle}) - } + this.setState({whiteStyle:true}) + this.setState({white_visible:true}) + } + else{ + this.setState({whiteStyle:false}) + this.setState({white_visible:false}) } - if(this.state.model.style != nextProps.keyStyle) - { + + let model = this.state.model; + model.style = style + this.setState({model:model}) + } + componentWillReceiveProps(nextProps) { + // if(this.state.whiteStyle != nextProps.whiteStyle) + // { + // if(this.props.name > 0) + // { + // this.setState({whiteStyle:nextProps.whiteStyle}) + // this.setState({white_visible:nextProps.whiteStyle}) + + // } + // } + + // if(this.state.model.style != nextProps.keyStyle) + // { + + // if(this.props.name > 0) + // { + // if(nextProps.keyStyle == 6) + // { + // let model = this.state.model; + // model.style = nextProps.keyStyle + // this.setState({model:model}) + // console.log(777878) + // } + // } - if(this.props.name > 0) - { - console.log("更改状态") + // } + // if(this.props.name > 0) + // { + // console.log("更改状态") - let model = this.state.model; - model.style = nextProps.keyStyle - this.setState({model:model}) + // let model = this.state.model; + // // model.style = nextProps.keyStyle + // // this.setState({model:model}) - if(model.style == 6) - { - sessionStorage.setItem("white",1) - this.setState({white_visible:true}) - } - else{ - sessionStorage.setItem("white",3) - this.setState({white_visible:false}) - } + // if(model.style == 6) + // { + + // sessionStorage.setItem("white",1) + // this.setState({white_visible:true}) + // } + // else{ + // console.log(1111) + // sessionStorage.setItem("white",3) + // this.setState({white_visible:false}) + // } - } - } + // } + // } } onChangeCombinedDate(e){ @@ -334,7 +367,6 @@ export default class acclist extends React.Component{ quantity:this.state.codeInfo.issued, restrict:this.state.codeInfo.restrict, range : rank.toString(), - } let arr = _.map(productlist,(item)=>{ @@ -358,13 +390,10 @@ export default class acclist extends React.Component{ if(this.state.rowIndex > -1) { - console.log("编辑") this.state.distdata[this.state.rowIndex] = temp; this.setState({distdata:this.state.distdata}) - console.log(this.state.distdata) } else{ - console.log("新增") let tempdata = this.state.distdata; tempdata.push(temp) this.setState({distdata:tempdata}) @@ -390,7 +419,7 @@ export default class acclist extends React.Component{ let step1 = JSON.parse (sessionStorage.getItem("step1")); let str = moment(val).format("YYYY-MM-DD HH:mm:ss") - let isBetween = moment(str).isBetween(step1.begin_time,step1.end_time,null,'(]'); + let isBetween = moment(str).isBetween(step1.begin_time,step1.end_time,null,'(]'); return !isBetween } @@ -626,21 +655,14 @@ export default class acclist extends React.Component{ let temp = this.state.exceldata.filter(o=>o.type == "success"); - console.log("excel数据",this.state.exceldata) - console.log(temp) let mobile_repeat= _.map(temp,(o)=>{ return o.mobile; }) - - console.log("手机重复",mobile_repeat) - this.setState({mobile_repeat:mobile_repeat}) let model = this.state.model; - console.log("重复号码数量",this.state.mobile_repeat.length) model.quantity = this.state.excel_count - this.state.error_count + mobile_repeat.length; - console.log("数量", model.quantity) this.setState({model:model}) this.setState({accessVerify:false}) @@ -726,7 +748,7 @@ export default class acclist extends React.Component{ resetUpload(){ this.setState({excel_visible:false}) this.setState({import_visible:true}) - this.setState({accessVerify:true}) + this.setState({accessVerify:true}) } switchChange(e,rowData){ @@ -943,10 +965,10 @@ export default class acclist extends React.Component{
{ this.onStyleChange(e)} } value={this.state.model.style}> - 0 && this.state.model.style ==6} >串码 - 0 && this.state.model.style ==6} >链接 - 0 && this.state.model.style ==6} >二维码 - 0 && this.state.model.style !=6} >白名单 + 0 && this.state.model.style == 6 } >串码 + 0 && this.state.model.style == 6 } >链接 + 0 && this.state.model.style == 6 } >二维码 + 0 && this.state.model.style != 6 } >白名单