From fb3ec146a9e1444ece749d0bcf232a554e933fb0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 17 五月 2022 22:56:16 +0800 Subject: [PATCH] Merge branch 'develop' --- src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 119 +++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 75 insertions(+), 44 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 7063ebe..a628ea3 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -395,7 +395,7 @@ content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } - content = col.prefix + content + col.postfix + content = (col.prefix || '') + content + (col.postfix || '') } if (col.marks) { @@ -435,7 +435,7 @@ } if (content) { - content = col.prefix + content + col.postfix + content = (col.prefix || '') + content + (col.postfix || '') } children = ( @@ -769,7 +769,7 @@ content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } - content = col.prefix + content + col.postfix + content = (col.prefix || '') + content + (col.postfix || '') } if (col.marks) { @@ -794,7 +794,7 @@ } if (content) { - content = col.prefix + content + col.postfix + content = (col.prefix || '') + content + (col.postfix || '') } children = ( @@ -873,7 +873,6 @@ lineMarks: PropTypes.any, // 琛屾爣璁� fields: PropTypes.array, // 缁勪欢瀛楁闆� BID: PropTypes.any, // 涓昏〃ID - data: PropTypes.any, // 琛ㄦ牸鏁版嵁 total: PropTypes.any, // 鎬绘暟 loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� @@ -964,12 +963,12 @@ }) } - if (setting.borderColor) { // 杈规棰滆壊 - let style = `#${setting.tableId} table, #${setting.tableId} tr, #${setting.tableId} th, #${setting.tableId} td {border-color: ${setting.borderColor}}` - let ele = document.createElement('style') - ele.innerHTML = style - document.getElementsByTagName('head')[0].appendChild(ele) - } + // if (setting.borderColor) { // 杈规棰滆壊 + // let style = `#${setting.tableId} table, #${setting.tableId} tr, #${setting.tableId} th, #${setting.tableId} td {border-color: ${setting.borderColor}}` + // let ele = document.createElement('style') + // ele.innerHTML = style + // document.getElementsByTagName('head')[0].appendChild(ele) + // } let size = (setting.pageSize || 10) + '' let pageOptions = ['10', '25', '50', '100', '500', '1000'] @@ -992,6 +991,12 @@ if (deForms.length > 0) { this.improveActionForm(deForms) } + + const element = document.getElementById(setting.tableId) + element && element.style.setProperty('--mk-table-border-color', setting.borderColor || '#e8e8e8') + element && element.style.setProperty('--mk-table-color', setting.color || 'rgba(0, 0, 0, 0.65)') + element && element.style.setProperty('--mk-table-font-size', setting.fontSize || '14px') + element && element.style.setProperty('--mk-table-font-weight', setting.fontWeight || 'normal') }) } @@ -1239,6 +1244,10 @@ } else if (setting.addable === 'true') { setTimeout(() => { this.plusLine() + }, 10) + } else if (edData[index]) { + setTimeout(() => { + this.subLine(col, edData[index]) }, 10) } } @@ -1831,7 +1840,7 @@ } pickupChange = () => { - const { submit, MenuID } = this.props + const { submit, MenuID, setting } = this.props const { data } = this.state let pickup = !this.state.pickup @@ -1845,7 +1854,7 @@ return } - if (!pickup && !is(fromJS(data), fromJS(this.state.edData))) { + if (!pickup && this.state.edData.filter(item => !item.$origin).length > 0) { const _this = this confirm({ title: '鏁版嵁宸蹭慨鏀癸紝纭畾鏀惧純淇濆瓨鍚楋紵', @@ -1866,18 +1875,32 @@ } else { pickup && MKEmitter.emit('resetSelectLine', MenuID, '', '') pickup && this.props.chgSelectData([]) + let keys = this.state.selectedRowKeys this.setState({ data: [], edData: [], + selectedRowKeys: [], pickup, loading: false, editable: false }, () => { - this.setState({ - data: data, - edData: pickup ? fromJS(data).toJS() : [] - }) + if (pickup && setting.tableType === 'checkbox' && keys.length > 0) { + this.setState({ + data: data, + edData: fromJS(data).toJS().filter(item => { + item.$origin = false + + return keys.includes(item.$$uuid) + }) + }) + } else { + this.setState({ + data: data, + edData: pickup ? fromJS(data).toJS() : [] + }) + } }) + } this.props.changeLock(pickup) } @@ -1934,33 +1957,41 @@ let height = setting.height || false return ( - <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${setting.operType || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}> - <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" disabled={loading || this.props.loading} checked={pickup} onChange={this.pickupChange} /> - {pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null} - <Table - rowKey="$$uuid" - components={components} - style={setting.style} - size={setting.size || 'middle'} - bordered={setting.bordered !== 'false'} - rowSelection={rowSelection} - columns={_columns} - dataSource={_data} - loading={this.props.loading} - scroll={{ x: '100%', y: height }} - onRow={(record, index) => { - return { - lineMarks, - data: record, - onClick: () => {this.changeRow(record.$$uuid)}, - } - }} - onChange={this.changeTable} - pagination={_pagination} - /> - {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null} - {pickup && setting.addable === 'true' ? <Button className="mk-add-line" onClick={() => this.addLine()} disabled={this.props.loading} type="link"><PlusOutlined /></Button> : null} - </div> + <> + {submit.hasAction && pickup ? <div className="edit-custom-table-leftbtn-wrap"> + <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> + </div> : null} + <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}> + {!submit.hasAction && pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null} + <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" disabled={loading || this.props.loading} checked={pickup} onChange={this.pickupChange} /> + </div> + <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${setting.operType || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}> + <Table + rowKey="$$uuid" + components={components} + // style={setting.style} + size={setting.size || 'middle'} + bordered={setting.bordered !== 'false'} + rowSelection={rowSelection} + columns={_columns} + dataSource={_data} + loading={this.props.loading} + scroll={{ x: '100%', y: height }} + onRow={(record, index) => { + return { + lineMarks, + data: record, + onClick: () => {this.changeRow(record.$$uuid)}, + } + }} + onChange={this.changeTable} + pagination={_pagination} + /> + {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null} + {pickup && setting.addable === 'true' ? <Button className="mk-add-line" onClick={() => this.addLine()} disabled={this.props.loading} type="link"><PlusOutlined /></Button> : null} + {pickup && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-footer-table" type="link">鎻愪氦</Button> : null} + </div> + </> ) } } -- Gitblit v1.8.0