集成excel报表

Raod 3 years ago
parent 30fbf6445e
commit 322a46583e

@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* TODO
*
* @author chenkening
* @date 2021/3/26 10:35
@ -31,11 +30,12 @@ public class ReportServiceImpl implements ReportService {
@Override
public void delReport(ReportDto reportDto) {
deleteById(reportDto.getId());
//删除gaea_report_excel、gaea_report_dashboard、gaea_report_dashboard_widget
//...
}
@Override
public void processBeforeOperation(Report entity, BaseOperationEnum operationEnum) throws BusinessException {
//目前只有大屏一种类型
entity.setReportType("report_screen");
}
}

@ -5,12 +5,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>AJ-Report</title>
<!-- <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/css/pluginsCss.css' />-->
<!-- <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/plugins.css' />-->
<!-- <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/css/luckysheet.css' />-->
<!-- <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/assets/iconfont/iconfont.css' />-->
<!-- <script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/js/plugin.js"></script>-->
<!-- <script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>-->
<link rel='stylesheet' href='src/components/luckysheet/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='src/components/luckysheet/plugins/plugins.css' />
<link rel='stylesheet' href='src/components/luckysheet/css/luckysheet.css' />
<link rel='stylesheet' href='src/components/luckysheet/assets/iconfont/iconfont.css' />
<script src="src/components/luckysheet/plugins/js/plugin.js"></script>
<script src="src/components/luckysheet/luckysheet.umd.js"></script>
</head>
<body>

@ -23,7 +23,6 @@
"element-ui": "^2.9.2",
"js-cookie": "2.2.0",
"jsbarcode": "^3.11.4",
"luckysheet": "^2.1.13",
"miment": "^0.0.9",
"moment": "^2.29.1",
"monaco-editor": "^0.20.0",

@ -182,8 +182,6 @@ export default {
path: "/bigscreen/designer",
query: {
reportCode: val.reportCode,
reportId: val.id,
accessKey: val.accessKey
}
});
window.open(routeUrl.href, "_blank");

