Commit 5f903da3 by zhaochengxiang

可见列设置

parent 6d8b2443
...@@ -119,4 +119,12 @@ export function* saveOwner(payload) { ...@@ -119,4 +119,12 @@ export function* saveOwner(payload) {
export function* changeOwner(payload) { export function* changeOwner(payload) {
return yield call(pds.changeOwner, payload) return yield call(pds.changeOwner, payload)
}
export function* saveCols(payload) {
return yield call(pds.saveCols, payload);
}
export function* getCols(payload) {
return yield call(pds.getCols, payload);
} }
\ No newline at end of file
...@@ -118,4 +118,12 @@ export function saveOwner(payload) { ...@@ -118,4 +118,12 @@ export function saveOwner(payload) {
export function changeOwner(payload) { export function changeOwner(payload) {
return PostJSON("/pdataservice/pdsCURD/changeOwnerOfDataService", payload) return PostJSON("/pdataservice/pdsCURD/changeOwnerOfDataService", payload)
}
export function saveCols(payload) {
return PostJSON("/pdataservice/pdsModel/saveVisibleTitle", payload);
}
export function getCols(payload) {
return GetJSON("/pdataservice/pdsModel/getVisibleTitle", payload);
} }
\ No newline at end of file
...@@ -4,13 +4,14 @@ import { Modal, Button, Switch, Row, Col, Checkbox, Typography } from 'antd'; ...@@ -4,13 +4,14 @@ import { Modal, Button, Switch, Row, Col, Checkbox, Typography } from 'antd';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
const cols = [ const cols = [
{title: '模型名称', require: true}, {title: '服务名称'},
{title: '中文名称'}, {title: '中文名称'},
{title: '路径'}, {title: '路径'},
{title: '状态'}, {title: '状态'},
{title: '创建人'}, {title: '管理人'},
{title: '是否启动OData'},
{title: '版本号'}, {title: '版本号'},
{title: '模型描述'}, {title: '服务描述'},
]; ];
const ColSettingModal = (props) => { const ColSettingModal = (props) => {
...@@ -20,22 +21,19 @@ const ColSettingModal = (props) => { ...@@ -20,22 +21,19 @@ const ColSettingModal = (props) => {
const [confirmLoading, setConfirmLoading] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false);
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
getPreference(); getPreference();
} }
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible]); }, [visible]);
const getPreference = () => { const getPreference = () => {
dispatch({ dispatch({
type: 'datamodel.getPreference', type: 'pds.getCols',
payload: {
modelName: 'DataServiceCol'
},
callback: data => { callback: data => {
if ((data.cols||'') === '') { setCheckedKeys(data?.map(item => item.titleCnName));
onCheckAllChange(true);
} else {
setCheckedKeys(data.cols.split(','));
}
} }
}) })
} }
...@@ -76,11 +74,12 @@ const ColSettingModal = (props) => { ...@@ -76,11 +74,12 @@ const ColSettingModal = (props) => {
const onModalOk = () => { const onModalOk = () => {
setConfirmLoading(true); setConfirmLoading(true);
dispatch({ dispatch({
type: 'datamodel.savePreference', type: 'pds.saveCols',
payload: { payload: {
data: { params: {modelName: 'DataServiceCol'},
cols: checkedKeys.join(',') data: checkedKeys?.map(item => {
} return { titleCnName: item }
})
}, },
callback: () => { callback: () => {
setConfirmLoading(false); setConfirmLoading(false);
......
...@@ -74,7 +74,7 @@ class Model extends React.Component { ...@@ -74,7 +74,7 @@ class Model extends React.Component {
componentDidMount() { componentDidMount() {
this.getModelStates(); this.getModelStates();
// this.getPreference(); this.getPreference();
window?.addEventListener("storage", this.modelEventChange); window?.addEventListener("storage", this.modelEventChange);
} }
...@@ -111,14 +111,12 @@ class Model extends React.Component { ...@@ -111,14 +111,12 @@ class Model extends React.Component {
getPreference = () => { getPreference = () => {
dispatch({ dispatch({
type: 'datamodel.getPreference', type: 'pds.getCols',
payload: {
modelName: 'DataServiceCol'
},
callback: data => { callback: data => {
this.setState(); this.setState({visibleColNames: data?.map(item => item.titleCnName)});
if ((data.cols||'') === '') {
this.setState({visibleColNames: []});
} else {
this.setState({visibleColNames: data.cols.split(',')});
}
} }
}) })
} }
...@@ -679,9 +677,9 @@ class Model extends React.Component { ...@@ -679,9 +677,9 @@ class Model extends React.Component {
<Button onClick={this.onBatchDeleteBtnClick} disabled={(selectModelerIds||[]).length===0}>删除</Button> <Button onClick={this.onBatchDeleteBtnClick} disabled={(selectModelerIds||[]).length===0}>删除</Button>
</Tooltip> </Tooltip>
</Space> */} </Space> */}
{/* <Space> <Space>
<Button onClick={this.onVisibleColSettingClick}>可见列设置</Button> <Button onClick={this.onVisibleColSettingClick}>可见列设置</Button>
</Space> */} </Space>
</React.Fragment> </React.Fragment>
} }
{ {
...@@ -795,6 +793,11 @@ class Model extends React.Component { ...@@ -795,6 +793,11 @@ class Model extends React.Component {
ids={selectModelerIds} ids={selectModelerIds}
onCancel={this.onOfflineCancel} onCancel={this.onOfflineCancel}
/> />
<ColSettingModal
visible={colSettingModalVisible}
onCancel={this.onColSettingModalCancel}
/>
</div> </div>
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment