提交 24298c86 authored 作者: 翟畅's avatar 翟畅

zc防伪码创建修改

上级 56243b21
......@@ -3,7 +3,7 @@ import { requestPath } from '@/utils/global.js'
export function newExchangeAPI(data) { //批量创建防伪码
return request({
url: `${requestPath.resource}/physical-conversion-code/save`,
url: `${requestPath.resource}/physical-conversion-code/xzconversionCode`,
method: 'post',
data
})
......
......@@ -362,21 +362,21 @@ import queryString from "query-string";
}
},
validateNum(val){
if(val > 10000){
this.$message.warning('防伪码生成数量最多不超过10000')
this.codeNumberForm.number = 10000
if(val > 20000){
this.$message.warning('防伪码生成数量最多不超过20000')
this.codeNumberForm.number = 20000
}
},
dataSubmitCode() { //批量创建--2000一次
dataSubmitCode() { //批量创建--5000一次
if(this.codeNumberForm.number && this.codeNumberForm.number > 0){
this.sending = true
this.progressNum = 0
this.codeTotal = Number(this.codeNumberForm.number)
this.codeNum = Math.ceil(this.codeTotal / 2000)
this.codeNum = Math.ceil(this.codeTotal / 5000)
this.codeCurrentNum = 0
if(this.codeTotal <= 2000){
if(this.codeTotal <= 5000){
this.progressTimer = setInterval(() => {
if(this.progressNum <= 80){
if(this.progressNum < 80){
this.progressNum ++
}else{
this.progressNum = 80
......@@ -397,7 +397,7 @@ import queryString from "query-string";
this.sending = false;
}
});
}else if(this.codeTotal > 2000){
}else if(this.codeTotal > 5000){
this.saveCodeEvent(1)
}
}else{
......@@ -406,15 +406,16 @@ import queryString from "query-string";
},
saveCodeEvent(num){
if(num == 1){
let maxNum = Math.floor((100 / this.codeNum) * 1)
this.progressTimer = setInterval(() => {
if(this.progressNum <= 80){
if(this.progressNum < maxNum){
this.progressNum ++
}else{
this.progressNum = 80
this.progressNum = maxNum
}
},2000)
}
newExchangeAPI({ number:2000,phyId:this.$route.query.id }).then(res => {
newExchangeAPI({ number:5000,phyId:this.$route.query.id }).then(res => {
if (res.data.code === 0) {
clearInterval(this.progressTimer)
this.codeCurrentNum ++
......@@ -424,7 +425,7 @@ import queryString from "query-string";
this.saveCodeEvent(2)
},2000)
}else if(this.codeCurrentNum == Number(this.codeNum - 1)){
let currentNum1 = Number(this.codeTotal - this.codeCurrentNum*2000)
let currentNum1 = Number(this.codeTotal - this.codeCurrentNum*5000)
newExchangeAPI({number:currentNum1,phyId:this.$route.query.id}).then(res => {
if (res.data.code === 0) {
clearInterval(this.progressTimer)
......
......@@ -430,21 +430,21 @@ import store from '@/store'
})
},
validateNum(val){
if(val > 10000){
this.$message.warning('防伪码生成数量最多不超过10000')
this.codeNumberForm.number = 10000
if(val > 20000){
this.$message.warning('防伪码生成数量最多不超过20000')
this.codeNumberForm.number = 20000
}
},
dataSubmitCode() { //批量创建--2000一次
dataSubmitCode() { //批量创建--5000一次
if(this.codeNumberForm.number && this.codeNumberForm.number > 0){
this.sending = true
this.progressNum = 0
this.codeTotal = Number(this.codeNumberForm.number)
this.codeNum = Math.ceil(this.codeTotal / 2000)
this.codeNum = Math.ceil(this.codeTotal / 5000)
this.codeCurrentNum = 0
if(this.codeTotal <= 2000){
if(this.codeTotal <= 5000){
this.progressTimer = setInterval(() => {
if(this.progressNum <= 80){
if(this.progressNum < 80){
this.progressNum ++
}else{
this.progressNum = 80
......@@ -465,7 +465,7 @@ import store from '@/store'
this.sending = false;
}
});
}else if(this.codeTotal > 2000){
}else if(this.codeTotal > 5000){
this.saveCodeEvent(1)
}
}else{
......@@ -474,15 +474,16 @@ import store from '@/store'
},
saveCodeEvent(num){
if(num == 1){
let maxNum = Math.floor((100 / this.codeNum) * 1)
this.progressTimer = setInterval(() => {
if(this.progressNum <= 80){
if(this.progressNum < maxNum){
this.progressNum ++
}else{
this.progressNum = 80
this.progressNum = maxNum
}
},2000)
}
newExchangeAPI({ number:2000 }).then(res => {
newExchangeAPI({ number:5000 }).then(res => {
if (res.data.code === 0) {
clearInterval(this.progressTimer)
this.codeCurrentNum ++
......@@ -492,7 +493,7 @@ import store from '@/store'
this.saveCodeEvent(2)
},2000)
}else if(this.codeCurrentNum == Number(this.codeNum - 1)){
let currentNum1 = Number(this.codeTotal - this.codeCurrentNum*2000)
let currentNum1 = Number(this.codeTotal - this.codeCurrentNum*5000)
newExchangeAPI({number:currentNum1}).then(res => {
if (res.data.code === 0) {
clearInterval(this.progressTimer)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论