正在发起撤销...,请等待
{this.state.timer} 秒
diff --git a/src/pages/plan/add/edit.js b/src/pages/plan/add/edit.js
index f0a5154a..682617b7 100644
--- a/src/pages/plan/add/edit.js
+++ b/src/pages/plan/add/edit.js
@@ -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 ? (
-
+
) : null
@@ -565,7 +599,7 @@ export default class add extends React.Component{
-
{this.onReturn(e)}} />
+ {this.setState({audit_visible:false})}} />
提交审核
@@ -577,7 +611,7 @@ export default class add extends React.Component{
-
+
@@ -615,11 +649,11 @@ export default class add extends React.Component{
-
{this.onReturn(e)}} />
- 撤销审批中
+ 撤销审批中
- 正在发起撤销...,请等待{this.state.timer}秒
+ 正在发起撤销...,请等待 {this.state.timer}秒
+
):null
diff --git a/src/pages/plan/add/step3.js b/src/pages/plan/add/step3.js
index 15348279..9575a5e5 100644
--- a/src/pages/plan/add/step3.js
+++ b/src/pages/plan/add/step3.js
@@ -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
diff --git a/src/pages/plan/key/edit.js b/src/pages/plan/key/edit.js
index 32a61d26..32bd730a 100644
--- a/src/pages/plan/key/edit.js
+++ b/src/pages/plan/key/edit.js
@@ -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{
-
{this.onReturn(e)}} />
+ {this.setState({audit_visible:false})}} />
提交审核
@@ -1258,7 +1296,7 @@ export default class acclist extends React.Component{
-
+
@@ -1298,7 +1336,7 @@ export default class acclist extends React.Component{
{this.setState({approvalLoading:false})}} />
撤销审批中
- 正在发起撤销...,请等待{this.state.timer}秒
+ 正在发起撤销...,请等待 {this.state.timer}秒