style:新增excel导出
Showing
7 changed files
with
111 additions
and
9 deletions
| ... | @@ -11,10 +11,10 @@ | ... | @@ -11,10 +11,10 @@ |
| 11 | "@jiaminghi/data-view": "^2.10.0", | 11 | "@jiaminghi/data-view": "^2.10.0", |
| 12 | "axios": "^0.21.1", | 12 | "axios": "^0.21.1", |
| 13 | "clipboard": "^2.0.11", | 13 | "clipboard": "^2.0.11", |
| 14 | "jsoneditor": "^9.9.2", | ||
| 15 | "core-js": "^3.6.5", | 14 | "core-js": "^3.6.5", |
| 16 | "echarts": "^4.6.0", | 15 | "echarts": "^4.6.0", |
| 17 | "js-cookie": "2.2.0", | 16 | "js-cookie": "2.2.0", |
| 17 | "jsoneditor": "^9.9.2", | ||
| 18 | "lodash": "^4.17.21", | 18 | "lodash": "^4.17.21", |
| 19 | "node-sass": "^4.14.1", | 19 | "node-sass": "^4.14.1", |
| 20 | "normalize.css": "7.0.0", | 20 | "normalize.css": "7.0.0", |
| ... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
| 22 | "vue": "2.6.10", | 22 | "vue": "2.6.10", |
| 23 | "vue-awesome": "^4.5.0", | 23 | "vue-awesome": "^4.5.0", |
| 24 | "vue-json-editor": "^1.4.3", | 24 | "vue-json-editor": "^1.4.3", |
| 25 | "vue-json-excel": "^0.3.0", | ||
| 25 | "vue-router": "3.0.2", | 26 | "vue-router": "3.0.2", |
| 26 | "vuex": "3.1.0", | 27 | "vuex": "3.1.0", |
| 27 | "xe-utils": "^3.5.7" | 28 | "xe-utils": "^3.5.7" | ... | ... |
| ... | @@ -6,7 +6,7 @@ import '@/styles/element-variables.scss' | ... | @@ -6,7 +6,7 @@ import '@/styles/element-variables.scss' |
| 6 | import '@/styles/index.scss' | 6 | import '@/styles/index.scss' |
| 7 | import Base from './base' // 全局组件引入 | 7 | import Base from './base' // 全局组件引入 |
| 8 | import mixin from '@/utils/mixin/theme.js' | 8 | import mixin from '@/utils/mixin/theme.js' |
| 9 | 9 | import JsonExcel from 'vue-json-excel' | |
| 10 | import dataV from '@jiaminghi/data-view'; | 10 | import dataV from '@jiaminghi/data-view'; |
| 11 | import echarts from "echarts" | 11 | import echarts from "echarts" |
| 12 | import { startLoadingAddCount, endLoadingSubCount } from './utils/requestLoading' | 12 | import { startLoadingAddCount, endLoadingSubCount } from './utils/requestLoading' |
| ... | @@ -44,6 +44,7 @@ import _ from 'lodash' | ... | @@ -44,6 +44,7 @@ import _ from 'lodash' |
| 44 | import './permission' // permission control | 44 | import './permission' // permission control |
| 45 | Vue.use(Element, { size: 'small', zIndex: 1000 }) | 45 | Vue.use(Element, { size: 'small', zIndex: 1000 }) |
| 46 | Vue.use(Base) | 46 | Vue.use(Base) |
| 47 | Vue.component('downloadExcel', JsonExcel) | ||
| 47 | Vue.component('icon', Icon); | 48 | Vue.component('icon', Icon); |
| 48 | Vue.prototype.$echarts = echarts | 49 | Vue.prototype.$echarts = echarts |
| 49 | Vue.use(dataV) | 50 | Vue.use(dataV) | ... | ... |
| ... | @@ -9,4 +9,7 @@ | ... | @@ -9,4 +9,7 @@ |
| 9 | /deep/.el-table--group::after, | 9 | /deep/.el-table--group::after, |
| 10 | .el-table--border::after { | 10 | .el-table--border::after { |
| 11 | width: 0 !important; | 11 | width: 0 !important; |
| 12 | } | ||
| 13 | .export-excel-wrapper{ | ||
| 14 | display: inline-block; | ||
| 12 | } | 15 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -25,6 +25,10 @@ | ... | @@ -25,6 +25,10 @@ |
| 25 | <el-form-item> | 25 | <el-form-item> |
| 26 | <btn nativeType="cz" @click="handleResetForm">重置</btn> | 26 | <btn nativeType="cz" @click="handleResetForm">重置</btn> |
| 27 | <btn nativeType="cx" @click="handleSearch">查询</btn> | 27 | <btn nativeType="cx" @click="handleSearch">查询</btn> |
| 28 | <download-excel class="export-excel-wrapper" :data="DetailsForm" :fields="json_fields" :header="title" | ||
| 29 | name="需要导出的表格名字.xls"> | ||
| 30 | <btn nativeType="cx">导出</btn> | ||
| 31 | </download-excel> | ||
| 28 | </el-form-item> | 32 | </el-form-item> |
| 29 | </el-col> | 33 | </el-col> |
| 30 | </el-row> | 34 | </el-row> |
| ... | @@ -111,8 +115,36 @@ export default { | ... | @@ -111,8 +115,36 @@ export default { |
| 111 | total: 0, | 115 | total: 0, |
| 112 | pageSize: 10, | 116 | pageSize: 10, |
| 113 | current: 1 | 117 | current: 1 |
| 114 | } | 118 | }, |
| 115 | }; | 119 | // 表格导出 |
| 120 | title: "xx公司表格", | ||
| 121 | json_fields: { | ||
| 122 | "排查日期": 'date', | ||
| 123 | "整改隐患内容": 'details', | ||
| 124 | "整改措施": 'measure', | ||
| 125 | "整改时限": 'timeLimit', | ||
| 126 | "应急措施和预案": 'plan', | ||
| 127 | "整改责任人": 'personInCharge', | ||
| 128 | "填表人": 'preparer', | ||
| 129 | "整改资金": 'fund', | ||
| 130 | "整改完成情况": 'complete', | ||
| 131 | "备注": 'remark', | ||
| 132 | }, | ||
| 133 | DetailsForm: [ | ||
| 134 | { | ||
| 135 | date: "2022-3-10", | ||
| 136 | details: "卸油区过路灯损坏", | ||
| 137 | measure: "更换灯泡", | ||
| 138 | timeLimit: "2022-3-21", | ||
| 139 | plan: "先使用充电灯代替,贴好安全提醒告示", | ||
| 140 | personInCharge: "王xx", | ||
| 141 | preparer: "王xx", | ||
| 142 | fund: "20元", | ||
| 143 | complete: "已完成整改", | ||
| 144 | remark: "重新更换了灯泡", | ||
| 145 | } | ||
| 146 | ] | ||
| 147 | } | ||
| 116 | }, | 148 | }, |
| 117 | created () { | 149 | created () { |
| 118 | this.handleResetForm() | 150 | this.handleResetForm() | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -22,9 +22,14 @@ | ... | @@ -22,9 +22,14 @@ |
| 22 | </el-col> | 22 | </el-col> |
| 23 | <!-- 按钮操作 --> | 23 | <!-- 按钮操作 --> |
| 24 | <el-col :span="12" class="btnColRight"> | 24 | <el-col :span="12" class="btnColRight"> |
| 25 | <el-form-item> | 25 | <el-form-item class="d-flex"> |
| 26 | <btn nativeType="cz" @click="handleResetForm">重置</btn> | 26 | <btn nativeType="cz" @click="handleResetForm">重置</btn> |
| 27 | <!-- 导出excel --> | ||
| 27 | <btn nativeType="cx" @click="handleSearch">查询</btn> | 28 | <btn nativeType="cx" @click="handleSearch">查询</btn> |
| 29 | <download-excel class="export-excel-wrapper" :data="DetailsForm" :fields="json_fields" :header="title" | ||
| 30 | name="需要导出的表格名字.xls"> | ||
| 31 | <btn nativeType="cx">导出</btn> | ||
| 32 | </download-excel> | ||
| 28 | </el-form-item> | 33 | </el-form-item> |
| 29 | </el-col> | 34 | </el-col> |
| 30 | </el-row> | 35 | </el-row> |
| ... | @@ -111,8 +116,36 @@ export default { | ... | @@ -111,8 +116,36 @@ export default { |
| 111 | total: 0, | 116 | total: 0, |
| 112 | pageSize: 10, | 117 | pageSize: 10, |
| 113 | current: 1 | 118 | current: 1 |
| 114 | } | 119 | }, |
| 115 | }; | 120 | // 表格导出 |
| 121 | title: "xx公司表格", | ||
| 122 | json_fields: { | ||
| 123 | "排查日期": 'date', | ||
| 124 | "整改隐患内容": 'details', | ||
| 125 | "整改措施": 'measure', | ||
| 126 | "整改时限": 'timeLimit', | ||
| 127 | "应急措施和预案": 'plan', | ||
| 128 | "整改责任人": 'personInCharge', | ||
| 129 | "填表人": 'preparer', | ||
| 130 | "整改资金": 'fund', | ||
| 131 | "整改完成情况": 'complete', | ||
| 132 | "备注": 'remark', | ||
| 133 | }, | ||
| 134 | DetailsForm: [ | ||
| 135 | { | ||
| 136 | date: "2022-3-10", | ||
| 137 | details: "卸油区过路灯损坏", | ||
| 138 | measure: "更换灯泡", | ||
| 139 | timeLimit: "2022-3-21", | ||
| 140 | plan: "先使用充电灯代替,贴好安全提醒告示", | ||
| 141 | personInCharge: "王xx", | ||
| 142 | preparer: "王xx", | ||
| 143 | fund: "20元", | ||
| 144 | complete: "已完成整改", | ||
| 145 | remark: "重新更换了灯泡", | ||
| 146 | } | ||
| 147 | ] | ||
| 148 | } | ||
| 116 | }, | 149 | }, |
| 117 | created () { | 150 | created () { |
| 118 | this.handleResetForm() | 151 | this.handleResetForm() | ... | ... |
| ... | @@ -25,6 +25,10 @@ | ... | @@ -25,6 +25,10 @@ |
| 25 | <el-form-item> | 25 | <el-form-item> |
| 26 | <btn nativeType="cz" @click="handleResetForm">重置</btn> | 26 | <btn nativeType="cz" @click="handleResetForm">重置</btn> |
| 27 | <btn nativeType="cx" @click="handleSearch">查询</btn> | 27 | <btn nativeType="cx" @click="handleSearch">查询</btn> |
| 28 | <download-excel class="export-excel-wrapper" :data="DetailsForm" :fields="json_fields" :header="title" | ||
| 29 | name="需要导出的表格名字.xls"> | ||
| 30 | <btn nativeType="cx">导出</btn> | ||
| 31 | </download-excel> | ||
| 28 | </el-form-item> | 32 | </el-form-item> |
| 29 | </el-col> | 33 | </el-col> |
| 30 | </el-row> | 34 | </el-row> |
| ... | @@ -111,8 +115,36 @@ export default { | ... | @@ -111,8 +115,36 @@ export default { |
| 111 | total: 0, | 115 | total: 0, |
| 112 | pageSize: 10, | 116 | pageSize: 10, |
| 113 | current: 1 | 117 | current: 1 |
| 114 | } | 118 | }, |
| 115 | }; | 119 | // 表格导出 |
| 120 | title: "xx公司表格", | ||
| 121 | json_fields: { | ||
| 122 | "排查日期": 'date', | ||
| 123 | "整改隐患内容": 'details', | ||
| 124 | "整改措施": 'measure', | ||
| 125 | "整改时限": 'timeLimit', | ||
| 126 | "应急措施和预案": 'plan', | ||
| 127 | "整改责任人": 'personInCharge', | ||
| 128 | "填表人": 'preparer', | ||
| 129 | "整改资金": 'fund', | ||
| 130 | "整改完成情况": 'complete', | ||
| 131 | "备注": 'remark', | ||
| 132 | }, | ||
| 133 | DetailsForm: [ | ||
| 134 | { | ||
| 135 | date: "2022-3-10", | ||
| 136 | details: "卸油区过路灯损坏", | ||
| 137 | measure: "更换灯泡", | ||
| 138 | timeLimit: "2022-3-21", | ||
| 139 | plan: "先使用充电灯代替,贴好安全提醒告示", | ||
| 140 | personInCharge: "王xx", | ||
| 141 | preparer: "王xx", | ||
| 142 | fund: "20元", | ||
| 143 | complete: "已完成整改", | ||
| 144 | remark: "重新更换了灯泡", | ||
| 145 | } | ||
| 146 | ] | ||
| 147 | } | ||
| 116 | }, | 148 | }, |
| 117 | created () { | 149 | created () { |
| 118 | this.handleResetForm() | 150 | this.handleResetForm() | ... | ... |
-
Please register or sign in to post a comment