zetan-cli-dev-template-vue-element-admin 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +8 -0
- package/template/.editorconfig +14 -0
- package/template/.env.development +5 -0
- package/template/.env.production +6 -0
- package/template/.env.staging +8 -0
- package/template/.eslintignore +4 -0
- package/template/.eslintrc.js +198 -0
- package/template/.travis.yml +5 -0
- package/template/LICENSE +21 -0
- package/template/README.es.md +228 -0
- package/template/README.ja.md +224 -0
- package/template/README.md +250 -0
- package/template/README.zh-CN.md +273 -0
- package/template/babel.config.js +14 -0
- package/template/build/index.js +35 -0
- package/template/jest.config.js +24 -0
- package/template/jsconfig.json +9 -0
- package/template/mock/article.js +116 -0
- package/template/mock/index.js +60 -0
- package/template/mock/mock-server.js +81 -0
- package/template/mock/remote-search.js +51 -0
- package/template/mock/role/index.js +98 -0
- package/template/mock/role/routes.js +530 -0
- package/template/mock/user.js +84 -0
- package/template/mock/utils.js +48 -0
- package/template/package.json +111 -0
- package/template/plop-templates/component/index.hbs +26 -0
- package/template/plop-templates/component/prompt.js +55 -0
- package/template/plop-templates/store/index.hbs +16 -0
- package/template/plop-templates/store/prompt.js +62 -0
- package/template/plop-templates/utils.js +2 -0
- package/template/plop-templates/view/index.hbs +26 -0
- package/template/plop-templates/view/prompt.js +55 -0
- package/template/plopfile.js +9 -0
- package/template/postcss.config.js +5 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/index.html +15 -0
- package/template/src/App.vue +11 -0
- package/template/src/api/article.js +41 -0
- package/template/src/api/qiniu.js +8 -0
- package/template/src/api/remote-search.js +17 -0
- package/template/src/api/role.js +38 -0
- package/template/src/api/user.js +24 -0
- package/template/src/assets/401_images/401.gif +0 -0
- package/template/src/assets/404_images/404.png +0 -0
- package/template/src/assets/404_images/404_cloud.png +0 -0
- package/template/src/assets/custom-theme/fonts/element-icons.ttf +0 -0
- package/template/src/assets/custom-theme/fonts/element-icons.woff +0 -0
- package/template/src/assets/custom-theme/index.css +1 -0
- package/template/src/components/BackToTop/index.vue +111 -0
- package/template/src/components/Breadcrumb/index.vue +82 -0
- package/template/src/components/Charts/Keyboard.vue +155 -0
- package/template/src/components/Charts/LineMarker.vue +227 -0
- package/template/src/components/Charts/MixChart.vue +271 -0
- package/template/src/components/Charts/mixins/resize.js +56 -0
- package/template/src/components/DndList/index.vue +166 -0
- package/template/src/components/DragSelect/index.vue +65 -0
- package/template/src/components/Dropzone/index.vue +297 -0
- package/template/src/components/ErrorLog/index.vue +78 -0
- package/template/src/components/GithubCorner/index.vue +54 -0
- package/template/src/components/Hamburger/index.vue +44 -0
- package/template/src/components/HeaderSearch/index.vue +180 -0
- package/template/src/components/ImageCropper/index.vue +1779 -0
- package/template/src/components/ImageCropper/utils/data2blob.js +19 -0
- package/template/src/components/ImageCropper/utils/effectRipple.js +39 -0
- package/template/src/components/ImageCropper/utils/language.js +232 -0
- package/template/src/components/ImageCropper/utils/mimes.js +7 -0
- package/template/src/components/JsonEditor/index.vue +77 -0
- package/template/src/components/Kanban/index.vue +99 -0
- package/template/src/components/MDinput/index.vue +360 -0
- package/template/src/components/MarkdownEditor/default-options.js +31 -0
- package/template/src/components/MarkdownEditor/index.vue +118 -0
- package/template/src/components/Pagination/index.vue +101 -0
- package/template/src/components/PanThumb/index.vue +142 -0
- package/template/src/components/RightPanel/index.vue +145 -0
- package/template/src/components/Screenfull/index.vue +60 -0
- package/template/src/components/Share/DropdownMenu.vue +103 -0
- package/template/src/components/SizeSelect/index.vue +57 -0
- package/template/src/components/Sticky/index.vue +91 -0
- package/template/src/components/SvgIcon/index.vue +62 -0
- package/template/src/components/TextHoverEffect/Mallki.vue +113 -0
- package/template/src/components/ThemePicker/index.vue +175 -0
- package/template/src/components/Tinymce/components/EditorImage.vue +111 -0
- package/template/src/components/Tinymce/dynamicLoadScript.js +59 -0
- package/template/src/components/Tinymce/index.vue +247 -0
- package/template/src/components/Tinymce/plugins.js +7 -0
- package/template/src/components/Tinymce/toolbar.js +6 -0
- package/template/src/components/Upload/SingleImage.vue +134 -0
- package/template/src/components/Upload/SingleImage2.vue +130 -0
- package/template/src/components/Upload/SingleImage3.vue +157 -0
- package/template/src/components/UploadExcel/index.vue +138 -0
- package/template/src/directive/clipboard/clipboard.js +49 -0
- package/template/src/directive/clipboard/index.js +13 -0
- package/template/src/directive/el-drag-dialog/drag.js +77 -0
- package/template/src/directive/el-drag-dialog/index.js +13 -0
- package/template/src/directive/el-table/adaptive.js +41 -0
- package/template/src/directive/el-table/index.js +13 -0
- package/template/src/directive/permission/index.js +13 -0
- package/template/src/directive/permission/permission.js +31 -0
- package/template/src/directive/sticky.js +91 -0
- package/template/src/directive/waves/index.js +13 -0
- package/template/src/directive/waves/waves.css +26 -0
- package/template/src/directive/waves/waves.js +72 -0
- package/template/src/filters/index.js +68 -0
- package/template/src/icons/index.js +9 -0
- package/template/src/icons/svg/404.svg +1 -0
- package/template/src/icons/svg/bug.svg +1 -0
- package/template/src/icons/svg/chart.svg +1 -0
- package/template/src/icons/svg/clipboard.svg +1 -0
- package/template/src/icons/svg/component.svg +1 -0
- package/template/src/icons/svg/dashboard.svg +1 -0
- package/template/src/icons/svg/documentation.svg +1 -0
- package/template/src/icons/svg/drag.svg +1 -0
- package/template/src/icons/svg/edit.svg +1 -0
- package/template/src/icons/svg/education.svg +1 -0
- package/template/src/icons/svg/email.svg +1 -0
- package/template/src/icons/svg/example.svg +1 -0
- package/template/src/icons/svg/excel.svg +1 -0
- package/template/src/icons/svg/exit-fullscreen.svg +1 -0
- package/template/src/icons/svg/eye-open.svg +1 -0
- package/template/src/icons/svg/eye.svg +1 -0
- package/template/src/icons/svg/form.svg +1 -0
- package/template/src/icons/svg/fullscreen.svg +1 -0
- package/template/src/icons/svg/guide.svg +1 -0
- package/template/src/icons/svg/icon.svg +1 -0
- package/template/src/icons/svg/international.svg +1 -0
- package/template/src/icons/svg/language.svg +1 -0
- package/template/src/icons/svg/link.svg +1 -0
- package/template/src/icons/svg/list.svg +1 -0
- package/template/src/icons/svg/lock.svg +1 -0
- package/template/src/icons/svg/message.svg +1 -0
- package/template/src/icons/svg/money.svg +1 -0
- package/template/src/icons/svg/nested.svg +1 -0
- package/template/src/icons/svg/password.svg +1 -0
- package/template/src/icons/svg/pdf.svg +1 -0
- package/template/src/icons/svg/people.svg +1 -0
- package/template/src/icons/svg/peoples.svg +1 -0
- package/template/src/icons/svg/qq.svg +1 -0
- package/template/src/icons/svg/search.svg +1 -0
- package/template/src/icons/svg/shopping.svg +1 -0
- package/template/src/icons/svg/size.svg +1 -0
- package/template/src/icons/svg/skill.svg +1 -0
- package/template/src/icons/svg/star.svg +1 -0
- package/template/src/icons/svg/tab.svg +1 -0
- package/template/src/icons/svg/table.svg +1 -0
- package/template/src/icons/svg/theme.svg +1 -0
- package/template/src/icons/svg/tree-table.svg +1 -0
- package/template/src/icons/svg/tree.svg +1 -0
- package/template/src/icons/svg/user.svg +1 -0
- package/template/src/icons/svg/wechat.svg +1 -0
- package/template/src/icons/svg/zip.svg +1 -0
- package/template/src/icons/svgo.yml +22 -0
- package/template/src/layout/components/AppMain.vue +57 -0
- package/template/src/layout/components/Navbar.vue +167 -0
- package/template/src/layout/components/Settings/index.vue +108 -0
- package/template/src/layout/components/Sidebar/FixiOSBug.js +26 -0
- package/template/src/layout/components/Sidebar/Item.vue +41 -0
- package/template/src/layout/components/Sidebar/Link.vue +43 -0
- package/template/src/layout/components/Sidebar/Logo.vue +82 -0
- package/template/src/layout/components/Sidebar/SidebarItem.vue +95 -0
- package/template/src/layout/components/Sidebar/index.vue +54 -0
- package/template/src/layout/components/TagsView/ScrollPane.vue +94 -0
- package/template/src/layout/components/TagsView/index.vue +292 -0
- package/template/src/layout/components/index.js +5 -0
- package/template/src/layout/index.vue +102 -0
- package/template/src/layout/mixin/ResizeHandler.js +45 -0
- package/template/src/main.js +53 -0
- package/template/src/permission.js +74 -0
- package/template/src/router/index.js +404 -0
- package/template/src/router/modules/charts.js +36 -0
- package/template/src/router/modules/components.js +102 -0
- package/template/src/router/modules/nested.js +66 -0
- package/template/src/router/modules/table.js +41 -0
- package/template/src/settings.js +35 -0
- package/template/src/store/getters.js +15 -0
- package/template/src/store/index.js +25 -0
- package/template/src/store/modules/app.js +56 -0
- package/template/src/store/modules/errorLog.js +28 -0
- package/template/src/store/modules/permission.js +69 -0
- package/template/src/store/modules/settings.js +35 -0
- package/template/src/store/modules/tagsView.js +160 -0
- package/template/src/store/modules/user.js +131 -0
- package/template/src/styles/btn.scss +99 -0
- package/template/src/styles/element-ui.scss +84 -0
- package/template/src/styles/element-variables.scss +31 -0
- package/template/src/styles/index.scss +191 -0
- package/template/src/styles/mixin.scss +66 -0
- package/template/src/styles/sidebar.scss +226 -0
- package/template/src/styles/transition.scss +48 -0
- package/template/src/styles/variables.scss +35 -0
- package/template/src/utils/auth.js +15 -0
- package/template/src/utils/clipboard.js +32 -0
- package/template/src/utils/error-log.js +35 -0
- package/template/src/utils/get-page-title.js +10 -0
- package/template/src/utils/index.js +357 -0
- package/template/src/utils/open-window.js +25 -0
- package/template/src/utils/permission.js +21 -0
- package/template/src/utils/request.js +85 -0
- package/template/src/utils/scroll-to.js +58 -0
- package/template/src/utils/validate.js +87 -0
- package/template/src/vendor/Export2Excel.js +220 -0
- package/template/src/vendor/Export2Zip.js +24 -0
- package/template/src/views/charts/keyboard.vue +23 -0
- package/template/src/views/charts/line.vue +23 -0
- package/template/src/views/charts/mix-chart.vue +23 -0
- package/template/src/views/clipboard/index.vue +49 -0
- package/template/src/views/components-demo/avatar-upload.vue +61 -0
- package/template/src/views/components-demo/back-to-top.vue +154 -0
- package/template/src/views/components-demo/count-to.vue +218 -0
- package/template/src/views/components-demo/dnd-list.vue +39 -0
- package/template/src/views/components-demo/drag-dialog.vue +61 -0
- package/template/src/views/components-demo/drag-kanban.vue +66 -0
- package/template/src/views/components-demo/drag-select.vue +43 -0
- package/template/src/views/components-demo/dropzone.vue +31 -0
- package/template/src/views/components-demo/json-editor.vue +36 -0
- package/template/src/views/components-demo/markdown.vue +101 -0
- package/template/src/views/components-demo/mixin.vue +169 -0
- package/template/src/views/components-demo/split-pane.vue +67 -0
- package/template/src/views/components-demo/sticky.vue +135 -0
- package/template/src/views/components-demo/tinymce.vue +36 -0
- package/template/src/views/dashboard/admin/components/BarChart.vue +102 -0
- package/template/src/views/dashboard/admin/components/BoxCard.vue +118 -0
- package/template/src/views/dashboard/admin/components/LineChart.vue +135 -0
- package/template/src/views/dashboard/admin/components/PanelGroup.vue +181 -0
- package/template/src/views/dashboard/admin/components/PieChart.vue +79 -0
- package/template/src/views/dashboard/admin/components/RaddarChart.vue +116 -0
- package/template/src/views/dashboard/admin/components/TodoList/Todo.vue +81 -0
- package/template/src/views/dashboard/admin/components/TodoList/index.scss +320 -0
- package/template/src/views/dashboard/admin/components/TodoList/index.vue +127 -0
- package/template/src/views/dashboard/admin/components/TransactionTable.vue +55 -0
- package/template/src/views/dashboard/admin/components/mixins/resize.js +55 -0
- package/template/src/views/dashboard/admin/index.vue +124 -0
- package/template/src/views/dashboard/editor/index.vue +74 -0
- package/template/src/views/dashboard/index.vue +31 -0
- package/template/src/views/documentation/index.vue +57 -0
- package/template/src/views/error-log/components/ErrorTestA.vue +13 -0
- package/template/src/views/error-log/components/ErrorTestB.vue +11 -0
- package/template/src/views/error-log/index.vue +32 -0
- package/template/src/views/error-page/401.vue +99 -0
- package/template/src/views/error-page/404.vue +228 -0
- package/template/src/views/example/components/ArticleDetail.vue +289 -0
- package/template/src/views/example/components/Dropdown/Comment.vue +41 -0
- package/template/src/views/example/components/Dropdown/Platform.vue +46 -0
- package/template/src/views/example/components/Dropdown/SourceUrl.vue +38 -0
- package/template/src/views/example/components/Dropdown/index.js +3 -0
- package/template/src/views/example/components/Warning.vue +13 -0
- package/template/src/views/example/create.vue +13 -0
- package/template/src/views/example/edit.vue +13 -0
- package/template/src/views/example/list.vue +112 -0
- package/template/src/views/excel/components/AutoWidthOption.vue +34 -0
- package/template/src/views/excel/components/BookTypeOption.vue +39 -0
- package/template/src/views/excel/components/FilenameOption.vue +27 -0
- package/template/src/views/excel/export-excel.vue +116 -0
- package/template/src/views/excel/merge-header.vue +101 -0
- package/template/src/views/excel/select-excel.vue +107 -0
- package/template/src/views/excel/upload-excel.vue +42 -0
- package/template/src/views/guide/index.vue +36 -0
- package/template/src/views/guide/steps.js +53 -0
- package/template/src/views/icons/element-icons.js +3 -0
- package/template/src/views/icons/index.vue +101 -0
- package/template/src/views/icons/svg-icons.js +10 -0
- package/template/src/views/login/auth-redirect.vue +15 -0
- package/template/src/views/login/components/SocialSignin.vue +72 -0
- package/template/src/views/login/index.vue +324 -0
- package/template/src/views/nested/menu1/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-1/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-2/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
- package/template/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
- package/template/src/views/nested/menu1/menu1-3/index.vue +5 -0
- package/template/src/views/nested/menu2/index.vue +5 -0
- package/template/src/views/pdf/content.js +58 -0
- package/template/src/views/pdf/download.vue +201 -0
- package/template/src/views/pdf/index.vue +13 -0
- package/template/src/views/permission/components/SwitchRoles.vue +32 -0
- package/template/src/views/permission/directive.vue +111 -0
- package/template/src/views/permission/page.vue +19 -0
- package/template/src/views/permission/role.vue +270 -0
- package/template/src/views/profile/components/Account.vue +38 -0
- package/template/src/views/profile/components/Activity.vue +185 -0
- package/template/src/views/profile/components/Timeline.vue +43 -0
- package/template/src/views/profile/components/UserCard.vue +134 -0
- package/template/src/views/profile/index.vue +68 -0
- package/template/src/views/qiniu/upload.vue +41 -0
- package/template/src/views/redirect/index.vue +12 -0
- package/template/src/views/tab/components/TabPane.vue +103 -0
- package/template/src/views/tab/index.vue +57 -0
- package/template/src/views/table/complex-table.vue +379 -0
- package/template/src/views/table/drag-table.vue +153 -0
- package/template/src/views/table/dynamic-table/components/FixedThead.vue +62 -0
- package/template/src/views/table/dynamic-table/components/UnfixedThead.vue +50 -0
- package/template/src/views/table/dynamic-table/index.vue +24 -0
- package/template/src/views/table/inline-edit-table.vue +149 -0
- package/template/src/views/theme/index.vue +120 -0
- package/template/src/views/zip/index.vue +77 -0
- package/template/tests/unit/.eslintrc.js +5 -0
- package/template/tests/unit/components/Hamburger.spec.js +18 -0
- package/template/tests/unit/components/SvgIcon.spec.js +22 -0
- package/template/tests/unit/utils/formatTime.spec.js +29 -0
- package/template/tests/unit/utils/param2Obj.spec.js +14 -0
- package/template/tests/unit/utils/parseTime.spec.js +37 -0
- package/template/tests/unit/utils/validate.spec.js +28 -0
- package/template/vue.config.js +124 -0
@@ -0,0 +1,220 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
import { saveAs } from 'file-saver'
|
3
|
+
import XLSX from 'xlsx'
|
4
|
+
|
5
|
+
function generateArray(table) {
|
6
|
+
var out = [];
|
7
|
+
var rows = table.querySelectorAll('tr');
|
8
|
+
var ranges = [];
|
9
|
+
for (var R = 0; R < rows.length; ++R) {
|
10
|
+
var outRow = [];
|
11
|
+
var row = rows[R];
|
12
|
+
var columns = row.querySelectorAll('td');
|
13
|
+
for (var C = 0; C < columns.length; ++C) {
|
14
|
+
var cell = columns[C];
|
15
|
+
var colspan = cell.getAttribute('colspan');
|
16
|
+
var rowspan = cell.getAttribute('rowspan');
|
17
|
+
var cellValue = cell.innerText;
|
18
|
+
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
|
19
|
+
|
20
|
+
//Skip ranges
|
21
|
+
ranges.forEach(function (range) {
|
22
|
+
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
|
23
|
+
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
//Handle Row Span
|
28
|
+
if (rowspan || colspan) {
|
29
|
+
rowspan = rowspan || 1;
|
30
|
+
colspan = colspan || 1;
|
31
|
+
ranges.push({
|
32
|
+
s: {
|
33
|
+
r: R,
|
34
|
+
c: outRow.length
|
35
|
+
},
|
36
|
+
e: {
|
37
|
+
r: R + rowspan - 1,
|
38
|
+
c: outRow.length + colspan - 1
|
39
|
+
}
|
40
|
+
});
|
41
|
+
};
|
42
|
+
|
43
|
+
//Handle Value
|
44
|
+
outRow.push(cellValue !== "" ? cellValue : null);
|
45
|
+
|
46
|
+
//Handle Colspan
|
47
|
+
if (colspan)
|
48
|
+
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
|
49
|
+
}
|
50
|
+
out.push(outRow);
|
51
|
+
}
|
52
|
+
return [out, ranges];
|
53
|
+
};
|
54
|
+
|
55
|
+
function datenum(v, date1904) {
|
56
|
+
if (date1904) v += 1462;
|
57
|
+
var epoch = Date.parse(v);
|
58
|
+
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
|
59
|
+
}
|
60
|
+
|
61
|
+
function sheet_from_array_of_arrays(data, opts) {
|
62
|
+
var ws = {};
|
63
|
+
var range = {
|
64
|
+
s: {
|
65
|
+
c: 10000000,
|
66
|
+
r: 10000000
|
67
|
+
},
|
68
|
+
e: {
|
69
|
+
c: 0,
|
70
|
+
r: 0
|
71
|
+
}
|
72
|
+
};
|
73
|
+
for (var R = 0; R != data.length; ++R) {
|
74
|
+
for (var C = 0; C != data[R].length; ++C) {
|
75
|
+
if (range.s.r > R) range.s.r = R;
|
76
|
+
if (range.s.c > C) range.s.c = C;
|
77
|
+
if (range.e.r < R) range.e.r = R;
|
78
|
+
if (range.e.c < C) range.e.c = C;
|
79
|
+
var cell = {
|
80
|
+
v: data[R][C]
|
81
|
+
};
|
82
|
+
if (cell.v == null) continue;
|
83
|
+
var cell_ref = XLSX.utils.encode_cell({
|
84
|
+
c: C,
|
85
|
+
r: R
|
86
|
+
});
|
87
|
+
|
88
|
+
if (typeof cell.v === 'number') cell.t = 'n';
|
89
|
+
else if (typeof cell.v === 'boolean') cell.t = 'b';
|
90
|
+
else if (cell.v instanceof Date) {
|
91
|
+
cell.t = 'n';
|
92
|
+
cell.z = XLSX.SSF._table[14];
|
93
|
+
cell.v = datenum(cell.v);
|
94
|
+
} else cell.t = 's';
|
95
|
+
|
96
|
+
ws[cell_ref] = cell;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
|
100
|
+
return ws;
|
101
|
+
}
|
102
|
+
|
103
|
+
function Workbook() {
|
104
|
+
if (!(this instanceof Workbook)) return new Workbook();
|
105
|
+
this.SheetNames = [];
|
106
|
+
this.Sheets = {};
|
107
|
+
}
|
108
|
+
|
109
|
+
function s2ab(s) {
|
110
|
+
var buf = new ArrayBuffer(s.length);
|
111
|
+
var view = new Uint8Array(buf);
|
112
|
+
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
113
|
+
return buf;
|
114
|
+
}
|
115
|
+
|
116
|
+
export function export_table_to_excel(id) {
|
117
|
+
var theTable = document.getElementById(id);
|
118
|
+
var oo = generateArray(theTable);
|
119
|
+
var ranges = oo[1];
|
120
|
+
|
121
|
+
/* original data */
|
122
|
+
var data = oo[0];
|
123
|
+
var ws_name = "SheetJS";
|
124
|
+
|
125
|
+
var wb = new Workbook(),
|
126
|
+
ws = sheet_from_array_of_arrays(data);
|
127
|
+
|
128
|
+
/* add ranges to worksheet */
|
129
|
+
// ws['!cols'] = ['apple', 'banan'];
|
130
|
+
ws['!merges'] = ranges;
|
131
|
+
|
132
|
+
/* add worksheet to workbook */
|
133
|
+
wb.SheetNames.push(ws_name);
|
134
|
+
wb.Sheets[ws_name] = ws;
|
135
|
+
|
136
|
+
var wbout = XLSX.write(wb, {
|
137
|
+
bookType: 'xlsx',
|
138
|
+
bookSST: false,
|
139
|
+
type: 'binary'
|
140
|
+
});
|
141
|
+
|
142
|
+
saveAs(new Blob([s2ab(wbout)], {
|
143
|
+
type: "application/octet-stream"
|
144
|
+
}), "test.xlsx")
|
145
|
+
}
|
146
|
+
|
147
|
+
export function export_json_to_excel({
|
148
|
+
multiHeader = [],
|
149
|
+
header,
|
150
|
+
data,
|
151
|
+
filename,
|
152
|
+
merges = [],
|
153
|
+
autoWidth = true,
|
154
|
+
bookType = 'xlsx'
|
155
|
+
} = {}) {
|
156
|
+
/* original data */
|
157
|
+
filename = filename || 'excel-list'
|
158
|
+
data = [...data]
|
159
|
+
data.unshift(header);
|
160
|
+
|
161
|
+
for (let i = multiHeader.length - 1; i > -1; i--) {
|
162
|
+
data.unshift(multiHeader[i])
|
163
|
+
}
|
164
|
+
|
165
|
+
var ws_name = "SheetJS";
|
166
|
+
var wb = new Workbook(),
|
167
|
+
ws = sheet_from_array_of_arrays(data);
|
168
|
+
|
169
|
+
if (merges.length > 0) {
|
170
|
+
if (!ws['!merges']) ws['!merges'] = [];
|
171
|
+
merges.forEach(item => {
|
172
|
+
ws['!merges'].push(XLSX.utils.decode_range(item))
|
173
|
+
})
|
174
|
+
}
|
175
|
+
|
176
|
+
if (autoWidth) {
|
177
|
+
/*设置worksheet每列的最大宽度*/
|
178
|
+
const colWidth = data.map(row => row.map(val => {
|
179
|
+
/*先判断是否为null/undefined*/
|
180
|
+
if (val == null) {
|
181
|
+
return {
|
182
|
+
'wch': 10
|
183
|
+
};
|
184
|
+
}
|
185
|
+
/*再判断是否为中文*/
|
186
|
+
else if (val.toString().charCodeAt(0) > 255) {
|
187
|
+
return {
|
188
|
+
'wch': val.toString().length * 2
|
189
|
+
};
|
190
|
+
} else {
|
191
|
+
return {
|
192
|
+
'wch': val.toString().length
|
193
|
+
};
|
194
|
+
}
|
195
|
+
}))
|
196
|
+
/*以第一行为初始值*/
|
197
|
+
let result = colWidth[0];
|
198
|
+
for (let i = 1; i < colWidth.length; i++) {
|
199
|
+
for (let j = 0; j < colWidth[i].length; j++) {
|
200
|
+
if (result[j]['wch'] < colWidth[i][j]['wch']) {
|
201
|
+
result[j]['wch'] = colWidth[i][j]['wch'];
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
ws['!cols'] = result;
|
206
|
+
}
|
207
|
+
|
208
|
+
/* add worksheet to workbook */
|
209
|
+
wb.SheetNames.push(ws_name);
|
210
|
+
wb.Sheets[ws_name] = ws;
|
211
|
+
|
212
|
+
var wbout = XLSX.write(wb, {
|
213
|
+
bookType: bookType,
|
214
|
+
bookSST: false,
|
215
|
+
type: 'binary'
|
216
|
+
});
|
217
|
+
saveAs(new Blob([s2ab(wbout)], {
|
218
|
+
type: "application/octet-stream"
|
219
|
+
}), `${filename}.${bookType}`);
|
220
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
import { saveAs } from 'file-saver'
|
3
|
+
import JSZip from 'jszip'
|
4
|
+
|
5
|
+
export function export_txt_to_zip(th, jsonData, txtName, zipName) {
|
6
|
+
const zip = new JSZip()
|
7
|
+
const txt_name = txtName || 'file'
|
8
|
+
const zip_name = zipName || 'file'
|
9
|
+
const data = jsonData
|
10
|
+
let txtData = `${th}\r\n`
|
11
|
+
data.forEach((row) => {
|
12
|
+
let tempStr = ''
|
13
|
+
tempStr = row.toString()
|
14
|
+
txtData += `${tempStr}\r\n`
|
15
|
+
})
|
16
|
+
zip.file(`${txt_name}.txt`, txtData)
|
17
|
+
zip.generateAsync({
|
18
|
+
type: "blob"
|
19
|
+
}).then((blob) => {
|
20
|
+
saveAs(blob, `${zip_name}.zip`)
|
21
|
+
}, (err) => {
|
22
|
+
alert('导出失败')
|
23
|
+
})
|
24
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="chart-container">
|
3
|
+
<chart height="100%" width="100%" />
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import Chart from '@/components/Charts/Keyboard'
|
9
|
+
|
10
|
+
export default {
|
11
|
+
name: 'KeyboardChart',
|
12
|
+
components: { Chart }
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<style scoped>
|
17
|
+
.chart-container{
|
18
|
+
position: relative;
|
19
|
+
width: 100%;
|
20
|
+
height: calc(100vh - 84px);
|
21
|
+
}
|
22
|
+
</style>
|
23
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="chart-container">
|
3
|
+
<chart height="100%" width="100%" />
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import Chart from '@/components/Charts/LineMarker'
|
9
|
+
|
10
|
+
export default {
|
11
|
+
name: 'LineChart',
|
12
|
+
components: { Chart }
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<style scoped>
|
17
|
+
.chart-container{
|
18
|
+
position: relative;
|
19
|
+
width: 100%;
|
20
|
+
height: calc(100vh - 84px);
|
21
|
+
}
|
22
|
+
</style>
|
23
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="chart-container">
|
3
|
+
<chart height="100%" width="100%" />
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import Chart from '@/components/Charts/MixChart'
|
9
|
+
|
10
|
+
export default {
|
11
|
+
name: 'MixChart',
|
12
|
+
components: { Chart }
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<style scoped>
|
17
|
+
.chart-container{
|
18
|
+
position: relative;
|
19
|
+
width: 100%;
|
20
|
+
height: calc(100vh - 84px);
|
21
|
+
}
|
22
|
+
</style>
|
23
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="app-container">
|
3
|
+
<el-tabs v-model="activeName">
|
4
|
+
<el-tab-pane label="use clipboard directly" name="directly">
|
5
|
+
<el-input v-model="inputData" placeholder="Please input" style="width:400px;max-width:100%;" />
|
6
|
+
<el-button type="primary" icon="el-icon-document" @click="handleCopy(inputData,$event)">
|
7
|
+
copy
|
8
|
+
</el-button>
|
9
|
+
</el-tab-pane>
|
10
|
+
<el-tab-pane label="use clipboard by v-directive" name="v-directive">
|
11
|
+
<el-input v-model="inputData" placeholder="Please input" style="width:400px;max-width:100%;" />
|
12
|
+
<el-button v-clipboard:copy="inputData" v-clipboard:success="clipboardSuccess" type="primary" icon="el-icon-document">
|
13
|
+
copy
|
14
|
+
</el-button>
|
15
|
+
</el-tab-pane>
|
16
|
+
</el-tabs>
|
17
|
+
</div>
|
18
|
+
</template>
|
19
|
+
|
20
|
+
<script>
|
21
|
+
import clip from '@/utils/clipboard' // use clipboard directly
|
22
|
+
import clipboard from '@/directive/clipboard/index.js' // use clipboard by v-directive
|
23
|
+
|
24
|
+
export default {
|
25
|
+
name: 'ClipboardDemo',
|
26
|
+
directives: {
|
27
|
+
clipboard
|
28
|
+
},
|
29
|
+
data() {
|
30
|
+
return {
|
31
|
+
activeName: 'directly',
|
32
|
+
inputData: 'https://github.com/PanJiaChen/vue-element-admin'
|
33
|
+
}
|
34
|
+
},
|
35
|
+
methods: {
|
36
|
+
handleCopy(text, event) {
|
37
|
+
clip(text, event)
|
38
|
+
},
|
39
|
+
clipboardSuccess() {
|
40
|
+
this.$message({
|
41
|
+
message: 'Copy successfully',
|
42
|
+
type: 'success',
|
43
|
+
duration: 1500
|
44
|
+
})
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
</script>
|
49
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="components-container">
|
3
|
+
<aside>This is based on
|
4
|
+
<a class="link-type" href="//github.com/dai-siki/vue-image-crop-upload"> vue-image-crop-upload</a>.
|
5
|
+
Since I was using only the vue@1 version, and it is not compatible with mockjs at the moment, I modified it myself, and if you are going to use it, it is better to use official version.
|
6
|
+
</aside>
|
7
|
+
|
8
|
+
<pan-thumb :image="image" />
|
9
|
+
|
10
|
+
<el-button type="primary" icon="el-icon-upload" style="position: absolute;bottom: 15px;margin-left: 40px;" @click="imagecropperShow=true">
|
11
|
+
Change Avatar
|
12
|
+
</el-button>
|
13
|
+
|
14
|
+
<image-cropper
|
15
|
+
v-show="imagecropperShow"
|
16
|
+
:key="imagecropperKey"
|
17
|
+
:width="300"
|
18
|
+
:height="300"
|
19
|
+
url="https://httpbin.org/post"
|
20
|
+
lang-type="en"
|
21
|
+
@close="close"
|
22
|
+
@crop-upload-success="cropSuccess"
|
23
|
+
/>
|
24
|
+
</div>
|
25
|
+
</template>
|
26
|
+
|
27
|
+
<script>
|
28
|
+
import ImageCropper from '@/components/ImageCropper'
|
29
|
+
import PanThumb from '@/components/PanThumb'
|
30
|
+
|
31
|
+
export default {
|
32
|
+
name: 'AvatarUploadDemo',
|
33
|
+
components: { ImageCropper, PanThumb },
|
34
|
+
data() {
|
35
|
+
return {
|
36
|
+
imagecropperShow: false,
|
37
|
+
imagecropperKey: 0,
|
38
|
+
image: 'https://wpimg.wallstcn.com/577965b9-bb9e-4e02-9f0c-095b41417191'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
methods: {
|
42
|
+
cropSuccess(resData) {
|
43
|
+
this.imagecropperShow = false
|
44
|
+
this.imagecropperKey = this.imagecropperKey + 1
|
45
|
+
this.image = resData.files.avatar
|
46
|
+
},
|
47
|
+
close() {
|
48
|
+
this.imagecropperShow = false
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
</script>
|
53
|
+
|
54
|
+
<style scoped>
|
55
|
+
.avatar{
|
56
|
+
width: 200px;
|
57
|
+
height: 200px;
|
58
|
+
border-radius: 50%;
|
59
|
+
}
|
60
|
+
</style>
|
61
|
+
|
@@ -0,0 +1,154 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="components-container">
|
3
|
+
<aside>
|
4
|
+
When the page is scrolled to the specified position, the Back to Top button appears in the lower right corner
|
5
|
+
</aside>
|
6
|
+
<aside>
|
7
|
+
You can customize the style of the button, show / hide, height of appearance, height of the return. If you need a text prompt, you can use element-ui el-tooltip elements externally
|
8
|
+
</aside>
|
9
|
+
<div class="placeholder-container">
|
10
|
+
<div>placeholder</div>
|
11
|
+
<div>placeholder</div>
|
12
|
+
<div>placeholder</div>
|
13
|
+
<div>placeholder</div>
|
14
|
+
<div>placeholder</div>
|
15
|
+
<div>placeholder</div>
|
16
|
+
<div>placeholder</div>
|
17
|
+
<div>placeholder</div>
|
18
|
+
<div>placeholder</div>
|
19
|
+
<div>placeholder</div>
|
20
|
+
<div>placeholder</div>
|
21
|
+
<div>placeholder</div>
|
22
|
+
<div>placeholder</div>
|
23
|
+
<div>placeholder</div>
|
24
|
+
<div>placeholder</div>
|
25
|
+
<div>placeholder</div>
|
26
|
+
<div>placeholder</div>
|
27
|
+
<div>placeholder</div>
|
28
|
+
<div>placeholder</div>
|
29
|
+
<div>placeholder</div>
|
30
|
+
<div>placeholder</div>
|
31
|
+
<div>placeholder</div>
|
32
|
+
<div>placeholder</div>
|
33
|
+
<div>placeholder</div>
|
34
|
+
<div>placeholder</div>
|
35
|
+
<div>placeholder</div>
|
36
|
+
<div>placeholder</div>
|
37
|
+
<div>placeholder</div>
|
38
|
+
<div>placeholder</div>
|
39
|
+
<div>placeholder</div>
|
40
|
+
<div>placeholder</div>
|
41
|
+
<div>placeholder</div>
|
42
|
+
<div>placeholder</div>
|
43
|
+
<div>placeholder</div>
|
44
|
+
<div>placeholder</div>
|
45
|
+
<div>placeholder</div>
|
46
|
+
<div>placeholder</div>
|
47
|
+
<div>placeholder</div>
|
48
|
+
<div>placeholder</div>
|
49
|
+
<div>placeholder</div>
|
50
|
+
<div>placeholder</div>
|
51
|
+
<div>placeholder</div>
|
52
|
+
<div>placeholder</div>
|
53
|
+
<div>placeholder</div>
|
54
|
+
<div>placeholder</div>
|
55
|
+
<div>placeholder</div>
|
56
|
+
<div>placeholder</div>
|
57
|
+
<div>placeholder</div>
|
58
|
+
<div>placeholder</div>
|
59
|
+
<div>placeholder</div>
|
60
|
+
<div>placeholder</div>
|
61
|
+
<div>placeholder</div>
|
62
|
+
<div>placeholder</div>
|
63
|
+
<div>placeholder</div>
|
64
|
+
<div>placeholder</div>
|
65
|
+
<div>placeholder</div>
|
66
|
+
<div>placeholder</div>
|
67
|
+
<div>placeholder</div>
|
68
|
+
<div>placeholder</div>
|
69
|
+
<div>placeholder</div>
|
70
|
+
<div>placeholder</div>
|
71
|
+
<div>placeholder</div>
|
72
|
+
<div>placeholder</div>
|
73
|
+
<div>placeholder</div>
|
74
|
+
<div>placeholder</div>
|
75
|
+
<div>placeholder</div>
|
76
|
+
<div>placeholder</div>
|
77
|
+
<div>placeholder</div>
|
78
|
+
<div>placeholder</div>
|
79
|
+
<div>placeholder</div>
|
80
|
+
<div>placeholder</div>
|
81
|
+
<div>placeholder</div>
|
82
|
+
<div>placeholder</div>
|
83
|
+
<div>placeholder</div>
|
84
|
+
<div>placeholder</div>
|
85
|
+
<div>placeholder</div>
|
86
|
+
<div>placeholder</div>
|
87
|
+
<div>placeholder</div>
|
88
|
+
<div>placeholder</div>
|
89
|
+
<div>placeholder</div>
|
90
|
+
<div>placeholder</div>
|
91
|
+
<div>placeholder</div>
|
92
|
+
<div>placeholder</div>
|
93
|
+
<div>placeholder</div>
|
94
|
+
<div>placeholder</div>
|
95
|
+
<div>placeholder</div>
|
96
|
+
<div>placeholder</div>
|
97
|
+
<div>placeholder</div>
|
98
|
+
<div>placeholder</div>
|
99
|
+
<div>placeholder</div>
|
100
|
+
<div>placeholder</div>
|
101
|
+
<div>placeholder</div>
|
102
|
+
<div>placeholder</div>
|
103
|
+
<div>placeholder</div>
|
104
|
+
<div>placeholder</div>
|
105
|
+
<div>placeholder</div>
|
106
|
+
<div>placeholder</div>
|
107
|
+
<div>placeholder</div>
|
108
|
+
<div>placeholder</div>
|
109
|
+
<div>placeholder</div>
|
110
|
+
<div>placeholder</div>
|
111
|
+
<div>placeholder</div>
|
112
|
+
<div>placeholder</div>
|
113
|
+
<div>placeholder</div>
|
114
|
+
<div>placeholder</div>
|
115
|
+
<div>placeholder</div>
|
116
|
+
<div>placeholder</div>
|
117
|
+
<div>placeholder</div>
|
118
|
+
<div>placeholder</div>
|
119
|
+
</div>
|
120
|
+
<!-- you can add element-ui's tooltip -->
|
121
|
+
<el-tooltip placement="top" content="tooltip">
|
122
|
+
<back-to-top :custom-style="myBackToTopStyle" :visibility-height="300" :back-position="50" transition-name="fade" />
|
123
|
+
</el-tooltip>
|
124
|
+
</div>
|
125
|
+
</template>
|
126
|
+
|
127
|
+
<script>
|
128
|
+
import BackToTop from '@/components/BackToTop'
|
129
|
+
|
130
|
+
export default {
|
131
|
+
name: 'BackToTopDemo',
|
132
|
+
components: { BackToTop },
|
133
|
+
data() {
|
134
|
+
return {
|
135
|
+
// customizable button style, show/hide critical point, return position
|
136
|
+
myBackToTopStyle: {
|
137
|
+
right: '50px',
|
138
|
+
bottom: '50px',
|
139
|
+
width: '40px',
|
140
|
+
height: '40px',
|
141
|
+
'border-radius': '4px',
|
142
|
+
'line-height': '45px', // 请保持与高度一致以垂直居中 Please keep consistent with height to center vertically
|
143
|
+
background: '#e7eaf1'// 按钮的背景颜色 The background color of the button
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
</script>
|
149
|
+
|
150
|
+
<style scoped>
|
151
|
+
.placeholder-container div {
|
152
|
+
margin: 10px;
|
153
|
+
}
|
154
|
+
</style>
|