From bde2916433c7830e2879e6524e32b9f6c8bd0bab Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 02 一月 2022 16:31:32 +0800 Subject: [PATCH] 2022-01-02 --- src/tabviews/custom/components/table/normal-table/index.jsx | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 63af99d..9e5dac6 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -58,6 +58,15 @@ let _cols = new Map() let _data = null let _sync = _config.setting.sync === 'true' + + if (_config.wrap.controlField) { + if (_config.wrap.controlVal) { + _config.wrap.controlVal = _config.wrap.controlVal.split(',') + } else { + _config.wrap.controlVal = [''] + } + } + let setting = {..._config.setting, ..._config.wrap, style: {}} if (setting.selected !== 'always' && setting.selected !== 'init') { @@ -79,6 +88,13 @@ item.$$BID = BID || '' item.$$BData = BData || '' item.$Index = index + 1 + '' + + if (setting.controlField) { + if (setting.controlVal.includes(item[setting.controlField])) { + item.$disabled = true + } + } + return item }) @@ -119,6 +135,8 @@ if (_config.wrap.collapse === 'true') { _config.wrap.title = _config.wrap.title || ' ' } + + _config.style = _config.style || {} this.setState({ pageSize: setting.pageSize || 10, @@ -219,6 +237,13 @@ item.$$BID = BID || '' item.$$BData = BData || '' item.$Index = start + index + '' + + if (setting.controlField) { + if (setting.controlVal.includes(item[setting.controlField])) { + item.$disabled = true + } + } + return item }), selectedData: [], @@ -537,6 +562,13 @@ item.$$BID = BID || '' item.$$BData = BData || '' item.$Index = index + 1 + '' + + if (setting.controlField) { + if (setting.controlVal.includes(item[setting.controlField])) { + item.$disabled = true + } + } + return item }) @@ -583,10 +615,15 @@ } render() { - const { BID, setting, searchlist, actions, config, columns, selectedData, BData } = this.state + const { BID, setting, searchlist, actions, config, columns, selectedData, BData, data } = this.state + + let style = {...config.style} + if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) { + style.display = 'none' + } return ( - <div className="custom-normal-table" style={config.style}> + <div className="custom-normal-table" style={style}> {config.wrap.collapse === 'true' ? <Collapse bordered={false} defaultActiveKey="1" expandIconPosition="right"> <Panel forceRender={true} header={<NormalHeader config={config}/>} key="1"> {searchlist && searchlist.length ? @@ -605,7 +642,7 @@ setting={setting} columns={columns} MenuID={config.uuid} - data={this.state.data} + data={data} fields={config.columns} total={this.state.total} lineMarks={config.lineMarks} -- Gitblit v1.8.0