From 213c70792e6af7f9ccef17d778c5f8806fbd513c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 28 十一月 2019 15:01:24 +0800 Subject: [PATCH] 2019-11-28-01 --- src/tabviews/commontable/mainTable/index.jsx | 43 +++++++++++++++++++++++++++++++------------ 1 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/tabviews/commontable/mainTable/index.jsx b/src/tabviews/commontable/mainTable/index.jsx index 30f6f7f..6dfe35e 100644 --- a/src/tabviews/commontable/mainTable/index.jsx +++ b/src/tabviews/commontable/mainTable/index.jsx @@ -23,22 +23,39 @@ selectedRowKeys: [], pageIndex: 1, pageSize: 10, - columns: this.props.columns.map((item, index) => { - return { + columns: null + } + + UNSAFE_componentWillMount () { + const { columns } = this.props + let _columns = [] + columns.forEach((item, index) => { + // console.log(item) + if (item.Hide === 'true') return + + let cell = { align: item.Align, - dataIndex: item.field, + dataIndex: item.uuid, title: item.label, - // fixed: index < 3, sorter: item.IsSort === 'true', width: item.Width || 120, - render: (text, record) => ( - <div style={{ wordWrap: 'break-word', wordBreak: 'break-word', minWidth: (item.Width || 120) + 'px' }}> - {text} - {/* {item.FieldName === 'MenuNo' ? <Icon onClick={(e) => {this.copycontent(e, record[item.FieldName])}} type="copy"/> : ''} */} - </div> - ) + render: (text, 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) }) + // {item.FieldName === 'MenuNo' ? <Icon onClick={(e) => {this.copycontent(e, record[item.FieldName])}} type="copy"/> : ''} + + this.setState({columns: _columns}) } copycontent = (e, content) => { @@ -60,12 +77,14 @@ changeRow = (record, index) => { // 鐐瑰嚮鏁磋锛岃Е鍙戝垏鎹紝鍒ゆ柇鏄惁鍙�夛紝鍗曢�夋垨澶氶�夛紝杩涜瀵瑰簲鎿嶄綔 - if (!this.props.select || !this.props.select.selectable) return + console.log(index) + if (!this.props.setting.tableType) return let newkeys = JSON.parse(JSON.stringify(this.state.selectedRowKeys)) + console.log(newkeys) let _re = newkeys.includes(index) - if (this.props.select.selectType === 'radio') { + if (this.props.setting.tableType === 'radio') { this.setState({ selectedRowKeys: [index] }) } else { if (_re) { -- Gitblit v1.8.0