wenlele
1 year ago
22 changed files with 881 additions and 17 deletions
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 88 KiB |
@ -0,0 +1,78 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import { basicAction } from '@peace/utils' |
||||
|
import { ApiTable } from '$utils' |
||||
|
|
||||
|
export function getStandardDocFolders (query = {}) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'get', |
||||
|
query, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'GET_STANDARD_DOC_FOLDERS', |
||||
|
url: `${ApiTable.standardDocFolders}`, |
||||
|
msg: { error: '获取标准文档目录列表失败' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
export function postStandardDocFolders (data = {}) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'post', |
||||
|
data, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'POST_STANDARD_DOC_FOLDERS', |
||||
|
url: `${ApiTable.standardDocFolders}`, |
||||
|
msg: { option: '标准文档目录新增' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function postStandardDocs (data = {}) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'post', |
||||
|
data, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'POST_STANDARD_DOCS', |
||||
|
url: `${ApiTable.standardDocs}`, |
||||
|
msg: { option: '新增标准文档' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function getStandardDocs (query = {}) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'get', |
||||
|
query, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'GET_STANDARD_DOCS', |
||||
|
url: `${ApiTable.standardDocs}`, |
||||
|
msg: { error: '获取标准文档列表失败' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function postFolderFile (data) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'post', |
||||
|
data, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'POST_FOLDER_FILE', |
||||
|
url: ApiTable.postFolderFile, |
||||
|
msg: { option: '删除文件夹或文件' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function fetchFiles (data = {}) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'post', |
||||
|
data, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'POST_FETCH_FILES', |
||||
|
url: `${ApiTable.fetchFiles}`, |
||||
|
msg: { error: '获取文件夹下文件失败' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
@ -0,0 +1,15 @@ |
|||||
|
'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' }
|
||||
|
// });
|
||||
|
// }
|
@ -0,0 +1,11 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import * as example from './example' |
||||
|
import * as documentLibrary from './documentLibrary' |
||||
|
import * as ruleLibrary from './ruleLibrary' |
||||
|
|
||||
|
export default { |
||||
|
...example, |
||||
|
...documentLibrary, |
||||
|
...ruleLibrary, |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import { basicAction } from '@peace/utils' |
||||
|
import { ApiTable } from '$utils' |
||||
|
|
||||
|
export function postBusinessRules (data = {}) { |
||||
|
let reminder = data?.id ? '修改业务规则' : '新增业务规则' |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'post', |
||||
|
data, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'POST_BUSINESS_RULES', |
||||
|
url: `${ApiTable.businessRules}`, |
||||
|
msg: { option: reminder }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function getBusinessRules (query = {}) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'get', |
||||
|
query, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'GET_BUSINESS_RULES', |
||||
|
url: `${ApiTable.businessRules}`, |
||||
|
msg: { error: '查询业务规则列表失败' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function delBusinessRules (id) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'del', |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'del_BUSINESS_RULES', |
||||
|
url: `${ApiTable.delBusinessRules.replace('{id}', id)}`, |
||||
|
msg: { option: '删除业务规则' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function getRegularBasis (query = {}) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'get', |
||||
|
query, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'GET_REGULAR_BASIS', |
||||
|
url: `${ApiTable.regularBasis}`, |
||||
|
msg: { error: '查询规则依据列表失败' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
@ -0,0 +1,118 @@ |
|||||
|
import React, { useEffect, useState } from 'react' |
||||
|
import { connect } from 'react-redux'; |
||||
|
import moment from 'moment'; |
||||
|
import { UploadLocal } from '$components'; |
||||
|
|
||||
|
|
||||
|
import { Tabs, Form, Input, DatePicker, Button, Modal, Select, Tag } from 'antd'; |
||||
|
|
||||
|
|
||||
|
function FileModal ({ loading, parent, user, actions, editData = {}, dispatch, close, success,remove }) { |
||||
|
|
||||
|
const { dataQuality } = actions |
||||
|
const [tabsKey, setTabsKey] = useState("stay") |
||||
|
const [query, setQuery] = useState({ page: 0, limit: 10 }); |
||||
|
const [proTableList, setProTableList] = useState({ rows: [], count: 0 }); |
||||
|
const [approve, setApprove] = useState() |
||||
|
|
||||
|
const [form] = Form.useForm(); |
||||
|
const [editUrl, setEditUrl] = useState([]); |
||||
|
useEffect(() => { |
||||
|
|
||||
|
}, []) |
||||
|
|
||||
|
|
||||
|
|
||||
|
const vsjunct = (params) => { |
||||
|
if (params.length) { |
||||
|
let appendix = [] |
||||
|
for (let p of params) { |
||||
|
appendix.push({ |
||||
|
fName: p.name, |
||||
|
size: p.size, |
||||
|
fileSize: p.size, |
||||
|
storageUrl: p.storageUrl,//必须有storageUrl
|
||||
|
}) |
||||
|
} |
||||
|
setEditUrl(appendix) |
||||
|
} else { |
||||
|
setEditUrl([]) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return <> |
||||
|
<Modal title="标准文档上传" open={true} width={600} |
||||
|
onOk={e => { |
||||
|
form.validateFields().then(v => { |
||||
|
dispatch(dataQuality.postStandardDocs({ |
||||
|
...v, |
||||
|
path: v?.files[0]?.url, docName: v?.files[0]?.name, |
||||
|
folder: parent || null, |
||||
|
})).then(res => { |
||||
|
if (res.success) { |
||||
|
close() |
||||
|
success() |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}} |
||||
|
onCancel={() => { |
||||
|
if (form.getFieldValue('files') && form.getFieldValue('files').length) { |
||||
|
remove(form.getFieldValue('files')[0]?.url) |
||||
|
} |
||||
|
close() |
||||
|
}} |
||||
|
> |
||||
|
<Form |
||||
|
style={{ marginLeft: 20 }} |
||||
|
form={form} |
||||
|
onValuesChange={v => { |
||||
|
|
||||
|
}} |
||||
|
autoComplete="off" |
||||
|
labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} |
||||
|
> |
||||
|
<Form.Item label="标准类型" name="standardType" rules={[{ required: true, message: '请选择标准类型' }]}> |
||||
|
<Select style={{ width: 200, }} allowClear |
||||
|
options={[{ value: '国家标准', label: '国家标准', }, { value: '行业标准', label: '行业标准', }, { value: '地方标准', label: '地方标准', },]} |
||||
|
/> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="标签" name="tags" > |
||||
|
<Input allowClear placeholder='请输入标签' maxLength={50} style={{ width: 300, marginRight: 16 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item |
||||
|
label='文件' |
||||
|
name='files' |
||||
|
key='files' |
||||
|
rules={[{ required: true, message: '文件不可为空' }]}> |
||||
|
<UploadLocal |
||||
|
// addNew={editData.add || !editData.record.files.length}
|
||||
|
isLocal={true} |
||||
|
maxFilesNum={1} |
||||
|
maxFileSize={40} |
||||
|
onChange={vsjunct} |
||||
|
fileTypes={["jpg", "png", "gif", "txt", "doc", "docx", "pdf", "xls", "xlsx", "zip", "rar"]} |
||||
|
value={editUrl} |
||||
|
// fileList={editData.record.files || []}
|
||||
|
/> |
||||
|
</Form.Item> |
||||
|
<Form.Item style={{ marginLeft: 42 }} key='tip'> |
||||
|
<Tag color="orange">文件大小不超过40MB,开放资源包含多个文件,建议将文件进行压缩,形成压缩包再上传</Tag> |
||||
|
<Tag color="orange">支持的文件格式:jpg,png,gif,txt,doc,docx,pdf,xsl,xlsx,zip,rar</Tag> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal > |
||||
|
|
||||
|
</> |
||||
|
} |
||||
|
function mapStateToProps (state) { |
||||
|
const { global, auth, resourceCatalog } = state; |
||||
|
return { |
||||
|
user: auth.user, |
||||
|
actions: global.actions, |
||||
|
clientHeight: global.clientHeight, |
||||
|
// resourceCatalog: resourceCatalog?.data || [],
|
||||
|
// isRequesting: resourceCatalog.isRequesting
|
||||
|
}; |
||||
|
} |
||||
|
export default connect(mapStateToProps)(FileModal) |
@ -0,0 +1,66 @@ |
|||||
|
import React, { useEffect, useState } from 'react' |
||||
|
import { connect } from 'react-redux'; |
||||
|
import moment from 'moment'; |
||||
|
import { v4 as uuidv4 } from 'uuid' |
||||
|
|
||||
|
import { Tabs, Form, Input, DatePicker, Button, Modal, Radio } from 'antd'; |
||||
|
|
||||
|
|
||||
|
function GroupModal ({ loading, parent, user, actions, dispatch, close, success, }) { |
||||
|
|
||||
|
const { dataQuality } = actions |
||||
|
|
||||
|
const [form] = Form.useForm(); |
||||
|
useEffect(() => { |
||||
|
|
||||
|
}, []) |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
return <> |
||||
|
<Modal title="新建分组" open={true} |
||||
|
onOk={e => { |
||||
|
form.validateFields().then(v => { |
||||
|
dispatch(dataQuality.postStandardDocFolders({ |
||||
|
...v, |
||||
|
parent: parent || null, |
||||
|
})).then(res => { |
||||
|
if (res.success) { |
||||
|
close() |
||||
|
success() |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}} |
||||
|
onCancel={() => { |
||||
|
close() |
||||
|
}} |
||||
|
> |
||||
|
<Form |
||||
|
style={{ marginLeft: 20 }} |
||||
|
form={form} |
||||
|
onValuesChange={v => { |
||||
|
|
||||
|
}} |
||||
|
autoComplete="off" |
||||
|
> |
||||
|
<Form.Item label="名称" name="name" rules={[{ required: true, message: '请输入分组名称,最多50字', max: 50 },]}> |
||||
|
<Input allowClear placeholder='请输入分组名称' style={{ width: 300, }} /> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal > |
||||
|
|
||||
|
</> |
||||
|
} |
||||
|
function mapStateToProps (state) { |
||||
|
const { global, auth, resourceCatalog } = state; |
||||
|
return { |
||||
|
user: auth.user, |
||||
|
actions: global.actions, |
||||
|
clientHeight: global.clientHeight, |
||||
|
// resourceCatalog: resourceCatalog?.data || [],
|
||||
|
// isRequesting: resourceCatalog.isRequesting
|
||||
|
}; |
||||
|
} |
||||
|
export default connect(mapStateToProps)(GroupModal) |
@ -0,0 +1,104 @@ |
|||||
|
import React, { useEffect, useState } from 'react' |
||||
|
import { connect } from 'react-redux'; |
||||
|
import moment from 'moment'; |
||||
|
import { v4 as uuidv4 } from 'uuid' |
||||
|
|
||||
|
import { Tabs, Form, Input, DatePicker, Button, Modal, Radio, Select, TreeSelect } from 'antd'; |
||||
|
const { TextArea } = Input; |
||||
|
const { Option, OptGroup } = Select; |
||||
|
function RuleModal ({ loading, parent, user, actions, dispatch, close, success, treeList, editData }) { |
||||
|
|
||||
|
const { dataQuality } = actions |
||||
|
const [tabsKey, setTabsKey] = useState("stay") |
||||
|
const [query, setQuery] = useState({ page: 0, limit: 10 }); |
||||
|
const [proTableList, setProTableList] = useState({ rows: [], count: 0 }); |
||||
|
const [approve, setApprove] = useState() |
||||
|
|
||||
|
const [form] = Form.useForm(); |
||||
|
useEffect(() => { |
||||
|
|
||||
|
}, []) |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
return <> |
||||
|
<Modal title={editData?.id ? '编辑业务规则' : "新建业务规则"} open={true} |
||||
|
onOk={e => { |
||||
|
form.validateFields().then(v => { |
||||
|
// console.log(v);
|
||||
|
dispatch(dataQuality.postBusinessRules({ |
||||
|
...v, id: editData?.id |
||||
|
})).then(res => { |
||||
|
if (res.success) { |
||||
|
close() |
||||
|
success() |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}} |
||||
|
onCancel={() => { |
||||
|
close() |
||||
|
}} |
||||
|
> |
||||
|
<Form |
||||
|
style={{ marginLeft: 20 }} |
||||
|
form={form} |
||||
|
onValuesChange={v => { |
||||
|
|
||||
|
}} |
||||
|
autoComplete="off" |
||||
|
labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} |
||||
|
> |
||||
|
<Form.Item label="名称" name="name" initialValue={editData?.name} rules={[{ required: true, message: '请输入分组名称,最多50字', max: 50}]}> |
||||
|
<Input allowClear placeholder='请输入分组名称' style={{ width: 300 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="描述" name="description" initialValue={editData?.description} rules={[{ required: true, message: '请输入分组名称' }]}> |
||||
|
<TextArea allowClear autoSize={{ minRows: 2 }} placeholder='描述' style={{ width: 300, }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="问题类型" name="problemType" initialValue={editData?.problemType} rules={[{ required: true, message: '请输入分组名称' }]}> |
||||
|
<Select style={{ width: 300, }} placeholder='问题类型' |
||||
|
options={[{ value: '一致性', label: '一致性', }, { value: '准确性', label: '准确性', }, { value: '完整性', label: '完整性', }, { value: '有效性', label: '有效性', }, { value: '及时性', label: '及时性', }, { value: '规范性', label: '规范性', },]} |
||||
|
/> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="问题级别" name="problemLevel" initialValue={editData?.problemLevel} rules={[{ required: true, message: '请输入分组名称' }]}> |
||||
|
<Select style={{ width: 300, }} placeholder='问题级别' |
||||
|
options={[{ value: '一般', label: '一般', }, { value: '重要', label: '重要', }, { value: '严重', label: '严重', },]} |
||||
|
/> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="制定依据" name="ruleBasis" initialValue={editData?.ruleBasis} rules={[{ required: true, message: '请输入分组名称' }]}> |
||||
|
<TreeSelect |
||||
|
showSearch |
||||
|
style={{ |
||||
|
width: 300, |
||||
|
}} |
||||
|
// value={}
|
||||
|
dropdownStyle={{ |
||||
|
maxHeight: 300, |
||||
|
overflow: 'auto', |
||||
|
}} |
||||
|
placeholder="" |
||||
|
allowClear |
||||
|
treeDefaultExpandAll |
||||
|
// onChange={onChange}
|
||||
|
treeData={treeList || []} |
||||
|
/> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal > |
||||
|
|
||||
|
</> |
||||
|
} |
||||
|
function mapStateToProps (state) { |
||||
|
const { global, auth, resourceCatalog } = state; |
||||
|
return { |
||||
|
user: auth.user, |
||||
|
actions: global.actions, |
||||
|
clientHeight: global.clientHeight, |
||||
|
// resourceCatalog: resourceCatalog?.data || [],
|
||||
|
// isRequesting: resourceCatalog.isRequesting
|
||||
|
}; |
||||
|
} |
||||
|
export default connect(mapStateToProps)(RuleModal) |
@ -0,0 +1,6 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import ServiceView from './serviceView'; |
||||
|
import ServiceManagement from './serviceManagement'; |
||||
|
|
||||
|
export {ServiceManagement,ServiceView}; |
@ -0,0 +1,160 @@ |
|||||
|
import React, { useEffect, useState } from 'react' |
||||
|
import { connect } from 'react-redux'; |
||||
|
import moment from 'moment'; |
||||
|
import { RouteRequest } from '@peace/utils'; |
||||
|
import { RouteTable } from '$utils' |
||||
|
|
||||
|
import { Tabs, Form, Input, Space, Button, Table, Popconfirm } from 'antd'; |
||||
|
const { Search } = Input; |
||||
|
import { CreditCardFilled, FilePdfOutlined } from '@ant-design/icons'; |
||||
|
import { agent } from 'superagent'; |
||||
|
|
||||
|
import RuleModal from '../components/ruleModal'; |
||||
|
|
||||
|
|
||||
|
function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) { |
||||
|
|
||||
|
const { dataService } = actions |
||||
|
const [query, setQuery] = useState({ page: 0, limit: 10 }); |
||||
|
const [ruleModal, setRuleModal] = useState(false) |
||||
|
const [editData, setEditData] = useState({}) |
||||
|
const [keyword, setKeyword] = useState() |
||||
|
const [tableList, setTableList] = useState({ rows: [], count: 0 }); |
||||
|
const [treeList, setTreeLista] = useState([]) |
||||
|
useEffect(() => { |
||||
|
resourceData() |
||||
|
// dispatch(dataQuality.getRegularBasis()).then(res => {
|
||||
|
// if (res.success) {
|
||||
|
// setTreeLista(res.payload.data)
|
||||
|
// }
|
||||
|
// })
|
||||
|
}, []) |
||||
|
|
||||
|
|
||||
|
let resourceData = (data) => { |
||||
|
// let params = data || query
|
||||
|
// dispatch(dataService.getBusinessRules({ keyword: keyword, ...params, })).then(res => {
|
||||
|
// if (res.success) {
|
||||
|
// setTableList({ rows: res.payload.data?.rows, count: res.payload.data?.count })
|
||||
|
|
||||
|
// }
|
||||
|
// })
|
||||
|
} |
||||
|
|
||||
|
const columns = [{ |
||||
|
title: '接口名称', |
||||
|
dataIndex: 'name', |
||||
|
}, { |
||||
|
title: '接口路由', |
||||
|
dataIndex: 'description', |
||||
|
}, { |
||||
|
title: '接口类型', |
||||
|
dataIndex: 'problemType', |
||||
|
}, { |
||||
|
title: '状态', |
||||
|
dataIndex: 'problemLevel' |
||||
|
}, { |
||||
|
title: '操作', |
||||
|
dataIndex: 'handle', |
||||
|
// ellipsis: true,
|
||||
|
render: (text, record) => <div style={{ width: 126 }}> |
||||
|
<Button type="link" onClick={() => { |
||||
|
// setEditData(record)
|
||||
|
// setRuleModal(true);
|
||||
|
}}>查看详情</Button> |
||||
|
<Button type="link" onClick={() => { |
||||
|
// setEditData(record)
|
||||
|
// setRuleModal(true);
|
||||
|
}}>编辑</Button> |
||||
|
<Popconfirm |
||||
|
title="是否确认删除该业务规则?" |
||||
|
onConfirm={() => { |
||||
|
dispatch(dataQuality.delBusinessRules(record.id)).then(res => { |
||||
|
if (res.success) { |
||||
|
setQuery({ limit: 10, page: 0 }); |
||||
|
resourceData({ limit: 10, page: 0, keyword }) |
||||
|
} |
||||
|
}) |
||||
|
}} |
||||
|
> |
||||
|
<Button type="link">删除</Button> |
||||
|
</Popconfirm> |
||||
|
<Button type="link" onClick={() => { |
||||
|
// setEditData(record)
|
||||
|
// setRuleModal(true);
|
||||
|
}}>禁用</Button> |
||||
|
</div> |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
return <> |
||||
|
|
||||
|
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> |
||||
|
<div style={{ display: 'flex', }}> |
||||
|
<Input |
||||
|
placeholder="接口名称" |
||||
|
value={keyword} |
||||
|
onChange={e => { |
||||
|
setKeyword(e?.target?.value) |
||||
|
}} |
||||
|
style={{ |
||||
|
width: 266, marginRight: 10 |
||||
|
}} |
||||
|
/> |
||||
|
<Button onClick={() => { |
||||
|
setQuery({ limit: 10, page: 0 }); |
||||
|
resourceData({ limit: 10, page: 0, keyword }) |
||||
|
}}>搜索</Button> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<Table |
||||
|
columns={columns} |
||||
|
dataSource={tableList?.rows || []} |
||||
|
scroll={{ scrollToFirstRowOnChange: true, y: clientHeight - 260 }} |
||||
|
pagination={{ |
||||
|
current: query?.page + 1, |
||||
|
pageSize: query?.limit, |
||||
|
total: tableList?.count, |
||||
|
showSizeChanger: true, |
||||
|
// showQuickJumper: true,
|
||||
|
showTotal: (total) => { return <span style={{ fontSize: 15 }}>{`共${Math.ceil(total / query?.limit)}页,${total}项`}</span> }, |
||||
|
onChange: (page, pageSize) => { |
||||
|
setQuery({ limit: pageSize, page: page - 1 }); |
||||
|
resourceData({ limit: pageSize, page: page - 1, keyword }); |
||||
|
} |
||||
|
}} |
||||
|
/> |
||||
|
|
||||
|
{ |
||||
|
ruleModal ? |
||||
|
<RuleModal |
||||
|
treeList={treeList} |
||||
|
editData={editData} |
||||
|
close={() => { |
||||
|
setRuleModal(false); |
||||
|
setEditData({}) |
||||
|
}} |
||||
|
success={() => { |
||||
|
resourceData({ limit: 10, page: 0, keyword }) |
||||
|
} |
||||
|
} |
||||
|
/> : "" |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</> |
||||
|
} |
||||
|
function mapStateToProps (state) { |
||||
|
const { global, auth, resourceCatalog } = state; |
||||
|
return { |
||||
|
user: auth.user, |
||||
|
actions: global.actions, |
||||
|
clientHeight: global.clientHeight, |
||||
|
// resourceCatalog: resourceCatalog?.data || [],
|
||||
|
// isRequesting: resourceCatalog.isRequesting
|
||||
|
}; |
||||
|
} |
||||
|
export default connect(mapStateToProps)(ServiceManagement) |
@ -0,0 +1,158 @@ |
|||||
|
import React, { useEffect, useState } from 'react' |
||||
|
import { connect } from 'react-redux'; |
||||
|
import moment from 'moment'; |
||||
|
import { RouteRequest } from '@peace/utils'; |
||||
|
import { RouteTable } from '$utils' |
||||
|
|
||||
|
import { Tabs, Form, Input, Space, Button, Table, Popconfirm } from 'antd'; |
||||
|
const { Search } = Input; |
||||
|
import { CreditCardFilled, FilePdfOutlined } from '@ant-design/icons'; |
||||
|
import { agent } from 'superagent'; |
||||
|
|
||||
|
import RuleModal from '../components/ruleModal'; |
||||
|
|
||||
|
|
||||
|
function ServiceView ({ loading, clientHeight, actions, dispatch, }) { |
||||
|
|
||||
|
const { dataService } = actions |
||||
|
const [query, setQuery] = useState({ page: 0, limit: 10 }); |
||||
|
const [ruleModal, setRuleModal] = useState(false) |
||||
|
const [editData, setEditData] = useState({}) |
||||
|
const [keyword, setKeyword] = useState() |
||||
|
const [tableList, setTableList] = useState({ rows: [], count: 0 }); |
||||
|
const [treeList, setTreeLista] = useState([]) |
||||
|
useEffect(() => { |
||||
|
resourceData() |
||||
|
// dispatch(dataQuality.getRegularBasis()).then(res => {
|
||||
|
// if (res.success) {
|
||||
|
// setTreeLista(res.payload.data)
|
||||
|
// }
|
||||
|
// })
|
||||
|
}, []) |
||||
|
|
||||
|
|
||||
|
let resourceData = (data) => { |
||||
|
// let params = data || query
|
||||
|
// dispatch(dataService.getBusinessRules({ keyword: keyword, ...params, })).then(res => {
|
||||
|
// if (res.success) {
|
||||
|
// setTableList({ rows: res.payload.data?.rows, count: res.payload.data?.count })
|
||||
|
|
||||
|
// }
|
||||
|
// })
|
||||
|
} |
||||
|
|
||||
|
const columns = [{ |
||||
|
title: '接口名称', |
||||
|
dataIndex: 'name', |
||||
|
}, { |
||||
|
title: '接口路由', |
||||
|
dataIndex: 'description', |
||||
|
}, { |
||||
|
title: '接口类型', |
||||
|
dataIndex: 'problemType', |
||||
|
}, { |
||||
|
title: '状态', |
||||
|
dataIndex: 'problemLevel' |
||||
|
}, { |
||||
|
title: '操作', |
||||
|
dataIndex: 'handle', |
||||
|
// ellipsis: true,
|
||||
|
render: (text, record) => <div style={{ width: 126 }}> |
||||
|
<Button type="link" onClick={() => { |
||||
|
// setEditData(record)
|
||||
|
// setRuleModal(true);
|
||||
|
}}>查看详情</Button> |
||||
|
<Button type="link" onClick={() => { |
||||
|
// setEditData(record)
|
||||
|
// setRuleModal(true);
|
||||
|
}}>编辑</Button> |
||||
|
<Popconfirm |
||||
|
title="是否确认删除该业务规则?" |
||||
|
onConfirm={() => { |
||||
|
dispatch(dataQuality.delBusinessRules(record.id)).then(res => { |
||||
|
if (res.success) { |
||||
|
setQuery({ limit: 10, page: 0 }); |
||||
|
resourceData({ limit: 10, page: 0, keyword }) |
||||
|
} |
||||
|
}) |
||||
|
}} |
||||
|
> |
||||
|
<Button type="link">删除</Button> |
||||
|
</Popconfirm> |
||||
|
<Button type="link" onClick={() => { |
||||
|
// setEditData(record)
|
||||
|
// setRuleModal(true);
|
||||
|
}}>禁用</Button> |
||||
|
</div> |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
return <> |
||||
|
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> |
||||
|
<div style={{ display: 'flex', }}> |
||||
|
<Input |
||||
|
placeholder="接口名称" |
||||
|
value={keyword} |
||||
|
onChange={e => { |
||||
|
setKeyword(e?.target?.value) |
||||
|
}} |
||||
|
style={{ |
||||
|
width: 266, marginRight: 10 |
||||
|
}} |
||||
|
/> |
||||
|
<Button onClick={() => { |
||||
|
setQuery({ limit: 10, page: 0 }); |
||||
|
resourceData({ limit: 10, page: 0, keyword }) |
||||
|
}}>搜索</Button> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<Table |
||||
|
columns={columns} |
||||
|
dataSource={tableList?.rows || []} |
||||
|
scroll={{ scrollToFirstRowOnChange: true, y: clientHeight - 260 }} |
||||
|
pagination={{ |
||||
|
current: query?.page + 1, |
||||
|
pageSize: query?.limit, |
||||
|
total: tableList?.count, |
||||
|
showSizeChanger: true, |
||||
|
// showQuickJumper: true,
|
||||
|
showTotal: (total) => { return <span style={{ fontSize: 15 }}>{`共${Math.ceil(total / query?.limit)}页,${total}项`}</span> }, |
||||
|
onChange: (page, pageSize) => { |
||||
|
setQuery({ limit: pageSize, page: page - 1 }); |
||||
|
resourceData({ limit: pageSize, page: page - 1, keyword }); |
||||
|
} |
||||
|
}} |
||||
|
/> |
||||
|
|
||||
|
{ |
||||
|
ruleModal ? |
||||
|
<RuleModal |
||||
|
treeList={treeList} |
||||
|
editData={editData} |
||||
|
close={() => { |
||||
|
setRuleModal(false); |
||||
|
setEditData({}) |
||||
|
}} |
||||
|
success={() => { |
||||
|
resourceData({ limit: 10, page: 0, keyword }) |
||||
|
} |
||||
|
} |
||||
|
/> : "" |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</> |
||||
|
} |
||||
|
function mapStateToProps (state) { |
||||
|
const { global, auth, resourceCatalog } = state; |
||||
|
return { |
||||
|
user: auth.user, |
||||
|
actions: global.actions, |
||||
|
clientHeight: global.clientHeight, |
||||
|
// resourceCatalog: resourceCatalog?.data || [],
|
||||
|
// isRequesting: resourceCatalog.isRequesting
|
||||
|
}; |
||||
|
} |
||||
|
export default connect(mapStateToProps)(ServiceView) |
@ -0,0 +1,15 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import reducers from './reducers'; |
||||
|
import routes from './routes'; |
||||
|
import actions from './actions'; |
||||
|
import { getNavItem } from './nav-item'; |
||||
|
|
||||
|
export default { |
||||
|
key: 'dataService', |
||||
|
name: '数据服务', |
||||
|
reducers: reducers, |
||||
|
routes: routes, |
||||
|
actions: actions, |
||||
|
getNavItem: getNavItem |
||||
|
}; |
@ -0,0 +1,19 @@ |
|||||
|
import React from 'react'; |
||||
|
import { Link } from 'react-router-dom'; |
||||
|
import { Menu } from 'antd'; |
||||
|
import { CarryOutOutlined } from '@ant-design/icons'; |
||||
|
const SubMenu = Menu.SubMenu; |
||||
|
|
||||
|
export function getNavItem (user) { |
||||
|
return ( |
||||
|
<SubMenu key="dataService" icon={<CarryOutOutlined />} title='数据服务'> |
||||
|
|
||||
|
<Menu.Item key="serviceManagement"> |
||||
|
<Link to="/dataService/serviceManagement">服务管理</Link> |
||||
|
</Menu.Item> |
||||
|
<Menu.Item key="serviceView"> |
||||
|
<Link to="/dataService/serviceView">服务查看</Link> |
||||
|
</Menu.Item> |
||||
|
</ SubMenu > |
||||
|
); |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
'use strict'; |
||||
|
import { ServiceManagement,ServiceView } from './containers'; |
||||
|
export default [{ |
||||
|
type: 'inner', |
||||
|
route: { |
||||
|
path: '/dataService', |
||||
|
key: 'dataService', |
||||
|
breadcrumb: '数据质量', |
||||
|
// 不设置 component 则面包屑禁止跳转
|
||||
|
childRoutes: [{ |
||||
|
path: '/serviceManagement', |
||||
|
key: 'serviceManagement', |
||||
|
component: ServiceManagement, |
||||
|
breadcrumb: '服务管理' |
||||
|
}, { |
||||
|
path: '/serviceView', |
||||
|
key: 'serviceView', |
||||
|
component: ServiceView, |
||||
|
breadcrumb: '服务查看' |
||||
|
}] |
||||
|
} |
||||
|
}]; |
Loading…
Reference in new issue