@ -71,7 +71,7 @@
<!-- <div id="x-spreadsheet-demo"
class="excel-designer" /> -->
<div id="luckysheet"
style="margin:0px;padding:0px;position:absolute;width:100%;height:800px;left: 0px;top: 30px;bottom:0px;" />
style="margin:0px;padding:0px;position:absolute;width:100%;height:95vh;left: 0px;top: 30px;bottom:0px;" />
<div id="qrCode"
ref="qrCodeDiv" />
<img id="barCode">
@ -152,7 +152,7 @@
<el-table ref="multipleTable"
:data="dataSetData"
tooltip-effect="dark"
style="width: 100%"
style="width: 100%;height: 60vh;overflow-y: scroll;"
@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55" />
@ -230,13 +230,11 @@ import { addReportExcel, editReportExcel } from '@/api/report'
import ColorPicker from '../../bigscreen/designer/form/colorPicker.vue'
// import QRCode from 'qrcodejs2'
// import JsBarcode from 'jsbarcode'
import LuckySheet from 'luckysheet'
export default {
name: 'Excels',
components: {
draggable,
ColorPicker,
LuckySheet
},
data () {
return {
@ -329,82 +327,141 @@ export default {
}
},
mounted () {
$(function () {
this.options = [
{ text: 'Money Manager.xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/money-manager-2.xlsx' },
{ text: 'Activity costs tracker.xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/Activity%20costs%20tracker.xlsx' },
{ text: 'House cleaning checklist.xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/House%20cleaning%20checklist.xlsx' },
{ text: 'Student assignment planner.xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/Student%20assignment%20planner.xlsx' },
{ text: 'Credit card tracker.xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/Credit%20card%20tracker.xlsx' },
{ text: 'Blue timesheet.xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/Blue%20timesheet.xlsx' },
{ text: 'Student calendar (Mon).xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/Student%20calendar%20%28Mon%29.xlsx' },
{ text: 'Blue mileage and expense report.xlsx', value: 'https://minio.cnbabylon.com/public/luckysheet/Blue%20mileage%20and%20expense%20report.xlsx' },
]
LuckySheet.create({
luckysheet.create({
container: 'luckysheet', // DOMid
title: 'Luckysheet Demo', //
lang: 'zh', //
plugins:['chart'],
data: [{
'name': 'Cell', //
'color': '', //
'index': 0, //
'status': 1, //
'order': 0, //
'hide': 0, //
'row': 36, //
'column': 18, //
'defaultRowHeight': 19, //
'defaultColWidth': 73, //
'celldata': [], // 使
'config': {
'merge': {}, //
'rowlen': {}, //
'columnlen': {}, //
'rowhidden': {}, //
'colhidden': {}, //
'borderInfo': {}, //
'authority': {}, //
hook:{
cellDragStop: function (cell, postion, sheetFile, ctx, event) {
// console.info(cell, postion, sheetFile, ctx, event);
},
rowTitleCellRenderBefore:function(rowNum,postion,ctx){
// console.log(rowNum);
},
rowTitleCellRenderAfter:function(rowNum,postion,ctx){
// console.log(ctx);
},
columnTitleCellRenderBefore:function(columnAbc,postion,ctx){
// console.log(columnAbc);
},
columnTitleCellRenderAfter:function(columnAbc,postion,ctx){
// console.log(postion);
},
cellRenderBefore:function(cell,postion,sheetFile,ctx){
// console.log(cell,postion,sheetFile,ctx);
},
cellRenderAfter:function(cell,postion,sheetFile,ctx){
// console.log(postion);
},
cellMousedownBefore:function(cell,postion,sheetFile,ctx){
// console.log("cellMousedownBefore", postion);
},
cellMousedown:function(cell,postion,sheetFile,ctx){
// console.log("cellMousedown",sheetFile);
},
sheetMousemove:function(cell,postion,sheetFile,moveState,ctx){
// console.log("sheetMousemove",cell,postion,sheetFile,moveState,ctx);
},
sheetMouseup:function(cell,postion,sheetFile,moveState,ctx){
console.log("sheetMouseup",cell,postion,sheetFile,moveState,ctx);
},
'scrollLeft': 0, //
'scrollTop': 315, //
'luckysheet_select_save': [], //
'calcChain': [], //
'isPivotTable': false, //
'pivotTable': {}, //
'filter_select': {}, //
'filter': null, //
'luckysheet_alternateformat_save': [], //
'luckysheet_alternateformat_save_modelCustom': [], //
'luckysheet_conditionformat_save': {}, //
'frozen': {}, //
'chart': [], //
'zoomRatio': 1, //
'image': [], //
'showGridLines': 1, // 线
'dataVerification': {} //
cellAllRenderBefore:function(data,sheetFile,ctx){
// console.info(data,sheetFile,ctx)
},
{
'name': 'Sheet2',
'color': '',
'index': 1,
'status': 0,
'order': 1,
'celldata': [],
'config': {}
updated:function(operate){
// console.info(operate)
},
cellUpdateBefore:function(r,c,value,isRefresh){
// console.info('cellUpdateBefore',r,c,value,isRefresh)
},
cellUpdated:function(r,c,oldValue, newValue, isRefresh){
// console.info('cellUpdated',r,c,oldValue, newValue, isRefresh)
},
sheetActivate:function(index, isPivotInitial, isNewSheet){
// console.info(index, isPivotInitial, isNewSheet)
},
rangeSelect:function(index, sheet){
// console.info(index, sheet)
},
commentInsertBefore:function(r, c){
// console.info(r, c)
},
commentInsertAfter:function(r, c, cell){
// console.info(r, c, cell)
},
commentDeleteBefore:function(r, c, cell){
// console.info(r, c, cell)
},
commentDeleteAfter:function(r, c, cell){
// console.info(r, c, cell)
},
commentUpdateBefore:function(r, c, value){
// console.info(r, c, value)
},
commentUpdateAfter:function(r, c, oldCell, newCell ){
// console.info(r, c, oldCell, newCell)
},
cellEditBefore:function(range ){
// console.info(range)
},
workbookCreateAfter:function(json){
// console.info(json)
},
rangePasteBefore:function(range,data){
// console.info('rangePasteBefore',range,data)
// return false; //Can intercept paste
},
},
data:[
{
'name': 'Sheet3',
'color': '',
'index': 2,
'status': 0,
'order': 2,
'celldata': [],
'config': {},
"name": "report", //
"color": "", //
"index": 0, //
"status": 1, //
"order": 0, //
"hide": 0,//
"row": 36, //
"column": 18, //
"defaultRowHeight": 19, //
"defaultColWidth": 73, //
"celldata": [], //使
"config": {
"merge":{}, //
"rowlen":{}, //
"columnlen":{}, //
"rowhidden":{}, //
"colhidden":{}, //
"borderInfo":{}, //
"authority":{}, //
},
"scrollLeft": 0, //
"scrollTop": 315, //
"luckysheet_select_save": [], //
"calcChain": [],//
"isPivotTable":false,//
"pivotTable":{},//
"filter_select": {},//
"filter": null,//
"luckysheet_alternateformat_save": [], //
"luckysheet_alternateformat_save_modelCustom": [], //
"luckysheet_conditionformat_save": {},//
"frozen": {}, //
"chart": [], //
"zoomRatio":1, //
"image":[], //
"showGridLines": 1, //线
"dataVerification":{} //
}
]
})
});
});
// this.load()
},
@ -524,6 +581,7 @@ export default {
},
onStart (setCode) {
this.setCode = setCode
console.log(setCode)
},
onEnd (evt) {
//
@ -532,11 +590,24 @@ export default {
var fieldLabel = evt.item.innerText //
var excelToolbarHeight = 40 // excel
var leftLayout = document.getElementsByClassName('layout-left')[0].clientWidth //
console.log(luckysheet)
console.log("x:",x)
console.log("y:",y)
console.log("leftLayout左侧宽度:",leftLayout)
// const aaa = luckysheet.sheetMouseup()
luckysheet.setCellValue(0,0,"哈哈哈")
// const a = luckysheet.getCellValue(0,0)
// debugger
console.log("滚动","aaa");
// console.log(a);
//
const { ri, ci } = this.sheet.datas[0].getCellRectByXY(x - leftLayout, y - excelToolbarHeight)
this.sheet.cellText(ri, ci, '#{' + this.setCode + '.' + fieldLabel + '}', 0)
// const { ri, ci } = this.sheet.datas[0].getCellRectByXY(x - leftLayout, y - excelToolbarHeight)
// this.sheet.cellText(ri, ci, '#{' + this.setCode + '.' + fieldLabel + '}', 0)
//
this.sheet.reRender()
// this.sheet.reRender()
},
del (val) {
for (let i = 0; i < this.dataSet.length; i++) {

@ -74,7 +74,15 @@ export default {
inputType: "input",
label: "报表编码",
field: "reportCode"
}
},
{
inputType: 'anji-select', //form input|input-number|anji-select(urldictCode)|anji-tree()|date|datetime|datetimerange
anjiSelectOption: {
dictCode: "REPORT_TYPE"
},
label: '报表类型',
field: 'reportType'
},
],
//
buttons: {
@ -120,6 +128,7 @@ export default {
editField: "reportName",
inputType: "input",
rules: [
{ required: true, message: '请输入报表名称', trigger: 'blur' },
{ min: 1, max: 100, message: "不超过100个字符", trigger: "blur" }
],
disabled: false
@ -131,6 +140,7 @@ export default {
editField: "reportCode",
inputType: "input",
rules: [
{ required: true, message: '请输入报表编码', trigger: 'blur' },
{ min: 1, max: 100, message: "不超过100个字符", trigger: "blur" }
],
disabled: "disableOnEdit"
@ -144,6 +154,7 @@ export default {
editField: "reportGroup",
inputType: "input",
rules: [
// { required: true, message: '', trigger: 'blur' },
{ min: 1, max: 100, message: "不超过100个字符", trigger: "blur" }
],
disabled: false,
@ -154,17 +165,18 @@ export default {
placeholder: "",
field: "reportType",
editField: "reportType",
tableHide: true,
editHide: true,
inputType: "anji-select",
fieldTableRowRenderer: row => {
return this.getDictLabelByCode("REPORT_TYPE", row["reportType"]);
},
anjiSelectOption: {
dictCode: "REPORT_TYPE"
},
rules: [
{ required: true, message: '请输入报表类型', trigger: 'blur' },
{ min: 1, max: 20, message: "不超过20个字符", trigger: "blur" }
],
disabled: true,
defaultValue: "report_screen"
disabled: "disableOnEdit",
},
{
label: "描述", //
@ -237,23 +249,36 @@ export default {
},
//
preview(val) {
let routePath = "";
if (val.reportType === 'report_excel') {
routePath = "/excelreport/viewer";
} else {
routePath = "/bigscreen/viewer";
}
var routeUrl = this.$router.resolve({
path: "/bigscreen/viewer",
path: routePath,
query: { reportCode: val.reportCode }
});
window.open(routeUrl.href, "_blank");
},
//
design(val) {
let routePath = "";
if (val.reportType === 'report_excel') {
routePath = "/excelreport/designer";
} else {
routePath = "/bigscreen/designer";
}
var routeUrl = this.$router.resolve({
path: "/bigscreen/designer",
path: routePath,
query: {
reportCode: val.reportCode,
reportId: val.id,
accessKey: val.accessKey
}
});
window.open(routeUrl.href, "_blank");
},
//
shareReport(val){

Binary file not shown.
Loading…
Cancel
Save