Browse Source

支持导出多个sheet页功能

feture-12345
mk 6 months ago
parent
commit
ab28b58156
  1. 2
      public/luckysheet/luckysheet.umd.js
  2. 4
      public/luckysheet/luckysheet.umd.js.map
  3. BIN
      public/test1.xlsx
  4. 3
      src/utils/export.js
  5. 2
      src/views/modules/base/smartExcel/cpts/excel-template-confirmation.vue
  6. 17
      src/views/modules/base/smartExcel/cpts/excel-view.vue

2
public/luckysheet/luckysheet.umd.js

File diff suppressed because one or more lines are too long

4
public/luckysheet/luckysheet.umd.js.map

File diff suppressed because one or more lines are too long

BIN
public/test1.xlsx

Binary file not shown.

3
src/utils/export.js

@ -4,8 +4,9 @@ export async function exportSheetExcel(luckysheet,name="file") { // 参数为lu
const workbook = new Excel.Workbook();
// 2.创建表格,第二个参数可以配置创建什么样的工作表
luckysheet.every(function (table) {
console.log(table,'seeee');
if (table.data.length === 0) return true;
const worksheet = workbook.addWorksheet(name);
const worksheet = workbook.addWorksheet(table.name);
// 3.设置单元格合并,设置单元格边框,设置单元格样式,设置值
setStyleAndValue(table.data, worksheet);
setMerge(table.config.merge, worksheet);

2
src/views/modules/base/smartExcel/cpts/excel-template-confirmation.vue

@ -66,7 +66,7 @@ export default {
options.loadUrl = ''
window.luckysheet.create({
...options,
data: [exportJson.sheets[0]],//sheetbug
data: exportJson.sheets,//sheetbug
title: exportJson.info.name,
hook: {},
});

17
src/views/modules/base/smartExcel/cpts/excel-view.vue

@ -1,5 +1,5 @@
<template>
<div class='flex' :style="{ height: tableHeight }">
<div class='flex' >
<div class="left_menu flex flex-y" v-if="!sheetTotal && pageType !== 'filling'">
<el-button type="text" round @click="handelClickBack" icon="el-icon-back">返回</el-button>
<section>
@ -31,7 +31,7 @@
<el-button type="primary" @click="handleClickExportExcel()" v-if="sheetTotal"> 导出</el-button>
</div>
</div>
<div id="luckysheet" style="height: 100%"></div>
<div id="luckysheet" :style="{ height: tableHeight }"></div>
</div>
<el-dialog title="上传共享数据" v-if="showUploadData" :visible.sync="showUploadData" width="60%"
:close-on-click-modal="false">
@ -95,7 +95,7 @@ export default {
},
computed: {
tableHeight() {
return (this.clientHeight - 10) + 'px'
return (this.clientHeight - 255) + 'px'
},
...mapGetters(['clientHeight', 'resolution']),
},
@ -115,6 +115,7 @@ export default {
},
methods: {
handleClickExportExcel(){
console.log(luckysheet.getAllSheets(),'seee1');
exportSheetExcel(luckysheet.getAllSheets(),this.infoObj.taskTitle)
},
async getTaskList() {
@ -218,18 +219,12 @@ export default {
options.container = 'luckysheet'
options.loadUrl = `${process.env.VUE_APP_API_SERVER}/actual/base/luckySheet/workbook/load?workbookId=${this.currentId}`
options.updateUrl = `${process.env.VUE_APP_SOCKET_SERVER}/actual/base/ws/luckysheet/${this.currentId}/${id}`
options.loadSheetUrl = `${process.env.VUE_APP_API_SERVER}/actual/base/luckySheet/workbook/loadSheets`
// options.loadSheetUrl = `${process.env.VUE_APP_API_SERVER}/actual/base/luckySheet/workbook/loadSheets`
window.luckysheet.create({
...options,
hook: {
cellEditBefore: this.handleCellEditBefore,
sheetCreateAfter: this.handleSheetCreateAfter,
},
});
},
handleSheetCreateAfter(e) {
console.log('setsheet', e);
},
handleClickMenu(i, val) {
this.menuActive = i;
this.currentId = val.subWorkBookId;

Loading…
Cancel
Save