Update add.js

This commit is contained in:
姜棚 2022-01-24 16:14:02 +08:00
parent 5f69e61f1e
commit 107b2059e3
1 changed files with 22 additions and 42 deletions

View File

@ -171,8 +171,6 @@ export default class acclist extends React.Component{
}) })
}) })
let codeInfo= { //数据模型不可少 let codeInfo= { //数据模型不可少
code_name:"", code_name:"",
issued:'',//发放总量 issued:'',//发放总量
@ -225,22 +223,22 @@ export default class acclist extends React.Component{
importClick(){ importClick(){
if(this.state.file_loading) if(this.state.file_loading)
{ {
Notify.error("文件正在解析中请稍等") Notify.error("文件正在解析中请稍等")
} }
else{ else{
if(this.state.success_visible) if(this.state.success_visible)
{ {
this.setState({accessVerify:false}) this.setState({accessVerify:false})
this.setState({excel_visible:true}) this.setState({excel_visible:true})
this.setState({import_visible:false}) this.setState({import_visible:false})
} }
else{ else{
Notify.error("请上传正确的文件") Notify.error("请上传正确的文件")
} }
} }
} }
Cancel(){ Cancel(){
Sweetalert.confirm({ Sweetalert.confirm({
@ -320,17 +318,11 @@ export default class acclist extends React.Component{
this.setState({drawerVisible2:true}) this.setState({drawerVisible2:true})
} }
async productSubmit(){ async productSubmit(){
let visible = await this.refs.product.submit() let visible = await this.refs.product.submit()
if(visible) if(visible)
{ {
Notify.success("保存成功") Notify.success("保存成功")
this.setState({drawerVisible2:false}) this.setState({drawerVisible2:false})
setTimeout(()=>{ setTimeout(()=>{
let data = JSON.parse(sessionStorage.getItem("productData")); let data = JSON.parse(sessionStorage.getItem("productData"));
@ -373,13 +365,11 @@ export default class acclist extends React.Component{
let model2 = this.state.codeInfo; let model2 = this.state.codeInfo;
model2.date_time = e; model2.date_time = e;
this.setState({codeInfo:model2}) this.setState({codeInfo:model2})
console.log(this.state.codeInfo)
} }
submit2(){ submit2(){
this.refs.form2.validator() this.refs.form2.validator()
} }
onRankChange(e){ onRankChange(e){
console.log(e)
_.forEach(this.state.tempdata, (item) => { _.forEach(this.state.tempdata, (item) => {
item.checked = e.findIndex((checks)=>{return checks.key == item.product_id}) > -1; item.checked = e.findIndex((checks)=>{return checks.key == item.product_id}) > -1;
}) })
@ -392,9 +382,8 @@ export default class acclist extends React.Component{
if(this.state.uploading ) if(this.state.uploading )
{ {
Notify.error("还有图片上传中,不可提交")
Notify.error("还有图片上传中,不可提交") return
return
} }
@ -403,7 +392,6 @@ export default class acclist extends React.Component{
_.forEach(productlist,(o)=>{ _.forEach(productlist,(o)=>{
sum += parseInt(o.quantity); sum += parseInt(o.quantity);
}) })
console.log("总数"+sum)
if(sum < this.state.codeInfo.issued) if(sum < this.state.codeInfo.issued)
{ {
Notify.error("所选商品库存总数小于发放量") Notify.error("所选商品库存总数小于发放量")
@ -415,9 +403,6 @@ export default class acclist extends React.Component{
let rank = _.map(this.state.rank,(item)=>{ let rank = _.map(this.state.rank,(item)=>{
return item.text return item.text
}) })
console.log(rank)
let tableData = this.state.distdata; let tableData = this.state.distdata;
let temp = { let temp = {
title:this.state.codeInfo.code_name, title:this.state.codeInfo.code_name,
@ -450,20 +435,14 @@ export default class acclist extends React.Component{
if(this.state.rowIndex > -1) if(this.state.rowIndex > -1)
{ {
console.log("编辑")
this.state.distdata[this.state.rowIndex] = temp; this.state.distdata[this.state.rowIndex] = temp;
this.setState({distdata:this.state.distdata}) this.setState({distdata:this.state.distdata})
console.log(this.state.distdata)
} }
else{ else{
console.log("新增")
let tempdata = this.state.distdata; let tempdata = this.state.distdata;
tempdata.push(temp) tempdata.push(temp)
this.setState({distdata:tempdata}) this.setState({distdata:tempdata})
} }
let id = sessionStorage.getItem("key_plan_id") let id = sessionStorage.getItem("key_plan_id")
} }
@ -873,14 +852,15 @@ export default class acclist extends React.Component{
}) })
console.log("重复的手机号",mobile_repeat) console.log("重复的手机号",mobile_repeat)
this.setState({mobile_repeat:mobile_repeat}) this.setState({mobile_repeat:mobile_repeat})
console.log(this.state.excel_count )
console.log(this.state.error_count )
let model = this.state.model; let model = this.state.model;
model.quantity = this.state.excel_count - this.state.error_count + this.state.mobile_repeat.length; model.quantity = this.state.excel_count - this.state.error_count + mobile_repeat.length;
this.setState({model:model}) this.setState({model:model})
this.setState({accessVerify:false}) this.setState({accessVerify:false})
this.setState({excel_visible:false}) this.setState({excel_visible:false})
this.setState({import_visible:false}) this.setState({import_visible:false})
this.setState({import_success:true}) this.setState({import_success:true})
} }
resetUpload(){ resetUpload(){