From 80deba0c2dcffd9e6b6f07815c7c52199309ce42 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 23 六月 2025 17:36:03 +0800 Subject: [PATCH] 2025-06-23 --- src/tabviews/custom/components/table/edit-table/normalTable/index.scss | 31 +++++++++++++++ src/tabviews/custom/components/table/edit-table/index.jsx | 20 ++++++++++ src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 50 +++++++++++++++++++----- 3 files changed, 90 insertions(+), 11 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 7f9b250..001ecdf 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/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 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 8415ed3..c65b69c 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/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} diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss index 1573c0b..cb83614 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss +++ b/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; -- Gitblit v1.8.0