|
@@ -49,11 +49,12 @@ interface Prosp {
|
|
|
gutter?: any
|
|
|
isCard?: boolean
|
|
|
totalData?: any[]
|
|
|
- refreshData?: () => void
|
|
|
+ refreshData?: () => void,
|
|
|
+ rowClassName?: string | ((record: any, index: any) => string),//样式
|
|
|
}
|
|
|
|
|
|
function TableData(props: Prosp) {
|
|
|
- const { isZj, scroll, columns, title, columnWidth, dataSource, totalData = [], refreshData, expandedRowRender, className, isCard = true, leftChild, page = undefined, rowSelection = false, pageSize = undefined, size = 'small', fixed = { left: 0, right: 1 }, total = 0, onChange, config, configName, ajax, syncAjax, hoverable = true, myKey, gutter = [0, 20] } = props
|
|
|
+ const { isZj, scroll, columns, title, columnWidth, rowClassName, dataSource, totalData = [], refreshData, expandedRowRender, className, isCard = true, leftChild, page = undefined, rowSelection = false, pageSize = undefined, size = 'small', fixed = { left: 0, right: 1 }, total = 0, onChange, config, configName, ajax, syncAjax, hoverable = true, myKey, gutter = [0, 20] } = props
|
|
|
const { state: userState } = useModel('useOperating.useUser')
|
|
|
const { isFell } = userState
|
|
|
const [visible, setVisible] = useState<boolean>(false)
|
|
@@ -267,11 +268,11 @@ function TableData(props: Prosp) {
|
|
|
>
|
|
|
<Row gutter={gutter}>
|
|
|
{header}
|
|
|
- <Tab {...{ size, newColumns, handelResize, columnWidth, className, isZj, totalData, rowSelection, columns, scroll, isFell, page, pageSize, dataSource, onChange, expandedRowRender, total, ajax, myKey }} />
|
|
|
+ <Tab {...{ size, newColumns, rowClassName, handelResize, columnWidth, className, isZj, totalData, rowSelection, columns, scroll, isFell, page, pageSize, dataSource, onChange, expandedRowRender, total, ajax, myKey }} />
|
|
|
</Row>
|
|
|
</Card> : <Row gutter={gutter}>
|
|
|
{header}
|
|
|
- <Tab {...{ size, newColumns, handelResize, className, isZj, columnWidth, totalData, rowSelection, columns, scroll, isFell, page, pageSize, dataSource, onChange, expandedRowRender, total, ajax, myKey }} />
|
|
|
+ <Tab {...{ size, newColumns, rowClassName, handelResize, className, isZj, columnWidth, totalData, rowSelection, columns, scroll, isFell, page, pageSize, dataSource, onChange, expandedRowRender, total, ajax, myKey }} />
|
|
|
</Row>}
|
|
|
</Col>
|
|
|
</Row >
|
|
@@ -282,7 +283,7 @@ function TableData(props: Prosp) {
|
|
|
|
|
|
/**表格 */
|
|
|
const Tab = React.memo((props: any) => {
|
|
|
- const { size, newColumns, className, handelResize, isZj, columns, scroll, columnWidth, totalData, rowSelection, isFell, page, pageSize, dataSource, onChange, expandedRowRender, total, ajax, myKey } = props
|
|
|
+ const { size, newColumns, rowClassName, className, handelResize, isZj, columns, scroll, columnWidth, totalData, rowSelection, isFell, page, pageSize, dataSource, onChange, expandedRowRender, total, ajax, myKey } = props
|
|
|
let ran = Math.ceil(Math.random() * 100)
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -342,7 +343,7 @@ const Tab = React.memo((props: any) => {
|
|
|
dataSource={dataSource}
|
|
|
scroll={scroll ? isFell ? { ...scroll, y: document.body.clientHeight - 300 } : scroll : {}}
|
|
|
onChange={(pagination: any, filters: any, sorter: any) => onChange && onChange({ pagination, filters, sortData: sorter })}
|
|
|
- rowClassName={(record: { color: string }) => style[record['color']]}
|
|
|
+ rowClassName={rowClassName}
|
|
|
columnWidth={columnWidth}
|
|
|
expandedRowRender={expandedRowRender ? expandedRowRender : undefined}
|
|
|
size={size}
|