审批调整细节

This commit is contained in:
姜棚 2022-01-05 13:28:58 +08:00
parent 364d2d6c30
commit 74c72edc35
4 changed files with 197 additions and 103 deletions

View File

@ -1012,7 +1012,6 @@ export default class exchangedit extends React.Component{
<div className="audit">
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.setState({approvalLoading:false})}} />
<div className="audit-box-title">撤销审批中</div>
<div className="audit-box-txt">
正在发起撤销...,请等待 <span style={{color:"red"}}> {this.state.timer}</span>

View File

@ -7,7 +7,7 @@ import Step1 from "./step1.js"
import Step2 from "./step2.js"
import Step3 from "./step3.js"
import _ from "lodash";
import {addPlanStep,handelResponse,getReseller,planSend,getDraftInfo,putPlanStep,uploadImg,getApprovalsInfo,approvals,terminateApprovals,getApprovalsStatus} from "../../../assets/api.js"
import {getThemeChoice,addPlanStep,handelResponse,getReseller,planSend,getDraftInfo,putPlanStep,uploadImg,getApprovalsInfo,approvals,terminateApprovals,getApprovalsStatus} from "../../../assets/api.js"
export default class add extends React.Component{
constructor(props){
@ -42,6 +42,7 @@ export default class add extends React.Component{
payment_direction:["对私账户","对公账户","预付款扣除"],
approvalLoading:false,
timer:3,
theme_options:[]
}
}
@ -79,7 +80,7 @@ export default class add extends React.Component{
let approval_id = sessionStorage.getItem("approval_id")
//获取审批接口的编辑信息
if(approval_id !=0)
if(approval_id > 0)
{
getApprovalsInfo(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
@ -110,10 +111,26 @@ export default class add extends React.Component{
},500)
}
else{
if(req.theme)
{
let theme_data ={
theme_id:req.theme.theme_id,
use:req.theme.theme_data.use,
link:req.theme.theme_data.link,
list:req.theme.theme_data.list
}
this.getThemeData();
console.log("样式数据",theme_data)
this.setState({step3_data:theme_data})
this.setState({card_visible : true})
this.setState({curstep:3})
}
},(err)=>{
Notify.error(err)
})
@ -296,6 +313,23 @@ export default class add extends React.Component{
}
}
getThemeData(){
getThemeChoice().then((res)=>{
handelResponse(res,(req,msg)=>{
let arr = _.map(req,(o)=>{
let obj = {};
obj.key = o.id;
obj.text = o.title
return obj
})
this.setState({theme_options:arr})
},(err)=>{
})
})
}
addNewkey(){
let step = "step2-" + this.state.keys.length
this.state.keys.push(step)
@ -535,7 +569,7 @@ export default class add extends React.Component{
this.state.card_visible ? (
<div id="step3" className="step3">
<Card style={{ width:'100%',height:"auto" }} title={this.state.step3_pagetitle}>
<Step3 ref="step3" data={this.state.step3_data} disabled={this.state.disabled} />
<Step3 ref="step3" data={this.state.step3_data} options={this.state.theme_options} disabled={this.state.disabled} />
</Card>
</div>
) : null
@ -565,7 +599,7 @@ export default class add extends React.Component{
<div className="audit">
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.onReturn(e)}} />
<Icon type="close" className="audit-close" onClick={(e)=>{this.setState({audit_visible:false})}} />
<div className="audit-box-title">提交审核</div>
<div className="payType">
@ -577,7 +611,7 @@ export default class add extends React.Component{
</div>
<div className="audit-btn-group">
<Button onClick={(e)=>{this.onReturn(e)}}>取消</Button>
<Button onClick={(e)=>{this.setState({audit_visible:false})}}>取消</Button>
<Button type="primary" onClick={(e)=>{this.onConfirm(e)}} >确定</Button>
</div>
</div>
@ -615,11 +649,11 @@ export default class add extends React.Component{
<div className="audit">
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.onReturn(e)}} />
<div className="audit-box-title">撤销审批中</div>
<div className="audit-box-title">撤销审批中</div>
<div className="audit-box-txt">
正在发起撤销...,请等待{this.state.timer}
正在发起撤销...,请等待<span style={{color:"red"}}> {this.state.timer}</span>
</div>
</div>
</div>
):null

