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批次信息 //创建key批次信息
export const addKeysBatchInfo = (id, params) => { 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批次详细信息 //更新key批次详细信息
export const putKeyBatchDetail = (id, params) => { 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批次压缩包和压缩包密码 //发送key批次压缩包和压缩包密码
export const planSend = (id, params) => { export const planSend = (id, params) => {
@ -847,28 +847,28 @@ export const getThemeType= () => {
//key码列表 //key码列表
export const getkeyDetailList= (id,data) => { 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) => { 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) => { 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) => { 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) => { 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审批 //key审批
export const keyApproval =(plan_id,key_id) => { export const keyApproval =(plan_id,key_id,data) => {
return req('post',baseurl + "/plan/"+plan_id+"/keys/"+key_id+"/approval") 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退出登录 // logout退出登录

View File

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

View File

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