diff --git a/api/app/lib/controllers/resourceConsumption/index.js b/api/app/lib/controllers/resourceConsumption/index.js index 5d8dc2f..85b2cd1 100644 --- a/api/app/lib/controllers/resourceConsumption/index.js +++ b/api/app/lib/controllers/resourceConsumption/index.js @@ -155,11 +155,8 @@ function deleteModelManagement(opts) { + module.exports = { - // getModelManagementList, - // addModelManagement, - // editModelManagement, - // deleteModelManagement, getApproveList, postApprove, } \ No newline at end of file diff --git a/web/client/src/app.js b/web/client/src/app.js index 91f27b8..f45bedc 100644 --- a/web/client/src/app.js +++ b/web/client/src/app.js @@ -9,6 +9,8 @@ import MetadataAcquisition from './sections/metadataAcquisition'; import resourceConsumption from './sections/resourceConsumption'; import resourceRetrieval from './sections/resourceRetrieval'; import memberManagement from './sections/memberManagement'; +import dataQuality from './sections/dataQuality'; +import safetySpecification from './sections/safetySpecification'; const App = props => { const { projectName } = props @@ -26,7 +28,9 @@ const App = props => { MetadataAcquisition, resourceConsumption, resourceRetrieval, - memberManagement + dataQuality, + safetySpecification, + memberManagement, ]} /> ) diff --git a/web/client/src/sections/dataQuality/actions/approve.js b/web/client/src/sections/dataQuality/actions/approve.js new file mode 100644 index 0000000..9f21dbd --- /dev/null +++ b/web/client/src/sections/dataQuality/actions/approve.js @@ -0,0 +1,29 @@ +'use strict'; + +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getApproveList (query = {}) { + return dispatch => basicAction({ + type: 'get', + query, + dispatch: dispatch, + actionType: 'GET_APPROVE_LIST', + url: `${ApiTable.approveList}`, + msg: { error: '获取资源消费列表失败' }, + reducer: { name: '' } + }); +} + + +export function postApprove (data = {}) { + return dispatch => basicAction({ + type: 'post', + data, + dispatch: dispatch, + actionType: 'POST_APPROVE', + url: `${ApiTable.approveList}`, + msg: { option: '资源审批' }, + reducer: { name: '' } + }); +} diff --git a/web/client/src/sections/dataQuality/actions/example.js b/web/client/src/sections/dataQuality/actions/example.js new file mode 100644 index 0000000..6b3c25d --- /dev/null +++ b/web/client/src/sections/dataQuality/actions/example.js @@ -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' } +// }); +// } diff --git a/web/client/src/sections/dataQuality/actions/index.js b/web/client/src/sections/dataQuality/actions/index.js new file mode 100644 index 0000000..f233405 --- /dev/null +++ b/web/client/src/sections/dataQuality/actions/index.js @@ -0,0 +1,9 @@ +'use strict'; + +import * as example from './example' +import * as approve from './approve' + +export default { + ...example, + ...approve, +} \ No newline at end of file diff --git a/web/client/src/sections/dataQuality/components/approveModal.js b/web/client/src/sections/dataQuality/components/approveModal.js new file mode 100644 index 0000000..4d01719 --- /dev/null +++ b/web/client/src/sections/dataQuality/components/approveModal.js @@ -0,0 +1,94 @@ +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 ApproveModal ({ loading, clientHeight, user, actions, dispatch, close, success, editData, }) { + + const { resourceConsumption } = 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 <> + { + form.validateFields().then(v => { + console.log(v); + dispatch(resourceConsumption.postApprove({ + id: editData?.id, ...v, + approveAt: moment().format('YYYY-MM-DD HH:mm:ss'), + approveBy: user?.id, + approveState: '已审批' + })).then(res => { + if (res.success) { + close() + success() + } + }) + }) + }} + onCancel={() => { + close() + }} + > +
{ + console.log(v); + if (v.approve) { + setApprove(v.approve) + } + // setFormData(v) + }} + autoComplete="off" + > + + + 同意 + 不同意 + + + {!approve || approve == 'false' ? + + + : ""} + {!approve || approve == 'true' ?
+ + + + +
: ""} +
+
+ + +} +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)(ApproveModal) \ No newline at end of file diff --git a/web/client/src/sections/dataQuality/containers/documentLibrary.js b/web/client/src/sections/dataQuality/containers/documentLibrary.js new file mode 100644 index 0000000..77918de --- /dev/null +++ b/web/client/src/sections/dataQuality/containers/documentLibrary.js @@ -0,0 +1,98 @@ +import React, { useEffect, useState } from 'react' +import { connect } from 'react-redux'; +import moment from 'moment'; +import ApproveModal from '../components/approveModal'; + + +import { Tabs, Form, Input, DatePicker, Button, Table } from 'antd'; +import { v1 } from 'uuid'; + + +function Approve ({ loading, clientHeight, actions, dispatch, }) { + + const { resourceConsumption } = actions + const [tabsKey, setTabsKey] = useState("stay") + const [query, setQuery] = useState({ page: 0, limit: 10 }); + const [proTableList, setProTableList] = useState({ rows: [], count: 0 }); + const [formData, setFormData] = useState({}) + const [approveModal, setApproveModal] = useState(false) + const [editData, setEditData] = useState({}) + const [column, setColumn] = useState([]) + + useEffect(() => { + resourceData() + }, []) + + + let resourceData = (params) => { + // let data = params || query + // dispatch(resourceConsumption.getApproveList({ approveState: tabsKey == 'stay' ? "审批中" : '已审批', ...formData, ...data, })).then(res => { + // if (res.success) { + // setProTableList(res.payload.data) + // } + // }) + } + + + + + useEffect(() => { + + }, []) + + return <> + + {/*
{ + + setFormData({ ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) + resourceData({ limit: 10, page: 0, ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) + setQuery({ limit: 10, page: 0 }); + console.log(v); + }} + autoComplete="off" + > + + + + + + + + + + + + +
*/} + + + { + approveModal ? + { + setApproveModal(false); + setEditData({}) + }} + success={() => { + resourceData({ limit: 10, page: 0 }) + setQuery({ limit: 10, page: 0 }); + }} + /> : "" + } + + +} +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)(Approve) \ No newline at end of file diff --git a/web/client/src/sections/dataQuality/containers/index.js b/web/client/src/sections/dataQuality/containers/index.js new file mode 100644 index 0000000..2a63c15 --- /dev/null +++ b/web/client/src/sections/dataQuality/containers/index.js @@ -0,0 +1,7 @@ +'use strict'; + +import DocumentLibrary from './documentLibrary'; +import RuleLibrary from './ruleLibrary'; +import QualityMonitor from './qualityMonitor'; + +export { DocumentLibrary, RuleLibrary,QualityMonitor }; diff --git a/web/client/src/sections/dataQuality/containers/qualityMonitor.js b/web/client/src/sections/dataQuality/containers/qualityMonitor.js new file mode 100644 index 0000000..a3991a9 --- /dev/null +++ b/web/client/src/sections/dataQuality/containers/qualityMonitor.js @@ -0,0 +1,91 @@ +import React, { useEffect, useState } from 'react' +import { connect } from 'react-redux'; +import moment from 'moment'; +import ApproveModal from '../components/approveModal'; + + +import { Tabs, Form, Input, DatePicker, Button, Table, Select } from 'antd'; +import { v1 } from 'uuid'; + + +function MyApplication ({ loading, clientHeight, actions, dispatch, user }) { + + const { resourceConsumption } = actions + + const [query, setQuery] = useState({ page: 0, limit: 10 }); + const [proTableList, setProTableList] = useState({ rows: [], count: 0 }); + const [formData, setFormData] = useState({}) + + useEffect(() => { + resourceData() + }, []) + + + let resourceData = (params) => { + // let data = params || query + // dispatch(resourceConsumption.getApproveList({ applyById: user?.id, ...formData, ...data, })).then(res => { + // if (res.success) { + // setProTableList(res.payload.data) + // } + // }) + } + + + + + + + return <> + {/*
{ + + setFormData({ ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) + resourceData({ limit: 10, page: 0, ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) + setQuery({ limit: 10, page: 0 }); + }} + autoComplete="off" + > + + + + + + + + + : ""} + {!approve || approve == 'true' ?
+ + + + +
: ""} +
+ + + +} +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)(ApproveModal) \ No newline at end of file diff --git a/web/client/src/sections/safetySpecification/containers/index.js b/web/client/src/sections/safetySpecification/containers/index.js new file mode 100644 index 0000000..addc944 --- /dev/null +++ b/web/client/src/sections/safetySpecification/containers/index.js @@ -0,0 +1,6 @@ +'use strict'; + +import SpecificationLibrary from './specificationLibrary'; + + +export { SpecificationLibrary}; diff --git a/web/client/src/sections/safetySpecification/containers/specificationLibrary.js b/web/client/src/sections/safetySpecification/containers/specificationLibrary.js new file mode 100644 index 0000000..77918de --- /dev/null +++ b/web/client/src/sections/safetySpecification/containers/specificationLibrary.js @@ -0,0 +1,98 @@ +import React, { useEffect, useState } from 'react' +import { connect } from 'react-redux'; +import moment from 'moment'; +import ApproveModal from '../components/approveModal'; + + +import { Tabs, Form, Input, DatePicker, Button, Table } from 'antd'; +import { v1 } from 'uuid'; + + +function Approve ({ loading, clientHeight, actions, dispatch, }) { + + const { resourceConsumption } = actions + const [tabsKey, setTabsKey] = useState("stay") + const [query, setQuery] = useState({ page: 0, limit: 10 }); + const [proTableList, setProTableList] = useState({ rows: [], count: 0 }); + const [formData, setFormData] = useState({}) + const [approveModal, setApproveModal] = useState(false) + const [editData, setEditData] = useState({}) + const [column, setColumn] = useState([]) + + useEffect(() => { + resourceData() + }, []) + + + let resourceData = (params) => { + // let data = params || query + // dispatch(resourceConsumption.getApproveList({ approveState: tabsKey == 'stay' ? "审批中" : '已审批', ...formData, ...data, })).then(res => { + // if (res.success) { + // setProTableList(res.payload.data) + // } + // }) + } + + + + + useEffect(() => { + + }, []) + + return <> + + {/*
{ + + setFormData({ ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) + resourceData({ limit: 10, page: 0, ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) + setQuery({ limit: 10, page: 0 }); + console.log(v); + }} + autoComplete="off" + > + + + + + + + + + + + + +
*/} + + + { + approveModal ? + { + setApproveModal(false); + setEditData({}) + }} + success={() => { + resourceData({ limit: 10, page: 0 }) + setQuery({ limit: 10, page: 0 }); + }} + /> : "" + } + + +} +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)(Approve) \ No newline at end of file diff --git a/web/client/src/sections/safetySpecification/index.js b/web/client/src/sections/safetySpecification/index.js new file mode 100644 index 0000000..38cf233 --- /dev/null +++ b/web/client/src/sections/safetySpecification/index.js @@ -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: 'resourceConsumption', + name: '资源消费', + reducers: reducers, + routes: routes, + actions: actions, + getNavItem: getNavItem +}; \ No newline at end of file diff --git a/web/client/src/sections/safetySpecification/nav-item.js b/web/client/src/sections/safetySpecification/nav-item.js new file mode 100644 index 0000000..f9897d2 --- /dev/null +++ b/web/client/src/sections/safetySpecification/nav-item.js @@ -0,0 +1,15 @@ +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 ( + } title='数据安全规范'> + + 数据安全规范库 + + + ); +} \ No newline at end of file diff --git a/web/client/src/sections/safetySpecification/reducers/index.js b/web/client/src/sections/safetySpecification/reducers/index.js new file mode 100644 index 0000000..7ed1088 --- /dev/null +++ b/web/client/src/sections/safetySpecification/reducers/index.js @@ -0,0 +1,5 @@ +'use strict'; + +export default { + +} \ No newline at end of file diff --git a/web/client/src/sections/safetySpecification/routes.js b/web/client/src/sections/safetySpecification/routes.js new file mode 100644 index 0000000..eb45b94 --- /dev/null +++ b/web/client/src/sections/safetySpecification/routes.js @@ -0,0 +1,17 @@ +'use strict'; +import {SpecificationLibrary } from './containers'; +export default [{ + type: 'inner', + route: { + path: '/safetySpecification', + key: 'safetySpecification', + breadcrumb: '数据安全规范', + // 不设置 component 则面包屑禁止跳转 + childRoutes: [{ + path: '/specificationLibrary', + key: 'specificationLibrary', + component: SpecificationLibrary, + breadcrumb: '数据安全规范库' + }] + } +}]; \ No newline at end of file