Commit a9565736 by zhaochengxiang

数据服务

parent 361facf3
......@@ -11,8 +11,9 @@ import * as datamodel from './datamodel';
import * as assetmanage from './assetmanage';
import * as tag from './tag';
import * as msd from './msd';
import * as psd from './psd';
const funcs = Connect({ user, datamodel, map, assetmanage, datasource, tag, msd })
const funcs = Connect({ user, datamodel, map, assetmanage, datasource, tag, msd, psd })
function* request(args) {
const { type, payload, callback, error } = args.args;
......
import * as psd from '../service/psd';
import { call } from 'redux-saga/effects';
export function* refreshCatalog(payload) {
return yield call(psd.refreshCatalog, payload);
}
export function* loadStateCatalog(payload) {
return yield call(psd.loadStateCatalog, payload);
}
export function* saveCatalog(payload) {
return yield call(psd.saveCatalog, payload);
}
export function* deleteCatalog(payload) {
return yield call(psd.deleteCatalog, payload);
}
export function* upDownCatalog(payload) {
return yield call(psd.upDownCatalog, payload);
}
export function* getServices(payload) {
return yield call(psd.getServices, payload);
}
export function* deleteService(payload) {
return yield call(psd.deleteService, payload);
}
export function* recatalogService(payload) {
return yield call(psd.recatalogService, payload);
}
export function* nextState(payload) {
return yield call(psd.nextState, payload);
}
\ No newline at end of file
......@@ -47,6 +47,10 @@ export const routes = [
name: 'msd-manage',
text: '主数据管理'
},
{
name: 'data-service',
text: '数据服务管理'
},
]
}
];
......
import { PostFile, GetJSON, PostJSON, Post, Get } from "../util/axios"
export function refreshCatalog() {
return GetJSON("/pdataservice/pdsCURD/refreshDataServiceCatalog")
}
export function loadStateCatalog() {
return GetJSON("/pdataservice/pdsCURD/loadDataServiceStateCatalog")
}
export function saveCatalog(payload) {
return PostJSON("/pdataservice/pdsCURD/saveDataServiceCatalog", payload)
}
export function deleteCatalog(payload) {
return PostJSON("/pdataservice/pdsCURD/deleteDataServiceCatalog", payload)
}
export function upDownCatalog(payload) {
return GetJSON("/pdataservice/pdsCURD/upDownDataServiceCatalog", payload)
}
export function getServices(payload) {
return GetJSON("/pdataservice/pdsCURD/getCurrentDataServiceCatalog", payload)
}
export function deleteService(payload) {
return PostJSON("/pdataservice/pdsCURD/deleteDataService", payload);
}
export function recatalogService(payload) {
return Post("/pdataservice/pdsCURD/recatalogDataService", payload);
}
export function nextState(payload) {
return GetJSON("/pdataservice/pdsCURD/nextState", payload);
}
import { useMemo, useState } from 'react';
import classNames from 'classnames';
import { ResizableBox } from 'react-resizable';
import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
import Tree from './tree'
import '../DataMaster/Define/index.less';
const FC = (props) => {
const [collapse, setCollapse] = useState(false);
const classes = useMemo(() => {
return classNames('data-master', {
'data-master-collapse': collapse,
});
}, [collapse]);
const onCollapseClick = () => {
setCollapse(!collapse);
}
return (
<div className={classes}>
<ResizableBox
className='left-wrap'
width={230}
height={Infinity}
axis='x'
minConstraints={[230, Infinity]} maxConstraints={[Infinity, Infinity]}
>
<Tree />
</ResizableBox>
<div className='left-collapse-wrap'>
<div className='left-collapse' onClick={onCollapseClick}>
{ collapse ? <CaretRightOutlined /> : <CaretLeftOutlined /> }
</div>
</div>
<div className='right-wrap'>
</div>
</div>
)
}
export default FC;
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Modal, Form, Input, Radio } from 'antd';
import { dispatchLatest } from '../../../model';
class UpdateTreeItemForm extends React.Component {
constructor(props){
super(props);
this.state = {
radioDisable: false
}
}
componentDidMount() {
this.radioState();
}
componentDidUpdate(preProps, preState) {
const { item } = this.props;
if (item!==preProps.item) {
this.radioState();
}
}
radioState = () => {
const { item } = this.props;
this.setState({ radioDisable: item? false: true })
}
render() {
const { type, form } = this.props;
const { radioDisable } = this.state;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 },
},
};
return (
<Form
{...formItemLayout}
form={form}
>
{
type==='add'&&<Form.Item label="目录类型" name="action">
<Radio.Group disabled={radioDisable} >
<Radio value='root'>根目录</Radio>
<Radio value='sub'>子目录</Radio>
</Radio.Group>
</Form.Item>
}
<Form.Item
label="名称"
name="name"
rules={[{ required: true, message: '请输入名称!' }]}
>
<Input />
</Form.Item>
<Form.Item
label="描述"
name="remark"
rules={[{ required: true, message: '请输入描述!' }]}
>
<Input />
</Form.Item>
</Form>
);
}
}
const FC = (props) => {
const { onOk, type, item, onCancel, visible, rootId } = props;
const [ confirmLoading, setConfirmLoading ] = useState(false);
const [form] = Form.useForm();
useEffect(() => {
if (visible) {
let _action = '';
if (type === 'add') {
_action = item ? 'sub' : 'root';
}
form.setFields([{ name: 'name', errors: [] }, { name: 'remark', errors: [] }]);
if (type === 'add') {
form.setFieldsValue({ action: _action, name: '', remark: '' });
} else {
form.setFieldsValue({ action: '', name: item?item.name:'', remark: item?item.remark:'' });
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible])
const handleOk = async () => {
setConfirmLoading(true);
try {
const values = await form.validateFields();
let payload = null;
if (type === 'add' && values.action==='root') {
payload = {
name: values.name||'',
remark: values.remark||'',
parentId: rootId
};
} else if (type === 'add') {
payload = {
name: values.name||'',
remark: values.remark||'',
parentId: item.id
};
} else {
payload = {
...item,
name: values.name||'',
remark: values.remark||'',
}
}
dispatchLatest({
type: 'psd.saveCatalog',
payload: {
data: payload
},
callback: id => {
setConfirmLoading(false);
if (onOk) {
onOk(id, payload);
}
},
error: () => {
setConfirmLoading(false);
}
});
} catch (errInfo) {
setConfirmLoading(false);
}
}
return (
<Modal
forceRender
confirmLoading={confirmLoading}
visible={visible}
title={type==='add'?"新增目录":"更新目录"}
onOk={handleOk}
onCancel={() => {
setConfirmLoading(false);
onCancel && onCancel();
}}
>
<UpdateTreeItemForm form={form} item={item} type={type} />
</Modal>
);
}
export default FC;
\ No newline at end of file
......@@ -14,6 +14,7 @@ import AssetBrowse from './AssetBrowse';
import AssetRecycle from './AssetRecycle';
import DataMasterDefine from "./DataMaster/Define";
import DataMasterManage from "./DataMaster/Manage";
import DataServiceManage from './DataService';
class Manage extends Component {
......@@ -37,6 +38,7 @@ class Manage extends Component {
<Route path={`${match.path}/asset-recycle`} component={AssetRecycle} />
<Route path={`${match.path}/msd-define`} component={DataMasterDefine} />
<Route path={`${match.path}/msd-manage`} component={DataMasterManage} />
<Route path={`${match.path}/data-service`} component={DataServiceManage} />
</Switch>
) : (
<GetSession {...this.props} />
......
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