From 265102e3b6c9865f0e9f1e035e7b1aba281dc8c1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 03 十二月 2019 15:33:16 +0800 Subject: [PATCH] 2019-12-03 --- src/tabviews/commontable/mainTable/index.jsx | 58 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/tabviews/commontable/mainTable/index.jsx b/src/tabviews/commontable/mainTable/index.jsx index 92f7b68..b17fb94 100644 --- a/src/tabviews/commontable/mainTable/index.jsx +++ b/src/tabviews/commontable/mainTable/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' // import { is, fromJS } from 'immutable' -import { Table, message, Affix } from 'antd' +import { Table, message, Affix, Button } from 'antd' import './index.scss' export default class MainTable extends Component { @@ -38,15 +38,16 @@ sorter: item.field && item.IsSort === 'true', width: item.Width || 120, render: (text, record) => { - let content = '' - if (item.field) { - content = record[item.field] || '' - } - return ( - <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> - {content} - </div> - ) + return this.getContent(item, record) + // let content = '' + // if (item.field) { + // content = record[item.field] || '' + // } + // return ( + // <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> + // {content} + // </div> + // ) } } _columns.push(cell) @@ -56,6 +57,43 @@ this.setState({columns: _columns}) } + getContent = (item, record) => { + if (item.type === 'operation') { + return ( + <div className={item.style} style={{ minWidth: (item.Width || 120) + 'px' }}> + {item.operations.map(btn => { + return <Button + className={'mk-btn mk-' + btn.class} + icon={btn.icon} + key={btn.uuid} + onClick={(e) => {this.actionTrigger(e, btn, record)}} + >{btn.label}</Button> + })} + </div> + ) + } else { + let content = '' + if (item.field) { + content = record[item.field] || '' + } + return ( + // <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> + <div> + <div className={'background'}></div> + <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> + {content} + </div> + </div> + ) + } + } + + actionTrigger = (e, btn, record) => { + e.stopPropagation() + console.log(btn) + console.log(record) + } + copycontent = (e, content) => { // 琛ㄦ牸涓唴瀹瑰鍒� e.stopPropagation() -- Gitblit v1.8.0