From fc19121311151a32c9354f08afca897b457a8c40 Mon Sep 17 00:00:00 2001 From: Pan Date: Mon, 26 Mar 2018 13:23:42 +0800 Subject: [PATCH 1/3] fix[TodoList]: fixed css bug with z-index #535 --- src/views/dashboard/admin/components/TodoList/index.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/dashboard/admin/components/TodoList/index.scss b/src/views/dashboard/admin/components/TodoList/index.scss index 95f1acaa..1851c9a9 100644 --- a/src/views/dashboard/admin/components/TodoList/index.scss +++ b/src/views/dashboard/admin/components/TodoList/index.scss @@ -231,7 +231,7 @@ right: 0; bottom: 0; left: 0; - height: 50px; + height: 40px; overflow: hidden; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2); } @@ -245,6 +245,8 @@ .filters { margin: 0; padding: 0; + position: relative; + z-index: 1; list-style: none; } .filters li { From a55b149b27d85ccc9541a6e826e845e46f8a8fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 26 Mar 2018 13:54:19 +0800 Subject: [PATCH 2/3] perf[excel]: refactor excel (#536) --- src/vendor/Export2Excel.js | 54 ++++++++++++++++----------------- src/views/excel/exportExcel.vue | 32 ++++++++++++++++--- src/views/excel/selectExcel.vue | 6 +++- 3 files changed, 59 insertions(+), 33 deletions(-) diff --git a/src/vendor/Export2Excel.js b/src/vendor/Export2Excel.js index 803eca25..377a946b 100644 --- a/src/vendor/Export2Excel.js +++ b/src/vendor/Export2Excel.js @@ -116,45 +116,43 @@ export function export_table_to_excel(id) { saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx") } -export function export_json_to_excel(th, jsonData, defaultTitle) { - +export function export_json_to_excel({header, data, filename='excel-list', autoWidth=true}={}) { /* original data */ - - var data = jsonData; - data.unshift(th); + data=[...data] + data.unshift(header); var ws_name = "SheetJS"; - var wb = new Workbook(), ws = sheet_from_array_of_arrays(data); - /*设置worksheet每列的最大宽度*/ - const colWidth = data.map(row => row.map(val => { - /*先判断是否为null/undefined*/ - if (val == null) { - return {'wch': 10}; - } - /*再判断是否为中文*/ - else if (val.toString().charCodeAt(0) > 255) { - return {'wch': val.toString().length * 2}; - } else { - return {'wch': val.toString().length}; - } - })) - /*以第一行为初始值*/ - let result = colWidth[0]; - for (let i = 1; i < colWidth.length; i++) { - for (let j = 0; j < colWidth[i].length; j++) { - if (result[j]['wch'] < colWidth[i][j]['wch']) { - result[j]['wch'] = colWidth[i][j]['wch']; + if(autoWidth){ + /*设置worksheet每列的最大宽度*/ + const colWidth = data.map(row => row.map(val => { + /*先判断是否为null/undefined*/ + if (val == null) { + return {'wch': 10}; + } + /*再判断是否为中文*/ + else if (val.toString().charCodeAt(0) > 255) { + return {'wch': val.toString().length * 2}; + } else { + return {'wch': val.toString().length}; + } + })) + /*以第一行为初始值*/ + let result = colWidth[0]; + for (let i = 1; i < colWidth.length; i++) { + for (let j = 0; j < colWidth[i].length; j++) { + if (result[j]['wch'] < colWidth[i][j]['wch']) { + result[j]['wch'] = colWidth[i][j]['wch']; + } } } + ws['!cols'] = result; } - ws['!cols'] = result; /* add worksheet to workbook */ wb.SheetNames.push(ws_name); wb.Sheets[ws_name] = ws; var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); - var title = defaultTitle || 'excel-list' - saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx") + saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), filename + ".xlsx"); } diff --git a/src/views/excel/exportExcel.vue b/src/views/excel/exportExcel.vue index be12ea4b..543ee2ee 100644 --- a/src/views/excel/exportExcel.vue +++ b/src/views/excel/exportExcel.vue @@ -1,8 +1,16 @@