wangyue
2 years ago
85 changed files with 11 additions and 3749 deletions
@ -1,69 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { ApiTable } from '$utils' |
|
||||
import { Request } from '@peace/utils' |
|
||||
|
|
||||
export const INIT_AUTH = 'INIT_AUTH'; |
|
||||
export function initAuth() { |
|
||||
const user = JSON.parse(sessionStorage.getItem('user')) || {}; |
|
||||
return { |
|
||||
type: INIT_AUTH, |
|
||||
payload: { |
|
||||
user: user |
|
||||
} |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export const REQUEST_LOGIN = 'REQUEST_LOGIN'; |
|
||||
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS'; |
|
||||
export const LOGIN_ERROR = 'LOGIN_ERROR'; |
|
||||
export function login(username, password) { |
|
||||
return dispatch => { |
|
||||
dispatch({ type: REQUEST_LOGIN }); |
|
||||
|
|
||||
if (!username || !password) { |
|
||||
dispatch({ |
|
||||
type: LOGIN_ERROR, |
|
||||
payload: { error: '请输入账号名和密码' } |
|
||||
}); |
|
||||
return Promise.resolve(); |
|
||||
} |
|
||||
|
|
||||
const url = ApiTable.login; |
|
||||
return Request.post(url, { username, password, p: '456' }) |
|
||||
.then(user => { |
|
||||
sessionStorage.setItem('user', JSON.stringify(user)); |
|
||||
dispatch({ |
|
||||
type: LOGIN_SUCCESS, |
|
||||
payload: { user: user }, |
|
||||
}); |
|
||||
}, error => { |
|
||||
let { body } = error.response; |
|
||||
dispatch({ |
|
||||
type: LOGIN_ERROR, |
|
||||
payload: { |
|
||||
error: body && body.message ? body.message : '登录失败' |
|
||||
} |
|
||||
}) |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
export const LOGOUT = 'LOGOUT'; |
|
||||
export function logout(user) { |
|
||||
const token = user.token; |
|
||||
const url = ApiTable.logout; |
|
||||
sessionStorage.removeItem('user'); |
|
||||
Request.put(url, { |
|
||||
token: token |
|
||||
}); |
|
||||
return { |
|
||||
type: LOGOUT |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default { |
|
||||
initAuth, |
|
||||
login, |
|
||||
logout |
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
/** |
|
||||
* Created by liu.xinyi |
|
||||
* on 2016/4/1. |
|
||||
*/ |
|
||||
'use strict'; |
|
||||
import auth from './auth'; |
|
||||
|
|
||||
export default { |
|
||||
...auth |
|
||||
}; |
|
@ -1,4 +0,0 @@ |
|||||
'use strict'; |
|
||||
import Login from './login'; |
|
||||
|
|
||||
export { Login }; |
|
@ -1,108 +0,0 @@ |
|||||
'use strict'; |
|
||||
import React, { useState, useEffect } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { push } from 'react-router-redux'; |
|
||||
import { Button, Input, Form, Row, Col, message } from 'antd'; |
|
||||
import { login } from '../actions/auth'; |
|
||||
import './style.less'; |
|
||||
|
|
||||
const FormItem = Form.Item; |
|
||||
const Login = props => { |
|
||||
const { dispatch, user, error, isRequesting } = props |
|
||||
const [username, setUserName] = useState('') |
|
||||
const [password, setPassword] = useState('') |
|
||||
const [inputChanged, setInputChanged] = useState(false) |
|
||||
|
|
||||
useEffect(() => { |
|
||||
|
|
||||
}, []) |
|
||||
|
|
||||
useEffect(() => { |
|
||||
if (error) { |
|
||||
message.error(error); |
|
||||
setPassword('') |
|
||||
} |
|
||||
}, [error]) |
|
||||
|
|
||||
useEffect(() => { |
|
||||
user && user.authorized ? dispatch(push('/fillion/infor')) : null |
|
||||
}, [user]) |
|
||||
|
|
||||
const enterHandler = e => { |
|
||||
if (e.key === 'Enter') { |
|
||||
setInputChanged(false) |
|
||||
dispatch(login(username, password)); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
const handleLogin = () => { |
|
||||
let reg_user = "SuperAdmin"; |
|
||||
let reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/; //11位手机号码正则
|
|
||||
if (username == reg_user || reg_tel.test(username)) { |
|
||||
setInputChanged(false) |
|
||||
dispatch(login(username, password)) |
|
||||
return |
|
||||
} |
|
||||
if (username == "" || password == "") { |
|
||||
setInputChanged(false) |
|
||||
dispatch(login(username, password)) |
|
||||
return |
|
||||
} |
|
||||
setInputChanged(false) |
|
||||
dispatch(login("12345678912564589", "123456789")) |
|
||||
} |
|
||||
|
|
||||
|
|
||||
return ( |
|
||||
<div className='login'> |
|
||||
<div className='left'></div> |
|
||||
<div className='right'> |
|
||||
<div className='loginBox'> |
|
||||
<h1>智慧应急</h1> |
|
||||
<Form onKeyDown={enterHandler}> |
|
||||
|
|
||||
<FormItem> |
|
||||
<div className='loginFormTit'>用户名</div> |
|
||||
<Input |
|
||||
className='loginInp' |
|
||||
type="text" |
|
||||
value={username} |
|
||||
maxlength={11} |
|
||||
onChange={e => { |
|
||||
setUserName(e.target.value) |
|
||||
setInputChanged(true) |
|
||||
}} |
|
||||
/> |
|
||||
</FormItem> |
|
||||
<div className='loginFormTit'>密码</div> |
|
||||
<FormItem> |
|
||||
<Input |
|
||||
className='loginInp' |
|
||||
type="password" |
|
||||
value={password} |
|
||||
|
|
||||
onChange={e => { |
|
||||
setPassword(e.target.value) |
|
||||
setInputChanged(true) |
|
||||
}} |
|
||||
/> |
|
||||
</FormItem> |
|
||||
</Form> |
|
||||
<Button type="primary" className='loginBtn' loading={isRequesting} onClick={handleLogin}>登录</Button> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
); |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
const { auth } = state; |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
error: auth.error, |
|
||||
isRequesting: auth.isRequesting |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(Login); |
|
@ -1,81 +0,0 @@ |
|||||
.login { |
|
||||
width: 100%; |
|
||||
height: 100%; |
|
||||
position: absolute; |
|
||||
top: 0; |
|
||||
left: 0; |
|
||||
|
|
||||
.left { |
|
||||
background-image: url('/assets/images/loginBg.jpg'); |
|
||||
background-size: 100% 100%; |
|
||||
background-repeat: no-repeat; |
|
||||
width: 55%; |
|
||||
height: 100%; |
|
||||
float: left; |
|
||||
top: 0px; |
|
||||
left: 0px; |
|
||||
} |
|
||||
|
|
||||
.right { |
|
||||
width: 45%; |
|
||||
height: 100%; |
|
||||
background-color: #000066; |
|
||||
float: left; |
|
||||
right: 0px; |
|
||||
bottom: 0px; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@media screen and (max-height:1440px) { |
|
||||
.loginBox { |
|
||||
top: 25%; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@media screen and (max-height: 768px) { |
|
||||
.loginBox { |
|
||||
top: 20%; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@media screen and (max-height: 630px) { |
|
||||
.loginBox { |
|
||||
top: 10%; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.loginBox { |
|
||||
height: 50%; |
|
||||
width: 25%; |
|
||||
position: absolute; |
|
||||
right: 6.5%; |
|
||||
z-index: 20; |
|
||||
|
|
||||
h1 { |
|
||||
color: #fff; |
|
||||
font-size: 58px; |
|
||||
} |
|
||||
|
|
||||
.loginFormTit { |
|
||||
width: 20%; |
|
||||
font-size: 18px; |
|
||||
color: rgb(255, 255, 255); |
|
||||
margin-bottom: 10px; |
|
||||
} |
|
||||
|
|
||||
.loginInp { |
|
||||
width: 80%; |
|
||||
height: 50px; |
|
||||
background: #ffffff; |
|
||||
border: 1px solid #C2C2C2; |
|
||||
border-radius: 5px; |
|
||||
} |
|
||||
|
|
||||
.loginBtn { |
|
||||
width: 80%; |
|
||||
height: 50px; |
|
||||
margin-top: 20px; |
|
||||
border-radius: 5px; |
|
||||
font-size: 16px; |
|
||||
} |
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import routes from './routes'; |
|
||||
import reducers from './reducers'; |
|
||||
import actions from './actions'; |
|
||||
|
|
||||
export default { |
|
||||
key: 'auth', |
|
||||
reducers: reducers, |
|
||||
routes: routes, |
|
||||
actions: actions |
|
||||
}; |
|
@ -1,40 +0,0 @@ |
|||||
'use strict'; |
|
||||
import * as actionTypes from '../actions/auth'; |
|
||||
import Immutable from 'immutable'; |
|
||||
|
|
||||
const initState = { |
|
||||
user: {}, |
|
||||
isRequesting: false, |
|
||||
error: null |
|
||||
}; |
|
||||
|
|
||||
function auth(state = initState, action) { |
|
||||
const payload = action.payload; |
|
||||
switch (action.type){ |
|
||||
case actionTypes.INIT_AUTH: |
|
||||
return Immutable.fromJS(state).set('user', payload.user).toJS(); |
|
||||
case actionTypes.REQUEST_LOGIN: |
|
||||
return Immutable.fromJS(state).merge({ |
|
||||
isRequesting: true, |
|
||||
error: null |
|
||||
}).toJS(); |
|
||||
case actionTypes.LOGIN_SUCCESS: |
|
||||
return Immutable.fromJS(state).merge({ |
|
||||
isRequesting: false, |
|
||||
user: payload.user |
|
||||
}).toJS(); |
|
||||
case actionTypes.LOGIN_ERROR: |
|
||||
return Immutable.fromJS(state).merge({ |
|
||||
isRequesting: false, |
|
||||
error: payload.error |
|
||||
}).toJS(); |
|
||||
case actionTypes.LOGOUT: |
|
||||
return Immutable.fromJS(state).merge({ |
|
||||
user: null |
|
||||
}).toJS(); |
|
||||
default: |
|
||||
return state; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
export default auth; |
|
@ -1,6 +0,0 @@ |
|||||
'use strict'; |
|
||||
import auth from './auth' |
|
||||
|
|
||||
export default { |
|
||||
auth |
|
||||
}; |
|
@ -1,12 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { Login } from './containers'; |
|
||||
|
|
||||
export default [{ |
|
||||
type: 'dapin', |
|
||||
route: { |
|
||||
key: 'signin', |
|
||||
path: "/signin", |
|
||||
component: Login |
|
||||
} |
|
||||
}]; |
|
@ -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,7 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import * as example from './example' |
|
||||
|
|
||||
export default { |
|
||||
...example |
|
||||
} |
|
@ -1,43 +0,0 @@ |
|||||
import React, { useEffect } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Card } from 'antd'; |
|
||||
import '../style.less'; |
|
||||
import ProTable, { TableDropdown } from '@ant-design/pro-table'; |
|
||||
|
|
||||
const Example = (props) => { |
|
||||
const { dispatch, actions, user, loading } = props |
|
||||
|
|
||||
useEffect(() => { |
|
||||
dispatch(actions.example.getMembers(user.orgId)) |
|
||||
}, []) |
|
||||
|
|
||||
return ( |
|
||||
<Spin tip="biubiubiu~" spinning={loading}> |
|
||||
<div id='example'> |
|
||||
<p>STYLE EXAMPLE</p> |
|
||||
</div> |
|
||||
<ProTable |
|
||||
columns={[{ |
|
||||
dataIndex: 'index', |
|
||||
valueType: 'indexBorder', |
|
||||
width: 48, |
|
||||
}]} |
|
||||
defaultData={[{ index: 1, key: 1 }]} |
|
||||
> |
|
||||
|
|
||||
</ProTable> |
|
||||
</Spin> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
const { auth, global, members } = state; |
|
||||
return { |
|
||||
loading: members.isRequesting, |
|
||||
user: auth.user, |
|
||||
actions: global.actions, |
|
||||
members: members.data |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(Example); |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import Example from './example'; |
|
||||
|
|
||||
export { Example }; |
|
@ -1,15 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import reducers from './reducers'; |
|
||||
import routes from './routes'; |
|
||||
import actions from './actions'; |
|
||||
import { getNavItem } from './nav-item'; |
|
||||
|
|
||||
export default { |
|
||||
key: 'example', |
|
||||
name: '书写示例', |
|
||||
reducers: reducers, |
|
||||
routes: routes, |
|
||||
actions: actions, |
|
||||
getNavItem: getNavItem |
|
||||
}; |
|
@ -1,16 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { Link } from 'react-router-dom'; |
|
||||
import { Menu } from 'antd'; |
|
||||
import { SettingOutlined } from '@ant-design/icons'; |
|
||||
|
|
||||
const SubMenu = Menu.SubMenu; |
|
||||
|
|
||||
export function getNavItem(user, dispatch) { |
|
||||
return ( |
|
||||
<SubMenu key="example" icon={<SettingOutlined />} title={'举个栗子'}> |
|
||||
<Menu.Item key="e1"> |
|
||||
<Link to="/example/e1">举个棒子</Link> |
|
||||
</Menu.Item> |
|
||||
</SubMenu> |
|
||||
); |
|
||||
} |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
export default { |
|
||||
|
|
||||
} |
|
@ -1,18 +0,0 @@ |
|||||
'use strict'; |
|
||||
import { Example, } from './containers'; |
|
||||
|
|
||||
export default [{ |
|
||||
type: 'inner', |
|
||||
route: { |
|
||||
path: '/example', |
|
||||
key: 'example', |
|
||||
breadcrumb: '栗子', |
|
||||
// 不设置 component 则面包屑禁止跳转
|
|
||||
childRoutes: [{ |
|
||||
path: '/e1', |
|
||||
key: 'e1', |
|
||||
component: Example, |
|
||||
breadcrumb: '棒子', |
|
||||
}] |
|
||||
} |
|
||||
}]; |
|
@ -1,3 +0,0 @@ |
|||||
#example:hover { |
|
||||
font-size: larger; |
|
||||
} |
|
@ -1,37 +0,0 @@ |
|||||
// 'use strict';
|
|
||||
|
|
||||
// import { basicAction } from '@peace/utils'
|
|
||||
// import { ApiTable } from '$utils'
|
|
||||
|
|
||||
// export function reportRectify (timeRange) {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'get',
|
|
||||
// dispatch: dispatch,
|
|
||||
// actionType: 'GET_REPORT_RECTIFY',
|
|
||||
// url: `${ApiTable.getReportRectify}?startTime=${timeRange ? timeRange[0] : ''}&endTime=${timeRange ? timeRange[1] : ''}`,
|
|
||||
// msg: {},
|
|
||||
// reducer: { name: 'reportRectify' }
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
||||
// export function reportRectifyDetail (day, depId) {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'get',
|
|
||||
// dispatch: dispatch,
|
|
||||
// actionType: 'GET_REPORT_RECTIFY_DETAIL',
|
|
||||
// url: `${ApiTable.getReportRectifyDetail}?day=${day}&depId=${depId}`,
|
|
||||
// msg: {},
|
|
||||
// reducer: { name: 'reportRectifyDetail' }
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
||||
// export function compileReportRectifyDetail (data) {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'post',
|
|
||||
// dispatch: dispatch,
|
|
||||
// data,
|
|
||||
// actionType: 'COMPILE_REPORT_RECTIFY_DETAIL',
|
|
||||
// url: `${ApiTable.compileReportRectifyDetail}`,
|
|
||||
// msg: { option: '保存信息' },
|
|
||||
// });
|
|
||||
// }
|
|
@ -1,59 +0,0 @@ |
|||||
// 'use strict';
|
|
||||
|
|
||||
// import { basicAction } from '@peace/utils'
|
|
||||
// import { ApiTable } from '$utils'
|
|
||||
|
|
||||
// export function allAreas (orgId) {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'get',
|
|
||||
// dispatch: dispatch,
|
|
||||
// actionType: 'GET_ALL_AREAS',
|
|
||||
// url: `${ApiTable.allAreas}`,
|
|
||||
// msg: {},
|
|
||||
// reducer: { name: 'allAreas' }
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
||||
// export function addReportConfig (data) {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'post',
|
|
||||
// dispatch: dispatch,
|
|
||||
// data: data,
|
|
||||
// actionType: 'POST_REPORT_CONFIGS',
|
|
||||
// url: `${ApiTable.addReportConfig}`,
|
|
||||
// msg: { option: '添加报表配置' },
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
||||
// export function getReportConfig () {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'get',
|
|
||||
// dispatch: dispatch,
|
|
||||
// actionType: 'GET_REPORT_CONFIGS',
|
|
||||
// url: `${ApiTable.getReportConfig}`,
|
|
||||
// msg: { error: '获取报表配置失败' },
|
|
||||
// reducer: { name: 'reportConfig' }
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
||||
// export function editReportConfig (data, configId) {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'put',
|
|
||||
// dispatch: dispatch,
|
|
||||
// data: data,
|
|
||||
// actionType: 'EDIT_REPORT_CONFIGS',
|
|
||||
// url: `${ApiTable.editReportConfig.replace('{reportId}', configId)}`,
|
|
||||
// msg: { option: '编辑报表配置' },
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
||||
// export function delReportConfig (configId) {
|
|
||||
// return dispatch => basicAction({
|
|
||||
// type: 'del',
|
|
||||
// dispatch: dispatch,
|
|
||||
// actionType: 'DEL_REPORT_CONFIGS',
|
|
||||
// url: `${ApiTable.delReportConfig.replace('{reportId}', configId)}`,
|
|
||||
// msg: { option: '删除报表配置' },
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
@ -1,6 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import * as infor from './infor' |
|
||||
export default { |
|
||||
...infor, |
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
import { basicAction } from '@peace/utils' |
|
||||
import { ApiTable } from '$utils' |
|
||||
|
|
||||
export function getDepMessage() { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_DEPARTMENT_MESSAGE', |
|
||||
url: ApiTable.getDepMessage, |
|
||||
msg: { error: '获取部门信息失败' }, |
|
||||
reducer: { name: 'depMessage' } |
|
||||
}); |
|
||||
} |
|
||||
export function getReportStatistic(query) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
query: query, |
|
||||
actionType: 'GET_DEPARTMENT_STATIS', |
|
||||
url: ApiTable.getReportStatistic, |
|
||||
msg: { error: '获取填报信息失败' }, |
|
||||
reducer: { name: 'reportstatistic' } |
|
||||
}); |
|
||||
} |
|
@ -1,118 +0,0 @@ |
|||||
// import React, { useEffect, useState } from 'react';
|
|
||||
// import { connect } from 'react-redux';
|
|
||||
// import { Spin, Drawer, Button } from 'antd';
|
|
||||
// import '../style.less';
|
|
||||
// import { EditableProTable } from '@ant-design/pro-table';
|
|
||||
|
|
||||
// const CompileDrawer = (props) => {
|
|
||||
// const { dispatch, actions, user, loading, visible, checkRow, close, reportRectifyDetail, checkAction } = props
|
|
||||
// const [requesting, setRequesting] = useState(false)
|
|
||||
// const [dataSource, setDataSource] = useState([])
|
|
||||
// const { report } = actions
|
|
||||
// const isCheck = checkAction == 'check'
|
|
||||
|
|
||||
// useEffect(() => {
|
|
||||
// if (checkRow.day) {
|
|
||||
// dispatch(report.reportRectifyDetail(checkRow.day, checkRow.depId))
|
|
||||
// }
|
|
||||
// }, [checkRow])
|
|
||||
|
|
||||
// useEffect(() => {
|
|
||||
// let data = reportRectifyDetail
|
|
||||
// let i = 1
|
|
||||
// for (let d of data) {
|
|
||||
// d.index_ = i++
|
|
||||
// }
|
|
||||
// setDataSource(data)
|
|
||||
// }, [reportRectifyDetail])
|
|
||||
|
|
||||
// return (
|
|
||||
// <Drawer
|
|
||||
// title={"合用场所安全隐患排查整治汇总表"}
|
|
||||
// placement="right"
|
|
||||
// onClose={() => {
|
|
||||
// close()
|
|
||||
// }}
|
|
||||
// visible={visible}
|
|
||||
// width={'82%'}
|
|
||||
// >
|
|
||||
// <Spin spinning={loading || requesting}>
|
|
||||
// <EditableProTable
|
|
||||
// columns={[
|
|
||||
// {
|
|
||||
// title: '序号',
|
|
||||
// dataIndex: 'index_',
|
|
||||
// readonly: true,
|
|
||||
// },
|
|
||||
// {
|
|
||||
// title: '名称',
|
|
||||
// dataIndex: 'name',
|
|
||||
// readonly: true,
|
|
||||
// }, {
|
|
||||
// title: '地址',
|
|
||||
// dataIndex: 'address',
|
|
||||
// readonly: true,
|
|
||||
// }, {
|
|
||||
// title: '排查发现隐患',
|
|
||||
// dataIndex: 'hiddenDanger',
|
|
||||
// readonly: true,
|
|
||||
// }, {
|
|
||||
// title: '采取整改措施',
|
|
||||
// dataIndex: 'correctiveAction',
|
|
||||
// }, {
|
|
||||
// title: '实施处罚、强制措施情况',
|
|
||||
// dataIndex: 'punishment',
|
|
||||
// },
|
|
||||
// ]}
|
|
||||
// controlled={true}
|
|
||||
// value={dataSource}
|
|
||||
// onChange={setDataSource}
|
|
||||
// rowKey="id"
|
|
||||
// headerTitle={`填报单位:${checkRow.region};时间:${checkRow.day}`}
|
|
||||
// maxLength={5}
|
|
||||
// recordCreatorProps={false}
|
|
||||
// editable={{
|
|
||||
// type: 'multiple',
|
|
||||
// editableKeys: isCheck ? [] : dataSource.map(r => r.id)
|
|
||||
// }}
|
|
||||
// toolBarRender={() => [
|
|
||||
// isCheck ? '' :
|
|
||||
// <Button
|
|
||||
// type="primary"
|
|
||||
// key="save"
|
|
||||
// onClick={() => {
|
|
||||
// // dataSource 就是当前数据,可以调用 api 将其保存
|
|
||||
// setRequesting(true)
|
|
||||
// const data = dataSource
|
|
||||
// for (let d of data) {
|
|
||||
// d.userId = user.id
|
|
||||
// delete d.index_
|
|
||||
// }
|
|
||||
// dispatch(report.compileReportRectifyDetail(dataSource)).then(res => {
|
|
||||
// setRequesting(false)
|
|
||||
// })
|
|
||||
// }}
|
|
||||
// >
|
|
||||
// 保存数据
|
|
||||
// </Button>
|
|
||||
// ]}
|
|
||||
// >
|
|
||||
|
|
||||
// </EditableProTable>
|
|
||||
// </Spin>
|
|
||||
// </Drawer >
|
|
||||
// )
|
|
||||
// }
|
|
||||
|
|
||||
// function mapStateToProps (state) {
|
|
||||
// const { auth, global, members, reportRectifyDetail } = state;
|
|
||||
// return {
|
|
||||
// loading: reportRectifyDetail.isRequesting,
|
|
||||
// user: auth.user,
|
|
||||
// actions: global.actions,
|
|
||||
// members: members.data,
|
|
||||
// reportRectifyDetail: reportRectifyDetail.data || []
|
|
||||
// };
|
|
||||
// }
|
|
||||
|
|
||||
// export default connect(mapStateToProps)(CompileDrawer);
|
|
@ -1,124 +0,0 @@ |
|||||
// import React, { useEffect, useRef } from 'react';
|
|
||||
// import { connect } from 'react-redux';
|
|
||||
// import { Spin, Button, Modal, Form, Switch } from 'antd';
|
|
||||
// import ProForm, { ProFormText, ProFormSelect } from '@ant-design/pro-form';
|
|
||||
// import { useState } from 'react';
|
|
||||
|
|
||||
// const ConfigModal = (props) => {
|
|
||||
// const { dispatch, actions, user, loading, visible, close, editData, allAreas, reportType } = props
|
|
||||
// const [excuteTimeOptions, setExcuteTimeOptions] = useState([])
|
|
||||
// const formRef = useRef()
|
|
||||
// const { report } = actions
|
|
||||
|
|
||||
// useEffect(() => {
|
|
||||
// let excuteTimeOptions = []
|
|
||||
// for (let i = 0; i < 24; i++) {
|
|
||||
// let curT = i
|
|
||||
// if (curT < 10) {
|
|
||||
// curT = '0' + curT
|
|
||||
// }
|
|
||||
// excuteTimeOptions.push({
|
|
||||
// value: curT + ':00',
|
|
||||
// label: curT + ':00',
|
|
||||
// })
|
|
||||
// excuteTimeOptions.push({
|
|
||||
// value: curT + ':30',
|
|
||||
// label: curT + ':30',
|
|
||||
// })
|
|
||||
// }
|
|
||||
// setExcuteTimeOptions(excuteTimeOptions);
|
|
||||
// }, [])
|
|
||||
|
|
||||
// return (
|
|
||||
// <Modal
|
|
||||
// title={`${editData ? '编辑' : '新增'}报表配置`}
|
|
||||
// visible={visible}
|
|
||||
// onOk={() => {
|
|
||||
// formRef.current.validateFields().then(v => {
|
|
||||
// v.excuteTime = String(v.excuteTime)
|
|
||||
// console.log(v);
|
|
||||
// dispatch(editData ? report.editReportConfig(v, editData.id) : report.addReportConfig(v)).then(res => {
|
|
||||
// if (res.success) {
|
|
||||
// dispatch(report.getReportConfig())
|
|
||||
// close()
|
|
||||
// }
|
|
||||
// })
|
|
||||
// })
|
|
||||
// }}
|
|
||||
// onCancel={() => {
|
|
||||
// close()
|
|
||||
// }}
|
|
||||
// >
|
|
||||
// <ProForm
|
|
||||
// formRef={formRef}
|
|
||||
// autoFocusFirstInput
|
|
||||
// layout={'horizontal'}
|
|
||||
// labelCol={{ span: 4 }}
|
|
||||
// wrapperCol={{ span: 18 }}
|
|
||||
// initialValues={
|
|
||||
// editData ?
|
|
||||
// editData :
|
|
||||
// {
|
|
||||
// excuteTime: '00:00',
|
|
||||
// isEnable: true
|
|
||||
// }
|
|
||||
// }
|
|
||||
// submitter={false}
|
|
||||
// formKey='config-form'
|
|
||||
// >
|
|
||||
// <ProFormText
|
|
||||
// name={'reportName'}
|
|
||||
// label="报表名称"
|
|
||||
// placeholder="请输入名称"
|
|
||||
// required
|
|
||||
// rules={[{ required: true, message: '请输入名称' }]}
|
|
||||
// />
|
|
||||
// <ProFormSelect
|
|
||||
// options={reportType}
|
|
||||
// cacheForSwr
|
|
||||
// name="reportTypeId"
|
|
||||
// label="报表类型"
|
|
||||
// required
|
|
||||
// rules={[{ required: true, message: '请选择报表类型' }]}
|
|
||||
// />
|
|
||||
// <ProFormSelect
|
|
||||
// options={
|
|
||||
// allAreas.map(a => {
|
|
||||
// return {
|
|
||||
// value: a.id,
|
|
||||
// label: a.name,
|
|
||||
// }
|
|
||||
// })}
|
|
||||
// cacheForSwr
|
|
||||
// name="regionId"
|
|
||||
// label="区域"
|
|
||||
// required
|
|
||||
// rules={[{ required: true, message: '请选择区域' }]}
|
|
||||
// />
|
|
||||
// <Form.Item name="isEnable" label="状态" valuePropName="checked">
|
|
||||
// <Switch checkedChildren="启用" unCheckedChildren="禁用" />
|
|
||||
// </Form.Item>
|
|
||||
// <ProFormSelect
|
|
||||
// options={excuteTimeOptions}
|
|
||||
// addonBefore={'每天'}
|
|
||||
// addonAfter={'时'}
|
|
||||
// cacheForSwr
|
|
||||
// name="excuteTime"
|
|
||||
// label="生成时间"
|
|
||||
// />
|
|
||||
// </ProForm>
|
|
||||
// </Modal>
|
|
||||
// )
|
|
||||
// }
|
|
||||
|
|
||||
// function mapStateToProps (state) {
|
|
||||
// const { auth, global, allAreas } = state;
|
|
||||
// console.log(allAreas);
|
|
||||
// return {
|
|
||||
// user: auth.user,
|
|
||||
// actions: global.actions,
|
|
||||
// allAreas: allAreas.data || []
|
|
||||
// };
|
|
||||
// }
|
|
||||
|
|
||||
// export default connect(mapStateToProps)(ConfigModal);
|
|
@ -1,132 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Table } from 'antd'; |
|
||||
import { ModalForm } from '@ant-design/pro-form'; |
|
||||
import moment from 'moment'; |
|
||||
const UserModal = (props) => { |
|
||||
const { visible, onVisibleChange } = props |
|
||||
const datas = props.modalRecord || {} |
|
||||
const scopeOfExamination = { ...datas }.hiddenDangerItem12 |
|
||||
const arr = [ |
|
||||
' 1、合用场所的所有权人、使用人是否遵守消防法律、法规、规章;', |
|
||||
' 2、住宿场所是否违规搭建;', |
|
||||
' 3、合用场所是否配置灭火器、消防应急照明等消防器材和设施;', |
|
||||
' 4、合用场所的电器产品的安装、使用及其线路和管路的设计、敷设、维护保养、检测,是否符合消防技术标准和管理规定;', |
|
||||
' 5、合用场所住宿是否超过2人;(judge_0) 若超过,人员住宿是否设置在首层,并直通室外安全出口。(judge_1)', |
|
||||
' 6、电动自行车是否违规室内充电、停放;', |
|
||||
' 7、合用场所是否违规生产、储存、经营易燃易爆危险品;', |
|
||||
' 8、合用场所除厨房外是否违规使用或者放置瓶装液化石油气、可燃液体;', |
|
||||
' 9、放置瓶装液化石油气的厨房是否采取防火分隔措施,并设置自然排风窗;', |
|
||||
' 10、合用场所疏散通道、安全出口是否保持畅通;', |
|
||||
' 11、合用场所的外窗或阳台是否设置金属栅栏;(judge_0) 若设置,是否能从内部易于开启。(judge_1)', |
|
||||
' 12、存在其他安全隐患;', |
|
||||
] |
|
||||
const columns = [ |
|
||||
{ |
|
||||
title: '场所名称', |
|
||||
dataIndex: 'reportName', |
|
||||
hideInSearch: true, |
|
||||
render: () => { |
|
||||
return <div>{datas.placeName}</div> |
|
||||
} |
|
||||
}, { |
|
||||
title: '场所基本情况', |
|
||||
dataIndex: 'reportName', |
|
||||
hideInSearch: true, |
|
||||
render: () => { |
|
||||
return <div> |
|
||||
<li>使用性质:{datas.placeType}</li> |
|
||||
<li>地址:{datas.address}</li> |
|
||||
<li>负责人:{datas.placeOwner}</li> |
|
||||
<li>电话:{datas.phone}</li> |
|
||||
<li>面积:{datas.dimension}</li> |
|
||||
<li>层数:{datas.floors}</li> |
|
||||
<li>常驻人口:{datas.numberOfPeople}</li> |
|
||||
</div> |
|
||||
} |
|
||||
}, { |
|
||||
title: '检查内容', |
|
||||
dataIndex: 'reportName', |
|
||||
hideInSearch: true, |
|
||||
render: () => { |
|
||||
return datas.hiddenDangerItem12 ? |
|
||||
scopeOfExamination.map((item, index) => { |
|
||||
let message = arr[index] |
|
||||
if (arr[index].indexOf('judge_') > -1) { |
|
||||
if (item.value == true && index === 4) { |
|
||||
message = message.replace(`judge_1`, item.child.value ? "是" : "否") |
|
||||
} else { |
|
||||
message = message.replace(`若超过,人员住宿是否设置在首层,并直通室外安全出口。(judge_1)`, '') |
|
||||
|
|
||||
|
|
||||
} |
|
||||
if (item.value == true && index === 10) { |
|
||||
message = message.replace(`judge_1`, item.child.value ? "是" : "否") |
|
||||
} else { |
|
||||
|
|
||||
message = message.replace(`若设置,是否能从内部易于开启。(judge_1)`, '') |
|
||||
|
|
||||
} |
|
||||
if (arr[index].indexOf('judge_0') > -1) { |
|
||||
return <li key={index}>{message.replace(`judge_0`, item.value ? "是" : "否")}</li> |
|
||||
} |
|
||||
} |
|
||||
return <li key={index}>{message}({item.value ? "是" : "否"})</li> |
|
||||
}) |
|
||||
: '---' |
|
||||
} |
|
||||
}, { |
|
||||
title: '存在具体问题', |
|
||||
dataIndex: 'reportName', |
|
||||
hideInSearch: true, |
|
||||
render: () => { |
|
||||
return <div>{datas.description ? datas.description : '---'}</div> |
|
||||
} |
|
||||
}, |
|
||||
] |
|
||||
const data = [ |
|
||||
{ |
|
||||
key: '1', |
|
||||
|
|
||||
address: 'New York No. 1 Lake Park', |
|
||||
tags: ['nice', 'developer'], |
|
||||
}, |
|
||||
]; |
|
||||
return ( |
|
||||
<Spin spinning={false}> |
|
||||
<ModalForm |
|
||||
width={'90rem'} |
|
||||
visible={visible} |
|
||||
onVisibleChange={onVisibleChange} |
|
||||
submitter={false} |
|
||||
> |
|
||||
<div style={{ width: '71vw' }}><span style={{ fontSize: '16px' }}>排查单位:{(datas || {}).checkAreaName || ''}</span> |
|
||||
<span style={{ fontSize: '16px', float: 'right', marginBottom: '10px' }}>填报日期:{moment((datas || {}).time).format('YYYY-MM-DD') || ''}</span><span style={{ clear: 'both' }}></span></div> |
|
||||
<Table columns={columns} dataSource={data} width={'50rem'} pagination={false} |
|
||||
|
|
||||
/> |
|
||||
<div style={{ width: '71vw', marginTop: '10px' }}> |
|
||||
<span style={{ fontSize: '16px' }}>排查人:{(datas || {}).checkUserName || ''}</span> |
|
||||
<span style={{ fontSize: '16px', float: 'right' }}>手机号:{(datas || {}).checkUserPhone || ''}</span></div> |
|
||||
</ModalForm> |
|
||||
</Spin> |
|
||||
) |
|
||||
} |
|
||||
function mapStateToProps(state) { |
|
||||
const { depMessage } = state; |
|
||||
const pakData = (dep) => { |
|
||||
return dep.map((d) => { |
|
||||
return { |
|
||||
title: d.name, |
|
||||
value: d.id, |
|
||||
children: pakData(d.subordinate) |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
let depData = pakData(depMessage.data || []) |
|
||||
return { |
|
||||
loading: depMessage.isRequesting, |
|
||||
depData, |
|
||||
}; |
|
||||
} |
|
||||
export default connect(mapStateToProps)(UserModal); |
|
@ -1,223 +0,0 @@ |
|||||
import React, { useEffect, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Button, Popconfirm, TreeSelect } from 'antd'; |
|
||||
import ProTable from '@ant-design/pro-table'; |
|
||||
|
|
||||
import moment from 'moment'; |
|
||||
import { getReportStatistic } from "../actions/infor" |
|
||||
const InForTable = (props) => { |
|
||||
const { dispatch, user, depData, depMessage, depLoading } = props |
|
||||
const [rowSelected, setRowSelected] = useState([]) |
|
||||
const [regionId, setRegionId] = useState()//区域id
|
|
||||
const [placeType, setPlaceType] = useState()//场所
|
|
||||
const [day, setDay] = useState([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')])//日期
|
|
||||
const [sitename, setSitename] = useState()//场所名称
|
|
||||
const [counts, setCounts] = useState()//shuju
|
|
||||
useEffect(() => { |
|
||||
setRegionId(user.departmentId) |
|
||||
}, [user]) |
|
||||
useEffect(() => { |
|
||||
setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) |
|
||||
}, [depData]) |
|
||||
const onChange = (value) => { |
|
||||
// setRegionName(value)
|
|
||||
setRegionId(value) |
|
||||
} |
|
||||
const columns = [ |
|
||||
{ |
|
||||
title: '场所名称', |
|
||||
dataIndex: 'placeName', |
|
||||
formItemProps: { |
|
||||
label: '场所名称', |
|
||||
}, |
|
||||
fieldProps: { |
|
||||
onChange: (value, cs) => { |
|
||||
setSitename(value.currentTarget.value) |
|
||||
}, |
|
||||
placeholder: '请输入场所名称进行搜索', |
|
||||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
title: '场所地址', |
|
||||
search: false, |
|
||||
dataIndex: 'time', |
|
||||
valueType: 'dateRange', |
|
||||
initialValue: day, |
|
||||
order: 4, |
|
||||
render: (dom, record) => { |
|
||||
return record.address |
|
||||
}, |
|
||||
fieldProps: { |
|
||||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
title: '隐患场所', |
|
||||
dataIndex: 'regionName', |
|
||||
valueType: 'select', |
|
||||
initialValue: -1, |
|
||||
fieldProps: { |
|
||||
label: null, |
|
||||
onChange: (value, cs) => { |
|
||||
setPlaceType(value); |
|
||||
}, |
|
||||
options: [{ |
|
||||
|
|
||||
label: '全部', |
|
||||
value: -1 |
|
||||
}, |
|
||||
{ |
|
||||
label: '隐患场所', |
|
||||
value: 0 |
|
||||
}, { |
|
||||
label: '非隐患场所', |
|
||||
value: 1 |
|
||||
}, { |
|
||||
label: '非合用场所', |
|
||||
value: 2 |
|
||||
},], |
|
||||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
||||
}, |
|
||||
order: 5, |
|
||||
render: (dom, record) => { |
|
||||
let flag = "是" |
|
||||
if (record.hiddenDangerItem12 == null) { |
|
||||
flag = <span style={{ color: '#8c8987' }}>/</span> |
|
||||
} |
|
||||
if (record.hiddenDangerItem12 && record.correctiveAction == null && record.punishment == null) { |
|
||||
flag = <span style={{ color: '#8c8987' }}>否</span> |
|
||||
} |
|
||||
return flag |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
title: '排查日期', |
|
||||
dataIndex: 'time', |
|
||||
valueType: 'dateRange', |
|
||||
initialValue: day, |
|
||||
order: 4, |
|
||||
fieldProps: { |
|
||||
onChange: (value, cs) => { |
|
||||
setDay(cs) |
|
||||
}, |
|
||||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
||||
}, |
|
||||
render: (dom, record) => { |
|
||||
return [moment(record.time).format('YYYY-MM-DD HH:mm:ss'),] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
title: '操作', |
|
||||
dataIndex: 'creatTime', |
|
||||
valueType: 'dateTimeRange', |
|
||||
hideInSearch: true, |
|
||||
render: (dom, record) => { |
|
||||
return <Button type="link" onClick={() => { props.openModal('edit', record) }}>详情</Button> |
|
||||
} |
|
||||
}, |
|
||||
] |
|
||||
return ( |
|
||||
<Spin spinning={false}> |
|
||||
<h4 style={{ position: 'relative', top: '34px', left: '62px' }}>区域:</h4> |
|
||||
<TreeSelect |
|
||||
value={regionId} |
|
||||
suffixIcon={true} |
|
||||
dropdownMatchSelectWidth={false} |
|
||||
style={{ width: '18.4%', marginLeft: '104px' }} |
|
||||
treeData={depData} |
|
||||
placeholder="全部" |
|
||||
showSearch={true} |
|
||||
onChange={onChange} |
|
||||
treeDefaultExpandAll={false} |
|
||||
request={async () => { |
|
||||
return depData |
|
||||
}} |
|
||||
expandedKeys={["title"]} |
|
||||
notFoundContent={ |
|
||||
depLoading ? |
|
||||
<p style={{ textAlign: 'center' }}> |
|
||||
<Spin spinning={depLoading}></Spin> |
|
||||
</p> : |
|
||||
<p style={{ textAlign: 'center' }}>暂无数据</p> |
|
||||
} |
|
||||
getPopupContainer={(triggerNode) => triggerNode.parentNode} |
|
||||
/> |
|
||||
<div> |
|
||||
<ProTable |
|
||||
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|
||||
rowKey="id" |
|
||||
onReset={(v) => { |
|
||||
const { id } = depMessage[0] |
|
||||
console.log(id) |
|
||||
setRegionId(id) |
|
||||
setPlaceType(-1) |
|
||||
setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) |
|
||||
setSitename('') |
|
||||
}} |
|
||||
rowSelection={{ |
|
||||
selectedRowKeys: rowSelected, |
|
||||
onChange: (selectedRowKeys) => { |
|
||||
setRowSelected(selectedRowKeys); |
|
||||
}, |
|
||||
}} |
|
||||
columns={columns} |
|
||||
options={false} |
|
||||
dataSource={(counts || {}).rows || []} |
|
||||
request={async (params) => { |
|
||||
const query = { |
|
||||
startDate: day[0], |
|
||||
endDate: day[1], |
|
||||
placeType: placeType, |
|
||||
regionId: regionId, |
|
||||
placeName: sitename, |
|
||||
limit: params.pageSize, |
|
||||
offset: ((params.current ? params.current : 1) - 1) * params.pageSize |
|
||||
} |
|
||||
setRowSelected([]); |
|
||||
const res = await dispatch(getReportStatistic(query)); |
|
||||
setCounts(res.payload.data) |
|
||||
return { |
|
||||
...res, |
|
||||
total: res.payload.data ? res.payload.data.count : 0 |
|
||||
} |
|
||||
}} |
|
||||
search={{ |
|
||||
defaultCollapsed: false, |
|
||||
optionRender: (searchConfig, formProps, dom) => [ |
|
||||
...dom.reverse(), |
|
||||
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, counts) }}> |
|
||||
<Button |
|
||||
> |
|
||||
导出 |
|
||||
</Button> |
|
||||
</Popconfirm> |
|
||||
], |
|
||||
}} |
|
||||
> |
|
||||
</ProTable></div> |
|
||||
|
|
||||
</Spin > |
|
||||
) |
|
||||
} |
|
||||
function mapStateToProps(state) { |
|
||||
const { auth, depMessage } = state; |
|
||||
const pakData = (dep) => { |
|
||||
return dep.map((d) => { |
|
||||
return { |
|
||||
title: d.name, |
|
||||
value: d.id, |
|
||||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|
||||
children: pakData(d.subordinate) |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
let depData = pakData(depMessage.data || []) |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
depMessage: depMessage.data || [], |
|
||||
depLoading: depMessage.isRequesting, |
|
||||
depData, |
|
||||
}; |
|
||||
} |
|
||||
export default connect(mapStateToProps)(InForTable); |
|
@ -1,6 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import infor from './infor'; |
|
||||
|
|
||||
|
|
||||
export { infor }; |
|
@ -1,59 +0,0 @@ |
|||||
import React, { useEffect, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import '../style.less'; |
|
||||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|
||||
import InForTable from '../components/inforTable'; |
|
||||
import UserModal from '../components/infor/details'; |
|
||||
const superagent = require('superagent'); |
|
||||
const infor = (props) => { |
|
||||
const { dispatch, user} = props |
|
||||
const [data, setData] = useState() |
|
||||
const [modalVisible, setModalVisible] = useState(false); |
|
||||
const [modalRecord, setModalRecord] = useState(); |
|
||||
useEffect(() => { |
|
||||
// dispatch(getDepMessage())
|
|
||||
dispatch(getReportStatistic()) |
|
||||
setData(props) |
|
||||
}, []); |
|
||||
//打开弹窗
|
|
||||
const openModal = (type, record) => { |
|
||||
setModalVisible(true); |
|
||||
// setModalType(type);
|
|
||||
if (type == 'edit') { |
|
||||
setModalRecord(record); |
|
||||
} else { |
|
||||
setModalRecord(null); |
|
||||
} |
|
||||
} |
|
||||
//批量导出
|
|
||||
const exports = (ids,counts) => { |
|
||||
// console.log(user);
|
|
||||
let reportIds = []; |
|
||||
if (ids.length) |
|
||||
reportIds = ids |
|
||||
else |
|
||||
reportIds = (counts || {}).ids || []; |
|
||||
superagent.post('/_report/http') |
|
||||
.send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { |
|
||||
const resTextIs = res.text.split('/').pop() |
|
||||
window.open( |
|
||||
'/_api/' + |
|
||||
`attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) |
|
||||
}) |
|
||||
} |
|
||||
return ( |
|
||||
<> <InForTable data={data} openModal={openModal} exports={exports} /> |
|
||||
<UserModal |
|
||||
visible={modalVisible} |
|
||||
onVisibleChange={setModalVisible} |
|
||||
modalRecord={modalRecord} |
|
||||
/></> |
|
||||
) |
|
||||
} |
|
||||
function mapStateToProps(state) { |
|
||||
const {auth}=state |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
} |
|
||||
} |
|
||||
export default connect(mapStateToProps)(infor); |
|
@ -1,124 +0,0 @@ |
|||||
// import React from 'react';
|
|
||||
// import { connect } from 'react-redux';
|
|
||||
// import { Spin, Table } from 'antd';
|
|
||||
// import { ModalForm } from '@ant-design/pro-form';
|
|
||||
// import moment from 'moment';
|
|
||||
// const UserModal = (props) => {
|
|
||||
// const { visible, onVisibleChange } = props
|
|
||||
// const datas = props.modalRecord || {}
|
|
||||
// const scopeOfExamination = { ...datas }.hiddenDangerItem12
|
|
||||
// const arr = [
|
|
||||
// ' 1、合用场所的所有权人、使用人是否遵守消防法律、法规、规章;',
|
|
||||
// ' 2、住宿场所是否违规搭建;',
|
|
||||
// ' 3、合用场所是否配置灭火器、消防应急照明等消防器材和设施;',
|
|
||||
// ' 4、合用场所的电器产品的安装、使用及其线路和管路的设计、敷设、维护保养、检测,是否符合消防技术标准和管理规定;',
|
|
||||
// ' 5、合用场所住宿是否超过2人;(judge_0) 若超过,人员住宿是否设置在首层,并直通室外安全出口;(judge_1)',
|
|
||||
// ' 6、电动自行车是否违规室内充电、停放;',
|
|
||||
// ' 7、合用场所是否违规生产、储存、经营易燃易爆危险品;',
|
|
||||
// ' 8、合用场所除厨房外是否违规使用或者放置瓶装液化石油气、可燃液体;',
|
|
||||
// ' 9、放置瓶装液化石油气的厨房是否采取防火分隔措施,并设置自然排风窗;',
|
|
||||
// ' 10、合用场所疏散通道、安全出口是否保持畅通;',
|
|
||||
// ' 11、合用场所的外窗或阳台是否设置金属栅栏;(judge_0) 若设置,是否能从内部易于开启。(judge_1)',
|
|
||||
// ' 12、存在其他安全隐患;',
|
|
||||
// ]
|
|
||||
// const columns = [
|
|
||||
// {
|
|
||||
// title: '场所名称',
|
|
||||
// dataIndex: 'reportName',
|
|
||||
// hideInSearch: true,
|
|
||||
// render: () => {
|
|
||||
// return <div>{datas.placeName}</div>
|
|
||||
// }
|
|
||||
// }, {
|
|
||||
// title: '场所基本情况',
|
|
||||
// dataIndex: 'reportName',
|
|
||||
// hideInSearch: true,
|
|
||||
// render: () => {
|
|
||||
// return <div>
|
|
||||
// <li>使用性质:{datas.placeType}</li>
|
|
||||
// <li>地址:{datas.address}</li>
|
|
||||
// <li>负责人:{datas.placeOwner}</li>
|
|
||||
// <li>电话:{datas.phone}</li>
|
|
||||
// <li>面积:{datas.dimension}</li>
|
|
||||
// <li>层数:{datas.floors}</li>
|
|
||||
// <li>常驻人口:{datas.numberOfPeople}</li>
|
|
||||
// </div>
|
|
||||
// }
|
|
||||
// }, {
|
|
||||
// title: '检查内容',
|
|
||||
// dataIndex: 'reportName',
|
|
||||
// hideInSearch: true,
|
|
||||
// render: () => {
|
|
||||
// return datas.hiddenDangerItem12 ?
|
|
||||
// scopeOfExamination.map((item, index) => {
|
|
||||
// let message = arr[index]
|
|
||||
// if (arr[index].indexOf('judge_') > -1) {
|
|
||||
// if (item.child && item.child.itemIndex) {
|
|
||||
// message = message.replace(`judge_${item.child.itemIndex}`, item.child.value ? "是" : "否")
|
|
||||
// } else {
|
|
||||
// message = message.replace(`judge_1`, '---')
|
|
||||
// }
|
|
||||
|
|
||||
// if (arr[index].indexOf('judge_0') > -1) {
|
|
||||
// return <li key={index}>{message.replace(`judge_0`, item.value ? "是" : "否")}</li>
|
|
||||
// }
|
|
||||
// }
|
|
||||
// return <li key={index}>{message}({item.value ? "是" : "否"})</li>
|
|
||||
// })
|
|
||||
// : '---'
|
|
||||
// }
|
|
||||
// }, {
|
|
||||
// title: '存在具体问题',
|
|
||||
// dataIndex: 'reportName',
|
|
||||
// hideInSearch: true,
|
|
||||
// render: () => {
|
|
||||
// return <div>{datas.description ? datas.description : '---'}</div>
|
|
||||
// }
|
|
||||
// },
|
|
||||
// ]
|
|
||||
// const data = [
|
|
||||
// {
|
|
||||
// key: '1',
|
|
||||
|
|
||||
// address: 'New York No. 1 Lake Park',
|
|
||||
// tags: ['nice', 'developer'],
|
|
||||
// },
|
|
||||
// ];
|
|
||||
// return (
|
|
||||
// <Spin spinning={false}>
|
|
||||
// <ModalForm
|
|
||||
// width={'90rem'}
|
|
||||
// visible={visible}
|
|
||||
// onVisibleChange={onVisibleChange}
|
|
||||
// submitter={false}
|
|
||||
// >
|
|
||||
// <div style={{ width:'71vw'}}><span style={{ fontSize: '16px' }}>排查单位:{(datas || {}).checkAreaName || ''}</span>
|
|
||||
// <span style={{ fontSize: '16px', float:'right',marginBottom:'10px'}}>填报日期:{moment((datas || {}).time).format('YYYY-MM-DD') || ''}</span><span style={{clear:'both'}}></span></div>
|
|
||||
// <Table columns={columns} dataSource={data} width={'50rem'} pagination={false}
|
|
||||
|
|
||||
// />
|
|
||||
// <div style={{ width:'71vw',marginTop:'10px'}}>
|
|
||||
// <span style={{ fontSize: '16px' }}>排查人:{(datas || {}).checkUserName || ''}</span>
|
|
||||
// <span style={{ fontSize: '16px',float:'right' }}>手机号:{(datas || {}).checkUserPhone || ''}</span></div>
|
|
||||
// </ModalForm>
|
|
||||
// </Spin>
|
|
||||
// )
|
|
||||
// }
|
|
||||
// function mapStateToProps (state) {
|
|
||||
// const { depMessage } = state;
|
|
||||
// const pakData = (dep) => {
|
|
||||
// return dep.map((d) => {
|
|
||||
// return {
|
|
||||
// title: d.name,
|
|
||||
// value: d.id,
|
|
||||
// children: pakData(d.subordinate)
|
|
||||
// }
|
|
||||
// })
|
|
||||
// }
|
|
||||
// let depData = pakData(depMessage.data || [])
|
|
||||
// return {
|
|
||||
// loading: depMessage.isRequesting,
|
|
||||
// depData,
|
|
||||
// };
|
|
||||
// }
|
|
||||
// export default connect(mapStateToProps)(UserModal);
|
|
@ -1,13 +0,0 @@ |
|||||
'use strict'; |
|
||||
import reducers from './reducers'; |
|
||||
import routes from './routes'; |
|
||||
import actions from './actions'; |
|
||||
import { getNavItem } from './nav-item'; |
|
||||
export default { |
|
||||
key: 'fillion', |
|
||||
name: '填报管理', |
|
||||
reducers: reducers, |
|
||||
routes: routes, |
|
||||
actions: actions, |
|
||||
getNavItem: getNavItem |
|
||||
}; |
|
@ -1,14 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { Link } from 'react-router-dom'; |
|
||||
import { Menu } from 'antd'; |
|
||||
import { ReadOutlined } from '@ant-design/icons'; |
|
||||
const SubMenu = Menu.SubMenu; |
|
||||
export function getNavItem(user, dispatch) { |
|
||||
return ( |
|
||||
<SubMenu key="fillion" icon={<ReadOutlined />} title={'填报管理'}> |
|
||||
<Menu.Item key="fillioninfor"> |
|
||||
<Link to="/fillion/infor">填报信息</Link> |
|
||||
</Menu.Item> |
|
||||
</SubMenu> |
|
||||
); |
|
||||
} |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
export default { |
|
||||
|
|
||||
} |
|
@ -1,19 +0,0 @@ |
|||||
'use strict'; |
|
||||
import { infor } from './containers'; |
|
||||
export default [{ |
|
||||
type: 'inner', |
|
||||
route: { |
|
||||
path: '/fillion', |
|
||||
key: 'fillion', |
|
||||
breadcrumb: '填报管理', |
|
||||
menuSelectKeys: ['fillion'], |
|
||||
menuOpenKeys: ['fillion'], |
|
||||
childRoutes: [ { |
|
||||
path: '/infor', |
|
||||
key: 'fillioninfor', |
|
||||
menuSelectKeys:['fillioninfor'], |
|
||||
component: infor, |
|
||||
breadcrumb: '填报信息', |
|
||||
}] |
|
||||
} |
|
||||
}]; |
|
@ -1,3 +0,0 @@ |
|||||
#example:hover { |
|
||||
font-size: larger; |
|
||||
} |
|
@ -1,30 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { basicAction } from '@peace/utils' |
|
||||
import { ApiTable } from '$utils' |
|
||||
export function getFundamental() { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_DATA', |
|
||||
url: ApiTable.getFundamental, |
|
||||
msg: { error: '获取数据失败' }, |
|
||||
reducer: { name: 'datas' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
export function getsortord(zuo, day) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_PATIENTIA', |
|
||||
url: ApiTable.getsortord.replace('{zuo}', zuo).replace('{day}', day), |
|
||||
msg: { error: '日期更新失败' }, |
|
||||
reducer: { name: 'Patientia' } |
|
||||
}); |
|
||||
} |
|
||||
export default { |
|
||||
getFundamental, |
|
||||
getsortord |
|
||||
} |
|
@ -1,7 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import * as date from "./data" |
|
||||
|
|
||||
export default { |
|
||||
...date |
|
||||
} |
|
@ -1,118 +0,0 @@ |
|||||
import React, { useState, useEffect } from 'react' |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { getFundamental } from '../actions/data'; |
|
||||
import * as echarts from "echarts" |
|
||||
import "../style.less" |
|
||||
|
|
||||
const DateModal = (props) => { |
|
||||
const { dispatch } = props |
|
||||
const [lists, setLists] = useState([]) |
|
||||
const [keys, setKeys] = useState([]) |
|
||||
const [days, setDays] = useState() |
|
||||
const [unkeys, setUnkeys] = useState([]) |
|
||||
const [num, setNum] = useState(1) |
|
||||
useEffect(() => { |
|
||||
// 获取数据
|
|
||||
dispatch(getFundamental()).then(res => { |
|
||||
setDays(res.payload.data.date) |
|
||||
|
|
||||
}) |
|
||||
}, [true]) |
|
||||
|
|
||||
const op = () => { |
|
||||
// 把获取的数据进行加工
|
|
||||
if (days && num == 1) { |
|
||||
|
|
||||
var daysValues = Object.values(days) |
|
||||
var daysKeys = Object.keys(days) |
|
||||
var list = [] |
|
||||
var arr = [] |
|
||||
var months = [] |
|
||||
for (let index = 6; index >= 0; index--) { |
|
||||
list.push(daysValues[index]) |
|
||||
} |
|
||||
setLists(list) |
|
||||
for (let index = 6; index >= 0; index--) { |
|
||||
arr.push(daysKeys[index].substring(8)) |
|
||||
} |
|
||||
for (let index = 6; index >= 0; index--) { |
|
||||
months.push(daysKeys[index].charAt(5) + "" + daysKeys[index].charAt(6)) |
|
||||
} |
|
||||
setUnkeys(months) |
|
||||
setKeys(arr) |
|
||||
setNum(2) |
|
||||
} |
|
||||
} |
|
||||
op() |
|
||||
useEffect(() => { |
|
||||
let a = ([...keys]) |
|
||||
let list = [] |
|
||||
for (let index = 0; index < 7; index++) { |
|
||||
list.push(a[index]) |
|
||||
} |
|
||||
for (let index = 0; index < 7; index++) { |
|
||||
list[index] = list[index] + "日" |
|
||||
} |
|
||||
var myChart = echarts.init(document.getElementById('echarts')); |
|
||||
// window.onresize在重复使用过程中会被覆盖
|
|
||||
// window.onresize = myChart.resize;
|
|
||||
// addEventListener来添加监听resize的事件,将能避免onresize的覆盖问题,并能实现对窗口的监听操作
|
|
||||
window.addEventListener("resize", function () { |
|
||||
myChart.resize() |
|
||||
}) |
|
||||
var option = { |
|
||||
title: { |
|
||||
text: '近七日填报数量', |
|
||||
left: "7%" |
|
||||
}, |
|
||||
grid: { |
|
||||
left: '3%', |
|
||||
right: '4%', |
|
||||
bottom: '3%', |
|
||||
containLabel: true |
|
||||
}, |
|
||||
tooltip: { |
|
||||
trigger: 'item', |
|
||||
formatter: function (params) { |
|
||||
var htmlStr = `填报数量:${params.value}条<br/>${unkeys[params.dataIndex] + "月" + params.name}<br/>` |
|
||||
return htmlStr; |
|
||||
} |
|
||||
}, |
|
||||
xAxis: { |
|
||||
type: 'category', |
|
||||
data: list, |
|
||||
axisTick: { |
|
||||
alignWithLabel: true |
|
||||
} |
|
||||
}, |
|
||||
yAxis: { |
|
||||
type: "value", |
|
||||
}, |
|
||||
series: [ |
|
||||
{ |
|
||||
name: '填报数量', |
|
||||
type: 'bar', |
|
||||
data: lists, |
|
||||
barWidth: 40 |
|
||||
} |
|
||||
] |
|
||||
}; |
|
||||
|
|
||||
// 使用刚指定的配置项和数据显示图表。
|
|
||||
myChart.setOption(option); |
|
||||
}, [lists]) |
|
||||
return ( |
|
||||
<div id='echarts'></div> |
|
||||
) |
|
||||
} |
|
||||
function mapStateToProps(state) { |
|
||||
const { auth, depMessage, depUser, global } = state; |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
clientHeight: global.clientHeight, |
|
||||
loading: depMessage.isRequesting, |
|
||||
depMessage: depMessage.data || [], |
|
||||
depUser: depUser.data || [] |
|
||||
}; |
|
||||
} |
|
||||
export default connect(mapStateToProps)(DateModal) |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import DateModal from './dateModal'; |
|
||||
|
|
||||
export { DateModal }; |
|
@ -1,157 +0,0 @@ |
|||||
import React, { useEffect, useState } from "react"; |
|
||||
import { connect } from "react-redux"; |
|
||||
import { Space, Row, Col, DatePicker, Spin } from "antd"; |
|
||||
import { getFundamental, getsortord } from "../actions/data"; |
|
||||
import { DateModal } from "../components"; |
|
||||
import moment from "moment"; |
|
||||
import "../style.less"; |
|
||||
const { RangePicker } = DatePicker; |
|
||||
const UserManage = (props) => { |
|
||||
const { dispatch, loading, datas, Patientias } = props; |
|
||||
const dateFormat = "YYYY/MM/DD"; |
|
||||
const [data, setData] = useState(); |
|
||||
const [Patientia, setPatientia] = useState(); |
|
||||
useEffect(() => { |
|
||||
// 获取数据
|
|
||||
dispatch(getFundamental()).then((res) => { |
|
||||
setData(res); |
|
||||
}); |
|
||||
}, [true]); |
|
||||
useEffect(() => { |
|
||||
// 根据接口获取规定时间内获取到的数据
|
|
||||
var customField = [ |
|
||||
moment().add(-6, "day").format("YYYY-MM-DD"), |
|
||||
moment(new Date(), dateFormat).format("YYYY-MM-DD"), |
|
||||
]; |
|
||||
dispatch(getsortord(customField[0], customField[1])).then((res) => { |
|
||||
setPatientia(res.payload.data); |
|
||||
}); |
|
||||
}, [true]); |
|
||||
// useEffect(() => {
|
|
||||
/* Patientia ? setPatientia(Patientia */ /* .sort(sortByKey("count")) */ /* ) : null */ |
|
||||
// }, [Patientia])
|
|
||||
// 根据数组里面对象的key值进行排序
|
|
||||
// const sortByKey = (key) => {
|
|
||||
// return function (a, b) {
|
|
||||
// var value1 = a[key];
|
|
||||
// var value2 = b[key];
|
|
||||
// return value2 - value1;
|
|
||||
// }
|
|
||||
// }
|
|
||||
const disabledDate = (current) => { |
|
||||
return ( |
|
||||
(current && current < moment("2022/03/01").subtract("day")) || |
|
||||
current > moment(new Date()).subtract("days") |
|
||||
); |
|
||||
}; |
|
||||
const getTime = (date) => { |
|
||||
// 根据时间框时间获取数据进行展示
|
|
||||
if (date) { |
|
||||
var ao = []; |
|
||||
ao.push(date[0].format("YYYY/MM/DD")); |
|
||||
ao.push(date[1].format("YYYY/MM/DD")); |
|
||||
} |
|
||||
dispatch(getsortord(ao[0], ao[1])).then((res) => { |
|
||||
setPatientia(res.payload.data /* .sort(sortByKey("count")) */); |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
return ( |
|
||||
<div style={{ overflow: "hiddle" }}> |
|
||||
{/* 此处进行了loding的效果 */} |
|
||||
<Spin spinning={loading} tip="稍等片刻~"> |
|
||||
{/* 页面上部分代码 */} |
|
||||
<div className="shuju-top"> |
|
||||
<Row className="wrap" type="flex" justify="center" align="middle"> |
|
||||
<Col span={6} align="center"> |
|
||||
<span>今日新增填报</span> |
|
||||
<p> {datas.data ? datas.data.added : null}</p> |
|
||||
</Col> |
|
||||
<Col span={6} align="center"> |
|
||||
<span>今日已审填报</span> |
|
||||
<p> |
|
||||
{datas.data ? datas.data.checked : null} |
|
||||
<span>/{datas.data ? datas.data.unChecked : null}</span> |
|
||||
</p> |
|
||||
</Col> |
|
||||
<Col span={6} align="center"> |
|
||||
<span>隐患场所总数</span> |
|
||||
<p>{datas.data ? datas.data.danger_place : null}</p> |
|
||||
</Col> |
|
||||
<Col span={6} align="center"> |
|
||||
<span>历史填报</span> |
|
||||
<p>{datas.data ? datas.data.history : null}</p> |
|
||||
</Col> |
|
||||
</Row> |
|
||||
</div> |
|
||||
{/* 页面下部分代码 */} |
|
||||
<div className="shuju-floer"> |
|
||||
{/* echarts柱状图 */} |
|
||||
<div className="shuju-floer-left">{datas ? <DateModal /> : null}</div> |
|
||||
{/* 根据时间进行的排序 */} |
|
||||
<div className="shuju-floer-reght"> |
|
||||
<p>各区县合用场所填报数量</p> |
|
||||
<Space direction="vertical" size={12}> |
|
||||
<RangePicker |
|
||||
disabledDate={disabledDate} |
|
||||
onChange={getTime} |
|
||||
defaultValue={[ |
|
||||
moment().add(-6, "day"), |
|
||||
moment(new Date(), dateFormat) |
|
||||
]} |
|
||||
width={"100%"} |
|
||||
allowClear={false} |
|
||||
/> |
|
||||
</Space> |
|
||||
<div className="dataDisplay"> |
|
||||
{Patientias |
|
||||
? Patientias.map((item, index) => { |
|
||||
return ( |
|
||||
<li |
|
||||
key={index} |
|
||||
className="traverse" |
|
||||
style={{ marginTop: index == 0 ? "30px" : "0" }} |
|
||||
> |
|
||||
{index >= 3 ? ( |
|
||||
<div className="topThree">{index + 1}</div> |
|
||||
) : ( |
|
||||
<div className="untopThree">{index + 1}</div> |
|
||||
)} |
|
||||
<span className="siteName">{item.name}</span> |
|
||||
<span className="sitePeople">{item.count}</span> |
|
||||
</li> |
|
||||
); |
|
||||
}) |
|
||||
: null} |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</Spin> |
|
||||
</div> |
|
||||
); |
|
||||
}; |
|
||||
function mapStateToProps(state) { |
|
||||
// console.log(state);
|
|
||||
const { auth, depMessage, depUser, global, datas, Patientia } = state; |
|
||||
// 在reducer中进行数据处理
|
|
||||
const sortByKey = (key) => { |
|
||||
return function (a, b) { |
|
||||
var value1 = a[key]; |
|
||||
var value2 = b[key]; |
|
||||
return value2 - value1; |
|
||||
}; |
|
||||
}; |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
clientHeight: global.clientHeight, |
|
||||
loading: datas.isRequesting && Patientia.isRequesting, |
|
||||
depMessage: depMessage.data || [], |
|
||||
depUser: depUser.data || [], |
|
||||
datas: datas || [], |
|
||||
Patientias: Patientia.data |
|
||||
? Patientia.data.sort(sortByKey("count")) |
|
||||
: null || [], |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(UserManage); |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import UserManage from './data'; |
|
||||
|
|
||||
export { UserManage }; |
|
@ -1,15 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import reducers from './reducers'; |
|
||||
import routes from './routes'; |
|
||||
import actions from './actions'; |
|
||||
import { getNavItem } from './nav-item'; |
|
||||
|
|
||||
export default { |
|
||||
key: 'middleground', |
|
||||
name: '', |
|
||||
reducers: reducers, |
|
||||
routes: routes, |
|
||||
actions: actions, |
|
||||
getNavItem: getNavItem |
|
||||
}; |
|
@ -1,18 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { Link } from 'react-router-dom'; |
|
||||
import { Menu } from 'antd'; |
|
||||
import { BarChartOutlined } from '@ant-design/icons'; |
|
||||
import { push } from 'react-router-redux'; |
|
||||
|
|
||||
|
|
||||
export function getNavItem(user, dispatch) { |
|
||||
if (user.type != 1) { |
|
||||
dispatch(push('/fillion/infor')); |
|
||||
return null |
|
||||
} |
|
||||
return ( |
|
||||
<Menu.Item key="middleground" icon={<BarChartOutlined />}> |
|
||||
<Link to="/middleground">数据中心</Link> |
|
||||
</Menu.Item> |
|
||||
); |
|
||||
} |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
export default { |
|
||||
|
|
||||
}; |
|
@ -1,14 +0,0 @@ |
|||||
'use strict'; |
|
||||
import { UserManage } from './containers'; |
|
||||
|
|
||||
export default [{ |
|
||||
type: 'inner', |
|
||||
route: { |
|
||||
path: '/middleground', |
|
||||
key: 'middleground', |
|
||||
breadcrumb: '数据中心', |
|
||||
menuSelectKeys: ['userManage'], |
|
||||
component: UserManage, |
|
||||
menuOpenKeys: ['middleground'], |
|
||||
} |
|
||||
}]; |
|
@ -1,86 +0,0 @@ |
|||||
.shuju-top{ |
|
||||
width: 100%; |
|
||||
min-Width: 1110px; |
|
||||
height: 20vh; |
|
||||
border: 1px solid #F2F2F2; |
|
||||
border-Right: 0; |
|
||||
margin-top: 5vh; |
|
||||
overflow: auto; |
|
||||
.wrap{ |
|
||||
min-Height: 100%; |
|
||||
span{ |
|
||||
color: #959595; |
|
||||
font-Size: 18px; |
|
||||
} |
|
||||
p{ |
|
||||
font-Size: 34px; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
.shuju-floer{ |
|
||||
width: 100%; |
|
||||
height: 500px; |
|
||||
float: left; |
|
||||
margin-Top: 50px; |
|
||||
min-Width: 1110px; |
|
||||
.shuju-floer-left{ |
|
||||
height: 500px; |
|
||||
float: left; |
|
||||
#echarts{ |
|
||||
width: calc(75vw - 200px ); |
|
||||
min-Width: 810px; |
|
||||
height: 500px; |
|
||||
} |
|
||||
} |
|
||||
.shuju-floer-reght{ |
|
||||
width: calc(32vw - 200px ); |
|
||||
min-Width: 290px; |
|
||||
height: 100%; |
|
||||
float: left; |
|
||||
p{ |
|
||||
color: #464646; |
|
||||
font-Size: 18px; |
|
||||
font-Weight: 600; |
|
||||
} |
|
||||
.dataDisplay{ |
|
||||
width: 340px; |
|
||||
height: 75%; |
|
||||
overflow-y: auto; |
|
||||
.traverse{ |
|
||||
width: 300px; |
|
||||
height: 30px; |
|
||||
list-style: none; |
|
||||
.topThree{ |
|
||||
width: 20px; |
|
||||
height: 20px; |
|
||||
background-Color: #f0f2f5; |
|
||||
float: left; |
|
||||
color: rgba(0, 0, 0, 0.6470588235294118); |
|
||||
border-Radius: 50%; |
|
||||
text-align: center; |
|
||||
line-Height: 20px; |
|
||||
font-Size: 12px; |
|
||||
} |
|
||||
.untopThree{ |
|
||||
width: 20px; |
|
||||
height: 20px; |
|
||||
background-Color: #314559; |
|
||||
float: left; |
|
||||
color: #FFFFFF; |
|
||||
border-radius: 50%; |
|
||||
text-align: center; |
|
||||
line-height: 20px; |
|
||||
font-size: 12px; |
|
||||
} |
|
||||
.siteName{ |
|
||||
margin-left: 20px; |
|
||||
} |
|
||||
.sitePeople{ |
|
||||
float: right; |
|
||||
margin-right: 10px; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
} |
|
@ -1,51 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { basicAction } from '@peace/utils' |
|
||||
import { ApiTable } from '$utils' |
|
||||
|
|
||||
export function getAuthority(orgId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_MEMBERS', |
|
||||
url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`, |
|
||||
msg: { error: '获取用户列表失败' }, |
|
||||
reducer: { name: 'members' } |
|
||||
}); |
|
||||
} |
|
||||
export function getResource(userId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_RESOURCE', |
|
||||
url: `${ApiTable.getResource}`, |
|
||||
msg: { error: '获取权限失败' }, |
|
||||
reducer: { name: 'resource' } |
|
||||
}); |
|
||||
} |
|
||||
export function getUserResource(userId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_USER_RESOURCE', |
|
||||
url: `${ApiTable.getUserResource}?userId=${userId}`, |
|
||||
msg: { error: '获取用户权限失败' }, |
|
||||
reducer: { name: 'userResource' } |
|
||||
}); |
|
||||
} |
|
||||
export function postUserRes(body) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'post', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'UPDATE_USER_RESOURCE', |
|
||||
url: `${ApiTable.postUserRes}`, |
|
||||
data: body, |
|
||||
msg: { success: '更新用户权限' } |
|
||||
}); |
|
||||
} |
|
||||
export default { |
|
||||
getAuthority, |
|
||||
getResource, |
|
||||
getUserResource, |
|
||||
postUserRes |
|
||||
} |
|
@ -1,11 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import * as authority from './authority' |
|
||||
import { getDepMessage, getDepUser, createUser } from './user' |
|
||||
|
|
||||
export default { |
|
||||
...authority, |
|
||||
getDepMessage, |
|
||||
getDepUser, |
|
||||
createUser, |
|
||||
} |
|
@ -1,78 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { basicAction } from '@peace/utils' |
|
||||
import { ApiTable } from '$utils' |
|
||||
|
|
||||
export function getDepMessage() { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_DEPARTMENT_MESSAGE', |
|
||||
url: ApiTable.getDepMessage, |
|
||||
msg: { error: '获取部门信息失败' }, |
|
||||
reducer: { name: 'depMessage' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function getDepUser(depId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_DEPARTMENT_USER', |
|
||||
url: ApiTable.getDepUser.replace('{depId}', depId), |
|
||||
msg: { error: '获取部门下用户信息失败' }, |
|
||||
reducer: { name: 'depUser' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function createUser(data) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'post', |
|
||||
data, |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'CREATE_DEPARTMENT_USER', |
|
||||
url: ApiTable.createUser, |
|
||||
msg: { option: '新建用户' }, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function updateUser(id, data) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'put', |
|
||||
data, |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'UPDATE_DEPARTMENT_USER', |
|
||||
url: ApiTable.updateUser.replace('{id}', id), |
|
||||
msg: { option: '修改用户' }, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function delUser(ids) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'del', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'DEL_DEPARTMENT_USER', |
|
||||
url: ApiTable.delUser.replace('{ids}', ids), |
|
||||
msg: { option: '删除用户' }, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function resetPwd(id, data) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'put', |
|
||||
data, |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'CREATE_DEPARTMENT_USER', |
|
||||
url: ApiTable.resetPwd.replace('{id}', id), |
|
||||
msg: { option: '重置用户密码' }, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export default { |
|
||||
getDepMessage, |
|
||||
getDepUser, |
|
||||
createUser, |
|
||||
updateUser, |
|
||||
delUser, |
|
||||
resetPwd |
|
||||
} |
|
@ -1,74 +0,0 @@ |
|||||
import React, { useRef, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Card, Modal, TreeSelect } from 'antd'; |
|
||||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; |
|
||||
|
|
||||
const ResetPwd = (props) => { |
|
||||
const { visible, onVisibleChange, onConfirm } = props; |
|
||||
const formRef = useRef(); |
|
||||
|
|
||||
const onFinish = (values) => { |
|
||||
if (onConfirm) { |
|
||||
onConfirm(values); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
return ( |
|
||||
<Spin spinning={false}> |
|
||||
<ModalForm |
|
||||
title={'重置密码'} |
|
||||
visible={visible} |
|
||||
onVisibleChange={onVisibleChange} |
|
||||
onFinish={onFinish} |
|
||||
formRef={formRef} |
|
||||
destroyOnClose |
|
||||
> |
|
||||
<ProFormText.Password |
|
||||
name={['password']} |
|
||||
width="md" |
|
||||
label="新密码" |
|
||||
required |
|
||||
placeholder="请输入密码" |
|
||||
fieldProps={{ |
|
||||
autocomplete: 'new-password' |
|
||||
}} |
|
||||
rules={[ |
|
||||
{ required: true, message: '请填写密码' }, |
|
||||
{ min: 6, message: '请填写至少6位密码' }, |
|
||||
]} |
|
||||
/> |
|
||||
<ProFormText.Password |
|
||||
name={['checkPassword']} |
|
||||
width="md" |
|
||||
label="确认密码" |
|
||||
required |
|
||||
autocomplete='off' |
|
||||
placeholder="请输入密码" |
|
||||
rules={[ |
|
||||
{ required: true, message: '请再次填写密码' }, |
|
||||
{ min: 6, message: '请填写至少6位密码' }, |
|
||||
{ |
|
||||
validator: (rule, value, callback) => { |
|
||||
const pwd = formRef.current.getFieldValue('password'); |
|
||||
if (!value) { |
|
||||
callback(); |
|
||||
} |
|
||||
if (pwd == value) { |
|
||||
callback(); |
|
||||
} else { |
|
||||
callback('两次输入的密码不一致'); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
]} |
|
||||
/> |
|
||||
</ModalForm> |
|
||||
</Spin> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
return {}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(ResetPwd); |
|
@ -1,119 +0,0 @@ |
|||||
import React, { useEffect } from 'react'; |
|
||||
import { Checkbox, Table } from 'antd'; |
|
||||
import { useState } from 'react'; |
|
||||
|
|
||||
const CheckboxGroup = Checkbox.Group; |
|
||||
|
|
||||
const Resource = props => { |
|
||||
const { roleData, userRole, userSelected, setResCode, userType } = props; |
|
||||
const [indeterminate, setIndeterminate] = useState({}); |
|
||||
const [roleCheck, setRoleCheck] = useState({});//一级权限码
|
|
||||
const [parentRoleCheck, setParentRoleCheck] = useState({}); //二级权限码
|
|
||||
useEffect(() => { |
|
||||
const check = {} |
|
||||
const parentCheck = {} |
|
||||
const initInd = {} |
|
||||
roleData && roleData.map && roleData.map(r => { |
|
||||
let currentInd = false; |
|
||||
let sum = 0; |
|
||||
if (r.resources) { |
|
||||
check[r.code] = [] |
|
||||
r.resources.map(child => { |
|
||||
if (userRole.find(code => code.resourceId == child.code)) { |
|
||||
currentInd = true; |
|
||||
sum++; |
|
||||
check[r.code].push(child.code); |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
parentCheck[r.code] = r.resources.length === sum |
|
||||
initInd[r.code] = parentCheck[r.code] ? false : currentInd |
|
||||
}); |
|
||||
setParentRoleCheck(parentCheck) |
|
||||
setRoleCheck(check); |
|
||||
setIndeterminate(initInd); |
|
||||
}, [userRole]); |
|
||||
|
|
||||
const setResData = (role) => { |
|
||||
let codes = []; |
|
||||
// Object.keys(partRole).map(r => {
|
|
||||
// if (partRole[r]) codes.push(r)
|
|
||||
// })
|
|
||||
Object.keys(role).map(r => { |
|
||||
if (role[r].length) { |
|
||||
codes.push(r); |
|
||||
} |
|
||||
codes = codes.concat(role[r]) |
|
||||
}) |
|
||||
setResCode(codes) |
|
||||
} |
|
||||
return ( |
|
||||
<Table |
|
||||
bordered |
|
||||
pagination={false} |
|
||||
dataSource={roleData} |
|
||||
columns={[{ |
|
||||
title: '功能', |
|
||||
key: 'name', |
|
||||
dataIndex: 'name', |
|
||||
render: (text, record) => { |
|
||||
const parentCode = record.code |
|
||||
return <Checkbox |
|
||||
|
|
||||
indeterminate={indeterminate[parentCode]} |
|
||||
onChange={(e) => { |
|
||||
const currentParCheck = JSON.parse(JSON.stringify(parentRoleCheck)); |
|
||||
currentParCheck[parentCode] = e.target.checked; |
|
||||
const currentCode = JSON.parse(JSON.stringify(roleCheck)); |
|
||||
currentCode[parentCode] = e.target.checked ? roleData.find(r => r.code == parentCode).resources.map(r => r.code) : [] |
|
||||
const currentInd = JSON.parse(JSON.stringify(indeterminate)); |
|
||||
currentInd[parentCode] = false; |
|
||||
|
|
||||
setParentRoleCheck(currentParCheck); |
|
||||
setRoleCheck(currentCode); |
|
||||
setIndeterminate(currentInd); |
|
||||
setResData(currentCode) |
|
||||
}} |
|
||||
checked={parentRoleCheck[parentCode] || false} |
|
||||
disabled={userSelected === "SuperAdmin" || userType === 4} |
|
||||
options={''} |
|
||||
> |
|
||||
{text} |
|
||||
</Checkbox> |
|
||||
} |
|
||||
}, { |
|
||||
title: '列表', |
|
||||
key: 'resources', |
|
||||
dataIndex: 'resources', |
|
||||
render: (text, record) => { |
|
||||
let data = []; |
|
||||
console.log() |
|
||||
text.map(s => { s.name !== "整治汇总编辑" ? data.push({ label: s.name, value: s.code }) : '' }) |
|
||||
let parentCode = record.code; |
|
||||
|
|
||||
return <CheckboxGroup |
|
||||
disabled={userSelected === "SuperAdmin" || userType === 4} |
|
||||
options={data} |
|
||||
value={roleCheck[parentCode] || []} |
|
||||
onChange={value => { |
|
||||
const checkArr = JSON.parse(JSON.stringify(roleCheck)); |
|
||||
const parentCheck = JSON.parse(JSON.stringify(parentRoleCheck)); |
|
||||
const ind = JSON.parse(JSON.stringify(indeterminate)); |
|
||||
const currentCode = roleData.find(r => r.code == parentCode) || {} |
|
||||
|
|
||||
checkArr[parentCode] = value; |
|
||||
ind[parentCode] = !!value.length && value.length < currentCode.resources.length |
|
||||
parentCheck[parentCode] = value.length === currentCode.resources.length |
|
||||
|
|
||||
setRoleCheck(checkArr); |
|
||||
setIndeterminate(ind); |
|
||||
setParentRoleCheck(parentCheck); |
|
||||
setResData(checkArr) |
|
||||
}} |
|
||||
/> |
|
||||
} |
|
||||
}]} |
|
||||
></Table > |
|
||||
) |
|
||||
} |
|
||||
export default Resource |
|
@ -1,172 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Card, Modal, TreeSelect, message } from 'antd'; |
|
||||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; |
|
||||
|
|
||||
const UserModal = (props) => { |
|
||||
const { visible, modalType, depData, onVisibleChange, onConfirm, editData } = props |
|
||||
const reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/; |
|
||||
const onFinish = (values) => { |
|
||||
if (onConfirm) { |
|
||||
onConfirm(values); |
|
||||
} |
|
||||
} |
|
||||
const mobile = (value) => { |
|
||||
if (reg_tel.test(value)) { |
|
||||
return |
|
||||
} |
|
||||
return message('请输入姓名') |
|
||||
} |
|
||||
return ( |
|
||||
<Spin spinning={false}> |
|
||||
<ModalForm |
|
||||
title={modalType == 'edit' ? '编辑用户' : '新建用户'} |
|
||||
visible={visible} |
|
||||
onVisibleChange={onVisibleChange} |
|
||||
onFinish={onFinish} |
|
||||
|
|
||||
destroyOnClose |
|
||||
initialValues={ |
|
||||
modalType == 'edit' ? |
|
||||
{ |
|
||||
contract: editData |
|
||||
} : |
|
||||
{ |
|
||||
contract: { |
|
||||
enable: true |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
> |
|
||||
<ProForm.Group> |
|
||||
<ProFormText |
|
||||
name={['contract', 'name']} |
|
||||
maxLength={24} |
|
||||
width="md" |
|
||||
label="姓名" |
|
||||
required |
|
||||
placeholder="请输入姓名" |
|
||||
rules={[{ required: true, message: '请输入姓名' }]} |
|
||||
/> |
|
||||
<ProFormText |
|
||||
name={['contract', 'phone']} |
|
||||
width="md" |
|
||||
label="用户名(手机号)" |
|
||||
required |
|
||||
fieldProps={{ |
|
||||
maxLength: 11, |
|
||||
}} |
|
||||
getValueFromEvent={(event) => { |
|
||||
return event.target.value.replace(/\D/g, '') |
|
||||
}} |
|
||||
placeholder="请输入用户名(手机号)" |
|
||||
rules={[ |
|
||||
{ required: true, valueType: Number, max: 11 }, { pattern: /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/, message: "请输入正确的手机号" } |
|
||||
]} |
|
||||
/> |
|
||||
</ProForm.Group> |
|
||||
<ProForm.Group> |
|
||||
<ProFormTreeSelect |
|
||||
name={['contract', 'departmentId']} |
|
||||
placeholder="请选择所属部门" |
|
||||
width="md" |
|
||||
label="所属部门" |
|
||||
required |
|
||||
fieldNames={{ |
|
||||
title: 'name', |
|
||||
key: 'id', |
|
||||
children: 'subordinate' |
|
||||
}} |
|
||||
onSelect={(selectedKeys, { selected, selectedNodes }) => { |
|
||||
if (selected) { |
|
||||
setDepSelectedKeys(selectedKeys) |
|
||||
setDepSelected(selectedNodes[0].name || "") |
|
||||
dispatch(getDepUser(selectedKeys[0])) |
|
||||
} |
|
||||
}} |
|
||||
fieldProps={{ |
|
||||
fieldNames: { |
|
||||
label: 'title', |
|
||||
}, |
|
||||
treeDefaultExpandAll: false, |
|
||||
}} |
|
||||
rules={[{ required: true, message: '请选择所属部门' }]} |
|
||||
request={async () => { |
|
||||
console.log(depData); |
|
||||
return depData |
|
||||
}} |
|
||||
expandedKeys={["title"]} |
|
||||
/> |
|
||||
< ProFormText |
|
||||
name={['contract', 'post']} |
|
||||
width="md" |
|
||||
label="职位" |
|
||||
// required
|
|
||||
placeholder="请输入职位" |
|
||||
/> |
|
||||
</ProForm.Group> |
|
||||
<ProForm.Group> |
|
||||
<ProFormText |
|
||||
name={['contract', 'email']} |
|
||||
width="md" |
|
||||
label="邮箱" |
|
||||
// required
|
|
||||
placeholder="请输入邮箱" |
|
||||
rules={[ |
|
||||
// { required: true, message: '请输入邮箱' },
|
|
||||
{ type: 'email', message: '请输入正确格式的邮箱' }, |
|
||||
]} |
|
||||
/> |
|
||||
{modalType == 'edit' ? null : <ProFormText.Password |
|
||||
name={['contract', 'password']} |
|
||||
width="md" |
|
||||
label="密码" |
|
||||
required |
|
||||
placeholder="请输入密码" |
|
||||
fieldProps={{ |
|
||||
autocomplete: 'new-password' |
|
||||
}} |
|
||||
rules={[ |
|
||||
{ required: true, message: '请填写密码' }, |
|
||||
{ min: 6, message: '请填写至少6位密码' }, |
|
||||
]} |
|
||||
/>} |
|
||||
</ProForm.Group> |
|
||||
<ProForm.Group> |
|
||||
<ProFormSwitch |
|
||||
name={['contract', 'enable']} |
|
||||
width="md" |
|
||||
label="是否启用" |
|
||||
placeholder="请选择" |
|
||||
// defaultChecked
|
|
||||
valuePropName="checked" |
|
||||
/> |
|
||||
</ProForm.Group> |
|
||||
</ModalForm> |
|
||||
</Spin> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
const { depMessage } = state; |
|
||||
|
|
||||
const pakData = (dep) => { |
|
||||
// console.log(dep);
|
|
||||
return dep.map((d) => { |
|
||||
return { |
|
||||
title: d.name, |
|
||||
value: d.id, |
|
||||
// key: d.id,
|
|
||||
children: pakData(d.subordinate) |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
let depData = pakData(depMessage.data || []) |
|
||||
|
|
||||
return { |
|
||||
loading: depMessage.isRequesting, |
|
||||
depData, |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(UserModal); |
|
@ -1,147 +0,0 @@ |
|||||
import React, { useEffect, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Row, Col, Card, Button, Tree, Empty } from 'antd'; |
|
||||
import { getDepMessage, getDepUser } from '../actions/user'; |
|
||||
import { getResource, getUserResource, postUserRes } from '../actions/authority'; |
|
||||
import Resource from '../components/resource'; |
|
||||
|
|
||||
const Authority = (props) => { |
|
||||
const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight } = props |
|
||||
const [depSelectedKeys, setDepSelectedKeys] = useState([]) |
|
||||
const [userSelectedKeys, setUserSelectedKeys] = useState([]) |
|
||||
const [depSelected, setDepSelected] = useState() |
|
||||
const [userSelected, setUserSelected] = useState() |
|
||||
const [resCode, setResCode] = useState({}) |
|
||||
const [useName, setUseName] = useState()// 选中名字
|
|
||||
const [userType,setUserType]=useState() |
|
||||
useEffect(() => { |
|
||||
dispatch(getResource()) |
|
||||
if (!(depMessage && depMessage.length)) { |
|
||||
dispatch(getDepMessage()) |
|
||||
} |
|
||||
|
|
||||
}, []) |
|
||||
useEffect(() => { |
|
||||
if (depMessage.length) { |
|
||||
setDepSelectedKeys([depMessage[0].id]) |
|
||||
setDepSelected([depMessage[0].name]) |
|
||||
dispatch(getDepUser(depMessage[0].id)) |
|
||||
} |
|
||||
|
|
||||
}, [depMessage]) |
|
||||
useEffect(() => { |
|
||||
if (depUser.length) { |
|
||||
setUserSelectedKeys([depUser[0].id]) |
|
||||
setUserSelected(depUser[0].username) |
|
||||
dispatch(getUserResource(depUser[0].id)) |
|
||||
setUseName(depUser[0].name) |
|
||||
} |
|
||||
}, [depUser]) |
|
||||
|
|
||||
const handleSave = () => { |
|
||||
dispatch(postUserRes({ userId: userSelectedKeys[0], resCode: resCode })).then(res => { |
|
||||
if (res.success) { |
|
||||
dispatch(getUserResource(userSelectedKeys[0])) |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
return ( |
|
||||
<Spin spinning={loading}> |
|
||||
<Row gutter={16}> |
|
||||
<Col span={4} style={{ height: '100%' }}> |
|
||||
<Card title="部门" bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|
||||
{ |
|
||||
depMessage.length ? |
|
||||
<Tree |
|
||||
height={clientHeight - 100} |
|
||||
defaultExpandedKeys={[depMessage[0].id]} |
|
||||
selectedKeys={depSelectedKeys} |
|
||||
onSelect={(selectedKeys, { selected, selectedNodes, node }) => { |
|
||||
setUserType(selectedNodes[0].type) |
|
||||
if (selected) { |
|
||||
setDepSelectedKeys(selectedKeys) |
|
||||
setDepSelected(selectedNodes[0].name || "") |
|
||||
dispatch(getDepUser(selectedKeys[0])) |
|
||||
} |
|
||||
|
|
||||
}} |
|
||||
treeData={depMessage} |
|
||||
fieldNames={{ |
|
||||
title: 'name', |
|
||||
key: 'id', |
|
||||
children: 'subordinate' |
|
||||
}} |
|
||||
/> : '' |
|
||||
} |
|
||||
</Card> |
|
||||
</Col> |
|
||||
<Col span={4} style={{ height: '100%', }}> |
|
||||
<Card title={`[${depSelected}] 用户列表`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|
||||
{ |
|
||||
depUser.length ? |
|
||||
<Tree |
|
||||
height={clientHeight - 100} |
|
||||
defaultSelectedKeys={[depUser[0].id]} |
|
||||
selectedKeys={userSelectedKeys} |
|
||||
onSelect={(selectedKeys, { selected, selectedNodes, node, event }) => { |
|
||||
const name = node.name |
|
||||
setUseName(name) |
|
||||
|
|
||||
if (selected) { |
|
||||
setUserSelectedKeys(selectedKeys) |
|
||||
setUserSelected(selectedNodes[0].username || '') |
|
||||
dispatch(getUserResource(selectedKeys[0])) |
|
||||
} |
|
||||
|
|
||||
}} |
|
||||
treeData={depUser} |
|
||||
fieldNames={{ |
|
||||
title: 'name', |
|
||||
key: 'id' |
|
||||
}} |
|
||||
/> : <Empty /> |
|
||||
} |
|
||||
</Card> |
|
||||
</Col> |
|
||||
<Col span={16} style={{ height: '100%', }}> |
|
||||
{depUser.length ? |
|
||||
<Card title={`[${useName ? useName : '管理员'}] 功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|
||||
<Resource |
|
||||
userSelected={userSelected} |
|
||||
roleData={resource} |
|
||||
userRole={userResource} |
|
||||
setResCode={setResCode} |
|
||||
userType={userType} |
|
||||
/> |
|
||||
<Row type="flex" justify="center" style={{ marginBottom: 16, marginTop: 16, textAlign: 'center' }}> |
|
||||
<Col span="24"> |
|
||||
<Button |
|
||||
disabled={userSelected === "SuperAdmin"||userType===4} |
|
||||
onClick={handleSave} |
|
||||
style={{ width: '60%' }} |
|
||||
type='primary'>保存修改</Button> |
|
||||
</Col></Row> |
|
||||
</Card> |
|
||||
: <Card title={`[]功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> |
|
||||
<Empty /> |
|
||||
</Card> |
|
||||
} |
|
||||
</Col> |
|
||||
</Row> |
|
||||
</Spin > |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
const { userResource, resource, depMessage, depUser, global } = state; |
|
||||
return { |
|
||||
clientHeight: global.clientHeight, |
|
||||
loading: depMessage.isRequesting || depUser.isRequesting || resource.isRequesting, |
|
||||
userResource: userResource.data || [], |
|
||||
resource: resource.data || [], |
|
||||
depMessage: depMessage.data || [], |
|
||||
depUser: depUser.data || [] |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(Authority); |
|
@ -1,6 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import Authority from './authority'; |
|
||||
import UserManage from './user'; |
|
||||
|
|
||||
export { Authority, UserManage }; |
|
@ -1,231 +0,0 @@ |
|||||
import React, { useEffect, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { EllipsisOutlined } from '@ant-design/icons'; |
|
||||
import { Spin, Space, Button, Popconfirm, Row, Col, Tree, Table, Card, Switch } from 'antd'; |
|
||||
import ProTable from '@ant-design/pro-table'; |
|
||||
import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd } from '../actions/user'; |
|
||||
import UserModal from '../components/userModal'; |
|
||||
import ResetPwd from '../components/resetPwd'; |
|
||||
|
|
||||
const TreeNode = Tree.TreeNode; |
|
||||
|
|
||||
const UserManage = (props) => { |
|
||||
const { dispatch, loading, depMessage, depUser, clientHeight } = props |
|
||||
const [modalVisible, setModalVisible] = useState(false); |
|
||||
const [modalType, setModalType] = useState(); |
|
||||
const [modalRecord, setModalRecord] = useState(); |
|
||||
const [pwdModalVisible, setPwdModalVisible] = useState(false); |
|
||||
const [depSelectedKeys, setDepSelectedKeys] = useState([]) |
|
||||
const [rowSelected, setRowSelected] = useState([]) |
|
||||
useEffect(() => { |
|
||||
dispatch(getDepMessage()) |
|
||||
}, []) |
|
||||
|
|
||||
useEffect(() => { |
|
||||
if (depMessage.length) { |
|
||||
setDepSelectedKeys([depMessage[0].id]) |
|
||||
dispatch(getDepUser(depMessage[0].id)) |
|
||||
} |
|
||||
}, [depMessage]) |
|
||||
|
|
||||
const columns = |
|
||||
[ |
|
||||
{ |
|
||||
title: '姓名', |
|
||||
dataIndex: 'name', |
|
||||
}, { |
|
||||
title: '用户名(手机号)', |
|
||||
dataIndex: 'username', |
|
||||
}, |
|
||||
{ |
|
||||
title: '职位', |
|
||||
dataIndex: 'post', |
|
||||
}, { |
|
||||
title: '邮箱', |
|
||||
dataIndex: 'email', |
|
||||
}, { |
|
||||
title: '启用状态', |
|
||||
dataIndex: 'enable', |
|
||||
render: (_, r) => { |
|
||||
return <Switch checkedChildren="启用" unCheckedChildren="禁用" disabled defaultChecked={r.enable} /> |
|
||||
} |
|
||||
}, { |
|
||||
title: '操作', |
|
||||
dataIndex: 'action', |
|
||||
render: (dom, record) => { |
|
||||
|
|
||||
return record.username == 'SuperAdmin' ? '' : [ |
|
||||
<Button type="link" onClick={() => { openModal('edit', record) }}>编辑</Button>, |
|
||||
<Popconfirm |
|
||||
title="确认删除?" |
|
||||
onConfirm={() => { |
|
||||
delUsers([record.id]) |
|
||||
}} |
|
||||
> |
|
||||
<Button type="link">删除</Button> |
|
||||
</Popconfirm>, |
|
||||
<Button |
|
||||
type="link" |
|
||||
onClick={() => { |
|
||||
setModalRecord(record); |
|
||||
setPwdModalVisible(true); |
|
||||
}} |
|
||||
>重置密码</Button> |
|
||||
] |
|
||||
}, |
|
||||
}, |
|
||||
]; |
|
||||
|
|
||||
//弹窗确认
|
|
||||
const onConfirm = (values) => { |
|
||||
if (modalType == 'edit') { |
|
||||
dispatch(updateUser(modalRecord.id, values.contract)).then(res => { |
|
||||
if (res.success) { |
|
||||
setModalVisible(false); |
|
||||
dispatch(getDepUser(depSelectedKeys[0])); |
|
||||
} |
|
||||
}); |
|
||||
} else { |
|
||||
dispatch(createUser(values.contract)).then(res => { |
|
||||
if (res.success) { |
|
||||
setModalVisible(false); |
|
||||
dispatch(getDepUser(depSelectedKeys[0])); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
//打开弹窗
|
|
||||
const openModal = (type, record) => { |
|
||||
setModalVisible(true); |
|
||||
setModalType(type); |
|
||||
if (type == 'edit') { |
|
||||
setModalRecord(record); |
|
||||
} else { |
|
||||
setModalRecord(null); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//删除用户
|
|
||||
const delUsers = (ids, type) => { |
|
||||
dispatch(delUser(ids)).then(res => { |
|
||||
dispatch(getDepUser(depSelectedKeys[0])); |
|
||||
if (type == 'batch') { |
|
||||
setRowSelected([]); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
//重置密码
|
|
||||
const onPwdConfirm = (values) => { |
|
||||
dispatch(resetPwd(modalRecord.id, { password: values.password })).then(res => { |
|
||||
if (res.success) { |
|
||||
setPwdModalVisible(false); |
|
||||
dispatch(getDepUser(depSelectedKeys[0])); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
return (<div > |
|
||||
<Spin spinning={loading} /* style={{ height: "calc(100vh - 70px)" }} */> |
|
||||
<Row gutter={16} /* style={{ overflow: "scroll" }} */> |
|
||||
<Col flex="260px" style={{ height: '100%' }}> |
|
||||
<Card title="部门" bordered={false} bodyStyle={{ padding: 8, paddingTop: 24, }}> |
|
||||
{ |
|
||||
depMessage.length ? |
|
||||
<Tree |
|
||||
height={clientHeight - 95} |
|
||||
defaultExpandedKeys={[depMessage[0].id]} |
|
||||
selectedKeys={depSelectedKeys} |
|
||||
onSelect={(selectedKeys, e) => { |
|
||||
if (e.selected) { |
|
||||
setDepSelectedKeys(selectedKeys) |
|
||||
dispatch(getDepUser(selectedKeys[0])) |
|
||||
} |
|
||||
}} |
|
||||
treeData={depMessage} |
|
||||
fieldNames={{ |
|
||||
title: 'name', |
|
||||
key: 'id', |
|
||||
children: 'subordinate' |
|
||||
}} |
|
||||
/> : '' |
|
||||
} |
|
||||
</Card> |
|
||||
</Col> |
|
||||
|
|
||||
<Col /* flex="auto" */ style={{ width: "calc(100% - 260px)", height: '100%', display: "black" }}> |
|
||||
<Card title="用户" bordered={false} height={clientHeight} bodyStyle={{ padding: 8, paddingTop: 24, overflow: "hidden", width: "100%" }}> |
|
||||
<ProTable |
|
||||
columns={columns} |
|
||||
dataSource={depUser} |
|
||||
style={{ width: "100% ", height: clientHeight - 95, overflow: "auto" }} |
|
||||
rowSelection={{ |
|
||||
selectedRowKeys: rowSelected, |
|
||||
onChange: (selectedRowKeys) => { |
|
||||
setRowSelected(selectedRowKeys); |
|
||||
|
|
||||
}, |
|
||||
getCheckboxProps: (record) => { |
|
||||
return { |
|
||||
disabled: record.username === 'SuperAdmin', |
|
||||
} |
|
||||
}, |
|
||||
}} |
|
||||
options={false} |
|
||||
search={false} |
|
||||
rowKey="id" |
|
||||
toolBarRender={() => [ |
|
||||
<span> |
|
||||
<Button |
|
||||
type="primary" |
|
||||
key="primary" |
|
||||
style={{ marginRight: 10 }} |
|
||||
onClick={() => openModal('create')} |
|
||||
>新建用户</Button> |
|
||||
<Button style={{ marginRight: 10 }} onClick={() => { dispatch(getDepUser(depSelectedKeys[0])); }}>刷新</Button> |
|
||||
<Popconfirm title="确认删除?" onConfirm={() => { delUsers(rowSelected, 'batch') }}> |
|
||||
<Button>批量删除</Button> |
|
||||
</Popconfirm> |
|
||||
</span> |
|
||||
]} |
|
||||
/> |
|
||||
</Card> |
|
||||
|
|
||||
{ |
|
||||
depMessage.length && modalVisible ? |
|
||||
<UserModal |
|
||||
visible={modalVisible} |
|
||||
onVisibleChange={setModalVisible} |
|
||||
modalType={modalType} |
|
||||
onConfirm={onConfirm} |
|
||||
editData={modalRecord} |
|
||||
/> |
|
||||
: '' |
|
||||
} |
|
||||
{pwdModalVisible ? <ResetPwd visible={pwdModalVisible} |
|
||||
onVisibleChange={setPwdModalVisible} |
|
||||
onConfirm={onPwdConfirm} /> : ''} |
|
||||
|
|
||||
</Col> |
|
||||
</Row> |
|
||||
</Spin> |
|
||||
</div> |
|
||||
|
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
const { depMessage, depUser, global } = state; |
|
||||
// console.log(state);
|
|
||||
return { |
|
||||
clientHeight: global.clientHeight, |
|
||||
loading: depMessage.isRequesting, |
|
||||
depMessage: depMessage.data || [], |
|
||||
depUser: depUser.data || [] |
|
||||
|
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(UserManage); |
|
@ -1,15 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import reducers from './reducers'; |
|
||||
import routes from './routes'; |
|
||||
import actions from './actions'; |
|
||||
import { getNavItem } from './nav-item'; |
|
||||
|
|
||||
export default { |
|
||||
key: 'organization', |
|
||||
name: '', |
|
||||
reducers: reducers, |
|
||||
routes: routes, |
|
||||
actions: actions, |
|
||||
getNavItem: getNavItem |
|
||||
}; |
|
@ -1,31 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { Link } from 'react-router-dom'; |
|
||||
import { Menu } from 'antd'; |
|
||||
import { SettingOutlined } from '@ant-design/icons'; |
|
||||
import { Func } from '$utils'; |
|
||||
import { push } from 'react-router-redux'; |
|
||||
|
|
||||
|
|
||||
const SubMenu = Menu.SubMenu; |
|
||||
|
|
||||
export function getNavItem(user, dispatch) { |
|
||||
if (!Func.isAuthorized("ORG_MANAGE")) { |
|
||||
return null |
|
||||
} |
|
||||
// console.log(!Func.isAuthorized("ORG_MANAGE"));
|
|
||||
if (user.type != 1 && user.type != 2 && user.type != 3) { |
|
||||
dispatch(push('/fillion/infor')); |
|
||||
return null |
|
||||
} |
|
||||
return ( |
|
||||
<SubMenu key="organization" icon={<SettingOutlined />} title={'组织管理'}> |
|
||||
{Func.isAuthorized("ORG_MEMBER") && <Menu.Item key="userManage"> |
|
||||
<Link to="/organization/user">用户管理</Link> |
|
||||
</Menu.Item> |
|
||||
} |
|
||||
{Func.isAuthorized("ORG_AUTH") && <Menu.Item key="authority"> |
|
||||
<Link to="/organization/authority">权限配置</Link> |
|
||||
</Menu.Item>} |
|
||||
</SubMenu> |
|
||||
); |
|
||||
} |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
export default { |
|
||||
|
|
||||
}; |
|
@ -1,26 +0,0 @@ |
|||||
'use strict'; |
|
||||
import { UserManage, Authority } from './containers'; |
|
||||
|
|
||||
export default [{ |
|
||||
type: 'inner', |
|
||||
route: { |
|
||||
path: '/organization', |
|
||||
key: 'organization', |
|
||||
breadcrumb: '组织管理', |
|
||||
menuSelectKeys: ['userManage'], |
|
||||
menuOpenKeys: ['organization'], |
|
||||
childRoutes: [{ |
|
||||
path: '/user', |
|
||||
key: 'userManage', |
|
||||
menuSelectKeys: ['userManage'], |
|
||||
component: UserManage, |
|
||||
breadcrumb: '用户管理', |
|
||||
}, { |
|
||||
path: '/authority', |
|
||||
key: 'authority', |
|
||||
component: Authority, |
|
||||
menuSelectKeys: ['authority'], |
|
||||
breadcrumb: '权限配置', |
|
||||
}] |
|
||||
} |
|
||||
}]; |
|
@ -1,37 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { basicAction } from '@peace/utils' |
|
||||
import { ApiTable } from '$utils' |
|
||||
|
|
||||
export function reportRectify (timeRange) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_REPORT_RECTIFY', |
|
||||
url: `${ApiTable.getReportRectify}?startTime=${timeRange ? timeRange[0] : ''}&endTime=${timeRange ? timeRange[1] : ''}`, |
|
||||
msg: {}, |
|
||||
reducer: { name: 'reportRectify' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function reportRectifyDetail (day, depId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_REPORT_RECTIFY_DETAIL', |
|
||||
url: `${ApiTable.getReportRectifyDetail}?day=${day}&depId=${depId}`, |
|
||||
msg: {}, |
|
||||
reducer: { name: 'reportRectifyDetail' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function compileReportRectifyDetail (data) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'post', |
|
||||
dispatch: dispatch, |
|
||||
data, |
|
||||
actionType: 'COMPILE_REPORT_RECTIFY_DETAIL', |
|
||||
url: `${ApiTable.compileReportRectifyDetail}`, |
|
||||
msg: { option: '保存信息' }, |
|
||||
}); |
|
||||
} |
|
@ -1,59 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { basicAction } from '@peace/utils' |
|
||||
import { ApiTable } from '$utils' |
|
||||
|
|
||||
export function allAreas (orgId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_ALL_AREAS', |
|
||||
url: `${ApiTable.allAreas}`, |
|
||||
msg: {}, |
|
||||
reducer: { name: 'allAreas' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function addReportConfig (data) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'post', |
|
||||
dispatch: dispatch, |
|
||||
data: data, |
|
||||
actionType: 'POST_REPORT_CONFIGS', |
|
||||
url: `${ApiTable.addReportConfig}`, |
|
||||
msg: { option: '添加报表配置' }, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function getReportConfig () { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_REPORT_CONFIGS', |
|
||||
url: `${ApiTable.getReportConfig}`, |
|
||||
msg: { error: '获取报表配置失败' }, |
|
||||
reducer: { name: 'reportConfig' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function editReportConfig (data, configId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'put', |
|
||||
dispatch: dispatch, |
|
||||
data: data, |
|
||||
actionType: 'EDIT_REPORT_CONFIGS', |
|
||||
url: `${ApiTable.editReportConfig.replace('{reportId}', configId)}`, |
|
||||
msg: { option: '编辑报表配置' }, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function delReportConfig (configId) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'del', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'DEL_REPORT_CONFIGS', |
|
||||
url: `${ApiTable.delReportConfig.replace('{reportId}', configId)}`, |
|
||||
msg: { option: '删除报表配置' }, |
|
||||
}); |
|
||||
} |
|
||||
|
|
@ -1,26 +0,0 @@ |
|||||
import { basicAction } from '@peace/utils' |
|
||||
import { ApiTable } from '$utils' |
|
||||
|
|
||||
export function getReportList(query) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
query: query, |
|
||||
actionType: 'GET_REPORT_LIST', |
|
||||
url: ApiTable.getReportList, |
|
||||
msg: { error: '获取报表数据失败' }, |
|
||||
reducer: { name: 'reportList' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function getRegionList(query) { |
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
query: query, |
|
||||
actionType: 'GET_REGION_LIST', |
|
||||
url: ApiTable.allAreas, |
|
||||
msg: { error: '获取区域数据失败' }, |
|
||||
reducer: { name: 'regionList' } |
|
||||
}); |
|
||||
} |
|
@ -1,11 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import * as config from './config' |
|
||||
import * as download from './download' |
|
||||
import * as compile from './compile' |
|
||||
|
|
||||
export default { |
|
||||
...config, |
|
||||
...download, |
|
||||
...compile, |
|
||||
} |
|
@ -1,118 +0,0 @@ |
|||||
import React, { useEffect, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Drawer, Button } from 'antd'; |
|
||||
import '../style.less'; |
|
||||
import { EditableProTable } from '@ant-design/pro-table'; |
|
||||
|
|
||||
const CompileDrawer = (props) => { |
|
||||
const { dispatch, actions, user, loading, visible, checkRow, close, reportRectifyDetail, checkAction } = props |
|
||||
const [requesting, setRequesting] = useState(false) |
|
||||
const [dataSource, setDataSource] = useState([]) |
|
||||
const { report } = actions |
|
||||
const isCheck = checkAction == 'check' |
|
||||
|
|
||||
useEffect(() => { |
|
||||
if (checkRow.day) { |
|
||||
dispatch(report.reportRectifyDetail(checkRow.day, checkRow.depId)) |
|
||||
} |
|
||||
}, [checkRow]) |
|
||||
|
|
||||
useEffect(() => { |
|
||||
let data = reportRectifyDetail |
|
||||
let i = 1 |
|
||||
for (let d of data) { |
|
||||
d.index_ = i++ |
|
||||
} |
|
||||
setDataSource(data) |
|
||||
}, [reportRectifyDetail]) |
|
||||
|
|
||||
return ( |
|
||||
<Drawer |
|
||||
title={"合用场所安全隐患排查整治汇总表"} |
|
||||
placement="right" |
|
||||
onClose={() => { |
|
||||
close() |
|
||||
}} |
|
||||
visible={visible} |
|
||||
width={'82%'} |
|
||||
> |
|
||||
<Spin spinning={loading || requesting}> |
|
||||
<EditableProTable |
|
||||
columns={[ |
|
||||
{ |
|
||||
title: '序号', |
|
||||
dataIndex: 'index_', |
|
||||
readonly: true, |
|
||||
}, |
|
||||
{ |
|
||||
title: '名称', |
|
||||
dataIndex: 'name', |
|
||||
readonly: true, |
|
||||
}, { |
|
||||
title: '地址', |
|
||||
dataIndex: 'address', |
|
||||
readonly: true, |
|
||||
}, { |
|
||||
title: '排查发现隐患', |
|
||||
dataIndex: 'hiddenDanger', |
|
||||
readonly: true, |
|
||||
}, { |
|
||||
title: '采取整改措施', |
|
||||
dataIndex: 'correctiveAction', |
|
||||
}, { |
|
||||
title: '实施处罚、强制措施情况', |
|
||||
dataIndex: 'punishment', |
|
||||
}, |
|
||||
]} |
|
||||
controlled={true} |
|
||||
value={dataSource} |
|
||||
onChange={setDataSource} |
|
||||
rowKey="id" |
|
||||
headerTitle={`填报单位:${checkRow.region};时间:${checkRow.day}`} |
|
||||
maxLength={5} |
|
||||
recordCreatorProps={false} |
|
||||
editable={{ |
|
||||
type: 'multiple', |
|
||||
editableKeys: isCheck ? [] : dataSource.map(r => r.id) |
|
||||
}} |
|
||||
toolBarRender={() => [ |
|
||||
isCheck ? '' : |
|
||||
<Button |
|
||||
type="primary" |
|
||||
key="save" |
|
||||
onClick={() => { |
|
||||
// dataSource 就是当前数据,可以调用 api 将其保存
|
|
||||
setRequesting(true) |
|
||||
const data = dataSource |
|
||||
for (let d of data) { |
|
||||
d.userId = user.id |
|
||||
delete d.index_ |
|
||||
} |
|
||||
dispatch(report.compileReportRectifyDetail(dataSource)).then(res => { |
|
||||
setRequesting(false) |
|
||||
}) |
|
||||
}} |
|
||||
> |
|
||||
保存数据 |
|
||||
</Button> |
|
||||
]} |
|
||||
> |
|
||||
|
|
||||
</EditableProTable> |
|
||||
</Spin> |
|
||||
</Drawer > |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps (state) { |
|
||||
const { auth, global, members, reportRectifyDetail } = state; |
|
||||
return { |
|
||||
loading: reportRectifyDetail.isRequesting, |
|
||||
user: auth.user, |
|
||||
actions: global.actions, |
|
||||
members: members.data, |
|
||||
reportRectifyDetail: reportRectifyDetail.data || [] |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(CompileDrawer); |
|
@ -1,124 +0,0 @@ |
|||||
import React, { useEffect, useRef } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Button, Modal, Form, Switch } from 'antd'; |
|
||||
import ProForm, { ProFormText, ProFormSelect } from '@ant-design/pro-form'; |
|
||||
import { useState } from 'react'; |
|
||||
|
|
||||
const ConfigModal = (props) => { |
|
||||
const { dispatch, actions, user, loading, visible, close, editData, allAreas, reportType } = props |
|
||||
const [excuteTimeOptions, setExcuteTimeOptions] = useState([]) |
|
||||
const formRef = useRef() |
|
||||
const { report } = actions |
|
||||
|
|
||||
useEffect(() => { |
|
||||
let excuteTimeOptions = [] |
|
||||
for (let i = 0; i < 24; i++) { |
|
||||
let curT = i |
|
||||
if (curT < 10) { |
|
||||
curT = '0' + curT |
|
||||
} |
|
||||
excuteTimeOptions.push({ |
|
||||
value: curT + ':00', |
|
||||
label: curT + ':00', |
|
||||
}) |
|
||||
excuteTimeOptions.push({ |
|
||||
value: curT + ':30', |
|
||||
label: curT + ':30', |
|
||||
}) |
|
||||
} |
|
||||
setExcuteTimeOptions(excuteTimeOptions); |
|
||||
}, []) |
|
||||
|
|
||||
return ( |
|
||||
<Modal |
|
||||
title={`${editData ? '编辑' : '新增'}报表配置`} |
|
||||
visible={visible} |
|
||||
onOk={() => { |
|
||||
formRef.current.validateFields().then(v => { |
|
||||
v.excuteTime = String(v.excuteTime) |
|
||||
console.log(v); |
|
||||
dispatch(editData ? report.editReportConfig(v, editData.id) : report.addReportConfig(v)).then(res => { |
|
||||
if (res.success) { |
|
||||
dispatch(report.getReportConfig()) |
|
||||
close() |
|
||||
} |
|
||||
}) |
|
||||
}) |
|
||||
}} |
|
||||
onCancel={() => { |
|
||||
close() |
|
||||
}} |
|
||||
> |
|
||||
<ProForm |
|
||||
formRef={formRef} |
|
||||
autoFocusFirstInput |
|
||||
layout={'horizontal'} |
|
||||
labelCol={{ span: 4 }} |
|
||||
wrapperCol={{ span: 18 }} |
|
||||
initialValues={ |
|
||||
editData ? |
|
||||
editData : |
|
||||
{ |
|
||||
excuteTime: '00:00', |
|
||||
isEnable: true |
|
||||
} |
|
||||
} |
|
||||
submitter={false} |
|
||||
formKey='config-form' |
|
||||
> |
|
||||
<ProFormText |
|
||||
name={'reportName'} |
|
||||
label="报表名称" |
|
||||
placeholder="请输入名称" |
|
||||
required |
|
||||
rules={[{ required: true, message: '请输入名称' }]} |
|
||||
/> |
|
||||
<ProFormSelect |
|
||||
options={reportType} |
|
||||
cacheForSwr |
|
||||
name="reportTypeId" |
|
||||
label="报表类型" |
|
||||
required |
|
||||
rules={[{ required: true, message: '请选择报表类型' }]} |
|
||||
/> |
|
||||
<ProFormSelect |
|
||||
options={ |
|
||||
allAreas.map(a => { |
|
||||
return { |
|
||||
value: a.id, |
|
||||
label: a.name, |
|
||||
} |
|
||||
})} |
|
||||
cacheForSwr |
|
||||
name="regionId" |
|
||||
label="区域" |
|
||||
required |
|
||||
rules={[{ required: true, message: '请选择区域' }]} |
|
||||
/> |
|
||||
<Form.Item name="isEnable" label="状态" valuePropName="checked"> |
|
||||
<Switch checkedChildren="启用" unCheckedChildren="禁用" /> |
|
||||
</Form.Item> |
|
||||
<ProFormSelect |
|
||||
options={excuteTimeOptions} |
|
||||
addonBefore={'每天'} |
|
||||
addonAfter={'时'} |
|
||||
cacheForSwr |
|
||||
name="excuteTime" |
|
||||
label="生成时间" |
|
||||
/> |
|
||||
</ProForm> |
|
||||
</Modal> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps (state) { |
|
||||
const { auth, global, allAreas } = state; |
|
||||
console.log(allAreas); |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
actions: global.actions, |
|
||||
allAreas: allAreas.data || [] |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(ConfigModal); |
|
@ -1,111 +0,0 @@ |
|||||
// 报表编辑
|
|
||||
|
|
||||
import React, { useEffect, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import moment from 'moment' |
|
||||
import CompileDrawer from '../components/compileDrawer' |
|
||||
import { Spin, Button, DatePicker, Space, Switch } from 'antd'; |
|
||||
import ProTable from '@ant-design/pro-table'; |
|
||||
import { Func } from '$utils'; |
|
||||
|
|
||||
const { RangePicker } = DatePicker; |
|
||||
|
|
||||
const Compile = (props) => { |
|
||||
const { dispatch, actions, user, loading, reportRectify } = props |
|
||||
const [searchTime, setSearchTime] = useState([moment(), moment()]) |
|
||||
const [compileDrawerVis, setCompileDrawerVis] = useState(false) |
|
||||
const [checkRow, setCheckRow] = useState({}) |
|
||||
const [checkAction, setCheckAction] = useState('') |
|
||||
const { report } = actions |
|
||||
|
|
||||
const getReportRectify = (searchTime) => { |
|
||||
dispatch(report.reportRectify([moment(searchTime[0]).format('YYYY-MM-DD'), moment(searchTime[1]).format('YYYY-MM-DD')])) |
|
||||
} |
|
||||
|
|
||||
useEffect(() => { |
|
||||
getReportRectify(searchTime) |
|
||||
}, []) |
|
||||
|
|
||||
const showCompileDrawerVis = (row, action) => { |
|
||||
setCompileDrawerVis(true) |
|
||||
setCheckRow(row) |
|
||||
setCheckAction(action) |
|
||||
} |
|
||||
|
|
||||
return ( |
|
||||
<Spin spinning={loading}> |
|
||||
<ProTable |
|
||||
columns={[{ |
|
||||
title: '日期', |
|
||||
dataIndex: 'day', |
|
||||
}, { |
|
||||
title: '名称', |
|
||||
dataIndex: 'name', |
|
||||
}, { |
|
||||
title: '是否提交', |
|
||||
dataIndex: 'reportBool', |
|
||||
render: (_, r) => { |
|
||||
return <Switch disabled={true} checked={r.reportBool} /> |
|
||||
} |
|
||||
}, { |
|
||||
title: '操作', |
|
||||
dataIndex: 'option', |
|
||||
render: (_, r) => { |
|
||||
return [ |
|
||||
<Space> |
|
||||
{/* {Func.isAuthorized("REPORT_EDIT") && |
|
||||
<Button type="primary" onClick={() => { |
|
||||
showCompileDrawerVis(r, 'edit') |
|
||||
}}>编辑</Button> |
|
||||
} */} |
|
||||
<Button type="primary" onClick={() => { |
|
||||
showCompileDrawerVis(r, 'check') |
|
||||
}}>查看</Button> |
|
||||
</Space> |
|
||||
] |
|
||||
} |
|
||||
},]} |
|
||||
dataSource={reportRectify} |
|
||||
rowKey="index" |
|
||||
search={false} |
|
||||
options={false} |
|
||||
headerTitle="合用场所安全隐患排查整治汇总表" |
|
||||
toolBarRender={() => [ |
|
||||
<RangePicker allowClear={false} value={searchTime} |
|
||||
onChange={(date, dateString) => { |
|
||||
setSearchTime(date) |
|
||||
getReportRectify(dateString) |
|
||||
}} |
|
||||
/>, |
|
||||
]} |
|
||||
> |
|
||||
|
|
||||
</ProTable> |
|
||||
<CompileDrawer |
|
||||
visible={compileDrawerVis} |
|
||||
close={() => { |
|
||||
setCompileDrawerVis(false) |
|
||||
setCheckRow({}) |
|
||||
setCheckAction('') |
|
||||
|
|
||||
getReportRectify(searchTime) |
|
||||
}} |
|
||||
checkRow={checkRow} |
|
||||
checkAction={checkAction} |
|
||||
/> |
|
||||
</Spin> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
const { auth, global, reportRectify } = state; |
|
||||
console.log(reportRectify); |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
actions: global.actions, |
|
||||
loading: reportRectify.isRequesting, |
|
||||
reportRectify: reportRectify.data || [] |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(Compile); |
|
@ -1,157 +0,0 @@ |
|||||
import React, { useEffect, useState } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import ConfigModal from '../components/configModal' |
|
||||
import { Spin, Button, Space, Popconfirm, Switch } from 'antd'; |
|
||||
import ProTable from '@ant-design/pro-table'; |
|
||||
import '../style.less'; |
|
||||
import Pinyin from '../../../utils/pinyin' |
|
||||
const reportType = [{ |
|
||||
value: 1, |
|
||||
label: '县区排查整治汇总表', |
|
||||
}, { |
|
||||
value: 2, |
|
||||
label: '各县区每日汇总表', |
|
||||
}, { |
|
||||
value: 3, |
|
||||
label: '隐患场所汇总表', |
|
||||
},] |
|
||||
var pinyin = null |
|
||||
var as = null |
|
||||
var bs = null |
|
||||
const Config = (props) => { |
|
||||
const { dispatch, actions, loading, reportConfig, allAreas } = props |
|
||||
const [configModalVis, setConfigModalVis] = useState(false) |
|
||||
const [editData, setEditData] = useState(null) |
|
||||
const { report } = actions |
|
||||
useEffect(() => { |
|
||||
dispatch(report.getReportConfig()) |
|
||||
dispatch(report.allAreas()) |
|
||||
|
|
||||
}, []) |
|
||||
useEffect(()=>{ |
|
||||
pinyin=new Pinyin() |
|
||||
}) |
|
||||
return ( |
|
||||
<Spin spinning={loading}> |
|
||||
<ProTable |
|
||||
columns={[{ |
|
||||
title: '报表名称', |
|
||||
dataIndex: 'reportName', |
|
||||
}, { |
|
||||
title: '区域名称', |
|
||||
dataIndex: 'region', |
|
||||
sorter: (a, b) => { |
|
||||
let regionOne = allAreas.find(item => item.id == a.regionId) |
|
||||
let regionTwo = allAreas.find(item => item.id == b.regionId) |
|
||||
|
|
||||
if (regionOne) { |
|
||||
as = pinyin.getCamelChars(regionOne.name).toLowerCase() |
|
||||
|
|
||||
} if (regionTwo) { |
|
||||
bs = pinyin.getCamelChars(regionTwo.name).toLowerCase() |
|
||||
|
|
||||
} else { |
|
||||
return '' |
|
||||
} |
|
||||
let codeOne=as.substr(0,1).charCodeAt() |
|
||||
let codeTwo=bs.substr(0,1).charCodeAt() |
|
||||
return codeOne-codeTwo |
|
||||
}, |
|
||||
render: (_, row, index, action) => { |
|
||||
let curRegion = allAreas.find(a => a.id == row.regionId) |
|
||||
return curRegion ? curRegion.name : '' |
|
||||
}, |
|
||||
}, { |
|
||||
title: '类型', |
|
||||
dataIndex: 'reportType', |
|
||||
|
|
||||
render: (_, r) => { |
|
||||
let curType = reportType.find(t => t.value == r.reportTypeId) |
|
||||
return curType ? curType.label : '' |
|
||||
}, |
|
||||
|
|
||||
}, { |
|
||||
title: '生成时间', |
|
||||
dataIndex: 'index', |
|
||||
render: (_, row) => { |
|
||||
return `每日 ${row.excuteTime.indexOf(':') > -1 ? row.excuteTime : row.excuteTime + ':00'}` |
|
||||
} |
|
||||
}, { |
|
||||
title: '启用状态', |
|
||||
dataIndex: 'isEnable', |
|
||||
render: (_, row) => { |
|
||||
return <Switch checkedChildren="启用" unCheckedChildren="禁用" disabled defaultChecked={row.isEnable} /> |
|
||||
|
|
||||
} |
|
||||
}, { |
|
||||
title: '操作', |
|
||||
dataIndex: 'option', |
|
||||
render: (_, row) => { |
|
||||
return [ |
|
||||
<Space> |
|
||||
<Button type="primary" |
|
||||
onClick={() => { |
|
||||
setConfigModalVis(true) |
|
||||
setEditData({ |
|
||||
...row, |
|
||||
excuteTime: row.excuteTime.indexOf(':') > -1 ? row.excuteTime : row.excuteTime + ':00' |
|
||||
}) |
|
||||
}} |
|
||||
>编辑</Button> |
|
||||
<Popconfirm |
|
||||
placement="topRight" |
|
||||
title={'确认删除此报备表配置?'} |
|
||||
onConfirm={() => { |
|
||||
dispatch(report.delReportConfig(row.id)).then(res => { |
|
||||
if (res.success) { |
|
||||
dispatch(report.getReportConfig()) |
|
||||
} |
|
||||
}) |
|
||||
}} |
|
||||
> |
|
||||
<Button type="primary" danger>删除</Button> |
|
||||
</Popconfirm> |
|
||||
</Space> |
|
||||
] |
|
||||
} |
|
||||
},]} |
|
||||
dataSource={reportConfig} |
|
||||
rowKey="id" |
|
||||
search={false} |
|
||||
options={false} |
|
||||
toolBarRender={() => [ |
|
||||
<Button type="primary" key="primary" onClick={() => { setConfigModalVis(true) }}> |
|
||||
添加报表配置 |
|
||||
</Button>, |
|
||||
]} |
|
||||
> |
|
||||
|
|
||||
</ProTable> |
|
||||
{ |
|
||||
configModalVis ? |
|
||||
<ConfigModal |
|
||||
visible={true} |
|
||||
close={() => { |
|
||||
setConfigModalVis(false) |
|
||||
setEditData(null) |
|
||||
}} |
|
||||
reportType={reportType} |
|
||||
editData={editData} |
|
||||
/> : '' |
|
||||
} |
|
||||
</Spin> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps(state) { |
|
||||
const { auth, global, reportConfig, allAreas } = state; |
|
||||
return { |
|
||||
loading: reportConfig.isRequesting, |
|
||||
user: auth.user, |
|
||||
actions: global.actions, |
|
||||
reportConfig: reportConfig.data || [], |
|
||||
allAreas: allAreas.data || [] |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(Config); |
|
@ -1,129 +0,0 @@ |
|||||
import React, { useEffect } from 'react'; |
|
||||
import { connect } from 'react-redux'; |
|
||||
import { Spin, Button } from 'antd'; |
|
||||
import ProTable from '@ant-design/pro-table'; |
|
||||
import '../style.less'; |
|
||||
import moment from 'moment'; |
|
||||
import { Func } from '$utils'; |
|
||||
|
|
||||
const Download = (props) => { |
|
||||
const { dispatch, actions, reportList, regionList, user } = props |
|
||||
|
|
||||
useEffect(() => { |
|
||||
dispatch(actions.report.getRegionList()); |
|
||||
}, []); |
|
||||
|
|
||||
const columns = [{ |
|
||||
title: '报表名称', |
|
||||
dataIndex: 'reportName', |
|
||||
formItemProps: { |
|
||||
label: null, |
|
||||
}, |
|
||||
fieldProps: { |
|
||||
placeholder: '输入报表名称' |
|
||||
} |
|
||||
}, { |
|
||||
title: '区域名称', |
|
||||
dataIndex: 'regionName', |
|
||||
valueType: 'select', |
|
||||
initialValue: -1, |
|
||||
fieldProps: { |
|
||||
label: null, |
|
||||
options: [{ |
|
||||
label: '全部', |
|
||||
value: -1 |
|
||||
}].concat(regionList) |
|
||||
}, |
|
||||
order: 5, |
|
||||
render: (dom, record) => { |
|
||||
return record.department ? record.department.name : null |
|
||||
} |
|
||||
}, { |
|
||||
title: '类型', |
|
||||
dataIndex: 'reportType', |
|
||||
hideInSearch: true, |
|
||||
render: (dom, record) => { |
|
||||
return record.reportType ? record.reportType.name : null |
|
||||
} |
|
||||
}, { |
|
||||
title: '生成时间', |
|
||||
dataIndex: 'creatTime', |
|
||||
valueType: 'dateTimeRange', |
|
||||
order: 4, |
|
||||
render: (dom, record) => { |
|
||||
return moment(record.creatTime).format('YYYY-MM-DD HH:mm') |
|
||||
} |
|
||||
}] |
|
||||
if (Func.isAuthorized("REPORT_DOWN")) { |
|
||||
columns.push({ |
|
||||
title: '操作', |
|
||||
key: 'option', |
|
||||
hideInSearch: true, |
|
||||
render: (dom, record) => { |
|
||||
// const ApiRoot = localStorage.getItem('tyApiRoot');
|
|
||||
const filePathArr = record.filePath.split('/') |
|
||||
|
|
||||
const fileName = filePathArr.pop() |
|
||||
// console.log(fileName);
|
|
||||
return [ |
|
||||
// <a key="download" href={ApiRoot + '' + record.filePath}>下载</a>
|
|
||||
<a href={ |
|
||||
'/_api/' + |
|
||||
// 'http://10.8.30.157:8439/'+
|
|
||||
`attachments?src=files/${fileName}&filename=${encodeURIComponent(fileName)}&token=${user.token}`} > |
|
||||
下载 |
|
||||
</a> |
|
||||
] |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
return ( |
|
||||
<Spin spinning={false}> |
|
||||
<ProTable |
|
||||
columns={columns} |
|
||||
toolbar={{ |
|
||||
settings: [] |
|
||||
}} |
|
||||
dataSource={reportList} |
|
||||
request={async (params) => { |
|
||||
const query = { |
|
||||
limit: params.pageSize, |
|
||||
offset: params.pageSize * (params.current - 1), |
|
||||
creatTime: params.creatTime, |
|
||||
reportName: params.reportName, |
|
||||
regionName: params.regionName |
|
||||
} |
|
||||
const res = await dispatch(actions.report.getReportList(query)); |
|
||||
return { |
|
||||
...res, |
|
||||
total: res.payload.data ? res.payload.data.count : 0 |
|
||||
} |
|
||||
}} |
|
||||
> |
|
||||
</ProTable> |
|
||||
</Spin > |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
function mapStateToProps (state) { |
|
||||
const { auth, global, reportList, regionList } = state; |
|
||||
const { count, rows } = reportList.data || {}; |
|
||||
let regions = []; |
|
||||
if (regionList.data && regionList.data.length > 0) { |
|
||||
regions = regionList.data.map(v => { |
|
||||
return { |
|
||||
label: v.name, |
|
||||
value: v.id, |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
return { |
|
||||
user: auth.user, |
|
||||
actions: global.actions, |
|
||||
reportList: rows || [], |
|
||||
regionList: regions |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
export default connect(mapStateToProps)(Download); |
|
@ -1,7 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import Config from './config'; |
|
||||
import Download from './download'; |
|
||||
import Compile from './compile' |
|
||||
|
|
||||
export { Config, Download, Compile }; |
|
@ -1,15 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import reducers from './reducers'; |
|
||||
import routes from './routes'; |
|
||||
import actions from './actions'; |
|
||||
import { getNavItem } from './nav-item'; |
|
||||
|
|
||||
export default { |
|
||||
key: 'report', |
|
||||
name: '报表管理', |
|
||||
reducers: reducers, |
|
||||
routes: routes, |
|
||||
actions: actions, |
|
||||
getNavItem: getNavItem |
|
||||
}; |
|
@ -1,35 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { Link } from 'react-router-dom'; |
|
||||
import { Menu } from 'antd'; |
|
||||
import { FileTextOutlined } from '@ant-design/icons'; |
|
||||
import { Func } from '$utils'; |
|
||||
import { push } from 'react-router-redux'; |
|
||||
|
|
||||
|
|
||||
const SubMenu = Menu.SubMenu; |
|
||||
|
|
||||
export function getNavItem(user, dispatch) { |
|
||||
if (user.type != 1 && user.type != 2) { |
|
||||
dispatch(push('/fillion/infor')); |
|
||||
return null |
|
||||
} |
|
||||
if (!Func.isAuthorized("REPORT_MANAGE")) { |
|
||||
return null |
|
||||
} |
|
||||
return ( |
|
||||
<SubMenu key="report" icon={<FileTextOutlined />} title={'报表管理'}> |
|
||||
{Func.isAuthorized("REPROT_CONFIG") && <Menu.Item key="reportConfig"> |
|
||||
<Link to="/report/config">报表配置</Link> |
|
||||
</Menu.Item>} |
|
||||
{Func.isAuthorized("REPORT_DOWN") && <Menu.Item key="reportDownload"> |
|
||||
<Link to="/report/download">报表下载</Link> |
|
||||
</Menu.Item>} |
|
||||
{Func.isAuthorized("REPORT_LIST") && |
|
||||
<Menu.Item key="reportCompile"> |
|
||||
<Link to="/report/compile">整治汇总表</Link> |
|
||||
</Menu.Item> |
|
||||
} |
|
||||
</SubMenu> |
|
||||
|
|
||||
); |
|
||||
} |
|
@ -1,5 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
export default { |
|
||||
|
|
||||
} |
|
@ -1,33 +0,0 @@ |
|||||
'use strict'; |
|
||||
import { Config, Download, Compile } from './containers'; |
|
||||
|
|
||||
export default [{ |
|
||||
type: 'inner', |
|
||||
route: { |
|
||||
path: '/report', |
|
||||
key: 'report', |
|
||||
breadcrumb: '报表管理', |
|
||||
menuSelectKeys: ['config'], |
|
||||
menuOpenKeys: ['report'], |
|
||||
// 不设置 component 则面包屑禁止跳转
|
|
||||
childRoutes: [{ |
|
||||
path: '/config', |
|
||||
key: 'reportConfig', |
|
||||
component: Config, |
|
||||
menuSelectKeys:['reportConfig'], |
|
||||
breadcrumb: '报表配置', |
|
||||
}, { |
|
||||
path: '/download', |
|
||||
key: 'reportDownload', |
|
||||
menuSelectKeys:['reportDownload'], |
|
||||
component: Download, |
|
||||
breadcrumb: '报表下载', |
|
||||
}, { |
|
||||
path: '/compile', |
|
||||
key: 'reportCompile', |
|
||||
menuSelectKeys:['reportCompile'], |
|
||||
component: Compile, |
|
||||
breadcrumb: '整治汇总表', |
|
||||
}] |
|
||||
} |
|
||||
}]; |
|
@ -1,3 +0,0 @@ |
|||||
#example:hover { |
|
||||
font-size: larger; |
|
||||
} |
|
Loading…
Reference in new issue