fixed #121
This commit is contained in:
梁灏 2016-12-13 11:45:16 +08:00
parent 0f6778937c
commit db8d1f7de7
2 changed files with 63 additions and 255 deletions

View file

@ -72,7 +72,7 @@
} }
&-body{ &-body{
overflow: auto; overflow: auto;
position: relative; //position: relative;
} }
&-with-fixed-top&-with-footer{ &-with-fixed-top&-with-footer{

View file

@ -1,279 +1,87 @@
<template> <template>
<i-table :columns="columns8" :data="data7" size="small" v-ref:table></i-table> <i-table width="550" border :columns="columns2" :data="data3"></i-table>
<br>
<i-button type="primary" size="large" @click="exportData(1)"><Icon type="ios-download-outline"></Icon> 导出原始数据</i-button>
<i-button type="primary" size="large" @click="exportData(2)"><Icon type="ios-download-outline"></Icon> 导出排序和过滤后的数据</i-button>
<i-button type="primary" size="large" @click="exportData(3)"><Icon type="ios-download-outline"></Icon> 导出自定义数据</i-button>
</template> </template>
<script> <script>
export default { export default {
data () { data () {
return { return {
columns8: [ columns2: [
{ {
"title": "名称", title: '姓名',
"key": "name", key: 'name',
"fixed": "left", width: 100,
"width": 200 fixed: 'left'
}, },
{ {
"title": "展示", title: '年龄',
"key": "show", key: 'age',
"width": 150, width: 100
"sortable": true, },
filters: [ {
{ title: '省份',
label: '大于4000', key: 'province',
value: 1 width: 100
}, },
{ {
label: '小于4000', title: '市区',
value: 2 key: 'city',
} width: 100
], },
filterMultiple: false, {
filterMethod (value, row) { title: '地址',
if (value === 1) { key: 'address',
return row.show > 4000; width: 200
} else if (value === 2) { },
return row.show < 4000; {
} title: '邮编',
key: 'zip',
width: 100
},
{
title: '操作',
key: 'action',
fixed: 'right',
width: 120,
render () {
return `<i-button type="text" size="small">查看</i-button><i-button type="text" size="small">编辑</i-button>`;
} }
},
{
"title": "唤醒",
"key": "weak",
"width": 150,
"sortable": true
},
{
"title": "登录",
"key": "signin",
"width": 150,
"sortable": true
},
{
"title": "点击",
"key": "click",
"width": 150,
"sortable": true
},
{
"title": "激活",
"key": "active",
"width": 150,
"sortable": true
},
{
"title": "7日留存",
"key": "day7",
"width": 150,
"sortable": true
},
{
"title": "30日留存",
"key": "day30",
"width": 150,
"sortable": true
},
{
"title": "次日留存",
"key": "tomorrow",
"width": 150,
"sortable": true
},
{
"title": "日活跃",
"key": "day",
"width": 150,
"sortable": true
},
{
"title": "周活跃",
"key": "week",
"width": 150,
"sortable": true
},
{
"title": "月活跃",
"key": "month",
"width": 150,
"sortable": true
} }
], ],
data7: [ data3: [
{ {
"name": "推广名称1", name: '王小明',
"fav": 0, age: 18,
"show": 7302, address: '北京市朝阳区芍药居',
"weak": 5627, province: '北京市',
"signin": 1563, city: '朝阳区',
"click": 4254, zip: 100000
"active": 1438,
"day7": 274,
"day30": 285,
"tomorrow": 1727,
"day": 558,
"week": 4440,
"month": 5610
}, },
{ {
"name": "推广名称2", name: '张小刚',
"fav": 0, age: 25,
"show": 4720, address: '北京市海淀区西二旗',
"weak": 4086, province: '北京市',
"signin": 3792, city: '海淀区',
"click": 8690, zip: 100000
"active": 8470,
"day7": 8172,
"day30": 5197,
"tomorrow": 1684,
"day": 2593,
"week": 2507,
"month": 1537
}, },
{ {
"name": "推广名称3", name: '李小红',
"fav": 0, age: 30,
"show": 7181, address: '上海市浦东新区世纪大道',
"weak": 8007, province: '上海市',
"signin": 8477, city: '浦东新区',
"click": 1879, zip: 100000
"active": 16,
"day7": 2249,
"day30": 3450,
"tomorrow": 377,
"day": 1561,
"week": 3219,
"month": 1588
}, },
{ {
"name": "推广名称4", name: '周小伟',
"fav": 0, age: 26,
"show": 9911, address: '深圳市南山区深南大道',
"weak": 8976, province: '广东',
"signin": 8807, city: '南山区',
"click": 8050, zip: 100000
"active": 7668,
"day7": 1547,
"day30": 2357,
"tomorrow": 7278,
"day": 5309,
"week": 1655,
"month": 9043
},
{
"name": "推广名称5",
"fav": 0,
"show": 934,
"weak": 1394,
"signin": 6463,
"click": 5278,
"active": 9256,
"day7": 209,
"day30": 3563,
"tomorrow": 8285,
"day": 1230,
"week": 4840,
"month": 9908
},
{
"name": "推广名称6",
"fav": 0,
"show": 6856,
"weak": 1608,
"signin": 457,
"click": 4949,
"active": 2909,
"day7": 4525,
"day30": 6171,
"tomorrow": 1920,
"day": 1966,
"week": 904,
"month": 6851
},
{
"name": "推广名称7",
"fav": 0,
"show": 5107,
"weak": 6407,
"signin": 4166,
"click": 7970,
"active": 1002,
"day7": 8701,
"day30": 9040,
"tomorrow": 7632,
"day": 4061,
"week": 4359,
"month": 3676
},
{
"name": "推广名称8",
"fav": 0,
"show": 862,
"weak": 6520,
"signin": 6696,
"click": 3209,
"active": 6801,
"day7": 6364,
"day30": 6850,
"tomorrow": 9408,
"day": 2481,
"week": 1479,
"month": 2346
},
{
"name": "推广名称9",
"fav": 0,
"show": 567,
"weak": 5859,
"signin": 128,
"click": 6593,
"active": 1971,
"day7": 7596,
"day30": 3546,
"tomorrow": 6641,
"day": 1611,
"week": 5534,
"month": 3190
},
{
"name": "推广名称10",
"fav": 0,
"show": 3651,
"weak": 1819,
"signin": 4595,
"click": 7499,
"active": 7405,
"day7": 8710,
"day30": 5518,
"tomorrow": 428,
"day": 9768,
"week": 2864,
"month": 5811
} }
] ]
} }
},
methods: {
exportData (type) {
if (type === 1) {
this.$refs.table.exportCsv({
filename: '原始数据'
});
} else if (type === 2) {
this.$refs.table.exportCsv({
filename: '排序和过滤后的数据',
original: false
});
} else if (type === 3) {
this.$refs.table.exportCsv({
filename: '自定义数据',
columns: this.columns8.filter((col, index) => index < 4),
data: this.data7.filter((data, index) => index < 4)
});
}
}
} }
} }
</script> </script>