| | |
| | | } |
| | | |
| | | render() { |
| | | let { lineMarks, data, className, ...resProps } = this.props |
| | | let { lineMarks, onDoubleClick, data, className, ...resProps } = this.props |
| | | let style = {} |
| | | |
| | | if (lineMarks && lineMarks.length > 0) { |
| | |
| | | }) |
| | | } |
| | | |
| | | return <tr {...resProps} className={className} style={style}/> |
| | | return <tr {...resProps} onDoubleClick={onDoubleClick} className={className} style={style}/> |
| | | } |
| | | } |
| | | |
| | |
| | | if (col.linkThdMenu || col.linkurl) { |
| | | content = ( |
| | | <div> |
| | | <div className="link-menu" onDoubleClick={() => this.triggerLink(col, record)}></div> |
| | | <div className="link-menu" onDoubleClick={(e) => this.triggerLink(e, col, record)}></div> |
| | | {content} |
| | | </div> |
| | | ) |
| | |
| | | if (col.linkThdMenu || col.linkurl) { |
| | | content = ( |
| | | <div> |
| | | <div className="link-menu" onDoubleClick={() => this.triggerLink(col, record)}></div> |
| | | <div className="link-menu" onDoubleClick={(e) => this.triggerLink(e, col, record)}></div> |
| | | {content} |
| | | </div> |
| | | ) |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { menuType, memberLevel, setting, fields } = this.props |
| | | let columns = fromJS(this.props.columns).toJS() |
| | | let _columns = [] |
| | | const { menuType, memberLevel, setting, fields, columns } = this.props |
| | | let radio = 5 // 虚化比例 |
| | | let _format = false // 是否虚化处理 |
| | | let rowspans = [] |
| | |
| | | } |
| | | } |
| | | |
| | | columns.forEach(item => { |
| | | if (item.hidden === true || item.Hide === 'true') return |
| | | let cell = null |
| | | |
| | | if (item.type === 'colspan') { |
| | | cell = {title: item.label, children: []} |
| | | |
| | | item.subcols.forEach(col => { |
| | | if (col.rowspan === 'true') { |
| | | rowspans.push(col.field) |
| | | 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)) { |
| | | col.blur = true |
| | | item.blur = true |
| | | } |
| | | |
| | | if (col.marks && col.marks.length === 0) { |
| | | col.marks = '' |
| | | |
| | | if (item.marks && item.marks.length === 0) { |
| | | item.marks = '' |
| | | } |
| | | |
| | | cell.children.push({ |
| | | align: col.Align, |
| | | title: col.label, |
| | | dataIndex: col.field || col.uuid, |
| | | key: col.uuid, |
| | | width: col.Width || 120, |
| | | |
| | | cell = { |
| | | align: item.Align, |
| | | dataIndex: item.uuid, |
| | | title: item.label, |
| | | sorter: item.field && item.IsSort === 'true', |
| | | width: item.Width || 120, |
| | | onCell: record => ({ |
| | | record, |
| | | col, |
| | | config: col.type === 'custom' ? {setting, columns: fields} : null, |
| | | col: item, |
| | | config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, |
| | | triggerLink: this.triggerLink, |
| | | updateStatus: this.updateStatus |
| | | }) |
| | | }) |
| | | }) |
| | | } else { |
| | | if (item.rowspan === 'true') { |
| | | rowspans.push(item.field) |
| | | } |
| | | } |
| | | if (_format && !Math.floor(Math.random() * radio)) { |
| | | item.blur = true |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | if (item.marks && item.marks.length === 0) { |
| | | item.marks = '' |
| | | } |
| | | |
| | | cell = { |
| | | align: item.Align, |
| | | dataIndex: item.field || 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 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | _columns.push(cell) |
| | | }) |
| | | let _columns = getColumns(columns) |
| | | |
| | | if (rowspans.length === 0) { |
| | | rowspans = null |
| | |
| | | } |
| | | |
| | | // 字段透视 |
| | | triggerLink = (item, record) => { |
| | | triggerLink = (e, item, record) => { |
| | | const { tabviews, MenuID } = this.props |
| | | e.stopPropagation() |
| | | |
| | | if (item.linkThdMenu) { |
| | | let tabmenu = item.linkThdMenu |
| | |
| | | }) |
| | | } |
| | | |
| | | 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 } = this.state |
| | |
| | | lineMarks, |
| | | data: record, |
| | | className: index === activeIndex ? ' mk-row-active ' : '', |
| | | onClick: () => {this.changeRow(record, index)} |
| | | onClick: () => {this.changeRow(record, index)}, |
| | | onDoubleClick: () => {this.doubleClickLine(record)} |
| | | } |
| | | }} |
| | | onChange={this.changeTable} |