md-iview 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/package.json +116 -0
- package/src/components/libs/util.js +117 -0
- package/src/components/md-error-page/403.less +92 -0
- package/src/components/md-error-page/403.vue +34 -0
- package/src/components/md-error-page/404.less +60 -0
- package/src/components/md-error-page/404.vue +34 -0
- package/src/components/md-error-page/500.less +73 -0
- package/src/components/md-error-page/500.vue +36 -0
- package/src/components/md-error-page/demo/index.less +22 -0
- package/src/components/md-error-page/demo/index.vue +97 -0
- package/src/components/md-form-item/index.js +3 -0
- package/src/components/md-icon/icon.vue +77 -0
- package/src/components/md-icon/icons.js +5 -0
- package/src/components/md-icon/index.js +11 -0
- package/src/components/md-icon/style/index.less +1 -0
- package/src/components/md-loading/index.js +55 -0
- package/src/components/md-loading/index.vue +53 -0
- package/src/components/md-loading/md-loading.js +38 -0
- package/src/components/md-print/demo/index.vue +260 -0
- package/src/components/md-print/index.js +123 -0
- package/src/components/md-rich-editor/index.vue +69 -0
- package/src/components/md-rich-editor/module/image-extend/index.js +216 -0
- package/src/components/md-scroll-bar/demo/index.vue +102 -0
- package/src/components/md-scroll-bar/index.js +3 -0
- package/src/components/md-scroll-bar/index.less +90 -0
- package/src/components/md-scroll-bar/index.vue +250 -0
- package/src/components/md-select/index.js +7 -0
- package/src/components/md-select/select.vue +841 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenu.vue +167 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenuShrink.vue +119 -0
- package/src/components/md-shrinkable-menu/demo/data/cachePage.js +1 -0
- package/src/components/md-shrinkable-menu/demo/data/currentPath.js +9 -0
- package/src/components/md-shrinkable-menu/demo/data/menu.js +575 -0
- package/src/components/md-shrinkable-menu/demo/data/menu2.js +1017 -0
- package/src/components/md-shrinkable-menu/demo/data/pageTagsList.js +153 -0
- package/src/components/md-shrinkable-menu/demo/index.less +297 -0
- package/src/components/md-shrinkable-menu/demo/index.vue +285 -0
- package/src/components/md-shrinkable-menu/index.vue +112 -0
- package/src/components/md-shrinkable-menu/sidebar.vue +195 -0
- package/src/components/md-shrinkable-menu/styles/menu.less +5 -0
- package/src/components/md-shrinkable-menu/styles/sidebar.less +363 -0
- package/src/components/md-split-pane/demo/index.vue +101 -0
- package/src/components/md-split-pane/index.js +3 -0
- package/src/components/md-split-pane/index.less +93 -0
- package/src/components/md-split-pane/index.vue +230 -0
- package/src/components/md-table/action-tooltip.vue +45 -0
- package/src/components/md-table/can-edit-v2.vue +823 -0
- package/src/components/md-table/can-edit.vue +723 -0
- package/src/components/md-table/custom-cell.vue +71 -0
- package/src/components/md-table/date-picker-cell-v2.vue +48 -0
- package/src/components/md-table/date-picker-cell.vue +39 -0
- package/src/components/md-table/demo/data/search.js +67 -0
- package/src/components/md-table/demo/data/table2csv.js +200 -0
- package/src/components/md-table/demo/data/table2excel.js +239 -0
- package/src/components/md-table/demo/data/table_data.js +251 -0
- package/src/components/md-table/demo/editable-table.vue +144 -0
- package/src/components/md-table/demo/exportable-table.vue +124 -0
- package/src/components/md-table/demo/widgets/header-search.vue +88 -0
- package/src/components/md-table/drop-down-cell-v2.vue +87 -0
- package/src/components/md-table/drop-down-cell.vue +81 -0
- package/src/components/md-table/editable-expand.vue +143 -0
- package/src/components/md-table/expand.vue +97 -0
- package/src/components/md-table/index.vue +53 -0
- package/src/components/md-table/iview-table/cell.vue +99 -0
- package/src/components/md-table/iview-table/expand.js +21 -0
- package/src/components/md-table/iview-table/export-csv.js +76 -0
- package/src/components/md-table/iview-table/header.js +16 -0
- package/src/components/md-table/iview-table/index.js +2 -0
- package/src/components/md-table/iview-table/mixin.js +31 -0
- package/src/components/md-table/iview-table/table-body.vue +101 -0
- package/src/components/md-table/iview-table/table-head.vue +311 -0
- package/src/components/md-table/iview-table/table-tr.vue +31 -0
- package/src/components/md-table/iview-table/table.vue +1026 -0
- package/src/components/md-table/iview-table/util.js +93 -0
- package/src/components/md-table/libs/table2excel.js +100 -0
- package/src/components/md-table/select-cell-v2.vue +64 -0
- package/src/components/md-table/select-cell.vue +46 -0
- package/src/components/md-table/table.less +76 -0
- package/src/components/md-toolbar/index.vue +171 -0
- package/src/components/md-tree/index.js +2 -0
- package/src/components/md-tree/node.vue +238 -0
- package/src/components/md-tree/render.js +17 -0
- package/src/components/md-tree/tree.vue +241 -0
- package/src/components/utilities/can.js +35 -0
- package/src/directives/index.js +34 -0
- package/src/directives/resize.js +27 -0
- package/src/directives/scroll.js +27 -0
- package/src/directives/style/bg-color.js +23 -0
- package/src/directives/style/color.js +23 -0
- package/src/directives/style/font-size.js +23 -0
- package/src/directives/style/height.js +23 -0
- package/src/directives/style/lineHeight.js +23 -0
- package/src/directives/style/margin.js +48 -0
- package/src/directives/style/opacity.js +23 -0
- package/src/directives/style/padding.js +48 -0
- package/src/directives/style/width.js +24 -0
- package/src/index.js +442 -0
- package/src/locale/lang.js +5 -0
- package/src/mixins/colorable.js +51 -0
- package/src/style/color/bezierEasing.less +110 -0
- package/src/style/color/colorPalette.less +75 -0
- package/src/style/color/colors.less +146 -0
- package/src/style/color/tinyColor.less +1184 -0
- package/src/style/common.less +72 -0
- package/src/style/components/_ripple.less +60 -0
- package/src/style/components/_shrinkable-menu.less +46 -0
- package/src/style/components/_toolbar.less +96 -0
- package/src/style/components/index.less +3 -0
- package/src/style/components/rich-editor.less +6 -0
- package/src/style/index.less +10 -0
- package/src/style/theme.less +155 -0
- package/src/utils/color.js +46 -0
- package/src/utils/console.js +105 -0
- package/src/utils/load.js +79 -0
- package/src/utils/mask.js +139 -0
- package/src/utils/mixins.js +5 -0
- package/src/utils/validate.js +271 -0
@@ -0,0 +1,251 @@
|
|
1
|
+
export const table1Columns = [
|
2
|
+
{
|
3
|
+
title: '序号',
|
4
|
+
type: 'index',
|
5
|
+
width: 80,
|
6
|
+
align: 'center'
|
7
|
+
},
|
8
|
+
{
|
9
|
+
title: '姓名',
|
10
|
+
align: 'center',
|
11
|
+
key: 'name',
|
12
|
+
editable: true
|
13
|
+
},
|
14
|
+
{
|
15
|
+
title: '性别',
|
16
|
+
align: 'center',
|
17
|
+
key: 'sex'
|
18
|
+
},
|
19
|
+
{
|
20
|
+
title: '岗位',
|
21
|
+
align: 'center',
|
22
|
+
key: 'work',
|
23
|
+
editable: true
|
24
|
+
},
|
25
|
+
{
|
26
|
+
title: '操作',
|
27
|
+
align: 'center',
|
28
|
+
width: 120,
|
29
|
+
key: 'handle',
|
30
|
+
handle: ['delete']
|
31
|
+
}
|
32
|
+
];
|
33
|
+
|
34
|
+
export const table1Data = [
|
35
|
+
{
|
36
|
+
name: 'Aresn',
|
37
|
+
sex: '男',
|
38
|
+
work: '前端开发'
|
39
|
+
},
|
40
|
+
{
|
41
|
+
name: 'Lison',
|
42
|
+
sex: '男',
|
43
|
+
work: '前端开发'
|
44
|
+
},
|
45
|
+
{
|
46
|
+
name: 'lisa',
|
47
|
+
sex: '女',
|
48
|
+
work: '程序员鼓励师'
|
49
|
+
}
|
50
|
+
];
|
51
|
+
|
52
|
+
export const editInlineColumns = [
|
53
|
+
{
|
54
|
+
title: '序号',
|
55
|
+
type: 'index',
|
56
|
+
width: 80,
|
57
|
+
align: 'center'
|
58
|
+
},
|
59
|
+
{
|
60
|
+
title: '姓名',
|
61
|
+
align: 'center',
|
62
|
+
key: 'name',
|
63
|
+
width: 90,
|
64
|
+
editable: true
|
65
|
+
},
|
66
|
+
{
|
67
|
+
title: '性别',
|
68
|
+
align: 'center',
|
69
|
+
key: 'sex'
|
70
|
+
},
|
71
|
+
{
|
72
|
+
title: '岗位',
|
73
|
+
align: 'center',
|
74
|
+
key: 'work',
|
75
|
+
width: 150,
|
76
|
+
editable: true
|
77
|
+
},
|
78
|
+
{
|
79
|
+
title: '操作',
|
80
|
+
align: 'center',
|
81
|
+
width: 190,
|
82
|
+
key: 'handle',
|
83
|
+
handle: ['edit', 'delete']
|
84
|
+
}
|
85
|
+
];
|
86
|
+
|
87
|
+
export const editInlineData = [
|
88
|
+
{
|
89
|
+
name: 'Aresn',
|
90
|
+
sex: '男',
|
91
|
+
work: '前端开发'
|
92
|
+
},
|
93
|
+
{
|
94
|
+
name: 'Lison',
|
95
|
+
sex: '男',
|
96
|
+
work: '前端开发'
|
97
|
+
},
|
98
|
+
{
|
99
|
+
name: 'lisa',
|
100
|
+
sex: '女',
|
101
|
+
work: '程序员鼓励师'
|
102
|
+
}
|
103
|
+
];
|
104
|
+
|
105
|
+
export const editIncellColumns = [
|
106
|
+
{
|
107
|
+
title: '序号',
|
108
|
+
type: 'index',
|
109
|
+
width: 80,
|
110
|
+
align: 'center'
|
111
|
+
},
|
112
|
+
{
|
113
|
+
title: '姓名',
|
114
|
+
align: 'center',
|
115
|
+
key: 'name',
|
116
|
+
width: 120,
|
117
|
+
editable: true
|
118
|
+
},
|
119
|
+
{
|
120
|
+
title: '性别',
|
121
|
+
align: 'center',
|
122
|
+
key: 'sex'
|
123
|
+
},
|
124
|
+
{
|
125
|
+
title: '岗位',
|
126
|
+
align: 'center',
|
127
|
+
width: 160,
|
128
|
+
key: 'work',
|
129
|
+
editable: true
|
130
|
+
},
|
131
|
+
{
|
132
|
+
title: '操作',
|
133
|
+
align: 'center',
|
134
|
+
width: 120,
|
135
|
+
key: 'handle',
|
136
|
+
handle: ['delete']
|
137
|
+
}
|
138
|
+
];
|
139
|
+
|
140
|
+
export const editIncellData = [
|
141
|
+
{
|
142
|
+
name: 'Aresn',
|
143
|
+
sex: '男',
|
144
|
+
work: '前端开发'
|
145
|
+
},
|
146
|
+
{
|
147
|
+
name: 'Lison',
|
148
|
+
sex: '男',
|
149
|
+
work: '前端开发'
|
150
|
+
},
|
151
|
+
{
|
152
|
+
name: 'lisa',
|
153
|
+
sex: '女',
|
154
|
+
work: '程序员鼓励师'
|
155
|
+
}
|
156
|
+
];
|
157
|
+
|
158
|
+
export const editInlineAndCellColumn = [
|
159
|
+
{
|
160
|
+
title: '序号',
|
161
|
+
type: 'index',
|
162
|
+
width: 80,
|
163
|
+
align: 'center'
|
164
|
+
},
|
165
|
+
{
|
166
|
+
title: '姓名',
|
167
|
+
align: 'center',
|
168
|
+
key: 'name',
|
169
|
+
width: 300,
|
170
|
+
editable: true
|
171
|
+
},
|
172
|
+
{
|
173
|
+
title: '性别',
|
174
|
+
align: 'center',
|
175
|
+
key: 'sex'
|
176
|
+
},
|
177
|
+
{
|
178
|
+
title: '岗位',
|
179
|
+
align: 'center',
|
180
|
+
width: 300,
|
181
|
+
key: 'work',
|
182
|
+
editable: true
|
183
|
+
},
|
184
|
+
{
|
185
|
+
title: '操作',
|
186
|
+
align: 'center',
|
187
|
+
width: 200,
|
188
|
+
key: 'handle',
|
189
|
+
handle: ['edit', 'delete']
|
190
|
+
}
|
191
|
+
];
|
192
|
+
|
193
|
+
export const editInlineAndCellData = [
|
194
|
+
{
|
195
|
+
name: 'Aresn',
|
196
|
+
sex: '男',
|
197
|
+
work: '前端开发'
|
198
|
+
},
|
199
|
+
{
|
200
|
+
name: 'Lison',
|
201
|
+
sex: '男',
|
202
|
+
work: '前端开发'
|
203
|
+
},
|
204
|
+
{
|
205
|
+
name: 'lisa',
|
206
|
+
sex: '女',
|
207
|
+
work: '程序员鼓励师'
|
208
|
+
}
|
209
|
+
];
|
210
|
+
|
211
|
+
export const showCurrentColumns = [
|
212
|
+
{
|
213
|
+
title: '序号',
|
214
|
+
type: 'index',
|
215
|
+
width: 80,
|
216
|
+
align: 'center'
|
217
|
+
},
|
218
|
+
{
|
219
|
+
title: '姓名',
|
220
|
+
align: 'center',
|
221
|
+
key: 'name',
|
222
|
+
width: 300,
|
223
|
+
editable: true
|
224
|
+
},
|
225
|
+
{
|
226
|
+
title: '性别',
|
227
|
+
align: 'center',
|
228
|
+
key: 'sex'
|
229
|
+
},
|
230
|
+
{
|
231
|
+
title: '岗位',
|
232
|
+
align: 'center',
|
233
|
+
width: 300,
|
234
|
+
key: 'work',
|
235
|
+
editable: true
|
236
|
+
}
|
237
|
+
];
|
238
|
+
|
239
|
+
const tableData = {
|
240
|
+
table1Columns: table1Columns,
|
241
|
+
table1Data: table1Data,
|
242
|
+
editInlineColumns: editInlineColumns,
|
243
|
+
editInlineData: editInlineData,
|
244
|
+
editIncellColumns: editIncellColumns,
|
245
|
+
editIncellData: editIncellData,
|
246
|
+
editInlineAndCellColumn: editInlineAndCellColumn,
|
247
|
+
editInlineAndCellData: editInlineAndCellData,
|
248
|
+
showCurrentColumns: showCurrentColumns
|
249
|
+
};
|
250
|
+
|
251
|
+
export default tableData;
|
@@ -0,0 +1,144 @@
|
|
1
|
+
<style lang="less">
|
2
|
+
@import '../../../style/common.less';
|
3
|
+
@import '../table.less';
|
4
|
+
</style>
|
5
|
+
|
6
|
+
<template>
|
7
|
+
<div>
|
8
|
+
<Row>
|
9
|
+
<Col span="6">
|
10
|
+
<Card>
|
11
|
+
<p slot="title">
|
12
|
+
<Icon type="load-b"></Icon>
|
13
|
+
简单说明
|
14
|
+
</p>
|
15
|
+
<div class="edittable-test-con">
|
16
|
+
可编辑单元格可配置可编辑的列,可设置编辑整行的可编辑单元格,也可配置单个编辑可编辑单元格,也可两种形式同时可用。可配置单元格内编辑的图标显示方式。
|
17
|
+
</div>
|
18
|
+
</Card>
|
19
|
+
</Col>
|
20
|
+
<Col span="18" class="padding-left-10">
|
21
|
+
<Card>
|
22
|
+
<div class="edittable-con-1">
|
23
|
+
<can-edit-table refs="table1" @on-delete="handleDel" v-model="tableData" :columns-list="columnsList"></can-edit-table>
|
24
|
+
</div>
|
25
|
+
</Card>
|
26
|
+
</Col>
|
27
|
+
</Row>
|
28
|
+
<Row class="margin-top-10">
|
29
|
+
<Col span="12">
|
30
|
+
<Card>
|
31
|
+
<p slot="title">
|
32
|
+
<Icon type="android-remove"></Icon>
|
33
|
+
可编辑单元行
|
34
|
+
</p>
|
35
|
+
<div class="edittable-table-height-con">
|
36
|
+
<can-edit-table refs="table2" v-model="editInlineData" :columns-list="editInlineColumns"></can-edit-table>
|
37
|
+
</div>
|
38
|
+
</Card>
|
39
|
+
</Col>
|
40
|
+
<Col span="12" class="padding-left-10">
|
41
|
+
<Card>
|
42
|
+
<p slot="title">
|
43
|
+
<Icon type="android-more-horizontal"></Icon>
|
44
|
+
可编辑单元格(鼠标移入显示编辑单元格按钮)
|
45
|
+
</p>
|
46
|
+
<div class="edittable-table-height-con">
|
47
|
+
<can-edit-table refs="table3" v-model="editIncellData" :hover-show="true" :edit-incell="true" :columns-list="editIncellColumns"></can-edit-table>
|
48
|
+
</div>
|
49
|
+
</Card>
|
50
|
+
</Col>
|
51
|
+
</Row>
|
52
|
+
<Row class="margin-top-10">
|
53
|
+
<Col span="24">
|
54
|
+
<Card>
|
55
|
+
<p slot="title">
|
56
|
+
<Icon type="ios-keypad"></Icon>
|
57
|
+
单元行和单元格两种方式编辑(始终显示编辑单元格按钮)
|
58
|
+
</p>
|
59
|
+
<Row :gutter="10">
|
60
|
+
<Col span="2">
|
61
|
+
<Row type="flex" justify="center" align="middle" class="edittable-table-get-currentdata-con">
|
62
|
+
<Button type="primary" @click="getCurrentData">当前数据</Button>
|
63
|
+
</Row>
|
64
|
+
</Col>
|
65
|
+
<Col span="22">
|
66
|
+
<div class="edittable-table-height-con">
|
67
|
+
<can-edit-table
|
68
|
+
refs="table4"
|
69
|
+
v-model="editInlineAndCellData"
|
70
|
+
@on-cell-change="handleCellChange"
|
71
|
+
@on-change="handleChange"
|
72
|
+
:editIncell="true"
|
73
|
+
:columns-list="editInlineAndCellColumn"
|
74
|
+
></can-edit-table>
|
75
|
+
</div>
|
76
|
+
</Col>
|
77
|
+
<Modal :width="900" v-model="showCurrentTableData">
|
78
|
+
<can-edit-table refs="table5" v-model="editInlineAndCellData" :columns-list="showCurrentColumns"></can-edit-table>
|
79
|
+
</Modal>
|
80
|
+
</Row>
|
81
|
+
</Card>
|
82
|
+
</Col>
|
83
|
+
</Row>
|
84
|
+
</div>
|
85
|
+
</template>
|
86
|
+
|
87
|
+
<script>
|
88
|
+
import canEditTable from '../can-edit.vue';
|
89
|
+
import tableData from './data/table_data.js';
|
90
|
+
export default {
|
91
|
+
name: 'editable-table',
|
92
|
+
components: {
|
93
|
+
canEditTable
|
94
|
+
},
|
95
|
+
data () {
|
96
|
+
return {
|
97
|
+
columnsList: [],
|
98
|
+
tableData: [],
|
99
|
+
editInlineColumns: [],
|
100
|
+
editInlineData: [],
|
101
|
+
editIncellColumns: [],
|
102
|
+
editIncellData: [],
|
103
|
+
editInlineAndCellColumn: [],
|
104
|
+
editInlineAndCellData: [],
|
105
|
+
showCurrentColumns: [],
|
106
|
+
showCurrentTableData: false
|
107
|
+
};
|
108
|
+
},
|
109
|
+
methods: {
|
110
|
+
getData () {
|
111
|
+
this.columnsList = tableData.table1Columns;
|
112
|
+
this.tableData = tableData.table1Data;
|
113
|
+
this.editInlineColumns = tableData.editInlineColumns;
|
114
|
+
this.editInlineData = tableData.editInlineData;
|
115
|
+
this.editIncellColumns = tableData.editIncellColumns;
|
116
|
+
this.editIncellData = tableData.editIncellData;
|
117
|
+
this.editInlineAndCellColumn = tableData.editInlineAndCellColumn;
|
118
|
+
this.editInlineAndCellData = tableData.editInlineAndCellData;
|
119
|
+
this.showCurrentColumns = tableData.showCurrentColumns;
|
120
|
+
},
|
121
|
+
handleNetConnect (state) {
|
122
|
+
this.breakConnect = state;
|
123
|
+
},
|
124
|
+
handleLowSpeed (state) {
|
125
|
+
this.lowNetSpeed = state;
|
126
|
+
},
|
127
|
+
getCurrentData () {
|
128
|
+
this.showCurrentTableData = true;
|
129
|
+
},
|
130
|
+
handleDel (val, index) {
|
131
|
+
this.$Message.success('删除了第' + (index + 1) + '行数据');
|
132
|
+
},
|
133
|
+
handleCellChange (val, index, key) {
|
134
|
+
this.$Message.success('修改了第 ' + (index + 1) + ' 行列名为 ' + key + ' 的数据');
|
135
|
+
},
|
136
|
+
handleChange (val, index) {
|
137
|
+
this.$Message.success('修改了第' + (index + 1) + '行数据');
|
138
|
+
}
|
139
|
+
},
|
140
|
+
created () {
|
141
|
+
this.getData();
|
142
|
+
}
|
143
|
+
};
|
144
|
+
</script>
|
@@ -0,0 +1,124 @@
|
|
1
|
+
<style lang="less" scoped>
|
2
|
+
@import '../../../style/common.less';
|
3
|
+
@import '../table.less';
|
4
|
+
</style>
|
5
|
+
|
6
|
+
<template>
|
7
|
+
<div>
|
8
|
+
<Row>
|
9
|
+
<Card>
|
10
|
+
<h4 slot="title">
|
11
|
+
<Icon type="android-archive"></Icon>
|
12
|
+
导出表格数据到 .Csv 文件
|
13
|
+
</h4>
|
14
|
+
<Row>
|
15
|
+
<Col span="18">
|
16
|
+
<Table :columns="columnsCsv" :data="csvData" size="small" ref="tableCsv"></Table>
|
17
|
+
</Col>
|
18
|
+
<Col span='6' class="padding-left-10">
|
19
|
+
<div class="exportable-table-download-con1">
|
20
|
+
<span style="margin-right: 16px;"><Button type="primary" size="large" @click="exportData(1)"><Icon type="ios-download-outline"></Icon> 导出原始数据</Button></span>
|
21
|
+
<Button type="primary" size="large" @click="exportData(2)"><Icon type="ios-download-outline"></Icon> 导出排序和过滤后的数据</Button>
|
22
|
+
</div>
|
23
|
+
<div class="exportable-table-download-con2">
|
24
|
+
<div>
|
25
|
+
<span>选取行范围: </span><InputNumber :min="1" :max="selectMaxRow" v-model="selectMinRow"></InputNumber>
|
26
|
+
<span> - </span>
|
27
|
+
<InputNumber :min="selectMinRow" :max="rowNum" v-model="selectMaxRow"></InputNumber>
|
28
|
+
</div>
|
29
|
+
<div class="margin-top-10">
|
30
|
+
<span>选取列范围: </span><InputNumber :min="1" :max="selectMaxCol" v-model="selectMinCol"></InputNumber>
|
31
|
+
<span> - </span>
|
32
|
+
<InputNumber :min="selectMinCol" :max="colNum" v-model="selectMaxCol"></InputNumber>
|
33
|
+
</div>
|
34
|
+
<div class="margin-top-10">
|
35
|
+
<span>输入文件名:</span>
|
36
|
+
<Input v-model="csvFileName" icon="document" placeholder="请输入文件名" style="width: 190px" />
|
37
|
+
</div>
|
38
|
+
<div class="margin-top-20">
|
39
|
+
<Button type="primary" size="large" @click="exportData(3)"><Icon type="ios-download-outline"></Icon> 导出自定义数据</Button>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</Col>
|
43
|
+
</Row>
|
44
|
+
</Card>
|
45
|
+
</Row>
|
46
|
+
<Row class="margin-top-10">
|
47
|
+
<Card>
|
48
|
+
<h4 slot="title">
|
49
|
+
<Icon type="android-archive"></Icon>
|
50
|
+
导出表格数据到 .Xls 文件 (Excel)
|
51
|
+
</h4>
|
52
|
+
<Row>
|
53
|
+
<Col span="18">
|
54
|
+
<Table :columns="excelColumns" height="390px" :data="table2excelData" size="small" ref="tableExcel"></Table>
|
55
|
+
</Col>
|
56
|
+
<Col span='6' class="padding-left-10">
|
57
|
+
<div class="margin-top-10 margin-left-10">
|
58
|
+
<span>输入文件名:</span>
|
59
|
+
<Input v-model="excelFileName" icon="document" placeholder="请输入文件名" style="width: 190px" />
|
60
|
+
</div>
|
61
|
+
<div class="margin-left-10 margin-top-20">
|
62
|
+
<a id="hrefToExportTable" style="postion: absolute;left: -10px;top: -10px;width: 0px;height: 0px;"></a>
|
63
|
+
<Button type="primary" size="large" @click="exportExcel">下载表格数据</Button>
|
64
|
+
</div>
|
65
|
+
</Col>
|
66
|
+
</Row>
|
67
|
+
</Card>
|
68
|
+
</Row>
|
69
|
+
</div>
|
70
|
+
</template>
|
71
|
+
|
72
|
+
<script>
|
73
|
+
import {table2csvData, csvColumns} from './data/table2csv.js';
|
74
|
+
import {table2excelData, excelColumns} from './data/table2excel.js';
|
75
|
+
import table2excel from '../libs/table2excel';
|
76
|
+
export default {
|
77
|
+
name: 'exportable-table',
|
78
|
+
data () {
|
79
|
+
return {
|
80
|
+
columnsCsv: csvColumns,
|
81
|
+
csvData: table2csvData,
|
82
|
+
table2excelData: table2excelData,
|
83
|
+
excelColumns: excelColumns,
|
84
|
+
rowNum: table2csvData.length,
|
85
|
+
colNum: csvColumns.length,
|
86
|
+
selectMinRow: 1,
|
87
|
+
selectMaxRow: table2csvData.length,
|
88
|
+
selectMinCol: 1,
|
89
|
+
selectMaxCol: csvColumns.length,
|
90
|
+
maxRow: 0,
|
91
|
+
minRow: 1,
|
92
|
+
maxCol: 0,
|
93
|
+
minCol: 1,
|
94
|
+
csvFileName: '',
|
95
|
+
excelFileName: '',
|
96
|
+
tableExcel: {},
|
97
|
+
fontSize: 16
|
98
|
+
};
|
99
|
+
},
|
100
|
+
methods: {
|
101
|
+
exportData (type) {
|
102
|
+
if (type === 1) {
|
103
|
+
this.$refs.tableCsv.exportCsv({
|
104
|
+
filename: '原始数据'
|
105
|
+
});
|
106
|
+
} else if (type === 2) {
|
107
|
+
this.$refs.tableCsv.exportCsv({
|
108
|
+
filename: '排序和过滤后的数据',
|
109
|
+
original: false
|
110
|
+
});
|
111
|
+
} else if (type === 3) {
|
112
|
+
this.$refs.tableCsv.exportCsv({
|
113
|
+
filename: this.csvFileName,
|
114
|
+
columns: this.columnsCsv.filter((col, index) => index >= this.selectMinCol - 1 && index <= this.selectMaxCol - 1),
|
115
|
+
data: this.csvData.filter((data, index) => index >= this.selectMinRow - 1 && index <= this.selectMaxRow - 1)
|
116
|
+
});
|
117
|
+
}
|
118
|
+
},
|
119
|
+
exportExcel () {
|
120
|
+
table2excel.transform(this.$refs.tableExcel, 'hrefToExportTable', this.excelFileName);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
};
|
124
|
+
</script>
|
@@ -0,0 +1,88 @@
|
|
1
|
+
<template>
|
2
|
+
<md-dropdown trigger="click" placement="bottom-start">
|
3
|
+
<div>
|
4
|
+
<md-icon type="ios-funnel" size="12" class="hs-icon"></md-icon>
|
5
|
+
</div>
|
6
|
+
<md-dropdown-menu slot="list">
|
7
|
+
<div class="hs-content">
|
8
|
+
<div class="hs-content__header">
|
9
|
+
<md-row>
|
10
|
+
<md-col span="22">
|
11
|
+
<md-input v-model="res.inputValue" suffix="ios-search" placeholder="Enter text" style="width: auto" />
|
12
|
+
</md-col>
|
13
|
+
</md-row>
|
14
|
+
</div>
|
15
|
+
<md-divider class="hs-divider"></md-divider>
|
16
|
+
<div class="hs-content__list">
|
17
|
+
<md-row>
|
18
|
+
<md-col span="22">
|
19
|
+
<CheckboxGroup v-model="res.checkValue" @on-change="onChangeCheckGroup">
|
20
|
+
<Checkbox v-for="item in items" :key="item.value" style="display: block;" :label="item.label"></Checkbox>
|
21
|
+
</CheckboxGroup>
|
22
|
+
</md-col>
|
23
|
+
</md-row>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<md-divider class="hs-divider"></md-divider>
|
27
|
+
<div class="hs-content__footer">
|
28
|
+
<md-row type="flex" justify="space-between" align="middle">
|
29
|
+
<md-col>
|
30
|
+
<span>筛选</span>
|
31
|
+
</md-col>
|
32
|
+
<md-col>
|
33
|
+
<md-btn type="primary" @click="handleClose" size="small">重置</md-btn>
|
34
|
+
</md-col>
|
35
|
+
</md-row>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</md-dropdown-menu>
|
39
|
+
</md-dropdown>
|
40
|
+
</template>
|
41
|
+
|
42
|
+
<script>
|
43
|
+
export default {
|
44
|
+
name: "header-search",
|
45
|
+
props:{
|
46
|
+
items:[Array, Object],
|
47
|
+
},
|
48
|
+
data () {
|
49
|
+
return {
|
50
|
+
res:{
|
51
|
+
inputValue:'',
|
52
|
+
checkValue:[]
|
53
|
+
},
|
54
|
+
}
|
55
|
+
},
|
56
|
+
methods: {
|
57
|
+
handleClose () {
|
58
|
+
console.log('res:', this.res);
|
59
|
+
},
|
60
|
+
onChangeCheckGroup(data) {
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
</script>
|
65
|
+
|
66
|
+
<style lang="less">
|
67
|
+
.hs-icon {
|
68
|
+
color: rgba(0, 0, 0, 0.25) !important;
|
69
|
+
margin: 0 4px;
|
70
|
+
&:hover {
|
71
|
+
color: rgb(87, 87, 87)
|
72
|
+
}
|
73
|
+
}
|
74
|
+
.hs-divider {
|
75
|
+
margin: 8px 0 !important;
|
76
|
+
}
|
77
|
+
.hs-content {
|
78
|
+
&__header {
|
79
|
+
margin:8px
|
80
|
+
}
|
81
|
+
&__list {
|
82
|
+
margin:0 8px
|
83
|
+
}
|
84
|
+
&__footer {
|
85
|
+
margin:0 8px
|
86
|
+
}
|
87
|
+
}
|
88
|
+
</style>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="drop-down-cell display-flex justify-content-space-around">
|
3
|
+
<Dropdown trigger="click" @on-click="onClickItem" :transfer="transfer">
|
4
|
+
<div class="display-flex justify-content-center">
|
5
|
+
{{ getCurrentLabel(this.cloneValue) }}
|
6
|
+
<md-icon type="md-arrow-dropdown" v-show="editable"></md-icon>
|
7
|
+
</div>
|
8
|
+
<DropdownMenu slot="list" v-show="editable">
|
9
|
+
<DropdownItem v-for="item in option" :key="item.value" :name="item.value">{{ item.label }}</DropdownItem>
|
10
|
+
</DropdownMenu>
|
11
|
+
</Dropdown>
|
12
|
+
</div>
|
13
|
+
</template>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
export default {
|
17
|
+
name: "drop-down-cell",
|
18
|
+
model: {
|
19
|
+
prop: "cell"
|
20
|
+
},
|
21
|
+
props: {
|
22
|
+
editable: {
|
23
|
+
type: Boolean,
|
24
|
+
default: false
|
25
|
+
},
|
26
|
+
option: Array | Object,
|
27
|
+
transfer:Boolean,
|
28
|
+
value: [Object, String, Number],
|
29
|
+
},
|
30
|
+
computed: {
|
31
|
+
keys() {
|
32
|
+
return Object.keys(this.mapItems);
|
33
|
+
}
|
34
|
+
},
|
35
|
+
watch: {
|
36
|
+
editable(to) {
|
37
|
+
console.log(to);
|
38
|
+
},
|
39
|
+
value: {
|
40
|
+
immediate: true,
|
41
|
+
handler(to) {
|
42
|
+
this.cloneValue = to;
|
43
|
+
}
|
44
|
+
},
|
45
|
+
},
|
46
|
+
created() {
|
47
|
+
// console.log(this.mapItems, this.cell.row[this.cell.column.key]);
|
48
|
+
},
|
49
|
+
data() {
|
50
|
+
return {
|
51
|
+
cloneValue: null
|
52
|
+
};
|
53
|
+
},
|
54
|
+
methods: {
|
55
|
+
getCurrentLabel(val) {
|
56
|
+
if (val === '' || val === null) return '';
|
57
|
+
let label = '';
|
58
|
+
this.option.map(item => {
|
59
|
+
if (item.value === val) {
|
60
|
+
label = item.label;
|
61
|
+
}
|
62
|
+
});
|
63
|
+
return label
|
64
|
+
},
|
65
|
+
|
66
|
+
onClickItem(val) {
|
67
|
+
this.$nextTick(() => {
|
68
|
+
this.cloneValue = val;
|
69
|
+
this.$emit("on-change", this.cloneValue);
|
70
|
+
});
|
71
|
+
}
|
72
|
+
}
|
73
|
+
};
|
74
|
+
</script>
|
75
|
+
<style>
|
76
|
+
.ivu-select-dropdown {
|
77
|
+
border-radius: 0;
|
78
|
+
max-height: 200px !important;
|
79
|
+
overflow: auto !important;
|
80
|
+
}
|
81
|
+
</style>
|
82
|
+
|
83
|
+
<style lang="less" scoped>
|
84
|
+
.drop-down-cell {
|
85
|
+
cursor: pointer;
|
86
|
+
}
|
87
|
+
</style>
|