diff --git a/api/app/lib/controllers/role/index.js b/api/app/lib/controllers/role/index.js index d3de073..875b92d 100644 --- a/api/app/lib/controllers/role/index.js +++ b/api/app/lib/controllers/role/index.js @@ -31,7 +31,7 @@ async function add(ctx) { throw '当前角色已存在' } - let storageData = { name } + let storageData = { name ,delete:true} await models.Role.create(storageData) ctx.status = 204; } catch (error) { diff --git a/web/client/src/layout/containers/layout/index.jsx b/web/client/src/layout/containers/layout/index.jsx index 531d5bc..d502115 100644 --- a/web/client/src/layout/containers/layout/index.jsx +++ b/web/client/src/layout/containers/layout/index.jsx @@ -15,6 +15,7 @@ import { RouteRequest } from '@peace/utils'; import Cookie from 'js-cookie'; import { login, LOGIN_SUCCESS } from '../../../sections/auth/actions/auth'; import { error } from 'webpack-dev-server/lib/utils/colors'; +import actions from '../../../sections/humanAffairs/actions' @@ -48,7 +49,7 @@ const LayoutContainer = props => { document.getElementById('HrApp').clientWidth - (collapsed ? 120 : 240) )); } - function deepCopy (data) {//深拷贝 + function deepCopy(data) {//深拷贝 //string,number,bool,null,undefined,symbol //object,array,date if (data && typeof data === "object") { @@ -217,6 +218,11 @@ const LayoutContainer = props => { localStorage.setItem('poms_open_sider', JSON.stringify(["archivesCenter"])) localStorage.setItem('poms_selected_sider', JSON.stringify(["humanAffairs"])) dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token, hrUserId: data.hrUserInfo && hrUserInfo.id })) + dispatch(actions.humanAffairs.getUserResource(res.payload.user.id)).then(res => { + if (res.success) { + sessionStorage.setItem('userResource', JSON.stringify(res.payload.data)) + } + }) } else { window.location.href = `${webPepUrl}/signin` } @@ -343,7 +349,7 @@ const LayoutContainer = props => { ) } -function mapStateToProps (state) { +function mapStateToProps(state) { const { global, auth, ajaxResponse, webSocket } = state; return { title: global.title, diff --git a/web/client/src/sections/humanAffairs/actions/role.js b/web/client/src/sections/humanAffairs/actions/role.js index e25a09b..105230b 100644 --- a/web/client/src/sections/humanAffairs/actions/role.js +++ b/web/client/src/sections/humanAffairs/actions/role.js @@ -116,4 +116,13 @@ export function addRoleResource(data) { }); } - +export function getUserResource(userId) {//查询 + return (dispatch) => basicAction({ + type: "get", + dispatch: dispatch, + actionType: "GET_USER_RESOURCE_LIST", + url: ApiTable.getUserResource.replace('{userId}',userId), + msg: { option: "查询角色权限列表" }, + reducer: { name: "userResource", params: { noClear: true } }, + }); +} diff --git a/web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx b/web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx index 8c4ff41..e675af2 100644 --- a/web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx +++ b/web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx @@ -5,6 +5,7 @@ import { Select, Input, Button, Tooltip, Table, Pagination, Skeleton, DatePicker import { IconSearch } from '@douyinfe/semi-icons'; import DetailModal from './detailModal'; import { SkeletonScreen } from "$components"; +import { isAuthorized } from '$utils' import '../../style.less' const EmployeeCommunication = (props) => { @@ -253,14 +254,17 @@ const EmployeeCommunication = (props) => { getEmployeeCommunicateData({ limit: 10, page: 0 }); }}>查询 -
-
{ - exportAllData() - }}> - 导出 -
-
+ { + isAuthorized('EXPORTEMPLOYEECOMMUNICATIONSTATISTICS') ?
+
{ + exportAllData() + }}> + 导出 +
+
:'' + } +
{
-
{ setImportModalV(true); }}> 导入 -
+
: ''} diff --git a/web/client/src/sections/humanAffairs/containers/employeeInformation.jsx b/web/client/src/sections/humanAffairs/containers/employeeInformation.jsx index 1c8e0be..ec84eb5 100644 --- a/web/client/src/sections/humanAffairs/containers/employeeInformation.jsx +++ b/web/client/src/sections/humanAffairs/containers/employeeInformation.jsx @@ -7,7 +7,7 @@ import '../style.less' import { Setup } from "$components"; import moment from 'moment' import { set } from 'nprogress'; -import { UserAttribute } from '$utils' +import { UserAttribute, isAuthorized } from '$utils' const employeeInformation = (props) => { const { dispatch, actions, history, user, loading, socket, xqMembers } = props @@ -591,24 +591,27 @@ const employeeInformation = (props) => {
-
{ - let obj = form.current.getValues() - if (form.current.getValues().entryTime?.length > 1) { - obj.hiredateStart = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD') - obj.hiredateEnd = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD') - } - else { - obj.hiredateStart = '' - obj.hiredateEnd = '' + { + isAuthorized('EXPORTEMPLOYEEINFORMATION') ?
{ + let obj = form.current.getValues() + if (form.current.getValues().entryTime?.length > 1) { + obj.hiredateStart = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD') + obj.hiredateEnd = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD') + } + else { + obj.hiredateStart = '' + obj.hiredateEnd = '' + } + setDownloadUrl(`members/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&marital=${obj.marital ? obj.marital : ''}&native=${obj.native ? obj.native : ''}&workPlace=${obj.workPlace ? obj.workPlace : ''}&hiredateStart=${obj.hiredateStart}&hiredateEnd=${obj.hiredateEnd}`) + }}> + + { + downloadUrl ?