Commit cbfbd076 by zhaochengxiang

服务

parent 93fe8351
...@@ -608,6 +608,9 @@ const ModelTable = (props) => { ...@@ -608,6 +608,9 @@ const ModelTable = (props) => {
let newCols = [...cols]; let newCols = [...cols];
if ((visibleColNames||[]).length > 0) { if ((visibleColNames||[]).length > 0) {
newCols = newCols.filter(col => visibleColNames.indexOf(col.title)!==-1 || col.title==='序号' || col.title==='操作'); newCols = newCols.filter(col => visibleColNames.indexOf(col.title)!==-1 || col.title==='序号' || col.title==='操作');
if ((visibleColNames||[]).indexOf('服务描述') === -1) {
newCols[newCols.length-2].width = null;
}
} }
if (modelId) { if (modelId) {
newCols.filter(col => col.title !=='序号'); newCols.filter(col => col.title !=='序号');
...@@ -935,6 +938,7 @@ const ModelTable = (props) => { ...@@ -935,6 +938,7 @@ const ModelTable = (props) => {
<Table <Table
rowSelection={view!=='grant'?rowSelection:undefined} rowSelection={view!=='grant'?rowSelection:undefined}
rowKey={'id'} rowKey={'id'}
extraColWidth={80}
columns={columns||[]} columns={columns||[]}
dataSource={modelId?(subData||[]):(filterData||[])} dataSource={modelId?(subData||[]):(filterData||[])}
pagination={false} pagination={false}
......
...@@ -36,7 +36,7 @@ const ResizeableHeaderCell = props => { ...@@ -36,7 +36,7 @@ const ResizeableHeaderCell = props => {
}; };
const ResizeableTable = (props) => { const ResizeableTable = (props) => {
const { columns, ...restProps } = props const { columns, extraColWidth, ...restProps } = props
const [tableWidth, setTableWidth] = useState(0) const [tableWidth, setTableWidth] = useState(0)
...@@ -61,7 +61,7 @@ const ResizeableTable = (props) => { ...@@ -61,7 +61,7 @@ const ResizeableTable = (props) => {
useEffect(() => { useEffect(() => {
if (!!columns && tableWidth > 0) { if (!!columns && tableWidth > 0) {
const contentWidth = getWidth(tableWidth) const contentWidth = getWidth(tableWidth, extraColWidth)
setDefaultWidth(columns, contentWidth) setDefaultWidth(columns, contentWidth)
paddingCol.current.width = 0 paddingCol.current.width = 0
...@@ -80,7 +80,7 @@ const ResizeableTable = (props) => { ...@@ -80,7 +80,7 @@ const ResizeableTable = (props) => {
}) })
setCols(cols) setCols(cols)
} }
}, [columns, tableWidth]) }, [columns, tableWidth, extraColWidth])
const cols1 = useMemo(() => !!cols ? [...cols, paddingCol.current] : undefined, [cols]) const cols1 = useMemo(() => !!cols ? [...cols, paddingCol.current] : undefined, [cols])
...@@ -105,9 +105,9 @@ const ResizeableTable = (props) => { ...@@ -105,9 +105,9 @@ const ResizeableTable = (props) => {
export default ResizeableTable; export default ResizeableTable;
function getWidth(tableWidth) { function getWidth(tableWidth, extraColWidth) {
// FIXME 判断没有选择列时,32为0 // FIXME 判断没有选择列时,32为0
return tableWidth - scrollbarWidth - 32 // scrollbar width, checkbox column return tableWidth - scrollbarWidth - extraColWidth // scrollbar width, checkbox column
} }
function setDefaultWidth(columns, width) { function setDefaultWidth(columns, width) {
......
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