480ef3a3 by lihua

优化列宽

1 parent f4b71ce6
......@@ -5,14 +5,14 @@ export function resolveRoutePath(basePath: string, routePath?: string) {
}
/** 计算表格列宽 */
export const calcColumnWidth = (data, title, dataFont, titleFont, otherWidth = 0) => {
export const calcColumnWidth = (data, title, dataFont, titleFont, otherWidth = 0, minWidth = 96) => {
let titleW = measureTextWidth(title, titleFont || dataFont);
if (!data.length) {
if (titleW + otherWidth > 260) {
return 260;
}
if (titleW + otherWidth + 32 < 96) {
return 96;
if (titleW + otherWidth + 32 < minWidth) {
return minWidth;
}
return titleW + 32 + otherWidth;//20边距,+2px边框 + 10px间隙
}
......@@ -32,8 +32,8 @@ export const calcColumnWidth = (data, title, dataFont, titleFont, otherWidth = 0
if (titleW + otherWidth > maxWidth) {
maxWidth = titleW + otherWidth;
}
if (maxWidth + 32 < 96) {
return 96;
if (maxWidth + 32 < minWidth) {
return minWidth;
}
return maxWidth + 32;
}
......
......@@ -136,7 +136,8 @@ const calcTableColumnWidth = (data: any[], prop, title, otherWidth = 0) => {
fontSize: 14,
fontFamily: "SimSun",
},
otherWidth
otherWidth,
70
);
};
......@@ -156,7 +157,7 @@ watch(
val?.slice(0, 30) || [],
field.field,
field.label,
24
10
);
});
},
......
......@@ -249,9 +249,9 @@ function getTableFields () {
'length': 100,
// 'inside_identifier': 100,
'indicate_format': 110,
'other_data_relationship': 150,
'other_data_relationship': 159,
'unit': 100,
'meta_data_type': 150,
'meta_data_type': 156,
'definition': 300,
'explanation': 300
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!