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