peng.peng
2 years ago
16 changed files with 281 additions and 241 deletions
@ -1,44 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function checkPostgreConnect(params) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'CHECK_POSTGRE_CONNECT', |
|||
url: ApiTable.pgCheckConnect, |
|||
msg: { |
|||
option: '', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function addAdapter(params) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'ADD_ADAPTER', |
|||
url: ApiTable.addAdapter, |
|||
msg: { |
|||
option: '新增适配器', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function getAdapters(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query || {}, |
|||
actionType: 'GET_ACQ_ADAPTERS', |
|||
url: `${ApiTable.getAdapters}`, |
|||
msg: { error: '获取适配器列表失败' }, |
|||
reducer: { name: 'adapters' } |
|||
}); |
|||
} |
|||
|
|||
|
@ -1,56 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function addDataSource(params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'ADD_DATSOURCE', |
|||
url: ApiTable.addDataSource, |
|||
msg: { |
|||
option: msg == '' ? '' : '新增数据源', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function getDataSources(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query || {}, |
|||
actionType: 'GET_ACQ_DATASOURCES', |
|||
url: `${ApiTable.getDataSources}`, |
|||
msg: { error: '获取数据源列表失败' }, |
|||
reducer: { name: 'datasources' } |
|||
}); |
|||
} |
|||
|
|||
export function deleteDataSource(id) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'del', |
|||
dispatch, |
|||
actionType: 'DELETE_ACQ_DATASOURCE', |
|||
url: ApiTable.modifyDataSource.replace('{id}', id), |
|||
msg: { |
|||
option: '数据源删除', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function modifyDataSource(id, params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'put', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'MODIFY_ACQ_DATASOURCE', |
|||
url: ApiTable.modifyDataSource.replace('{id}', id), |
|||
msg: { |
|||
option: msg || '数据源编辑', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
@ -1,15 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
// export function getMembers(orgId) {
|
|||
// return dispatch => basicAction({
|
|||
// type: 'get',
|
|||
// dispatch: dispatch,
|
|||
// actionType: 'GET_MEMBERS',
|
|||
// url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`,
|
|||
// msg: { error: '获取用户列表失败' },
|
|||
// reducer: { name: 'members' }
|
|||
// });
|
|||
// }
|
@ -1,14 +1,6 @@ |
|||
'use strict'; |
|||
|
|||
import * as example from './example' |
|||
import * as adapter from './adapter' |
|||
import * as dataSource from './dataSource' |
|||
import * as task from './task'; |
|||
import * as log from './log'; |
|||
import * as member from './member'; |
|||
export default { |
|||
...example, |
|||
...adapter, |
|||
...dataSource, |
|||
...task, |
|||
...log |
|||
...member |
|||
} |
@ -1,16 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getLogs(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query || {}, |
|||
actionType: 'GET_ACQ_LOGS', |
|||
url: `${ApiTable.getLogs}`, |
|||
msg: { error: '获取采集日志失败' }, |
|||
reducer: { name: 'acqlogs' } |
|||
}); |
|||
} |
@ -0,0 +1,56 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getUserList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query || {}, |
|||
actionType: 'GET_MEMBER_REPORT', |
|||
url: `${ApiTable.getUserList}`, |
|||
msg: { error: '获取用户列表失败' }, |
|||
reducer: { name: 'member' } |
|||
}); |
|||
} |
|||
|
|||
|
|||
export function addUser(params) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'ADD_MEMBER_REPORT', |
|||
url: ApiTable.addUser, |
|||
msg: { |
|||
option: '用户新增', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function deleteUser(id) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'del', |
|||
dispatch, |
|||
actionType: 'DELETE_MEMBER_REPORT', |
|||
url: ApiTable.modifyUser.replace('{id}', id), |
|||
msg: { |
|||
option: '用户删除', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function modifyUser(id, params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'put', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'MODIFY_MEMBER_REPORT', |
|||
url: ApiTable.modifyUser.replace('{id}', id), |
|||
msg: { |
|||
option: msg || '用户编辑', |
|||
}, |
|||
}); |
|||
} |
|||
|
@ -0,0 +1,61 @@ |
|||
import React, { useRef } from 'react'; |
|||
import { Button, Form } from 'antd'; |
|||
import { |
|||
ModalForm, |
|||
ProFormText, |
|||
} from '@ant-design/pro-form'; |
|||
|
|||
export default (props) => { |
|||
const { title, triggerRender, editData = null, onFinish } = props; |
|||
const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; |
|||
const initialValues = {}; |
|||
const [form] = Form.useForm(); |
|||
const formRef = useRef(); |
|||
return ( |
|||
<ModalForm |
|||
formRef={formRef} |
|||
title={title || ''} |
|||
initialValues={initialValues} |
|||
trigger={ |
|||
triggerRender ? triggerRender : <Button type="primary" > |
|||
{title || ''} |
|||
</Button> |
|||
} |
|||
layout="horizontal" |
|||
grid={true} |
|||
{...formItemLayout} |
|||
modalProps={{ |
|||
destroyOnClose: true, |
|||
onCancel: () => { }, |
|||
}} |
|||
onFinish={async (values) => { |
|||
return onFinish && await onFinish({ ...values, msg: '重置密码' }, editData, '重置密码') |
|||
}} |
|||
width={500} |
|||
> |
|||
<ProFormText.Password |
|||
rules={[{ required: true, message: '请输入旧密码' }, |
|||
{ max: 255, message: '旧密码长度不能大于255个字符' }, |
|||
{ |
|||
pattern: /^[a-z0-9A-Z_]{6,20}$/, message: '密码由6-20位字母、数字或_组成' |
|||
}, |
|||
]} |
|||
name="oldpassword" |
|||
label="旧密码" |
|||
/> |
|||
|
|||
<ProFormText.Password |
|||
rules={[{ required: true, message: '请输入新密码' }, |
|||
{ max: 255, message: '新密码长度不能大于255个字符' }, |
|||
{ |
|||
pattern: /^[a-z0-9A-Z_]{6,20}$/, message: '密码由6-20位字母、数字或_组成' |
|||
}, |
|||
]} |
|||
name="password" |
|||
label="新密码" |
|||
/> |
|||
|
|||
|
|||
</ModalForm> |
|||
); |
|||
}; |
Loading…
Reference in new issue