peng.peng
1 year ago
13 changed files with 195 additions and 385 deletions
@ -0,0 +1,56 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getBackupsList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query || {}, |
|||
actionType: 'GET_BACKUPS_REPORT', |
|||
url: `${ApiTable.getBackupsList}`, |
|||
msg: { error: '获取数据备份列表失败' }, |
|||
reducer: { name: 'backups' } |
|||
}); |
|||
} |
|||
|
|||
|
|||
export function addBackups(params) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'ADD_BACKUPS_REPORT', |
|||
url: ApiTable.addBackups, |
|||
msg: { |
|||
option: '数据备份新增', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function deleteBackups(id) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'del', |
|||
dispatch, |
|||
actionType: 'DELETE_BACKUPS_REPORT', |
|||
url: ApiTable.modifyBackups.replace('{id}', id), |
|||
msg: { |
|||
option: '数据备份删除', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function modifyBackups(id, params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'put', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'MODIFY_BACKUPS_REPORT', |
|||
url: ApiTable.modifyBackups.replace('{id}', id), |
|||
msg: { |
|||
option: msg || '数据备份编辑', |
|||
}, |
|||
}); |
|||
} |
|||
|
@ -1,6 +1,6 @@ |
|||
'use strict'; |
|||
|
|||
import * as member from './member'; |
|||
import * as backups from './backups'; |
|||
export default { |
|||
...member |
|||
...backups |
|||
} |
@ -1,56 +0,0 @@ |
|||
'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 || '用户编辑', |
|||
}, |
|||
}); |
|||
} |
|||
|
@ -1,69 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function addTask(params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'ADD_ACQ_TASK', |
|||
url: ApiTable.addTask, |
|||
msg: { |
|||
option: msg || '新增采集任务', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function getTasks(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query || {}, |
|||
actionType: 'GET_ACQ_TASKS', |
|||
url: `${ApiTable.getTasks}`, |
|||
msg: { error: '获取采集任务列表失败' }, |
|||
reducer: { name: 'tasks' } |
|||
}); |
|||
} |
|||
|
|||
export function deleteTask(id) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'del', |
|||
dispatch, |
|||
actionType: 'DELETE_ACQ_TASK', |
|||
url: ApiTable.modifyTask.replace('{id}', id), |
|||
msg: { |
|||
option: '采集任务删除', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function modifyTask(id, params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'put', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'MODIFY_ACQ_TASK', |
|||
url: ApiTable.modifyTask.replace('{id}', id), |
|||
msg: { |
|||
option: msg || '采集任务编辑', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function runTask(params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'RUN_ACQ_TASK', |
|||
url: ApiTable.runTask, |
|||
msg: { |
|||
option: msg || '任务执行', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
@ -0,0 +1,93 @@ |
|||
import React, { useRef } from 'react'; |
|||
import { Button, Form } from 'antd'; |
|||
import { InfoCircleOutlined } from '@ant-design/icons'; |
|||
import { |
|||
ModalForm, |
|||
ProFormTreeSelect, |
|||
ProFormText, |
|||
} from '@ant-design/pro-form'; |
|||
import moment from 'moment'; |
|||
export default (props) => { |
|||
const { title, triggerRender, editData = null, onFinish, dataSources } = props; |
|||
const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; |
|||
const initialValues = editData ? { |
|||
...editData, |
|||
} : {}; |
|||
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) => { |
|||
values.databases = dataSources?.rows?.find(s => s.id == values?.databases?.value)?.config; |
|||
values.createTime = moment(); |
|||
values.state = '备份中'; |
|||
return onFinish && await onFinish(values, editData, form) |
|||
// return true;
|
|||
}} |
|||
width={500} |
|||
> |
|||
<ProFormText |
|||
rules={[{ required: true, message: '请输入姓名' }, |
|||
{ max: 255, message: '姓名长度不能大于255个字符' }, |
|||
]} |
|||
name="note" |
|||
label="备份信息" |
|||
/> |
|||
|
|||
<ProFormTreeSelect |
|||
name="databases" |
|||
label='数据源' |
|||
placeholder="请选择数据源" |
|||
allowClear |
|||
secondary |
|||
request={async () => { |
|||
return [ |
|||
{ |
|||
title: 'postgre', |
|||
disabled: true, |
|||
value: '0-0', |
|||
children: dataSources?.rows?.filter(s => s?.type != '备份数据库')?.map(s => { |
|||
return { |
|||
title: s.name, |
|||
value: s.id, |
|||
} |
|||
}) |
|||
}, |
|||
]; |
|||
}} |
|||
rules={[{ required: true, message: '请选择数据源' }]} |
|||
// tree-select args
|
|||
fieldProps={{ |
|||
showArrow: false, |
|||
filterTreeNode: true, |
|||
showSearch: true, |
|||
popupMatchSelectWidth: false, |
|||
labelInValue: true, |
|||
autoClearSearchValue: true, |
|||
multiple: false, |
|||
treeDefaultExpandAll: true, |
|||
treeNodeFilterProp: 'title', |
|||
fieldNames: { |
|||
label: 'title', |
|||
}, |
|||
}} |
|||
/> |
|||
|
|||
</ModalForm> |
|||
); |
|||
}; |
@ -1,78 +0,0 @@ |
|||
import React, { useRef } from 'react'; |
|||
import { Button, Form } from 'antd'; |
|||
import { InfoCircleOutlined } from '@ant-design/icons'; |
|||
import { |
|||
ModalForm, |
|||
ProFormSelect, |
|||
ProFormTextArea, |
|||
ProFormDigit, |
|||
ProFormText, |
|||
ProFormSwitch |
|||
} from '@ant-design/pro-form'; |
|||
|
|||
export default (props) => { |
|||
const { title, triggerRender, editData = null, onFinish, paramsName } = props; |
|||
const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; |
|||
const initialValues = editData ? { |
|||
...editData, |
|||
} : {}; |
|||
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, editData, form) |
|||
// return true;
|
|||
}} |
|||
width={500} |
|||
> |
|||
<ProFormText |
|||
rules={[{ required: true, message: '请输入姓名' }, |
|||
{ max: 255, message: '姓名长度不能大于255个字符' }, |
|||
]} |
|||
name="name" |
|||
label="姓名" |
|||
/> |
|||
|
|||
<ProFormText |
|||
rules={[{ required: true, message: '请输入用户名' }, |
|||
{ max: 255, message: '用户名长度不能大于255个字符' }, |
|||
]} |
|||
name="username" |
|||
label="用户名" |
|||
/> |
|||
|
|||
<ProFormSelect |
|||
disabled={editData} |
|||
rules={[{ required: true, message: '请选择角色' }]} |
|||
options={[ |
|||
{ label: '系统管理员', value: '系统管理员' }, |
|||
{ label: '数据消费者', value: '数据消费者' }, |
|||
]} |
|||
name="role" |
|||
label="角色" |
|||
/> |
|||
|
|||
<ProFormSwitch name="enabled" label="是否启用" |
|||
fieldProps={ |
|||
{ defaultChecked: true } |
|||
} |
|||
/> |
|||
</ModalForm> |
|||
); |
|||
}; |
@ -1,61 +0,0 @@ |
|||
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> |
|||
); |
|||
}; |
@ -1,69 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function addTask(params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'ADD_ACQ_TASK', |
|||
url: ApiTable.addTask, |
|||
msg: { |
|||
option: msg || '新增采集任务', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function getTasks(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query || {}, |
|||
actionType: 'GET_ACQ_TASKS', |
|||
url: `${ApiTable.getTasks}`, |
|||
msg: { error: '获取采集任务列表失败' }, |
|||
reducer: { name: 'tasks' } |
|||
}); |
|||
} |
|||
|
|||
export function deleteTask(id) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'del', |
|||
dispatch, |
|||
actionType: 'DELETE_ACQ_TASK', |
|||
url: ApiTable.modifyTask.replace('{id}', id), |
|||
msg: { |
|||
option: '采集任务删除', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function modifyTask(id, params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'put', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'MODIFY_ACQ_TASK', |
|||
url: ApiTable.modifyTask.replace('{id}', id), |
|||
msg: { |
|||
option: msg || '采集任务编辑', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
export function runTask(params, msg) { |
|||
return (dispatch) => basicAction({ |
|||
type: 'post', |
|||
data: params, |
|||
dispatch, |
|||
actionType: 'RUN_ACQ_TASK', |
|||
url: ApiTable.runTask, |
|||
msg: { |
|||
option: msg || '任务执行', |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
Loading…
Reference in new issue