From 38b5297cbfbe3d61ee2e800b51e8324ee163f43e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 18 一月 2021 12:24:50 +0800 Subject: [PATCH] 2021-01-18 --- src/tabviews/custom/components/share/normalTable/index.jsx | 40 +++++++++++++++++++++++++--------------- 1 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 5d403fe..e75297d 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -170,7 +170,7 @@ } render() { - let { col, config, record, className, style, triggerLink, updateStatus, ...resProps } = this.props + let { col, config, record, className, style, triggerLink, ...resProps } = this.props if (!col) return (<td {...resProps} className={className} style={style}/>) @@ -347,12 +347,12 @@ } else if (col.type === 'custom') { style.padding = '0px' resProps.children = ( - <CardCellComponent data={record} cards={config} elements={col.elements} updateStatus={this.props.updateStatus}/> + <CardCellComponent data={record} cards={config} elements={col.elements}/> ) } else if (col.type === 'action') { style.padding = '0px 5px' resProps.children = ( - <CardCellComponent data={record} cards={config} elements={col.elements} updateStatus={this.props.updateStatus}/> + <CardCellComponent data={record} cards={config} elements={col.elements}/> ) } @@ -376,11 +376,11 @@ 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, // 姣忛〉鏁版嵁鏉℃暟 @@ -441,8 +441,7 @@ record, col: item, config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, - triggerLink: this.triggerLink, - updateStatus: this.updateStatus + triggerLink: this.triggerLink }) } } @@ -457,9 +456,26 @@ 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 }) } @@ -480,12 +496,6 @@ return } MKEmitter.removeListener('resetTable', this.resetTable) - } - - updateStatus = (type, positon, btn) => { - if (type === 'refresh') { - this.props.refreshbyaction(positon, btn) - } } // 瀛楁閫忚 @@ -733,7 +743,7 @@ render() { const { setting, statFValue, lineMarks, data } = this.props - const { selectedRowKeys, activeIndex, pickup } = this.state + const { selectedRowKeys, activeIndex, pickup, tableId } = this.state // 璁剧疆琛ㄦ牸閫夋嫨灞炴�э細鍗曢�夈�佸閫夈�佷笉鍙�� let rowSelection = null @@ -780,13 +790,13 @@ } return ( - <div className="normal-custom-table"> + <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} + size={setting.size || 'middle'} bordered={setting.bordered !== 'false'} rowSelection={rowSelection} columns={this.state.columns} -- Gitblit v1.8.0