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

View File

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