add PDA送空

This commit is contained in:
张江玮
2023-05-13 17:42:10 +08:00
parent 5ffca09127
commit 65734963c5
14 changed files with 227 additions and 50 deletions

View File

@@ -234,14 +234,16 @@ export async function blobValidate(data) {
* 注prop,title有一个必传
*/
export function flexWidth(prop, tableData, title, num = 0) {
if (tableData.length === 0) { // 表格没数据不做处理
return
}
let flexWidth = 0// 初始化表格列宽
let columnContent = ''// 占位最宽的内容
const canvas = document.createElement('canvas')
const context = canvas.getContext('2d')
context.font = '14px Microsoft YaHei'
if (tableData.length === 0) { // 表格没数据采用标题
const width = context.measureText(title)
flexWidth = width.width + 20 + num
return flexWidth + 'px'
}
// 获取占位最宽的内容
let index = 0
for (let i = 0; i < tableData.length; i++) { // 循环表格内容,获取表格内容中最长的数据