View File

@ -15,20 +15,30 @@ const TabPanel = Tabs.TabPanel;
export default class acclist extends React.Component{
constructor(props){
super(props)
console.log(props)
this.state={
model:{ //数据模型不可少
"theme_id": "",
"theme_id":"",
"list": 2,
"use": 1,
"link": 3,
},
options:[]
select_theme:null
}
}
componentDidMount(e){
this.getThemeData();
this.getThemeData();
}
@ -44,6 +54,19 @@ export default class acclist extends React.Component{
})
this.setState({options:arr})
if(this.props.data && this.props.data.theme_id)
{
this.setState({theme_id:this.props.data.theme_id})
let selctobj = this.state.options.find(o=>o.key == this.props.data.theme_id)
let model = this.state.model;
model.theme_id = selctobj
this.setState({model:model})
}
},(err)=>{
})
})
@ -101,7 +124,7 @@ export default class acclist extends React.Component{
edit(data)
{
let model={ //数据模型不可少
"theme_id": data.theme_id,
"theme_id":192 ,
"list": data.list,
"use": data.use,
"link": data.link

View File

@ -121,26 +121,30 @@ export default class acclist extends React.Component{
temp.push(req.code_batch[i])
}
//获取审批单信息
getApprovalsInfo(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
for(let i = 0;i < req.code_batch.length;i++)
{
let code_batch = req.code_batch[i];
let range = []
for(let j = 0;j < code_batch.product.length;j++)
{
let product = code_batch.product[j];
range.push(product.product_name)
}
req.code_batch[i].disabled = false
req.code_batch[i].checked = false
code_batch.range = range.toString();
temp.push(req.code_batch[i])
}
})
})
if(approval_id > 0)
{
getApprovalsInfo(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
for(let i = 0;i < req.code_batch.length;i++)
{
let code_batch = req.code_batch[i];
let range = []
for(let j = 0;j < code_batch.product.length;j++)
{
let product = code_batch.product[j];
range.push(product.product_name)
}
req.code_batch[i].disabled = false
req.code_batch[i].checked = false
code_batch.range = range.toString();
temp.push(req.code_batch[i])
}
})
})
}
let model = {
style: req.style,
@ -477,26 +481,32 @@ export default class acclist extends React.Component{
}
onReCall(){
onReCall(){
let approval_id = sessionStorage.getItem("approval_id")
this.setState({recall_visible:false})
terminateApprovals(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
this.setState({approvalLoading:true})
let timer_c = setInterval(()=>{
console.log(this.state.timer)
if(this.state.timer <= 0)
{
clearInterval(timer_c)
this.setState({approvalLoading:false})
}
let time = this.state.timer - 1;
this.setState({timer:time})
},1000)
},(err)=>{
Notify.error(err)
})
})
if(approval_id > 0)
{
terminateApprovals(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
this.setState({approvalLoading:true})
let timer_c = setInterval(()=>{
console.log(this.state.timer)
if(this.state.timer <= 0)
{
clearInterval(timer_c)
this.setState({approvalLoading:false})
}
let time = this.state.timer - 1;
this.setState({timer:time})
},1000)
},(err)=>{
Notify.error(err)
})
})
}
}
onSubmit(){
@ -508,60 +518,88 @@ export default class acclist extends React.Component{
onConfirm(){
if(this.state.isEdit)
{
this.setState({audit_visible:false})
this.setState({audit_visible:false})
let approval_id = sessionStorage.getItem("approval_id")
getApprovalsStatus(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
if(req.status == 0)
{
this.setState({recall_visible:true})
}
if(req.status == 1)
{
Notify.error("进行中的批次不能提交审核")
setTimeout(()=>{
this.props.history.push('/home/key-list/');
},2000)
}
if(req.status == 2 || req.status == 3){
let selection = this.refs.bindObj.getSelectData()
console.log("选中对象")
console.log(selection)
let formdata = selection.filter((item)=>{
return !item.hasOwnProperty("disabled") || item.disabled == false
})
let id = sessionStorage.getItem("keybatch_id")
let data = {
code_batch:formdata,
"reseller_id":this.state.reseller.id,
"reseller_name":this.state.reseller.name,
"company_name":this.state.reseller.company_name,
"receive_email":this.state.reseller.contact_email[0],
"payment_direction":this.state.payment_direction[this.state.paytype - 1],
if(approval_id > 0)
{
getApprovalsStatus(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
if(req.status == 0)
{
this.setState({recall_visible:true})
}
putKeyBatchDetail(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("更新key成功");
if(req.status == 1)
{
Notify.error("进行中的批次不能提交审核")
setTimeout(()=>{
window.history.back()
},1000);
},(err)=>{
Notify.error(err)
})
})
}
this.props.history.push('/home/key-list/');
},2000)
}
if(req.status == 2 || req.status == 3){
let selection = this.refs.bindObj.getSelectData()
console.log("选中对象")
console.log(selection)
let formdata = selection.filter((item)=>{
return !item.hasOwnProperty("disabled") || item.disabled == false
})
let id = sessionStorage.getItem("keybatch_id")
let data = {
code_batch:formdata,
"reseller_id":this.state.reseller.id,
"reseller_name":this.state.reseller.name,
"company_name":this.state.reseller.company_name,
"receive_email":this.state.reseller.contact_email[0],
"payment_direction":this.state.payment_direction[this.state.paytype - 1],
}
putKeyBatchDetail(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("更新key成功");
setTimeout(()=>{
window.history.back()
},1000);
},(err)=>{
Notify.error(err)
})
})
}
},(err)=>{
Notify.error(err)
})
})
}
else{
let selection = this.refs.bindObj.getSelectData()
console.log("选中对象")
console.log(selection)
let formdata = selection.filter((item)=>{
return !item.hasOwnProperty("disabled") || item.disabled == false
})
let id = sessionStorage.getItem("keybatch_id")
let data = {
code_batch:formdata,
"reseller_id":this.state.reseller.id,
"reseller_name":this.state.reseller.name,
"company_name":this.state.reseller.company_name,
"receive_email":this.state.reseller.contact_email[0],
"payment_direction":this.state.payment_direction[this.state.paytype - 1],
}
putKeyBatchDetail(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("更新key成功");
setTimeout(()=>{
window.history.back()
},1000);
},(err)=>{
Notify.error(err)
Notify.error(err)
})
})
}
}
else{
if(this.refs.form1.validator())
@ -1246,7 +1284,7 @@ export default class acclist extends React.Component{
<div className="audit">
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.onReturn(e)}} />
<Icon type="close" className="audit-close" onClick={(e)=>{this.setState({audit_visible:false})}} />
<div className="audit-box-title">提交审核</div>
<div className="payType">
@ -1258,7 +1296,7 @@ export default class acclist extends React.Component{
</div>
<div className="audit-btn-group">
<Button onClick={(e)=>{this.onReturn(e)}}>取消</Button>
<Button onClick={(e)=>{this.setState({audit_visible:false})}}>取消</Button>
<Button type="primary" onClick={(e)=>{this.onConfirm(e)}} >确定</Button>
</div>
</div>
@ -1298,7 +1336,7 @@ export default class acclist extends React.Component{
<Icon type="close" className="audit-close" onClick={(e)=>{this.setState({approvalLoading:false})}} />
<div className="audit-box-title">撤销审批中</div>
<div className="audit-box-txt">
正在发起撤销...,请等待{this.state.timer}
正在发起撤销...,请等待<span style={{color:"red"}}> {this.state.timer}</span>
</div>
</div>
</div>