Commit e8824fa0 by zhaochengxiang

调整样式

parent 161c6ae3
......@@ -48,7 +48,7 @@ const ModelNameColumn = (props) => {
let _textComponent = <span>{text}</span>;
if (data.digest) {
_textComponent = <div style={{ width: 400, maxHeight: 300, overflow: 'auto' }}>
<Descriptions className='model-digest-descritpion' column={2} size='small'>
<Descriptions className='model-digest-descritpion' column={1} size='small'>
<Descriptions.Item label='模型名称'>
{ data.digest.name||'' }
</Descriptions.Item>
......@@ -351,7 +351,6 @@ const ModelTable = (props) => {
const _data = paginate(newData||[], pageNum, pageSize);
autoResizeColumns(_data);
setFilterData(_data);
//eslint-disable-next-line react-hooks/exhaustive-deps
......@@ -362,14 +361,15 @@ const ModelTable = (props) => {
if (tableWidth) {
let newColumns = [], newIncludePathColumns = [];
let excludePathCols = [...cols];
if ((modelId||'') !== '') {
newColumns = cols.filter(item => item.dataIndex!=='key');
excludePathCols = cols.filter(item => item.dataIndex!=='key');
}
cols.forEach((column, index) => {
excludePathCols.forEach((column, index) => {
const newColumn = {...column};
if (!newColumn.width) {
const rowWidth = (cols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50;
const rowWidth = (excludePathCols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 97; //展开50 勾选32 滚动条15
if (tableWidth > rowWidth) {
newColumn.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
......@@ -382,13 +382,12 @@ const ModelTable = (props) => {
});
const includePathCols = [...cols];
includePathCols.splice(3, 0, pathColumn);
includePathCols.forEach((column, index) => {
const newColumn = {...column};
if (!newColumn.width) {
const rowWidth = (includePathCols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50;
const rowWidth = (includePathCols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 97;
if (tableWidth > rowWidth) {
newColumn.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
......@@ -407,43 +406,6 @@ const ModelTable = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [ tableWidth ])
const autoResizeColumns = (val) => {
if ((val||[]).length>0) {
let maxLength = 0, maxLength_cn = 0, name = '', cnName = '';
(val||[]).forEach(item => {
let len = getTextLength(item.name||'');
let len_cn = getTextLength(item.cnName||'');
if (maxLength<len) {
name = item.name;
maxLength = len;
}
if (maxLength_cn<len_cn) {
cnName = item.cnName;
maxLength_cn = len_cn;
}
})
let newColumns = [...columns];
newColumns[1].width = getTextWidth(name)+20;
newColumns[2].width = getTextWidth(cnName)+20;
let minWidth = isSzseEnv?200:120;
if (newColumns[1].width < minWidth) {
newColumns[1].width = minWidth;
}
if (newColumns[2].width < minWidth) {
newColumns[2].width = minWidth;
}
setColumns(newColumns);
}
}
const getDataModel = () => {
dispatch({
type: 'datamodel.getDataModel',
......@@ -452,7 +414,6 @@ const ModelTable = (props) => {
},
callback: data => {
setSubData(data?[data]:[]);
autoResizeColumns(data?[data]:[]);
},
error: () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment