import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import md5 from 'md5'
|
import { connect } from 'react-redux'
|
import { is, fromJS } from 'immutable'
|
import { Table, Typography, Icon, Col, Switch } from 'antd'
|
|
import { modifyTabview } from '@/store/action'
|
import asyncComponent from '@/utils/asyncComponent'
|
import MKEmitter from '@/utils/events.js'
|
import zhCN from '@/locales/zh-CN/main.js'
|
import enUS from '@/locales/en-US/main.js'
|
import '@/assets/css/table.scss'
|
import './index.scss'
|
|
const { Paragraph } = Typography
|
const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
|
|
class BodyRow extends React.Component {
|
shouldComponentUpdate (nextProps, nextState) {
|
return !is(fromJS(this.props.data), fromJS(nextProps.data)) || !is(fromJS(this.props.className), fromJS(nextProps.className))
|
}
|
|
render() {
|
let { lineMarks, onDoubleClick, data, className, ...resProps } = this.props
|
let style = {}
|
|
if (lineMarks && lineMarks.length > 0) {
|
lineMarks.some(mark => {
|
let originVal = data[mark.field[0]] + ''
|
let contrastVal = ''
|
let result = false
|
|
if (mark.field[1] === 'static') {
|
contrastVal = mark.contrastValue + ''
|
} else {
|
contrastVal = data[mark.field[2]] + ''
|
}
|
|
if (mark.match === '=') {
|
result = originVal === contrastVal
|
} else if (mark.match === '!=') {
|
result = originVal !== contrastVal
|
} else if (mark.match === 'like') {
|
result = originVal.indexOf(contrastVal) > -1
|
} else if (mark.match === '>') {
|
try {
|
originVal = parseFloat(originVal)
|
contrastVal = parseFloat(contrastVal)
|
} catch {
|
originVal = NaN
|
}
|
|
if (!isNaN(originVal) && !isNaN(contrastVal) && originVal > contrastVal) {
|
result = true
|
}
|
} else if (mark.match === '<') {
|
try {
|
originVal = parseFloat(originVal)
|
contrastVal = parseFloat(contrastVal)
|
} catch {
|
originVal = NaN
|
}
|
|
if (!isNaN(originVal) && !isNaN(contrastVal) && originVal < contrastVal) {
|
result = true
|
}
|
}
|
|
if (result) {
|
if (mark.signType[0] === 'font') {
|
style.color = mark.color
|
} else if (mark.signType[0] === 'background') {
|
style.background = mark.color
|
if (mark.fontColor) {
|
style.color = mark.fontColor
|
}
|
className += className + ' background'
|
} else if (mark.signType[0] === 'underline') {
|
style.textDecoration = 'underline'
|
style.color = mark.color
|
} else if (mark.signType[0] === 'line-through') {
|
style.textDecoration = 'line-through'
|
style.color = mark.color
|
}
|
}
|
|
return result
|
})
|
}
|
|
return <tr {...resProps} onDoubleClick={onDoubleClick} className={className} style={style}/>
|
}
|
}
|
|
class BodyCell extends React.Component {
|
getMark = (record, marks, style, content) => {
|
marks.some(mark => {
|
let originVal = record[mark.field[0]] + ''
|
let contrastVal = ''
|
let result = false
|
|
if (mark.field[1] === 'static') {
|
contrastVal = mark.contrastValue + ''
|
} else {
|
contrastVal = record[mark.field[2]] + ''
|
}
|
|
if (mark.match === '=') {
|
result = originVal === contrastVal
|
} else if (mark.match === '!=') {
|
result = originVal !== contrastVal
|
} else if (mark.match === 'like') {
|
result = originVal.indexOf(contrastVal) > -1
|
} else if (mark.match === '>') {
|
try {
|
originVal = parseFloat(originVal)
|
contrastVal = parseFloat(contrastVal)
|
} catch {
|
originVal = NaN
|
}
|
|
if (!isNaN(originVal) && !isNaN(contrastVal) && originVal > contrastVal) {
|
result = true
|
}
|
} else if (mark.match === '<') {
|
try {
|
originVal = parseFloat(originVal)
|
contrastVal = parseFloat(contrastVal)
|
} catch {
|
originVal = NaN
|
}
|
|
if (!isNaN(originVal) && !isNaN(contrastVal) && originVal < contrastVal) {
|
result = true
|
}
|
}
|
|
if (result) {
|
if (mark.signType[0] === 'font') {
|
style.color = mark.color
|
} else if (mark.signType[0] === 'background') {
|
style.background = mark.color
|
if (mark.fontColor) {
|
style.color = mark.fontColor
|
}
|
} else if (mark.signType[0] === 'underline') {
|
style.textDecoration = 'underline'
|
style.color = mark.color
|
} else if (mark.signType[0] === 'line-through') {
|
style.textDecoration = 'line-through'
|
style.color = mark.color
|
} else if (mark.signType[0] === 'icon') {
|
let icon = (<Icon style={{color: mark.color}} type={mark.signType[3]} />)
|
if (mark.signType[1] === 'front') {
|
content = <span>{icon} {content}</span>
|
} else {
|
content = <span>{content} {icon}</span>
|
}
|
}
|
}
|
return result
|
})
|
|
return content
|
}
|
|
shouldComponentUpdate (nextProps, nextState) {
|
return !nextProps.record || !is(fromJS(this.props.record), fromJS(nextProps.record))
|
}
|
|
render() {
|
let { col, config, record, className, style, triggerLink, updateStatus, ...resProps } = this.props
|
|
if (!col) return (<td {...resProps} className={className} style={style}/>)
|
|
if (col.type === 'text') {
|
let content = ''
|
if (record[col.field] !== undefined) {
|
content = `${record[col.field]}`
|
}
|
|
if (content !== '') {
|
if (col.textFormat === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(content)) {
|
content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}`
|
} else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) {
|
content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}`
|
}
|
|
content = col.prefix + content + col.postfix
|
}
|
|
if (col.marks) {
|
style = style || {}
|
content = this.getMark(record, col.marks, style, content)
|
}
|
if (col.blur) {
|
content = md5(content)
|
}
|
|
if (col.rowspan === 'true') {
|
resProps.rowSpan = record['$$' + col.field]
|
}
|
|
if (col.linkThdMenu || col.linkurl) {
|
content = (
|
<div>
|
<div className="link-menu" onDoubleClick={(e) => this.triggerLink(e, col, record)}></div>
|
{content}
|
</div>
|
)
|
}
|
|
resProps.children = content
|
} else if (col.type === 'number') {
|
let content = ''
|
try {
|
content = parseFloat(record[col.field])
|
if (isNaN(content)) {
|
content = ''
|
}
|
} catch {
|
content = ''
|
}
|
|
if (content !== '') {
|
let decimal = col.decimal || 0
|
if (col.format === 'percent') {
|
content = content * 100
|
decimal = decimal > 2 ? decimal - 2 : 0
|
}
|
|
content = content.toFixed(decimal)
|
|
if (col.format === 'thdSeparator') {
|
content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
|
}
|
|
content = col.prefix + content + col.postfix
|
}
|
|
if (col.marks) {
|
style = style || {}
|
content = this.getMark(record, col.marks, style, content)
|
}
|
|
if (col.blur) {
|
content = md5(content)
|
}
|
|
if (col.linkThdMenu || col.linkurl) {
|
content = (
|
<div>
|
<div className="link-menu" onDoubleClick={(e) => this.triggerLink(e, col, record)}></div>
|
{content}
|
</div>
|
)
|
}
|
|
resProps.children = content
|
} else if (col.type === 'picture') {
|
let photos = ''
|
if (record[col.field]) {
|
photos = `${record[col.field]}`
|
photos = photos.split(',')
|
}
|
|
let cols = 24 / (col.picSort || 1)
|
let paddingTop = '100%'
|
|
if (col.lenWidRadio === '16:9') {
|
paddingTop = '56.25%'
|
} else if (col.lenWidRadio === '3:2') {
|
paddingTop = '66.67%'
|
} else if (col.lenWidRadio === '4:3') {
|
paddingTop = '75%'
|
}
|
|
resProps.children = (
|
<div>
|
{photos.map((url, i) => (
|
<Col key={i} span={cols}>
|
<div className="ant-mk-picture" style={{paddingTop, backgroundImage: `url('${url}')`}}></div>
|
</Col>
|
))}
|
</div>
|
)
|
} else if (col.type === 'textarea') {
|
let content = ''
|
if (record[col.field] !== undefined) {
|
content = `${record[col.field]}`
|
}
|
|
if (content) {
|
content = col.prefix + content + col.postfix
|
}
|
|
if (col.blur) {
|
content = md5(content)
|
}
|
|
resProps.children = (
|
<div>
|
{content ? <Paragraph copyable ellipsis={{ rows: 3, expandable: true }}>{content}</Paragraph> : null }
|
</div>
|
)
|
} else if (col.type === 'link') {
|
let content = ''
|
let _href = record[col.field] || ''
|
|
if (col.nameField) {
|
content = record[col.nameField] || ''
|
}
|
|
if (!content && _href) {
|
content = _href
|
} else if (!_href) {
|
content = ''
|
}
|
|
if (col.joint === 'true' && _href) {
|
let _quary = `id=${record.$$uuid}&userid=${sessionStorage.getItem('UserID')}&appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}`
|
let _param = ''
|
|
try {
|
_param = window.btoa(_quary)
|
} catch {
|
_param = window.btoa(window.encodeURIComponent(_quary))
|
}
|
|
if (/\?/ig.test(_href)) {
|
_href += '&' + _param
|
} else {
|
_href += '?' + _param
|
}
|
}
|
|
if (col.blur) {
|
content = md5(content)
|
}
|
|
resProps.children = (
|
<div>
|
{content && _href ? <a href={_href} target="_blank" rel="noopener noreferrer">{content}</a> : null }
|
</div>
|
)
|
} else if (col.type === 'custom') {
|
style.padding = '0px'
|
resProps.children = (
|
<CardCellComponent data={record} cards={config} elements={col.elements} updateStatus={this.props.updateStatus}/>
|
)
|
} else if (col.type === 'action') {
|
style.padding = '0px 5px'
|
resProps.children = (
|
<CardCellComponent data={record} cards={config} elements={col.elements} updateStatus={this.props.updateStatus}/>
|
)
|
}
|
|
if (resProps.rowSpan === 0) return null
|
return (<td {...resProps} className={className} style={style}/>)
|
}
|
}
|
|
class NormalTable extends Component {
|
static propTpyes = {
|
statFValue: PropTypes.any, // 合计字段数据
|
MenuID: PropTypes.string, // 菜单Id
|
setting: PropTypes.object, // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定)
|
columns: PropTypes.array, // 表格列
|
lineMarks: PropTypes.array, // 行标记
|
fields: PropTypes.array, // 组件字段集
|
ContainerId: PropTypes.any, // 标签页外层Id
|
BData: PropTypes.any, // 主表数据
|
data: PropTypes.any, // 表格数据
|
total: PropTypes.any, // 总数
|
loading: PropTypes.bool, // 表格加载中
|
refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新
|
chgSelectData: PropTypes.func, // 数据切换
|
refreshbyaction: PropTypes.func, // 按钮执行完成后刷新
|
}
|
|
state = {
|
dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
|
tableId: '', // 表格ID
|
selectedRowKeys: [], // 表格中选中行
|
pageIndex: 1, // 初始页面索引
|
pageSize: 10, // 每页数据条数
|
columns: null, // 显示列
|
activeIndex: null, // 标记当前选中行
|
rowspans: null, // 行合并字段信息
|
pickup: false, // 收起未选择项
|
orderfields: {} // 排序id与field转换
|
}
|
|
UNSAFE_componentWillMount () {
|
const { menuType, memberLevel, setting, fields, columns } = this.props
|
let radio = 5 // 虚化比例
|
let _format = false // 是否虚化处理
|
let rowspans = []
|
let orderfields = {}
|
|
if (window.GLOB.dataFormat && menuType !== 'HS' && memberLevel) {
|
_format = true
|
|
if (memberLevel >= 30) {
|
radio = 20
|
} else if (memberLevel >= 20) {
|
radio = 10
|
}
|
}
|
|
let getColumns = (cols) => {
|
return cols.map(item => {
|
let cell = null
|
|
if (item.type === 'colspan') {
|
cell = { title: item.label, align: item.Align }
|
cell.children = getColumns(item.subcols)
|
} else {
|
if (item.rowspan === 'true') {
|
rowspans.push(item.field)
|
}
|
if (_format && !Math.floor(Math.random() * radio)) {
|
item.blur = true
|
}
|
|
if (item.marks && item.marks.length === 0) {
|
item.marks = ''
|
}
|
|
if (item.field) {
|
orderfields[item.uuid] = item.field
|
}
|
|
cell = {
|
align: item.Align,
|
dataIndex: item.uuid,
|
title: item.label,
|
sorter: item.field && item.IsSort === 'true',
|
width: item.Width || 120,
|
onCell: record => ({
|
record,
|
col: item,
|
config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null,
|
triggerLink: this.triggerLink,
|
updateStatus: this.updateStatus
|
})
|
}
|
}
|
|
return cell
|
})
|
}
|
|
let _columns = getColumns(columns)
|
|
if (rowspans.length === 0) {
|
rowspans = null
|
}
|
|
let tableId = (() => {
|
let uuid = []
|
let _options = 'abcdefghigklmnopqrstuv'
|
for (let i = 0; i < 19; i++) {
|
uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
|
}
|
return uuid.join('')
|
}) ()
|
|
if (setting.borderColor) { // 边框颜色
|
let style = `#${tableId} table, #${tableId} tr, #${tableId} th, #${tableId} td {border-color: ${setting.borderColor}}`
|
let ele = document.createElement('style')
|
ele.innerHTML = style
|
document.getElementsByTagName('head')[0].appendChild(ele)
|
}
|
|
this.setState({
|
columns: _columns,
|
rowspans,
|
tableId,
|
orderfields
|
})
|
}
|
|
shouldComponentUpdate (nextProps, nextState) {
|
return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
|
}
|
|
componentDidMount () {
|
MKEmitter.addListener('resetTable', this.resetTable)
|
}
|
|
/**
|
* @description 组件销毁,清除state更新
|
*/
|
componentWillUnmount () {
|
this.setState = () => {
|
return
|
}
|
MKEmitter.removeListener('resetTable', this.resetTable)
|
}
|
|
updateStatus = (type, positon, btn) => {
|
if (type === 'refresh') {
|
this.props.refreshbyaction(positon, btn)
|
}
|
}
|
|
// 字段透视
|
triggerLink = (e, item, record) => {
|
const { tabviews, MenuID } = this.props
|
e.stopPropagation()
|
|
if (item.linkThdMenu) {
|
let tabmenu = item.linkThdMenu
|
|
tabmenu.param = {
|
searchkey: item.field,
|
searchval: record[item.field] || '',
|
BID: record.$$uuid
|
}
|
|
tabmenu.selected = true
|
|
let index = 0
|
let isexit = false
|
let tabs = tabviews.map((tab, i) => {
|
tab.selected = false
|
|
if (tab.MenuID === MenuID) {
|
index = i
|
} else if (tab.MenuID === tabmenu.MenuID) {
|
tab.param = tabmenu.param
|
tab.selected = true
|
isexit = true
|
}
|
|
return tab
|
})
|
|
if (!isexit) {
|
tabs.splice(index + 1, 0, tabmenu)
|
}
|
|
this.props.modifyTabview(tabs)
|
} else {
|
let src = item.linkurl
|
|
if (item.linkurl.indexOf('paramsmain/') > -1) {
|
try {
|
let _url = item.linkurl.split('paramsmain/')[0] + 'paramsmain/'
|
let _param = JSON.parse(window.decodeURIComponent(window.atob(item.linkurl.split('paramsmain/')[1])))
|
let dataparam = {
|
searchkey: item.field,
|
searchval: record[item.field] || '',
|
BID: record.$$uuid
|
}
|
_param.UserID = sessionStorage.getItem('UserID')
|
_param.LoginUID = sessionStorage.getItem('LoginUID')
|
_param.User_Name = sessionStorage.getItem('User_Name')
|
_param.param = dataparam
|
src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))
|
} catch {
|
console.warn('菜单参数解析错误!')
|
}
|
}
|
|
window.open(src)
|
}
|
}
|
|
/**
|
*
|
*/
|
onSelectChange = selectedRowKeys => {
|
const { setting } = this.props
|
|
let index = ''
|
let _activeIndex = null
|
if (selectedRowKeys.length > 0) {
|
index = selectedRowKeys.slice(-1)[0]
|
}
|
|
if (setting.tableType === 'checkbox') {
|
_activeIndex = index === '' ? null : index
|
}
|
|
this.changedata(index)
|
|
this.setState({ selectedRowKeys, activeIndex: _activeIndex })
|
|
let selects = this.props.data.filter((item, _index) => selectedRowKeys.includes(_index))
|
|
this.props.chgSelectData(selects)
|
}
|
|
/**
|
* @description 点击整行,触发切换, 判断是否可选,单选或多选,进行对应操作
|
*/
|
changeRow = (record, index) => {
|
const { setting } = this.props
|
|
if (!setting.tableType || this.state.pickup) return
|
|
let newkeys = fromJS(this.state.selectedRowKeys).toJS()
|
|
if (setting.tableType === 'radio') {
|
newkeys = [index]
|
this.changedata(index)
|
this.setState({ selectedRowKeys: newkeys })
|
} else {
|
let _index = ''
|
if (newkeys.includes(index)) {
|
newkeys = newkeys.filter(item => item !== index)
|
if (newkeys.length > 0) {
|
_index = newkeys.slice(-1)[0]
|
}
|
this.changedata(_index)
|
} else {
|
_index = index
|
newkeys.push(index)
|
this.changedata(index)
|
}
|
|
this.setState({ selectedRowKeys: newkeys, activeIndex: _index !== '' ? _index : null })
|
}
|
|
let selects = this.props.data.filter((item, _index) => newkeys.includes(_index))
|
|
this.props.chgSelectData(selects)
|
}
|
|
changeTable = (pagination, filters, sorter) => {
|
const { orderfields } = this.state
|
|
this.setState({
|
pageIndex: pagination.current,
|
pageSize: pagination.pageSize,
|
selectedRowKeys: [],
|
activeIndex: null,
|
pickup: false
|
})
|
|
sorter.field = orderfields[sorter.field] || ''
|
|
this.props.refreshdata(pagination, filters, sorter)
|
}
|
|
changedata = (index) => {
|
const { MenuID, data, setting } = this.props
|
|
let _id = ''
|
let _data = ''
|
|
if (data && data.length > 0 && index !== '') {
|
_id = data[index][setting.primaryKey] || ''
|
_data = data[index] || ''
|
}
|
|
MKEmitter.emit('resetSelectLine', MenuID, _id, _data)
|
}
|
|
resetTable = (id, repage) => {
|
const { MenuID } = this.props
|
|
if (id !== MenuID) return
|
|
if (repage === 'false') {
|
this.setState({
|
selectedRowKeys: [],
|
activeIndex: null,
|
pickup: false
|
})
|
} else {
|
this.setState({
|
pageIndex: 1,
|
selectedRowKeys: [],
|
activeIndex: null,
|
pickup: false
|
})
|
}
|
}
|
|
handleRowspan = (data) => {
|
const { rowspans } = this.state
|
|
if (!rowspans || data.length === 0) return data
|
|
data = fromJS(data).toJS()
|
data = data.reverse()
|
data.forEach((item, index) => {
|
if (index === 0) {
|
rowspans.forEach(cell => {
|
item['$' + cell] = 1
|
})
|
} else {
|
let preItem = data[index - 1]
|
rowspans.forEach((cell, i) => {
|
if (i === 0) {
|
if ((item[cell] || item[cell] === 0) && preItem[cell] === item[cell]) {
|
item['$' + cell] = preItem['$' + cell] + 1
|
} else {
|
item['$' + cell] = 1
|
}
|
} else {
|
if ((item[cell] || item[cell] === 0) && preItem[cell] === item[cell]) {
|
item['$' + cell] = preItem['$' + cell] + 1
|
} else {
|
item['$' + cell] = 1
|
}
|
if (item['$' + cell] > item['$' + rowspans[i - 1]]) {
|
item['$' + cell] = 1
|
}
|
}
|
})
|
}
|
})
|
data = data.reverse()
|
data.forEach((item, index) => {
|
if (index === 0) {
|
rowspans.forEach(cell => {
|
item['$$' + cell] = item['$' + cell]
|
})
|
} else {
|
let preItem = data[index - 1]
|
rowspans.forEach(cell => {
|
if (preItem['$' + cell] > 1) {
|
item['$$' + cell] = 0
|
} else {
|
item['$$' + cell] = item['$' + cell]
|
}
|
})
|
}
|
})
|
return data
|
}
|
|
pickupChange = () => {
|
this.setState({
|
pickup: !this.state.pickup
|
})
|
}
|
|
doubleClickLine = (record) => {
|
const { setting } = this.props
|
|
if (!setting.doubleClick) return
|
|
MKEmitter.emit('triggerBtnId', setting.doubleClick, [record])
|
}
|
|
render() {
|
const { setting, statFValue, lineMarks, data } = this.props
|
const { selectedRowKeys, activeIndex, pickup, tableId } = this.state
|
|
// 设置表格选择属性:单选、多选、不可选
|
let rowSelection = null
|
if (setting.tableType) {
|
rowSelection = {
|
selectedRowKeys,
|
type: (setting.tableType === 'radio') ? 'radio' : 'checkbox',
|
onChange: this.onSelectChange
|
}
|
}
|
|
const components = {
|
body: {
|
row: BodyRow,
|
cell: BodyCell
|
}
|
}
|
|
// 数据收起时,过滤已选数据
|
let _data = data || []
|
|
if (pickup) {
|
_data = _data.filter((item, index) => selectedRowKeys.includes(index))
|
}
|
|
_data = this.handleRowspan(_data)
|
|
let _pagination = false
|
if (setting.laypage !== 'false' && setting.laypage !== false) {
|
_pagination = {
|
current: this.state.pageIndex,
|
pageSize: this.state.pageSize,
|
pageSizeOptions: ['10', '25', '50', '100', '500', '1000'],
|
showSizeChanger: true,
|
total: this.props.total || 0,
|
showTotal: (total, range) => `${range[0]}-${range[1]} ${this.state.dict['main.pagination.of']} ${total} ${this.state.dict['main.pagination.items']}`
|
}
|
}
|
|
let _footer = ''
|
|
if (statFValue && statFValue.length > 0) {
|
_footer = statFValue.map(f => `${f.label}(合计):${f.value}`).join(';')
|
}
|
|
return (
|
<div className={'normal-custom-table ' + setting.tableHeader} id={tableId}>
|
{(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ?
|
<Switch title="收起" className="main-pickup" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null
|
}
|
<Table
|
size="middle"
|
components={components}
|
bordered={setting.bordered !== 'false'}
|
rowSelection={rowSelection}
|
columns={this.state.columns}
|
dataSource={_data}
|
loading={this.props.loading}
|
scroll={{ x: '100%', y: false }}
|
onRow={(record, index) => {
|
return {
|
lineMarks,
|
data: record,
|
className: index === activeIndex ? ' mk-row-active ' : '',
|
onClick: () => {this.changeRow(record, index)},
|
onDoubleClick: () => {this.doubleClickLine(record)}
|
}
|
}}
|
onChange={this.changeTable}
|
pagination={_pagination}
|
/>
|
{_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null}
|
</div>
|
)
|
}
|
}
|
|
const mapStateToProps = (state) => {
|
return {
|
menuType: state.editLevel,
|
tabviews: state.tabviews,
|
memberLevel: state.memberLevel
|
}
|
}
|
|
const mapDispatchToProps = (dispatch) => {
|
return {
|
modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
|
}
|
}
|
|
export default connect(mapStateToProps, mapDispatchToProps)(NormalTable)
|