refactor: sql执行列返回字段类型

This commit is contained in:
meilin.huang
2023-12-14 21:27:11 +08:00
parent 18cf2e54c4
commit a5a813f95f
15 changed files with 127 additions and 44 deletions

View File

@@ -373,6 +373,15 @@ export class DbInst {
return columnType.match(/int|double|float|nubmer|decimal|byte|bit/gi);
}
/**
* 判断字段类型是否为日期相关类型
* @param columnType 字段类型
* @returns
*/
static isDate(columnType: string) {
return columnType.match(/date|time/gi);
}
/**
*
* @param str 字符串
@@ -385,8 +394,8 @@ export class DbInst {
return;
}
// 获取列名称的长度 加上排序图标长度
const columnWidth: number = getTextWidth(prop) + 23;
// 获取列名称的长度 加上排序图标长度、abc为字段类型简称占位符
const columnWidth: number = getTextWidth(prop + 'abc') + 23;
// prop为该列的字段名(传字符串);tableData为该表格的数据源(传变量);
if (!tableData || !tableData.length || tableData.length === 0 || tableData === undefined) {
return columnWidth;