提交 2f8c8c89 authored 作者: 钟是志's avatar 钟是志

字段过长显示不正常的bug

上级 8898a447
...@@ -64,6 +64,18 @@ const { TextArea } = Input; ...@@ -64,6 +64,18 @@ const { TextArea } = Input;
const { Option } = Select; const { Option } = Select;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const giveRender = (column = {}) => {
if (!column?.render) { // 超过30个字的字段 自动隐藏
column.render = (text, record) => {
if (text && typeof text === 'string' && text.length > 30) {
return <span title={text}>{text.slice(0, 30)}</span>;
}
return text;
};
}
return column;
}
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({ @connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
DataColumn, DataColumn,
SqlManageEntity, SqlManageEntity,
...@@ -384,13 +396,7 @@ export default class tableCom extends Component { ...@@ -384,13 +396,7 @@ export default class tableCom extends Component {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss'); column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
} }
if (!column.render) { // 超过30个字的字段 自动隐藏 column = giveRender(column);
column.render = (text, record) => {
if (text && typeof text === 'string' && text.length > 30) {
return <span title={text}>{text.slice(0, 30)}</span>;
}
};
}
columns.push(column); columns.push(column);
...@@ -434,13 +440,7 @@ export default class tableCom extends Component { ...@@ -434,13 +440,7 @@ export default class tableCom extends Component {
}; };
} }
if (!column.render) { // 超过30个字的字段 自动隐藏 column = giveRender(column);
column.render = (text, record) => {
if (text && typeof text === 'string' && text.length > 30) {
return <span title={text}>{text.slice(0, 30)}</span>;
}
};
}
columns.push(column); columns.push(column);
} }
...@@ -476,14 +476,7 @@ export default class tableCom extends Component { ...@@ -476,14 +476,7 @@ export default class tableCom extends Component {
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) { if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss'); column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
} }
if (!column.render) { // 超过30个字的字段 自动隐藏 column = giveRender(column);
column.render = (text, record) => {
if (text && typeof text === 'string' && text.length > 30) {
return <span title={text}>{text.slice(0, 30)}</span>;
}
};
}
columns.push(column); columns.push(column);
} else { } else {
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论