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

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

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

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

@ -71,7 +71,7 @@
<!-- <div id="x-spreadsheet-demo" <!-- <div id="x-spreadsheet-demo"
class="excel-designer" /> --> class="excel-designer" /> -->
<div id="luckysheet" <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" <div id="qrCode"
ref="qrCodeDiv" /> ref="qrCodeDiv" />
<img id="barCode"> <img id="barCode">
@ -152,7 +152,7 @@
<el-table ref="multipleTable" <el-table ref="multipleTable"
:data="dataSetData" :data="dataSetData"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" style="width: 100%;height: 60vh;overflow-y: scroll;"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" <el-table-column type="selection"
width="55" /> width="55" />
@ -230,13 +230,11 @@ import { addReportExcel, editReportExcel } from '@/api/report'
import ColorPicker from '../../bigscreen/designer/form/colorPicker.vue' import ColorPicker from '../../bigscreen/designer/form/colorPicker.vue'
// import QRCode from 'qrcodejs2' // import QRCode from 'qrcodejs2'
// import JsBarcode from 'jsbarcode' // import JsBarcode from 'jsbarcode'
import LuckySheet from 'luckysheet'
export default { export default {
name: 'Excels', name: 'Excels',
components: { components: {
draggable, draggable,
ColorPicker, ColorPicker,
LuckySheet
}, },
data () { data () {
return { return {
@ -329,82 +327,141 @@ export default {
} }
}, },
mounted () { mounted () {
$(function () {
this.options = [ luckysheet.create({
{ 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({
container: 'luckysheet', // DOMid container: 'luckysheet', // DOMid
title: 'Luckysheet Demo', // title: 'Luckysheet Demo', //
lang: 'zh', // lang: 'zh', //
plugins:['chart'], plugins:['chart'],
data: [{ hook:{
'name': 'Cell', // cellDragStop: function (cell, postion, sheetFile, ctx, event) {
'color': '', // // console.info(cell, postion, sheetFile, ctx, event);
'index': 0, // },
'status': 1, // rowTitleCellRenderBefore:function(rowNum,postion,ctx){
'order': 0, // // console.log(rowNum);
'hide': 0, // },
'row': 36, // rowTitleCellRenderAfter:function(rowNum,postion,ctx){
'column': 18, // // console.log(ctx);
'defaultRowHeight': 19, // },
'defaultColWidth': 73, // columnTitleCellRenderBefore:function(columnAbc,postion,ctx){
'celldata': [], // 使 // console.log(columnAbc);
'config': { },
'merge': {}, // columnTitleCellRenderAfter:function(columnAbc,postion,ctx){
'rowlen': {}, // // console.log(postion);
'columnlen': {}, // },
'rowhidden': {}, // cellRenderBefore:function(cell,postion,sheetFile,ctx){
'colhidden': {}, // // console.log(cell,postion,sheetFile,ctx);
'borderInfo': {}, // },
'authority': {}, // 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, // cellAllRenderBefore:function(data,sheetFile,ctx){
'scrollTop': 315, // // console.info(data,sheetFile,ctx)
'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': {} //
}, },
{ updated:function(operate){
'name': 'Sheet2', // console.info(operate)
'color': '', },
'index': 1, cellUpdateBefore:function(r,c,value,isRefresh){
'status': 0, // console.info('cellUpdateBefore',r,c,value,isRefresh)
'order': 1, },
'celldata': [], cellUpdated:function(r,c,oldValue, newValue, isRefresh){
'config': {} // 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', "name": "report", //
'color': '', "color": "", //
'index': 2, "index": 0, //
'status': 0, "status": 1, //
'order': 2, "order": 0, //
'celldata': [], "hide": 0,//
'config': {}, "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() // this.load()
}, },
@ -524,6 +581,7 @@ export default {
}, },
onStart (setCode) { onStart (setCode) {
this.setCode = setCode this.setCode = setCode
console.log(setCode)
}, },
onEnd (evt) { onEnd (evt) {
// //
@ -532,11 +590,24 @@ export default {
var fieldLabel = evt.item.innerText // var fieldLabel = evt.item.innerText //
var excelToolbarHeight = 40 // excel var excelToolbarHeight = 40 // excel
var leftLayout = document.getElementsByClassName('layout-left')[0].clientWidth // 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) // const { ri, ci } = this.sheet.datas[0].getCellRectByXY(x - leftLayout, y - excelToolbarHeight)
this.sheet.cellText(ri, ci, '#{' + this.setCode + '.' + fieldLabel + '}', 0) // this.sheet.cellText(ri, ci, '#{' + this.setCode + '.' + fieldLabel + '}', 0)
// //
this.sheet.reRender() // this.sheet.reRender()
}, },
del (val) { del (val) {
for (let i = 0; i < this.dataSet.length; i++) { for (let i = 0; i < this.dataSet.length; i++) {

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

Binary file not shown.
Loading…
Cancel
Save