修改自定义报表

This commit is contained in:
GGJ
2024-08-08 16:25:35 +08:00
parent d04336e1c8
commit 13432b351d
2 changed files with 31 additions and 14 deletions

View File

@@ -95,12 +95,14 @@ const tableStore = new TableStore({
tableStore.table.params.lineId = dotList.value.id
},
loadCallback: () => {
console.log(tableStore.table.data)
tableStore.table.data.forEach((item: any) => {
item.data1 ? (item.data = JSON.parse(item.data1)) : ''
item.celldata.forEach((k: any) => {
item.data[k.r][k.c].v = k.v
item.data[k.r][k.c].v ? (item.data[k.r][k.c].v = k.v) : ''
})
})
console.log(tableStore.table.data)
setTimeout(() => {
luckysheet.create({
container: 'luckysheet',
title: '', // 表 头名
@@ -110,6 +112,7 @@ const tableStore = new TableStore({
showsheetbar: true, // 是否显示底部sheet按钮
data: tableStore.table.data
})
}, 10)
}
})
provide('tableStore', tableStore)

View File

@@ -85,6 +85,15 @@ const beforeUpload = (file: any) => {
}
luckysheet.destroy()
options.value.title = exportJson.info.name
console.log('🚀 ~ exportJson.sheets:', exportJson.sheets)
exportJson.sheets.forEach((item: any) => {
// item.celldata = []
// item.data = []
item.celldata.forEach((k: any) => {
k.v.ct.s ? (k.v.v = k.v.ct.s[0].v) : ''
k.v.ct.s ? (k.v.m = k.v.ct.s[0].v) : ''
})
})
options.value.data = exportJson.sheets
luckysheet.create(options.value)
})
@@ -95,9 +104,14 @@ const preservation = () => {
}
// 新增
const submitForm = (formdata: any, text: string) => {
console.log('🚀 ~ submitForm ~ text:', text)
let userStr = JSON.stringify(luckysheet.getAllSheets())
let blob = new Blob([userStr], {
// let userStr = JSON.stringify(luckysheet.getAllSheets())
let userStr = luckysheet.getAllSheets()
console.log('🚀 ~ submitForm ~ userStr:', userStr)
userStr.forEach((item: any) => {
item.data1 = JSON.stringify(item.data)
})
let blob = new Blob([JSON.stringify(userStr)], {
type: 'application/json;charset=UTF-8'
})
let files = new window.File([blob], 'content.json', {