src/tabviews/custom/components/table/edit-table/index.jsx
@@ -61,6 +61,14 @@ BID = BData.$BID || '' } if (setting.controlField) { if (setting.controlVal) { setting.controlVal = setting.controlVal.split(',') } else { setting.controlVal = [''] } } _config.submit.style = _config.submit.style || {} _config.submit.wrapStyle = {} setting.hasAction = _config.action.length > 0 @@ -494,6 +502,12 @@ }) } if (setting.controlField) { if (setting.controlVal.includes(item[setting.controlField] + '')) { item.$disabled = true } } return item }) @@ -594,6 +608,12 @@ }) } if (setting.controlField) { if (setting.controlVal.includes(_data[setting.controlField] + '')) { _data.$disabled = true } } data = data.map(item => { if (item.$$uuid === _data.$$uuid) { _data.key = item.key src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -623,6 +623,10 @@ let style = {} let className = '' if (data && data.$disabled) { className = className + ' mk-disabled ' } lineMarks && lineMarks.some(mark => { let originVal = data[mark.field[0]] + '' let contrastVal = '' @@ -2770,24 +2774,48 @@ /** * @description 选中行 */ onSelectChange = selectedRowKeys => { this.setState({ selectedRowKeys }) onSelectChange = (selectedRowKeys, keys) => { const { setting } = this.props let activeId = '' if (selectedRowKeys.length > 0) { activeId = selectedRowKeys.slice(-1)[0] if (setting.controlField && selectedRowKeys.length > 0) { let newkeys = keys.filter(item => !item.$disabled).map(item => item.$$uuid) this.setState({ selectedRowKeys: newkeys }) let activeId = '' if (newkeys.length > 0) { activeId = newkeys.slice(-1)[0] } this.changedata(activeId) this.selectdata(newkeys) } else { this.setState({ selectedRowKeys }) let activeId = '' if (selectedRowKeys.length > 0) { activeId = selectedRowKeys.slice(-1)[0] } this.changedata(activeId) this.selectdata(selectedRowKeys) } this.changedata(activeId) this.selectdata(selectedRowKeys) // this.setState({ selectedRowKeys }) // let activeId = '' // if (selectedRowKeys.length > 0) { // activeId = selectedRowKeys.slice(-1)[0] // } // this.changedata(activeId) // this.selectdata(selectedRowKeys) } /** * @description 点击整行,触发切换, 判断是否可选,单选或多选,进行对应操作 */ changeRow = (id) => { changeRow = (record) => { const { setting } = this.props if (!setting.tableType) return if (!setting.tableType || record.$disabled) return let id = record.$$uuid let newkeys = fromJS(this.state.selectedRowKeys).toJS() @@ -2938,12 +2966,12 @@ dataSource={_data} loading={this.props.loading} scroll={{ x: '100%', y: height }} onRow={(record, index) => { onRow={(record, _) => { return { lineMarks, title: setting.tipField ? record[setting.tipField] : '', data: record, onClick: () => {this.changeRow(record.$$uuid)}, onClick: () => {this.changeRow(record)}, } }} onChange={this.changeTable} src/tabviews/custom/components/table/edit-table/normalTable/index.scss
@@ -25,6 +25,35 @@ font-size: 10px; } .mk-disabled { .ant-table-selection-column { .ant-checkbox-wrapper { cursor: not-allowed; .ant-checkbox-inner { cursor: not-allowed; background-color: #fff!important; border-color: #d9d9d9!important; } input { cursor: not-allowed; } } .ant-radio-wrapper { cursor: not-allowed; .ant-radio-inner { cursor: not-allowed; background-color: #fff!important; border-color: #d9d9d9!important; } input { cursor: not-allowed; } } } } table { max-width: 100%; width: 100%; @@ -166,6 +195,7 @@ left: 0px; right: 0px; bottom: 0px; min-width: auto!important; } .has-error, .has-error .ant-input-number-input { border-color: #ff4d4f!important; @@ -202,6 +232,7 @@ .ant-calendar-picker { display: block; height: 30px; min-width: auto!important; } .has-error, .has-error .ant-input-number-input { border-color: #ff4d4f!important;