导出
This commit is contained in:
parent
a7edd554f0
commit
c283de72bf
@ -63,7 +63,14 @@ class SoldActivatedController extends Controller
|
||||
$query = $query->where('company_id', $conditions['company_id']);
|
||||
}
|
||||
|
||||
$list = $query->get()->groupBy('company_id');
|
||||
$list = $query->get();
|
||||
|
||||
if (!empty($list)) {
|
||||
$maxMonth = max($list->pluck('activated_month')->toArray());
|
||||
$maxMonth = Carbon::parse($maxMonth);
|
||||
}
|
||||
|
||||
$list = $list->groupBy('company_id');
|
||||
|
||||
$res = [];
|
||||
|
||||
@ -80,7 +87,7 @@ class SoldActivatedController extends Controller
|
||||
$res[$company_id][$month]['order_month'] = $month;
|
||||
$res[$company_id][$month]['sells'] = 0;
|
||||
|
||||
for ($j=0; $j <= $endtime->diffInMonths($starttime); $j++) {
|
||||
for ($j=0; $j <= $maxMonth->diffInMonths($starttime); $j++) {
|
||||
$m = $starttime->copy()->addMonths($j)->format('Y-m');
|
||||
|
||||
$item = $monthList[$m] ?? [];
|
||||
|
@ -53,6 +53,9 @@
|
||||
</li>
|
||||
|
||||
<li class="f-r">
|
||||
<div class="handle-item" v-if="data.length">
|
||||
<Button @click="exportData" type="warning">导出</Button>
|
||||
</div>
|
||||
<div class="handle-item">
|
||||
<Button @click="index()" ghost type="primary">立即搜索</Button>
|
||||
</div>
|
||||
@ -65,7 +68,7 @@
|
||||
</div>
|
||||
|
||||
<div class="page-list-wrap">
|
||||
<Table :columns="columns" :data="data ? data : []"></Table>
|
||||
<Table :columns="columns" :data="data ? data : []" ref="table"></Table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -24,7 +24,7 @@ export default {
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
setColumns() {
|
||||
setColumns(maxTime) {
|
||||
let columns = [
|
||||
{
|
||||
title: '销售时间',
|
||||
@ -38,7 +38,7 @@ export default {
|
||||
}
|
||||
];
|
||||
|
||||
for (let i = 0; i <= this.moment(this.params.endtime).diff(this.moment(this.params.starttime), 'months'); i++) {
|
||||
for (let i = 0; i <= this.moment(maxTime).diff(this.moment(this.params.starttime), 'months'); i++) {
|
||||
columns.push({
|
||||
title: this.moment(this.params.starttime).add(i, 'months').format('YYYY-MM'),
|
||||
key: this.moment(this.params.starttime).add(i, 'months').format('YYYY-MM'),
|
||||
@ -66,7 +66,6 @@ export default {
|
||||
return this.$Message.error('请先选择企业');
|
||||
}
|
||||
|
||||
this.setColumns();
|
||||
this.isShowLoading(true);
|
||||
|
||||
let params = JSON.parse(JSON.stringify(this.params));
|
||||
@ -79,7 +78,14 @@ export default {
|
||||
}).then(res => {
|
||||
this.isShowLoading(false);
|
||||
if (res.code == 0) {
|
||||
this.data = res.data[this.params.company_id];
|
||||
let data = res.data[this.params.company_id];
|
||||
|
||||
if (data.length) {
|
||||
let maxTime = Object.keys(data[0])[Object.keys(data[0]).length - 1];
|
||||
this.setColumns(maxTime);
|
||||
}
|
||||
|
||||
this.data = data;
|
||||
}
|
||||
}).catch(() => {
|
||||
this.isShowLoading(false);
|
||||
@ -104,6 +110,11 @@ export default {
|
||||
return item.status === 0;
|
||||
});
|
||||
});
|
||||
},
|
||||
exportData() {
|
||||
this.$refs.table.exportCsv({
|
||||
filename: '销售激活统计_' + this.company.name + '_' + this.moment(this.params.starttime).format('YYYYMM') + '-' + this.moment(this.params.endtime).format('YYYYMM')
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
2
public/css/chunk-70e42009.92a7aa54.css
Normal file
2
public/css/chunk-70e42009.92a7aa54.css
Normal file
File diff suppressed because one or more lines are too long
2
public/js/app.39b27fa9.js
Normal file
2
public/js/app.39b27fa9.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.39b27fa9.js.map
Normal file
1
public/js/app.39b27fa9.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/app.945bce33.js
Normal file
2
public/js/app.945bce33.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.945bce33.js.map
Normal file
1
public/js/app.945bce33.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/app.b39c38f7.js
Normal file
2
public/js/app.b39c38f7.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.b39c38f7.js.map
Normal file
1
public/js/app.b39c38f7.js.map
Normal file
File diff suppressed because one or more lines are too long
15
public/js/chunk-394777df.aa939f83.js
Normal file
15
public/js/chunk-394777df.aa939f83.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/chunk-394777df.aa939f83.js.map
Normal file
1
public/js/chunk-394777df.aa939f83.js.map
Normal file
File diff suppressed because one or more lines are too long
15
public/js/chunk-70e42009.37779c13.js
Normal file
15
public/js/chunk-70e42009.37779c13.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/chunk-70e42009.37779c13.js.map
Normal file
1
public/js/chunk-70e42009.37779c13.js.map
Normal file
File diff suppressed because one or more lines are too long
15
public/js/chunk-70e42009.68fd4f1b.js
Normal file
15
public/js/chunk-70e42009.68fd4f1b.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/chunk-70e42009.68fd4f1b.js.map
Normal file
1
public/js/chunk-70e42009.68fd4f1b.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -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-394777df.91f7cc7e.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.20f6d59e.js rel=prefetch><link href=/js/chunk-394777df.28c896a1.js rel=prefetch><link href=/js/chunk-996b1e80.1e853bf4.js rel=prefetch><link href=/css/app.d71a8195.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.e0230465.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.d71a8195.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.e0230465.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-70e42009.92a7aa54.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.20f6d59e.js rel=prefetch><link href=/js/chunk-70e42009.68fd4f1b.js rel=prefetch><link href=/js/chunk-996b1e80.1e853bf4.js rel=prefetch><link href=/css/app.d71a8195.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.b39c38f7.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.d71a8195.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.b39c38f7.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user