diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index f6a69ba3b..f8567e6c5 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -48,9 +48,9 @@ "echarts": "4.2.1", "element-ui": "2.13.0", "file-saver": "2.0.1", - "js-beautify": "^1.10.2", "fuse.js": "3.4.4", "jquery": "^3.5.1", + "js-beautify": "^1.10.2", "js-cookie": "2.2.0", "jsencrypt": "3.0.0-rc.1", "normalize.css": "7.0.0", @@ -61,12 +61,13 @@ "sortablejs": "1.8.4", "vue": "2.6.10", "vue-count-to": "1.0.13", - "vue-quill-editor": "3.0.6", "vue-cropper": "0.4.9", + "vue-quill-editor": "3.0.6", "vue-router": "3.0.2", "vue-splitpane": "1.0.4", "vuedraggable": "2.20.0", - "vuex": "3.1.0" + "vuex": "3.1.0", + "xlsx": "^0.16.3" }, "devDependencies": { "@babel/core": "7.0.0", diff --git a/ruoyi-ui/src/views/fx_dashboard/dashboard_daterange.vue b/ruoyi-ui/src/views/fx_dashboard/dashboard_daterange.vue index ec99d039f..27a5cfc71 100644 --- a/ruoyi-ui/src/views/fx_dashboard/dashboard_daterange.vue +++ b/ruoyi-ui/src/views/fx_dashboard/dashboard_daterange.vue @@ -41,6 +41,8 @@ 查询 + 导出 + @@ -77,6 +79,7 @@ 产线明细
import echarts from 'echarts' - + import FileSaver from 'file-saver' + import XLSX from 'xlsx' require('echarts/theme/macarons') // echarts theme import resize from '../dashboard/mixins/resize' import {getDateRange} from '@/api/dashboard/fxdashboard' @@ -144,10 +148,10 @@ tableData: [], options: [{ value: '08:00:01', - label: '白班' + label: '08:00' }, { value: '20:00:00', - label: '夜班' + label: '20:00' }], daterange_group_value1: [], daterange_group_value2: [], @@ -185,8 +189,8 @@ this.daterange_group_value1 = "08:00:01" this.daterange_group_value2 = "08:00:01" - this.daterange_time1= '2020-05-01' - this.daterange_time2= '2020-05-01' + this.daterange_time1= '2020-07-01' + this.daterange_time2= '2020-07-01' }, @@ -284,7 +288,21 @@ - } + }, + exportExcel () { + /* generate workbook object from table */ + let wb = XLSX.utils.table_to_book(document.querySelector('#exportTableData')); + /* get binary string as output */ + let wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' }); + try { + FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), '车间报表.xlsx'); + } catch (e) + { + if (typeof console !== 'undefined') + console.log(e, wbout) + } + return wbout + }, } diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 52dd9ec34..9a0ec2dbc 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -1,52 +1,52 @@