Merge branch 'key_audit_edit' into product_v1.1.0

This commit is contained in:
姜棚 2022-01-25 18:00:06 +08:00
commit e09d1af5d0
3 changed files with 250 additions and 100 deletions

View File

@ -316,7 +316,7 @@ export const startOrStopPlan = (id, params) => {
//创建key批次信息
export const addKeysBatchInfo = (id, params) => {
return req('post', baseurl + "/plan/" + id + "/keys", params)
return req('post', "http://192.168.6.165:8080" + "/plan/" + id + "/keys", params)
}
@ -345,7 +345,7 @@ export const getKeyBatchDetail = (id, params) => {
//更新key批次详细信息
export const putKeyBatchDetail = (id, params) => {
return req('put', baseurl + "/keys/" + id, params)
return req('put', "http://192.168.6.165:8080" + "/keys/" + id, params)
}
//发送key批次压缩包和压缩包密码
export const planSend = (id, params) => {
@ -847,28 +847,28 @@ export const getThemeType= () => {
//key码列表
export const getkeyDetailList= (id,data) => {
return req('get', baseurl + "/key/"+id,data)
return req('get', "http://192.168.6.165:8080" + "/key/"+id,data)
}
//提交审核
export const approvals= (id,data) => {
return req('post', baseurl + "/plan/"+id+"/approvals",data)
return req('post', "http://192.168.6.165:8080" + "/plan/"+id+"/approvals",data)
}
export const getApprovalsInfo= (id,data) => {
return req('get', baseurl + "/approvals/"+id+"/market_approval_data",data)
return req('get', "http://192.168.6.165:8080" + "/approvals/"+id+"/market_approval_data",data)
}
export const terminateApprovals= (id,data) => {
return req('put', baseurl + "/approvals/"+id+"/terminate",data)
return req('put', "http://192.168.6.165:8080" + "/approvals/"+id+"/terminate",data)
}
export const getApprovalsStatus= (id,data) => {
return req('get', baseurl + "/approvals/"+id+"/status")
return req('get', "http://192.168.6.165:8080" + "/approvals/"+id+"/status")
}
//作废
@ -904,12 +904,14 @@ export const planCancel= (id) => {
}
//key审批
export const keyApproval =(plan_id,key_id) => {
return req('post',baseurl + "/plan/"+plan_id+"/keys/"+key_id+"/approval")
export const keyApproval =(plan_id,key_id,data) => {
return req('post',"http://192.168.6.165:8080" + "/plan/"+plan_id+"/keys/"+key_id+"/approval",data)
}
export const keyEditApproval =(key_id,data) => {
return req('post',"http://192.168.6.165:8080" + "/keys/"+key_id+"/approval",data)
}
// logout退出登录

View File

@ -545,19 +545,20 @@ export default class acclist extends React.Component{
let id = sessionStorage.getItem("key_plan_id")
addKeysBatchInfo(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
keyApproval(id,req.key_batch_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("成功发起审批");
setTimeout(()=>{
this.props.history.push('/home/key-list/');
},2000)
// keyApproval(id,req.id).then((res)=>{
// handelResponse(res,(req,msg)=>{
// },(err)=>{
// Notify.error(err);
// })
// })
},(err)=>{
Notify.error(err);
})
})
},(err)=>{
Notify.error(err);

View File

@ -6,7 +6,7 @@ import Ipt from "../../../components/input/main"
import Form from "../../../components/form/main"
import FormItem from "../../../components/form-item/main"
import Grid from "../../../components/gird/main.js"
import {addPlanStep,getApprovalsInfo,handelResponse,getPlanList,addKeysBatchInfo,getKeyBatchDetail,getReseller,putKeyBatchDetail,uploadImg,terminateApprovals,getApprovalsStatus,approvals
import {addPlanStep,getApprovalsInfo,handelResponse,getPlanList,addKeysBatchInfo,getKeyBatchDetail,getReseller,putKeyBatchDetail,uploadImg,keyApproval,keyEditApproval,terminateApprovals,getApprovalsStatus,approvals
} from "../../../assets/api.js"
import Productform from "../product/add"
import Bus from "../../../assets/eventBus.js"
@ -69,7 +69,9 @@ export default class acclist extends React.Component{
reseller:null,
payment_direction:["对私账户","对公账户","预付款扣除"],
recall_visible:false,
timer:3
timer:3,
plan_id:0,
key_status:-1
}
}
@ -100,13 +102,18 @@ export default class acclist extends React.Component{
this.setState({isCancel:true})
}
// if(req.status == 1)
// {
// this.setState({isEdit:false})
// }
// else{
// this.setState({isEdit:true})
// }
console.log("key的状态",req.status)
if(req.status == 1)
{
this.setState({isEdit:false})
}
else{
this.setState({isEdit:true})
}
this.setState({key_status:req.status})
this.setState({plan_id:req.plan_id})
this.setState({pagetitle:"编辑key"})
req.code_batch = req.code_batch ? req.code_batch : []
@ -131,20 +138,21 @@ export default class acclist extends React.Component{
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])
}
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(req.payment_direction)
{
@ -512,14 +520,19 @@ export default class acclist extends React.Component{
}
onSubmit(){
this.setState({audit_visible:true})
}
onConfirm(){
let selection = this.refs.bindObj.getSelectData()
let formdata = selection.filter((item)=>{
return !item.hasOwnProperty("disabled") || item.disabled == false
})
if(this.state.isEdit)
{
this.setState({audit_visible:false})
let approval_id = sessionStorage.getItem("approval_id")
if(approval_id > 0)
@ -555,7 +568,10 @@ export default class acclist extends React.Component{
"receive_email":this.state.reseller.contact_email[0],
"payment_direction":this.state.payment_direction[this.state.paytype - 1],
}
putKeyBatchDetail(id,data).then((res)=>{
keyEditApproval(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("成功发起审批");
setTimeout(()=>{
@ -572,65 +588,201 @@ export default class acclist extends React.Component{
})
}
else{
let selection = this.refs.bindObj.getSelectData()
console.log("选中对象")
console.log(selection)
let formdata = selection.filter((item)=>{
return !item.hasOwnProperty("disabled") || item.disabled == false
if(this.state.key_status != 1)
{
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],
}
console.log("key批次id",id)
keyEditApproval(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("成功发起审批");
setTimeout(()=>{
window.history.back()
},1000);
},(err)=>{
Notify.error(err)
})
})
}
else{
let data = {
batch_name : this.state.model.batch_name,
style:this.state.model.style,
quantity:this.state.model.quantity,
bind_object:this.state.checkedList,
allow_repetition:this.state.model.allow_repetition,
allow_loss:this.state.model.allow_loss,
merge_stock:this.state.model.merge_stock,
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],
}
let id = sessionStorage.getItem("keybatch_id")
putKeyBatchDetail(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
keyApproval(this.state.plan_id,id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("成功发起审批");
setTimeout(()=>{
this.props.history.push('/home/key-list/');
},2000)
},(err)=>{
Notify.error(err);
})
})
},(err)=>{
Notify.error(err)
})
})
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("成功发起审批");
setTimeout(()=>{
window.history.back()
},1000);
},(err)=>{
Notify.error(err)
})
})
// putKeyBatchDetail(id,data).then((res)=>{
// handelResponse(res,(req,msg)=>{
// Notify.success("成功发起审批");
// setTimeout(()=>{
// window.history.back()
// },1000);
// },(err)=>{
// Notify.error(err)
// })
// })
// keyApproval(this.state.plan_id,id,data).then((res)=>{
// handelResponse(res,(req,msg)=>{
// Notify.success("成功发起审批");
// setTimeout(()=>{
// this.props.history.push('/home/key-list/');
// },2000)
// },(err)=>{
// Notify.error(err);
// })
// })
}
}
else{
if(this.refs.form1.validator())
{
let data = {};
data.batch_name = this.state.model.batch_name;
data.style = this.state.model.style;
data.quantity = this.state.model.quantity;
data.bind_object = this.state.checkedList;
data.allow_repetition = this.state.model.allow_repetition;
data.allow_loss = this.state.model.allow_loss;
data.merge_stock = this.state.model.merge_stock;
data.code_batch = this.refs.bindObj.getSelectData();
if(data.code_batch.length == 0)
{
Notify.error("请绑定对象")
return
let data = {
batch_name : this.state.model.batch_name,
style:this.state.model.style,
quantity:this.state.model.quantity,
bind_object:this.state.checkedList,
allow_repetition:this.state.model.allow_repetition,
allow_loss:this.state.model.allow_loss,
merge_stock:this.state.model.merge_stock,
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],
}
let id = sessionStorage.getItem("keybatch_id")
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)
{
this.setState({audit_visible:true})
}
if(req.status == 2 || req.status == 3){
putKeyBatchDetail(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
keyApproval(this.state.plan_id,id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("成功发起审批");
setTimeout(()=>{
this.props.history.push('/home/key-list/');
},2000)
},(err)=>{
Notify.error(err);
})
})
},(err)=>{
Notify.error(err)
})
})
}
},(err)=>{
Notify.error(err)
})
})
}
let id = sessionStorage.getItem("key_plan_id")
addKeysBatchInfo(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("成功发起审批");
setTimeout(()=>{
window.history.back()
},1000);
},(err)=>{
})
})
}
}
// if(this.refs.form1.validator())
// {
// let data = {};
// data.batch_name = this.state.model.batch_name;
// data.style = this.state.model.style;
// data.quantity = this.state.model.quantity;
// data.bind_object = this.state.checkedList;
// data.allow_repetition = this.state.model.allow_repetition;
// data.allow_loss = this.state.model.allow_loss;
// data.merge_stock = this.state.model.merge_stock;
// data.code_batch = this.refs.bindObj.getSelectData();
// if(data.code_batch.length == 0)
// {
// Notify.error("请绑定对象")
// return
// }
// let id = sessionStorage.getItem("key_plan_id")
// addKeysBatchInfo(id,data).then((res)=>{
// handelResponse(res,(req,msg)=>{
// Notify.success("成功发起审批");
// setTimeout(()=>{
// window.history.back()
// },1000);
// },(err)=>{
// })
// })
// }
//}
}
onBindNum(e,row){
@ -883,11 +1035,6 @@ export default class acclist extends React.Component{
//校验规则
const rules = {
quantity: [
{ type: "required", message: "请输入key数量"},
{ type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"},
],
bind_object: [
{ type: "required", message: "请选择绑定类型"},
],