This commit is contained in:
邓皓元 2019-05-09 16:14:32 +08:00
parent 73c5933a40
commit 387c050a5d
5 changed files with 98 additions and 59 deletions

View File

@ -14,9 +14,9 @@
<Button @click="openEdit(true)" icon="md-add" type="primary">执行同步</Button>
</div>
<div class="handle-item">
<!-- <div class="handle-item">
<Button @click="openRefund(true)" icon="md-arrow-dropleft" type="primary">退货同步</Button>
</div>
</div> -->
<div class="handle-item">
<Button @click="openCancelled(true)" icon="md-close" type="primary">注销同步</Button>

View File

@ -10,9 +10,9 @@ export default {
this.my_show = bool;
if (bool) {
this.current = 0;
this.status = 'wait';
this.status = "wait";
this.circle.percent = 0;
this.circle.content = '未开始';
this.circle.content = "未开始";
}
}
},
@ -23,45 +23,62 @@ export default {
disabled: false,
steps: [
{
'title': '同步企业',
'content': '所有企业数据',
'command': 'real:sync-company',
'max': 5
title: "同步企业",
content: "所有企业数据",
command: "real:sync-company",
max: 5
},
{
'title': '同步套餐',
'content': '所有套餐数据',
'command': 'real:sync-package',
'max': 10
title: "同步套餐",
content: "所有套餐数据",
command: "real:sync-package",
max: 10
},
{
'title': '同步流量池',
'content': '所有流量池的数据',
'command': 'real:sync-flow-pool',
'max': 20
title: "同步流量池",
content: "所有流量池的数据",
command: "real:sync-flow-pool",
max: 20
},
{
'title': '同步订单',
'content': '指定月份的销售订单数据',
'command': 'real:sync-order',
'max': 60,
'datePicker': true
title: "同步退货",
content: "同步本月退之前的订单",
command: "real:sync-refund",
max: 25,
datePicker: true
},
{
'title': '同步企业订单',
'content': '指定月份的续费及增值包数据',
'command': 'real:sync-added-order',
'max': 100,
'datePicker': true
title: "同步订单",
content: "指定月份的销售订单数据",
command: "real:sync-order",
max: 60,
datePicker: true
},
{
title: "同步退货",
content: "同步本月退当月的订单",
command: "real:sync-refund",
max: 65,
datePicker: true
},
{
title: "同步企业订单",
content: "指定月份的续费及增值包数据",
command: "real:sync-added-order",
max: 100,
datePicker: true
}
],
current: 0,
circle: {
percent: 0,
content: '未开始'
content: "未开始"
},
status: 'wait',
month: this.moment().subtract('1', 'months').startOf('month').format('YYYY-MM')
status: "wait",
month: this.moment()
.subtract("1", "months")
.startOf("month")
.format("YYYY-MM")
};
},
methods: {
@ -74,26 +91,26 @@ export default {
let params = {};
params.command = this.steps[this.current]['command'];
params.command = this.steps[this.current]["command"];
if (!params.command) {
return this.$Message.error('命令错误');
return this.$Message.error("命令错误");
}
if (this.steps[this.current]['datePicker']) {
if (this.steps[this.current]["datePicker"]) {
if (!this.month) {
return this.$Message.error('请选择要同步的月份');
return this.$Message.error("请选择要同步的月份");
}
params.parameters = {
month: this.moment(this.month).format('YYYY-MM')
month: this.moment(this.month).format("YYYY-MM")
};
}
let max = this.steps[this.current]['max'];
let max = this.steps[this.current]["max"];
this.status = 'process';
this.circle.content = '正在' + this.steps[this.current]['title'];
this.status = "process";
this.circle.content = "正在" + this.steps[this.current]["title"];
let interval = setInterval(() => {
if (this.circle.percent < max) {
@ -101,24 +118,31 @@ export default {
}
}, 1000);
service.post('/api/artisan/call', params).then(res => {
service
.post("/api/artisan/call", params)
.then(res => {
if (res.code == 0) {
this.circle.content = this.steps[this.current]['title'] + '完成';
this.circle.content = this.steps[this.current]["title"] + "完成";
this.circle.percent = max;
this.status = (max == 100) ? 'finish' : 'wait';
this.status = max == 100 ? "finish" : "wait";
this.current++;
} else {
this.circle.content = '同步失败';
this.circle.percent = this.steps[this.current - 1] ? this.steps[this.current - 1]['max'] : 0;
this.status = 'error';
this.circle.content = "同步失败";
this.circle.percent = this.steps[this.current - 1]
? this.steps[this.current - 1]["max"]
: 0;
this.status = "error";
}
this.disabled = false;
clearInterval(interval);
}).catch((err) => {
this.circle.content = '同步失败';
this.circle.percent = this.steps[this.current - 1] ? this.steps[this.current - 1]['max'] : 0;
this.status = 'error';
})
.catch(err => {
this.circle.content = "同步失败";
this.circle.percent = this.steps[this.current - 1]
? this.steps[this.current - 1]["max"]
: 0;
this.status = "error";
this.disabled = false;
clearInterval(interval);
});
@ -128,7 +152,7 @@ export default {
},
visibleChange(bool) {
if (!bool) {
this.$emit('update:show', false);
this.$emit("update:show", false);
}
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/css/chunk-8064e07e.03f6c57e.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/js/chunk-8064e07e.3dc31d76.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.0c8b8e78.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.0c8b8e78.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/css/chunk-8064e07e.03f6c57e.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/js/chunk-8064e07e.3468404c.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.2b8e6a09.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.2b8e6a09.js></script></body></html>