Commit 65b1d92d by zhaochengxiang

增加序号

parent 734c154d
...@@ -54,6 +54,7 @@ const ModelNameColumn = (props) => { ...@@ -54,6 +54,7 @@ const ModelNameColumn = (props) => {
if (data.digest) { if (data.digest) {
_textComponent = <div style={{ width: 500, maxHeight: 300, overflow: 'auto' }}> _textComponent = <div style={{ width: 500, maxHeight: 300, overflow: 'auto' }}>
<Table <Table
rowKey='name'
dataSource={data.digest.attributeDigests||[]} dataSource={data.digest.attributeDigests||[]}
columns={cols} columns={cols}
loading={false} loading={false}
...@@ -113,12 +114,12 @@ const ModelTable = (props) => { ...@@ -113,12 +114,12 @@ const ModelTable = (props) => {
const [ subData, setSubData ] = useState([]); const [ subData, setSubData ] = useState([]);
const cols = [ const cols = [
// { {
// name: '序号', name: '序号',
// key: 'key', key: 'index',
// width: 60, width: 60,
// sortable: false, sortable: false,
// }, },
{ {
name: '模型名称', name: '模型名称',
key: 'name', key: 'name',
......
...@@ -22,6 +22,7 @@ export enum RowType { ...@@ -22,6 +22,7 @@ export enum RowType {
export interface RowData { export interface RowData {
id: string, id: string,
index?: string;
__pid__?: string __pid__?: string
__row__?: any __row__?: any
__type__?: RowType __type__?: RowType
...@@ -150,6 +151,11 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat ...@@ -150,6 +151,11 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
const [sortColumns, setSortColumns] = useState<readonly SortColumn[]>([]); // 排序列图标状态 const [sortColumns, setSortColumns] = useState<readonly SortColumn[]>([]); // 排序列图标状态
const [_rows, _setRows] = useState<readonly Row[]>([]) const [_rows, _setRows] = useState<readonly Row[]>([])
useEffect(() => { useEffect(() => {
(rows||[]).forEach((item, index) => {
item.index = `${index+1}`;
})
if (sortColumns.length === 0) { if (sortColumns.length === 0) {
_setRows(rows); _setRows(rows);
} else { } else {
......
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