From b816a38598a2b96f244ba1aacec05f7071b1a803 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 26 三月 2021 16:09:56 +0800 Subject: [PATCH] 2021-03-26 --- src/tabviews/custom/components/share/normalTable/index.jsx | 62 ++++++++++++------------------ 1 files changed, 25 insertions(+), 37 deletions(-) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 65f1256..c3d2d10 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}/>) @@ -201,11 +201,11 @@ 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> + <div className="link-menu" onDoubleClick={(e) => triggerLink(e, col, record)}></div> {content} </div> ) @@ -248,10 +248,14 @@ 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> + <div className="link-menu" onDoubleClick={(e) => triggerLink(e, col, record)}></div> {content} </div> ) @@ -347,12 +351,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,7 +380,6 @@ loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 - refreshbyaction: PropTypes.func, // 鎸夐挳鎵ц瀹屾垚鍚庡埛鏂� } state = { @@ -442,8 +445,7 @@ record, col: item, config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, - triggerLink: this.triggerLink, - updateStatus: this.updateStatus + triggerLink: this.triggerLink }) } } @@ -500,15 +502,9 @@ 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 + const { tabviews } = this.props e.stopPropagation() if (item.linkThdMenu) { @@ -522,27 +518,19 @@ tabmenu.selected = true - let index = 0 - let isexit = false - let tabs = tabviews.map((tab, i) => { + let tabs = tabviews.filter((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 + return tab.MenuID !== tabmenu.MenuID }) - if (!isexit) { - tabs.splice(index + 1, 0, tabmenu) + if (tabviews.length > tabs.length) { + this.props.modifyTabview(fromJS(tabs).toJS()) } - this.props.modifyTabview(tabs) + this.setState({}, () => { + tabs.push(tabmenu) + this.props.modifyTabview(tabs) + }) } else { let src = item.linkurl @@ -581,7 +569,7 @@ index = selectedRowKeys.slice(-1)[0] } - if (setting.tableType === 'checkbox') { + if (setting.tableType === 'checkbox' || setting.tableType === 'radio') { _activeIndex = index === '' ? null : index } @@ -607,7 +595,7 @@ if (setting.tableType === 'radio') { newkeys = [index] this.changedata(index) - this.setState({ selectedRowKeys: newkeys }) + this.setState({ selectedRowKeys: newkeys, activeIndex: index }) } else { let _index = '' if (newkeys.includes(index)) { @@ -697,13 +685,13 @@ let preItem = data[index - 1] rowspans.forEach((cell, i) => { if (i === 0) { - if ((item[cell] || item[cell] === 0) && preItem[cell] === item[cell]) { + if (preItem[cell] === item[cell]) { item['$' + cell] = preItem['$' + cell] + 1 } else { item['$' + cell] = 1 } } else { - if ((item[cell] || item[cell] === 0) && preItem[cell] === item[cell]) { + if (preItem[cell] === item[cell]) { item['$' + cell] = preItem['$' + cell] + 1 } else { item['$' + cell] = 1 @@ -803,8 +791,8 @@ <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