数据回显渲染

Raod 3 years ago
parent f791de2132
commit efc3485d08

@ -57,6 +57,12 @@ public class TokenFilter implements Filter {
HttpServletResponse response = (HttpServletResponse) servletResponse;
String uri = request.getRequestURI();
//OPTIONS直接放行
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
filterChain.doFilter(request, response);
return;
}
if (SLASH.equals(uri)) {
response.sendRedirect("/index.html");
return;

@ -245,6 +245,7 @@ export default {
reportCode: '',
options: [],
sheet: {},
sheetData: [],
dataSetData: [],
reportExcelDto: {
id: null,
@ -326,10 +327,49 @@ export default {
}
},
mounted () {
$(function () {
luckysheet.create({
mounted () {},
created () {
this.reportCode = this.$route.query.reportCode
this.accessKey = this.$route.query.accessKey
this.loadDataSet()
this.design()
this.initPaperList()
this.getWindowDpi()
},
methods: {
handleClose () {
this.printVisible = false
},
handleChange (val) {
},
// tabs
handleClick (tab, event) {
},
async design () {
// reportCode
const { code, data } = await detailByReportCode(this.reportCode)
if (data != null) {
this.reportId = data.id
}
this.sheetData = (data == null ? [{}] : JSON.parse(data.jsonStr))
console.log(this.sheetData)
this.createSheet();
if (data != null) {
if (data.setCodes != null && data.setCodes !== '') {
var dataSetList = data.setCodes.split('|')
dataSetList.forEach((code) => {
this.dataSetData.forEach((setData) => {
if (code === setData.setCode) {
this.detail(setData.id)
}
})
})
}
}
},
//
createSheet(){
const options = {
container: 'luckysheet', // DOMid
title: 'Luckysheet Demo', //
lang: 'zh', //
@ -458,49 +498,12 @@ export default {
"dataVerification":{} //
}
]
});
});
};
options.data = this.sheetData;
// this.load()
},
created () {
this.reportCode = this.$route.query.reportCode
this.accessKey = this.$route.query.accessKey
this.loadDataSet()
this.design()
this.initPaperList()
this.getWindowDpi()
},
methods: {
handleClose () {
this.printVisible = false
},
handleChange (val) {
},
// tabs
handleClick (tab, event) {
},
async design () {
// reportCode
const { code, data } = await detailByReportCode(this.reportCode)
if (data != null) {
this.reportId = data.id
}
// this.sheet.loadData(data == null ? [{}] : JSON.parse(data.jsonStr)['sheet'])
if (data != null) {
if (data.setCodes != null && data.setCodes !== '') {
var dataSetList = data.setCodes.split('|')
dataSetList.forEach((code) => {
this.dataSetData.forEach((setData) => {
if (code === setData.setCode) {
this.detail(setData.id)
}
})
})
}
}
$(function () {
luckysheet.create(options);
});
},
async loadDataSet () {
const { code, data } = await queryAllDataSet()
@ -510,11 +513,11 @@ export default {
doCancel () {
this.pop = false
},
save () {
async save() {
console.log(luckysheet.toJson())
console.log(luckysheet.getAllSheets())
console.log(luckysheet.getSheetData(0))
// console.log(luckysheet.toJson())
// console.log(luckysheet.getAllSheets())
// console.log(luckysheet.getSheetData(0))
this.reportExcelDto.jsonStr = JSON.stringify(luckysheet.getAllSheets())
var setCodeList = []
@ -534,10 +537,14 @@ export default {
this.reportExcelDto.setCodes = setCodeList.join('|')
this.reportExcelDto.reportCode = this.reportCode
if (this.reportId == null) {
const res = addReportExcel(this.reportExcelDto)
const {code} = await addReportExcel(this.reportExcelDto)
if (code != '200') return
this.$message.success('保存成功')
} else {
this.reportExcelDto.id = this.reportId
const res = editReportExcel(this.reportExcelDto)
const {code} = await editReportExcel(this.reportExcelDto)
if (code != '200') return
this.$message.success('更新成功')
}
},
@ -622,75 +629,6 @@ export default {
//
changed (val, key) {
},
load () {
// eslint-disable-next-line no-undef
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': {}, //
},
'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': {} //
},
{
'name': 'Sheet2',
'color': '',
'index': 1,
'status': 0,
'order': 1,
'celldata': [],
'config': {}
},
{
'name': 'Sheet3',
'color': '',
'index': 2,
'status': 0,
'order': 2,
'celldata': [],
'config': {},
}
]
})
},
testClick () {
console.log('sdsdsddsd')
},

Loading…
Cancel
Save